diff --git a/lib/layouts/jss.layout b/lib/layouts/jss.layout index 0aab2aedb0..b0a7ec4373 100644 --- a/lib/layouts/jss.layout +++ b/lib/layouts/jss.layout @@ -126,7 +126,7 @@ Style "Short Title" LabelString "Short Title:" End -InsetLayout "Flex:pkg" +InsetLayout "Flex:Pkg" LyxType custom LabelString pkg LatexType command @@ -146,14 +146,13 @@ InsetLayout "Flex:pkg" Color latex Size Small EndFont - InToc true HTMLTag pkg ResetsFont true spellcheck false End -InsetLayout "Flex:proglang" - CopyStyle "Flex:pkg" +InsetLayout "Flex:Proglang" + CopyStyle "Flex:Pkg" LabelString proglang LatexName proglang Font @@ -167,8 +166,8 @@ InsetLayout "Flex:proglang" HTMLTag proglang End -InsetLayout "Flex:code" - CopyStyle "Flex:proglang" +InsetLayout "Flex:Code" + CopyStyle "Flex:Proglang" Spellcheck 0 LabelString code LatexName code @@ -182,10 +181,31 @@ InsetLayout "Flex:E-mail" HTMLTag email End -Style "Code Chunk" - Category MainText +InsetLayout "Flex:Code Chunk" + CopyStyle "Flex:Pkg" LatexType Environment LatexName CodeChunk + Decoration Classic + Spellcheck 0 + ParbreakIsNewline 1 + FreeSpacing 1 + PassThru 1 + KeepEmpty 1 + LabelString "Code Chunk" + Font + Family Typewriter + EndFont + LabelFont + #Series Bold + Color Green + EndFont +End + +Style "Code" + LatexName Code + LabelString "Code" + LatexType Environment + LatexName Code Spellcheck 0 NextNoIndent 1 ParbreakIsNewline 1 @@ -193,12 +213,11 @@ Style "Code Chunk" PassThru 1 KeepEmpty 1 NewLine 0 - TopSep 0.7 - BottomSep 0.7 + TopSep 0 + BottomSep 0 Align Block AlignPossible Block Labeltype Above - LabelString "Code Chunk" Font Family Typewriter EndFont @@ -210,22 +229,14 @@ Style "Code Chunk" HTMLItem p End -Style "Standard Code" - CopyStyle "Code Chunk" - LatexName Code - LabelString "Code" - TopSep 0 - BottomSep 0 -End - Style "Code Input" - CopyStyle "Standard Code" + CopyStyle "Code" LatexName CodeInput LabelString "Code Input" End Style "Code Output" - CopyStyle "Standard Code" + CopyStyle "Code" LatexName CodeOutput LabelString "Code Output" End diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py index d9d64e6f8f..6e237fba4b 100644 --- a/lib/lyx2lyx/lyx_2_2.py +++ b/lib/lyx2lyx/lyx_2_2.py @@ -1223,7 +1223,7 @@ def revert_jss(document): while m != -1 or j != -1 or h != -1 or k != -1 or n != -1: # \pkg if h != -1: - h = find_token(document.body, "\\begin_inset Flex pkg", h) + h = find_token(document.body, "\\begin_inset Flex Pkg", h) if h != -1: endh = find_end_of_inset(document.body, h) document.body[endh - 2 : endh + 1] = put_cmd_in_ert("}") @@ -1231,7 +1231,7 @@ def revert_jss(document): h = h + 5 # \proglang if m != -1: - m = find_token(document.body, "\\begin_inset Flex proglang", m) + m = find_token(document.body, "\\begin_inset Flex Proglang", m) if m != -1: endm = find_end_of_inset(document.body, m) document.body[endm - 2 : endm + 1] = put_cmd_in_ert("}") @@ -1239,12 +1239,16 @@ def revert_jss(document): m = m + 5 # \code if j != -1: - j = find_token(document.body, "\\begin_inset Flex code", j) + j = find_token(document.body, "\\begin_inset Flex Code", j) if j != -1: - endj = find_end_of_inset(document.body, j) - document.body[endj - 2 : endj + 1] = put_cmd_in_ert("}") - document.body[j : j + 4] = put_cmd_in_ert("\\code{") - j = j + 5 + # assure that we are not in a Code Chunk inset + if document.body[j][-1] == "e": + endj = find_end_of_inset(document.body, j) + document.body[endj - 2 : endj + 1] = put_cmd_in_ert("}") + document.body[j : j + 4] = put_cmd_in_ert("\\code{") + j = j + 5 + else: + j = j + 1 # \email if k != -1: k = find_token(document.body, "\\begin_inset Flex E-mail", k) @@ -1378,28 +1382,14 @@ def revert_jss(document): while m != -1 or j != -1 or h != -1 or k != -1: # \CodeChunk if h != -1: - h = find_token(document.body, "\\begin_layout Code Chunk", h) + h = find_token(document.body, "\\begin_inset Flex Code Chunk", h) if h != -1: - endh = find_end_of_layout(document.body, h) - begindeeper = find_token(document.body, "\\begin_deeper", h) - enddeeper = find_token(document.body, "\\end_deeper", h) - document.body[enddeeper + 1 : enddeeper] = ["\\end_layout"] - document.body[enddeeper : enddeeper + 1] = put_cmd_in_ert("\\end{CodeChunk}") - del document.body[begindeeper] + endh = find_end_of_inset(document.body, h) + document.body[endh + 1 : endh] = ["\\end_layout"] + document.body[endh : endh + 1] = put_cmd_in_ert("\\end{CodeChunk}") document.body[h : h + 3] = put_cmd_in_ert("\\begin{CodeChunk}") document.body[h - 1 : h] = ["\\begin_layout Standard"] h = h + 1 - # \Code - if m != -1: - m = find_token(document.body, "\\begin_layout Standard Code", m) - if m != -1: - endm = find_end_of_layout(document.body, m) - document.body[endm : endm + 1] = ["\\end_layout", "", "\\begin_layout Standard"] - document.body[endm + 3 : endm + 4] = put_cmd_in_ert("\\end{Code}") - document.body[endm + 13 : endm + 13] = ["\\end_layout", "", "\\begin_layout Standard"] - document.body[m + 1 : m] = ["\\end_layout", "", "\\begin_layout Standard"] - document.body[m : m + 1] = put_cmd_in_ert("\\begin{Code}") - m = m + 1 # \CodeInput if j != -1: j = find_token(document.body, "\\begin_layout Code Input", j) @@ -1422,6 +1412,17 @@ def revert_jss(document): document.body[k + 1 : k] = ["\\end_layout", "", "\\begin_layout Standard"] document.body[k : k + 1] = put_cmd_in_ert("\\begin{CodeOutput}") k = k + 1 + # \Code + if m != -1: + m = find_token(document.body, "\\begin_layout Code", m) + if m != -1: + endm = find_end_of_layout(document.body, m) + document.body[endm : endm + 1] = ["\\end_layout", "", "\\begin_layout Standard"] + document.body[endm + 3 : endm + 4] = put_cmd_in_ert("\\end{Code}") + document.body[endm + 13 : endm + 13] = ["\\end_layout", "", "\\begin_layout Standard"] + document.body[m + 1 : m] = ["\\end_layout", "", "\\begin_layout Standard"] + document.body[m : m + 1] = put_cmd_in_ert("\\begin{Code}") + m = m + 1 def convert_subref(document): diff --git a/lib/templates/JSS-article.lyx b/lib/templates/JSS-article.lyx index 3a257956ed..bdb0fa5cb7 100644 --- a/lib/templates/JSS-article.lyx +++ b/lib/templates/JSS-article.lyx @@ -214,7 +214,7 @@ nojss \begin_layout Title A Capitalized Title: Something about a Package -\begin_inset Flex pkg +\begin_inset Flex Pkg status open \begin_layout Plain Layout @@ -280,7 +280,7 @@ optional \end_layout \begin_layout Short Title -\begin_inset Flex pkg +\begin_inset Flex Pkg status open \begin_layout Plain Layout @@ -315,7 +315,7 @@ e abstract of the article.The abstract of the article.The abstract of the \begin_layout Keywords keywords, comma-separated, not capitalized, -\begin_inset Flex proglang +\begin_inset Flex Proglang status open \begin_layout Plain Layout @@ -412,7 +412,7 @@ Fax: +43/512/507-2851 \begin_layout Section About package -\begin_inset Flex pkg +\begin_inset Flex Pkg status open \begin_layout Plain Layout @@ -422,7 +422,7 @@ foo \end_inset in -\begin_inset Flex proglang +\begin_inset Flex Proglang status open \begin_layout Plain Layout @@ -458,7 +458,7 @@ The short title provides bookmarks for PDF files The special JSS style commands related to software and mathematical formulas are written as follows in \SpecialChar LyX : -\begin_inset Flex proglang +\begin_inset Flex Proglang status open \begin_layout Plain Layout @@ -468,7 +468,7 @@ R \end_inset or -\begin_inset Flex proglang +\begin_inset Flex Proglang status open \begin_layout Plain Layout @@ -478,7 +478,7 @@ R \end_inset for the names of programming languages, -\begin_inset Flex pkg +\begin_inset Flex Pkg status open \begin_layout Plain Layout @@ -488,7 +488,7 @@ foo \end_inset or -\begin_inset Flex pkg +\begin_inset Flex Pkg status open \begin_layout Plain Layout @@ -498,7 +498,7 @@ foo \end_inset for software packages, and -\begin_inset Flex code +\begin_inset Flex Code status open \begin_layout Plain Layout @@ -508,7 +508,7 @@ some code \end_inset or -\begin_inset Flex pkg +\begin_inset Flex Pkg status open \begin_layout Plain Layout @@ -588,54 +588,68 @@ Prob Writing several lines of code: \end_layout -\begin_layout Code Chunk +\begin_layout Standard +\begin_inset Flex Code Chunk +status open -\end_layout +\begin_layout Code -\begin_deeper -\begin_layout Standard Code first line of code \end_layout -\begin_layout Standard Code +\begin_layout Code + second line of code \end_layout -\begin_layout Standard Code +\begin_layout Code + third line of code \end_layout -\end_deeper +\end_inset + + +\end_layout + \begin_layout Standard Alternatively, you can distinguish between input and output code: \end_layout -\begin_layout Code Chunk +\begin_layout Standard +\begin_inset Flex Code Chunk +status open -\end_layout - -\begin_deeper \begin_layout Code Input + first line of input code \end_layout \begin_layout Code Input + second line of input code \end_layout \begin_layout Code Output + first line of output code \end_layout \begin_layout Code Output + second line of output code \end_layout \begin_layout Code Output + third line of output code \end_layout -\end_deeper +\end_inset + + +\end_layout + \begin_layout Section* Acknowledgments \end_layout