commit 30f2accf7774829ee35f8288dbf9d30db1f4427f
Author: Uwe Stöhr <[email protected]>
Date: Tue May 26 01:15:29 2015 +0200
jss.layout: changes as requested by the user in bug#9516
- added appendix style and lyx2lyx reversion
- add support for parsing \noindent
- update example file
diff --git a/lib/layouts/jss.layout b/lib/layouts/jss.layout
index 64fa1d9..20209f5 100644
--- a/lib/layouts/jss.layout
+++ b/lib/layouts/jss.layout
@@ -48,7 +48,8 @@ Style Abstract
InTitle 1
InPreamble 1
Margin Dynamic
- LeftMargin MMNMM
+ LeftMargin MM
+ NextNoIndent 1
ParSkip 0.4
BottomSep 1.5
TopSep 1.5
@@ -67,7 +68,7 @@ End
Style Address
CopyStyle Abstract
LatexName Address
- Labeltype Above
+ LabelType Above
LabelString "Affiliation:"
Margin Static
LeftMargin M
@@ -152,6 +153,7 @@ End
InsetLayout "Flex:code"
CopyStyle "Flex:proglang"
+ Spellcheck 0
LabelString code
LatexName code
HTMLTag code
@@ -168,6 +170,7 @@ Style "Code Chunk"
Category MainText
LatexType Environment
LatexName CodeChunk
+ Spellcheck 0
NextNoIndent 1
ParbreakIsNewline 1
FreeSpacing 1
@@ -210,3 +213,22 @@ Style "Code Output"
LatexName CodeOutput
LabelString "Code Output"
End
+
+Style Appendix
+ LatexType Environment
+ LatexName appendix
+ Category BackMatter
+ TopSep 0.6
+ BottomSep 0.6
+ Margin First_Dynamic
+ Align Block
+ NextNoIndent 1
+ LabelType Above
+ LabelString "Appendix"
+ LabelSep M
+ LabelFont
+ Series Bold
+ Shape Up
+ Size large
+ EndFont
+End
diff --git a/lib/lyx2lyx/lyx2lyx_tools.py b/lib/lyx2lyx/lyx2lyx_tools.py
index 3bed231..5c1f3cb 100644
--- a/lib/lyx2lyx/lyx2lyx_tools.py
+++ b/lib/lyx2lyx/lyx2lyx_tools.py
@@ -206,6 +206,8 @@ def lyx2latex(document, lines):
line = "'"
elif line.startswith("\\begin_inset Newline newline"):
line = "\\\\ "
+ elif line.startswith("\\noindent"):
+ line = "\\noindent " # we need the space behind the command
elif line.startswith("\\begin_inset space"):
line = line[18:].strip()
if line.startswith("\\hspace"):
diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py
index c18d905..b977e69 100644
--- a/lib/lyx2lyx/lyx_2_2.py
+++ b/lib/lyx2lyx/lyx_2_2.py
@@ -1375,7 +1375,8 @@ def revert_jss(document):
m = 0
j = 0
k = 0
- while m != -1 or j != -1 or h != -1 or k != -1:
+ l = 0
+ while m != -1 or j != -1 or h != -1 or k != -1 or l != -1:
# \CodeChunk
if h != -1:
h = find_token(document.body, "\\begin_layout Code Chunk", h)
@@ -1416,12 +1417,23 @@ def revert_jss(document):
k = find_token(document.body, "\\begin_layout Code Output", k)
if k != -1:
endk = find_end_of_layout(document.body, k)
- document.body[endk : endj + 1] = ["\\end_layout", "",
"\\begin_layout Standard"]
+ document.body[endk : endk + 1] = ["\\end_layout", "",
"\\begin_layout Standard"]
document.body[endk + 3 : endk + 4] =
put_cmd_in_ert("\\end{CodeOutput}")
document.body[endk + 13 : endk + 13] = ["\\end_layout", "",
"\\begin_layout Standard"]
document.body[k + 1 : k] = ["\\end_layout", "", "\\begin_layout
Standard"]
document.body[k : k + 1] = put_cmd_in_ert("\\begin{CodeOutput}")
k = k + 1
+ if l != -1:
+ l = find_token(document.body, "\\begin_layout Appendix", l)
+ if l != -1:
+ endl = find_end_of_layout(document.body, l)
+ document.body[endl : endl + 1] = ["\\end_layout", "",
"\\begin_layout Standard"]
+ document.body[endl + 3 : endl + 4] =
put_cmd_in_ert("\\end{appendix}")
+ document.body[endl + 13 : endl + 13] = ["\\end_layout", ""]
+ document.body[l + 1 : l] = ["\\end_layout", "", "\\begin_layout
Standard"]
+ document.body[l : l + 1] = put_cmd_in_ert("\\begin{appendix}")
+ document.body[l -1 : l] = ["", "\\begin_layout Standard"]
+ l = l + 1
def convert_subref(document):
diff --git a/lib/templates/JSS-article.lyx b/lib/templates/JSS-article.lyx
index f630a4e..fce934c 100644
--- a/lib/templates/JSS-article.lyx
+++ b/lib/templates/JSS-article.lyx
@@ -1,5 +1,5 @@
#LyX 2.2 created this file. For more info see http://www.lyx.org/
-\lyxformat 493
+\lyxformat 495
\begin_document
\begin_header
\origin unavailable
@@ -303,7 +303,14 @@ only if necessary
\end_layout
\begin_layout Abstract
+\noindent
The abstract of the article.
+ The abstract of the article.The abstract of the article.The abstract of the
+ article.The abstract of the article.The abstract of the article.The abstract
+ of the article.The abstract of the article.The abstract of the article.The
+ abstract of the article.The abstract of the article.The abstract of the
article.Th
+e abstract of the article.The abstract of the article.The abstract of the
+ article.The abstract of the article.The abstract of the article.
\end_layout
\begin_layout Keywords
@@ -645,5 +652,9 @@ Acknowledgments
Here you can write some acknowledgments.
\end_layout
+\begin_layout Appendix
+This is the appendix section
+\end_layout
+
\end_body
\end_document