From 7725e35439a94e7e6e00ff31b4d08be1813e18ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 26 Nov 2012 02:50:53 +0100 Subject: [PATCH 1/8] IEEEtran: update layout and example; fileformat change - the 2 generic lyx2lyx conversion routines can also be used for other layout updates --- lib/layouts/IEEEtran.layout | 15 ++++ lib/lyx2lyx/lyx_2_1.py | 143 +++++++++++++++++++++++++++++++++++- lib/templates/IEEEtran.lyx | 102 ++++++++----------------- src/version.h | 4 +- 4 files changed, 189 insertions(+), 75 deletions(-) diff --git a/lib/layouts/IEEEtran.layout b/lib/layouts/IEEEtran.layout index 0ce9fc6f0e..74ef6f0bd4 100644 --- a/lib/layouts/IEEEtran.layout +++ b/lib/layouts/IEEEtran.layout @@ -162,6 +162,11 @@ Style Page_headings Category FrontMatter InTitle 1 Align Center + Argument 1 + Mandatory 1 + LabelString "Left Side" + Tooltip "Left side of the header line" + EndArgument Font Size Small EndFont @@ -278,6 +283,11 @@ Style Biography LabelString "Photo" Tooltip "Optional photo for biography" EndArgument + Argument 2 + Mandatory 1 + LabelString "Name" + Tooltip "Name of the author" + EndArgument Align Block TextFont Size Small @@ -289,6 +299,11 @@ Style Biography_without_photo CopyStyle Biography LaTeXName IEEEbiographynophoto ResetArgs 1 + Argument 1 + Mandatory 1 + LabelString "Name" + Tooltip "Name of the author" + EndArgument End Style BiographyNoPhoto diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index f9b0266a6e..3fd1a84c32 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1166,6 +1166,145 @@ def revert_latexargs(document): i = i + 1 +def revert_Argument_to_TeX_brace(document, line, n, nmax, environment): + ''' + Reverts an InsetArgument to TeX-code + usage: + revert_Argument_to_TeX_brace(document, LineOfBeginLayout, StartArgument, EndArgument, isEnvironment) + LineOfBeginLayout is the line of the \begin_layout statement + StartArgument is the number of the first argument that needs to be converted + EndArgument is the number of the last argument that needs to be converted or the last defined one + isEnvironment must be true, if the layout id for a LaTeX environment + ''' + lineArg = 0 + while lineArg != -1 and n < nmax + 1: + lineArg = find_token(document.body, "\\begin_inset Argument " + str(n), line) + if lineArg != -1: + beginPlain = find_token(document.body, "\\begin_layout Plain Layout", lineArg) + endLayout = find_token(document.body, "\\end_layout", beginPlain) + endInset = find_token(document.body, "\\end_inset", endLayout) + if environment == False: + document.body[endLayout : endInset + 1] = put_cmd_in_ert("}{") + del(document.body[lineArg : beginPlain + 1]) + else: + document.body[endLayout : endInset + 1] = put_cmd_in_ert("}") + document.body[lineArg : beginPlain + 1] = put_cmd_in_ert("{") + n = n + 1 + + +def revert_IEEEtran(document): + " Reverts InsetArgument to old syntax " + i = 0 + j = 0 + k = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout Page headings", i) + if i != -1: + revert_Argument_to_TeX_brace(document, i, 1, 1, False) + i = i + 1 + if j != -1: + j = find_token(document.body, "\\begin_layout Biography without photo", j) + if j != -1: + revert_Argument_to_TeX_brace(document, j, 1, 1, True) + j = j + 1 + if k != -1: + k = find_token(document.body, "\\begin_layout Biography", k) + kA = find_token(document.body, "\\begin_layout Biography without photo", k) + if k == kA and k != -1: + k = k + 1 + continue + if k != -1: + # start with the second argument, therefore 2 + revert_Argument_to_TeX_brace(document, k, 2, 2, True) + k = k + 1 + if i == -1 and j == -1 and k == -1: + return + + +def convert_Argument_to_TeX_brace(document, line, n, nmax, environment): + ''' + Converts TeX code to an InsetArgument + !!! Be careful if the braces are different in your case as exppected here: + - }{ separates mandatory arguments of commands + - { and } surround a mandatory argument of an environment + usage: + convert_Argument_to_TeX_brace(document, LineOfBeginLayout, StartArgument, EndArgument, isEnvironment) + LineOfBeginLayout is the line of the \begin_layout statement + StartArgument is the number of the first ERT that needs to be converted + EndArgument is the number of the last ERT that needs to be converted + isEnvironment must be true, if the layout id for a LaTeX environment + + Notes: + - this routine will fail if the user has additional TeX-braces (there is nothing we can do) + - this routine can currently handle only one mandatory argument of environments + Todo: + - support the case that }{ is in the file in 2 separate ERTs + ''' + lineArg = line + while lineArg != -1 and n < nmax + 1: + lineArg = find_token(document.body, "\\begin_inset ERT", lineArg) + if environment == False and lineArg != -1: + bracePair = find_token(document.body, "}{", lineArg) + if bracePair == lineArg + 5: # assure that the "}{" is in this ERT + end = find_token(document.body, "\\end_inset", bracePair) + document.body[lineArg : end + 1] = ["\\end_layout", "", "\\end_inset"] + document.body[line + 1 : line + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] + n = n + 1 + else: + lineArg = lineArg + 1 + if environment == True and lineArg != -1: + opening = find_token(document.body, "{", lineArg) + if opening == lineArg + 5: # assure that the "{" is in this ERT + end = find_token(document.body, "\\end_inset", opening) + document.body[lineArg : end + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] + n = n + 1 + lineArg2 = find_token(document.body, "\\begin_inset ERT", lineArg) + closing = find_token(document.body, "}", lineArg2) + if closing == lineArg2 + 5: # assure that the "}" is in this ERT + end2 = find_token(document.body, "\\end_inset", closing) + document.body[lineArg2 : end2 + 1] = ["\\end_layout", "", "\\end_inset"] + else: + lineArg = lineArg + 1 + + +def convert_IEEEtran(document): + ''' + Converts ERT of + Page headings + Biography + Biography without photo + to InsetArgument + ''' + i = 0 + j = 0 + k = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout Page headings", i) + if i != -1: + convert_Argument_to_TeX_brace(document, i, 1, 1, False) + i = i + 1 + if j != -1: + j = find_token(document.body, "\\begin_layout Biography without photo", j) + if j != -1: + convert_Argument_to_TeX_brace(document, j, 1, 1, True) + j = j + 1 + if k != -1: + # assure that we don't handle Biography Biography without photo + k = find_token(document.body, "\\begin_layout Biography", k) + kA = find_token(document.body, "\\begin_layout Biography without photo", k - 1) + if k == kA and k != -1: + k = k + 1 + continue + if k != -1: + # the argument we want to convert is the second one + convert_Argument_to_TeX_brace(document, k, 2, 2, True) + k = k + 1 + if i == -1 and j == -1 and k == -1: + return + + ## # Conversion hub # @@ -1204,10 +1343,12 @@ convert = [ [443, []], [444, []], [445, []], - [446, [convert_latexargs]] + [446, [convert_latexargs]], + [447, [convert_IEEEtran]] ] revert = [ + [446, [revert_IEEEtran]], [445, [revert_latexargs]], [444, [revert_uop]], [443, [revert_biolinum]], diff --git a/lib/templates/IEEEtran.lyx b/lib/templates/IEEEtran.lyx index 5040be9abe..c3948c1e6f 100644 --- a/lib/templates/IEEEtran.lyx +++ b/lib/templates/IEEEtran.lyx @@ -1,5 +1,5 @@ -#LyX 2.0 created this file. For more info see http://www.lyx.org/ -\lyxformat 413 +#LyX 2.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 447 \begin_document \begin_header \textclass IEEEtran @@ -20,13 +20,13 @@ \font_roman default \font_sans default \font_typewriter default +\font_math auto \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 - \graphics default \default_output_format default \output_sync 0 @@ -50,15 +50,21 @@ \pdf_quoted_options "pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false" \papersize default \use_geometry false -\use_amsmath 1 -\use_esint 0 -\use_mhchem 1 -\use_mathdots 1 +\use_package amsmath 1 +\use_package amssymb 1 +\use_package esint 0 +\use_package mathdots 1 +\use_package mathtools 0 +\use_package mhchem 1 +\use_package undertilde 0 \cite_engine basic +\cite_engine_type numerical +\biblio_style plain \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false +\justification true \use_refstyle 0 \index Index \shortcut idx @@ -304,13 +310,11 @@ optional \end_layout \begin_layout Page headings -Journal of XXX -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +Journal of XXX \end_layout \end_inset @@ -467,7 +471,7 @@ Methodology \end_layout \begin_layout Theorem -\begin_inset Argument +\begin_inset Argument 1 status collapsed \begin_layout Plain Layout @@ -556,7 +560,7 @@ above \align center \begin_inset Tabular - + @@ -684,43 +688,10 @@ options "IEEEtran" \end_layout \begin_layout Biography -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -{ -\end_layout - -\end_inset - -Your Name -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -} -\end_layout - -\end_inset - - All about you and the what your interests are. -\begin_inset Argument +\begin_inset Argument 1 status open \begin_layout Plain Layout -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -{ -\end_layout - -\end_inset - - \begin_inset Graphics filename ../examples/CV-image.png width 1in @@ -731,22 +702,21 @@ status collapsed \end_inset -\begin_inset ERT -status collapsed +\end_layout + +\end_inset + + +\begin_inset Argument 2 +status open \begin_layout Plain Layout - -} +Your Name \end_layout \end_inset - -\end_layout - -\end_inset - - + All about you and the what your interests are. \end_layout \begin_layout --Separator-- @@ -754,23 +724,11 @@ status collapsed \end_layout \begin_layout Biography without photo -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -{ -\end_layout - -\end_inset - Coauthor -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -} \end_layout \end_inset diff --git a/src/version.h b/src/version.h index a305e9ce11..3febd57b16 100644 --- a/src/version.h +++ b/src/version.h @@ -30,8 +30,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 446 // spitz: InsetArgument revision -#define LYX_FORMAT_TEX2LYX 446 // landroni: InsetArgument revision +#define LYX_FORMAT_LYX 447 // uwestoehr: IEEEtran layout revision +#define LYX_FORMAT_TEX2LYX 447 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER From 0c622a5c580b215c7e75a68098ac6d1959146dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 26 Nov 2012 03:39:40 +0100 Subject: [PATCH 2/8] aastex: update layout and example file - also fix an issue in the generic lyx2lyx InsetArgument routines --- lib/layouts/aastex.layout | 746 +++++++++++++++++++------------------- lib/lyx2lyx/lyx_2_1.py | 45 ++- lib/templates/aastex.lyx | 46 +-- 3 files changed, 438 insertions(+), 399 deletions(-) diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout index fd8c9c9d30..01f443b82e 100644 --- a/lib/layouts/aastex.layout +++ b/lib/layouts/aastex.layout @@ -32,33 +32,34 @@ # Version 1.3 5/7/04 - Updated for AASTeX 5.2 # Version 1.4 26/10/08 - new custom insets for \altaffilmark, \tablenotemark # - new environments for \altaffiltext and \tablenotetext +# Version 1.5 26/11/12 - added mandatory argument for \altaffiltext Format 41 -Columns 1 -Sides 1 -#SecNumDepth 3 -TocDepth 0 -PageStyle Plain -Provides amsmath 1 -Provides natbib 1 -Provides url 1 +Columns 1 +Sides 1 +#SecNumDepth 3 +TocDepth 0 +PageStyle Plain +Provides amsmath 1 +Provides natbib 1 +Provides url 1 ClassOptions - PageStyle "" + PageStyle "" End Style Standard - Margin Static - LatexType Paragraph - LatexName dummy - ParIndent MM - ParSkip 0.4 - Align Block - AlignPossible Block, Left, Right, Center - LabelType No_Label + Margin Static + LatexType Paragraph + LatexName dummy + ParIndent MM + ParSkip 0.4 + Align Block + AlignPossible Block, Left, Right, Center + LabelType No_Label End @@ -66,19 +67,19 @@ End # Therefore I'll define the entries first, then fill them in Style Section - TocLevel 1 + TocLevel 1 End Style Subsection - TocLevel 2 + TocLevel 2 End Style Subsubsection - TocLevel 3 + TocLevel 3 End Style Paragraph - TocLevel 4 + TocLevel 4 End Style Itemize @@ -176,334 +177,339 @@ NoStyle Bibliography Style Section - Align Center - NextNoIndent 0 - TopSep 2.0 - BottomSep 1.3 + Align Center + NextNoIndent 0 + TopSep 2.0 + BottomSep 1.3 Font - Series Bold - Size Normal + Series Bold + Size Normal EndFont - TocLevel 1 + TocLevel 1 End Style Subsection - Align Center - NextNoIndent 0 - TopSep 1.7 - BottomSep 1.1 + Align Center + NextNoIndent 0 + TopSep 1.7 + BottomSep 1.1 Font - Series Bold - Size Normal + Series Bold + Size Normal EndFont - TocLevel 2 + TocLevel 2 End Style Subsubsection - Align Center - NextNoIndent 0 - TopSep 1.7 - BottomSep 1.1 + Align Center + NextNoIndent 0 + TopSep 1.7 + BottomSep 1.1 Font - Series Medium - Shape Italic - Size Normal + Series Medium + Shape Italic + Size Normal EndFont - TocLevel 3 + TocLevel 3 End Style Title - TopSep 2 - BottomSep 1.3 - Align Center - InTitle 0 + TopSep 2 + BottomSep 1.3 + Align Center + InTitle 0 Font - Series Bold - Size Large + Series Bold + Size Large EndFont End Style Author - Align Center - LabelType No_Label - InTitle 0 + Align Center + LabelType No_Label + InTitle 0 Font - Size Normal - Series Medium - Shape SmallCaps + Size Normal + Series Medium + Shape SmallCaps EndFont End Style Date - InTitle 0 - LabelSep "" - TopSep 1.2 - Align Center + InTitle 0 + LabelSep "" + TopSep 1.2 + Align Center Font - Size Small + Size Small EndFont End Style Abstract - LeftMargin "MMM" - RightMargin "MMM" - ParIndent "MM" - InTitle 0 - TopSep 1.4 - BottomSep 0.7 - LabelType Centered_Top_Environment - Align Block - AlignPossible Block, Left, Right, Center + LeftMargin "MMM" + RightMargin "MMM" + ParIndent "MM" + InTitle 0 + TopSep 1.4 + BottomSep 0.7 + LabelType Centered_Top_Environment + Align Block + AlignPossible Block, Left, Right, Center Font - Size Normal + Size Normal EndFont LabelFont - Series Bold - Size Normal + Series Bold + Size Normal EndFont End Style Affiliation - Margin Static - LatexType Command - LatexName affil - Category FrontMatter - ParSkip 0.4 - BottomSep 0.4 - Align Center - AlignPossible Block, Left, Right, Center - LabelType No_Label + Margin Static + LatexType Command + LatexName affil + Category FrontMatter + ParSkip 0.4 + BottomSep 0.4 + Align Center + AlignPossible Block, Left, Right, Center + LabelType No_Label Font - Family Roman - Size Normal + Family Roman + Size Normal EndFont End Style Altaffilation - Margin Dynamic - LatexType Command - LatexName altaffiltext - Category FrontMatter - ParSkip 0.4 - Align Block - LabelSep xx - LabelType Static - LabelString "Alternative affiliation:" + Margin Dynamic + LatexType Command + LatexName altaffiltext + Category FrontMatter + ParSkip 0.4 + Align Block + Argument 1 + Mandatory 1 + LabelString "Number" + Tooltip "Consecutive number for the alternative affiliations" + EndArgument + LabelSep xx + LabelType Static + LabelString "Alternative affiliation:" LabelFont - Color green + Color green EndFont End InsetLayout "Flex:altaffilmark" - LyxType custom - LatexType command - LatexName altaffilmark - LabelString "altaffiliation mark" + LyxType custom + LatexType command + LatexName altaffilmark + LabelString "altaffiliation mark" Font - Color foreground - Size Small - Family Roman - Shape Up - Series Medium - Misc No_Emph - Misc No_Noun - Misc No_Bar + Color foreground + Size Small + Family Roman + Shape Up + Series Medium + Misc No_Emph + Misc No_Noun + Misc No_Bar EndFont LabelFont - Color green - Size Small + Color green + Size Small EndFont End Style Keywords - LeftMargin MMM - Margin Dynamic - LatexType Command - InTitle 0 - LatexName keywords - Category FrontMatter - ParSkip 0.4 - BottomSep 0.4 - Align Block - AlignPossible Block, Left, Right, Center - LabelType Static - LabelSep M - LabelString "Subject headings:" + LeftMargin MMM + Margin Dynamic + LatexType Command + InTitle 0 + LatexName keywords + Category FrontMatter + ParSkip 0.4 + BottomSep 0.4 + Align Block + AlignPossible Block, Left, Right, Center + LabelType Static + LabelSep M + LabelString "Subject headings:" Font - Family Roman - Shape Up - Size Normal + Family Roman + Shape Up + Size Normal EndFont LabelFont - Family Roman - Shape Italic - Size Normal + Family Roman + Shape Italic + Size Normal EndFont End Style Email - Margin Static - LatexType Command - InTitle 0 - LatexName email - Category FrontMatter - ParSkip 0.4 - BottomSep 0.4 - Align Center - AlignPossible Block, Left, Right, Center - LabelType No_Label + Margin Static + LatexType Command + InTitle 0 + LatexName email + Category FrontMatter + ParSkip 0.4 + BottomSep 0.4 + Align Center + AlignPossible Block, Left, Right, Center + LabelType No_Label Font - Family Roman - Size Normal - Shape Italic + Family Roman + Size Normal + Shape Italic EndFont End Style Acknowledgements - Margin Dynamic - LatexType Command - InTitle 0 - LatexName acknowledgements - TopSep 1.2 - ParSkip 0.4 - BottomSep 0.8 - Align Left - LabelType Static - LabelString "[Acknowledgements]" - KeepEmpty 1 + Margin Dynamic + LatexType Command + InTitle 0 + LatexName acknowledgements + TopSep 1.2 + ParSkip 0.4 + BottomSep 0.8 + Align Left + LabelType Static + LabelString "[Acknowledgements]" + KeepEmpty 1 Font - Family Roman - Size Normal - Shape Italic + Family Roman + Size Normal + Shape Italic EndFont End Style And - Margin Dynamic - LatexType Command - InTitle 0 - LatexName and - Category FrontMatter - TopSep 1.2 - ParSkip 0.4 - BottomSep 1.2 - Align Center - LabelType Static - LabelString "and" - KeepEmpty 1 + Margin Dynamic + LatexType Command + InTitle 0 + LatexName and + Category FrontMatter + TopSep 1.2 + ParSkip 0.4 + BottomSep 1.2 + Align Center + LabelType Static + LabelString "and" + KeepEmpty 1 Font - Family Roman - Size Normal + Family Roman + Size Normal EndFont End Style PlaceFigure - Margin Dynamic - LatexType Command - InTitle 0 - LatexName placefigure - TopSep 1.2 - ParSkip 0.4 - BottomSep 0.8 - Align Left - LabelType Static - LabelSep M - LabelString "Place Figure here:" + Margin Dynamic + LatexType Command + InTitle 0 + LatexName placefigure + TopSep 1.2 + ParSkip 0.4 + BottomSep 0.8 + Align Left + LabelType Static + LabelSep M + LabelString "Place Figure here:" Font - Family Roman - Size Normal - Shape Italic + Family Roman + Size Normal + Shape Italic EndFont End Style PlaceTable - Margin Dynamic - LatexType Command - InTitle 0 - LatexName placetable - TopSep 1.2 - ParSkip 0.4 - BottomSep 0.8 - Align Left - LabelType Static - LabelSep M - LabelString "Place Table here:" + Margin Dynamic + LatexType Command + InTitle 0 + LatexName placetable + TopSep 1.2 + ParSkip 0.4 + BottomSep 0.8 + Align Left + LabelType Static + LabelSep M + LabelString "Place Table here:" Font - Family Roman - Size Normal - Shape Italic + Family Roman + Size Normal + Shape Italic EndFont End Style Appendix - Margin Dynamic - LatexType Command - LatexName appendix - Category BackMatter - TopSep 1.2 - ParSkip 0.4 - BottomSep 0.8 - Align Left - LabelType Static - LabelString "[Appendix]" - KeepEmpty 1 + Margin Dynamic + LatexType Command + LatexName appendix + Category BackMatter + TopSep 1.2 + ParSkip 0.4 + BottomSep 0.8 + Align Left + LabelType Static + LabelString "[Appendix]" + KeepEmpty 1 Font - Family Roman - Size Normal - Shape Italic + Family Roman + Size Normal + Shape Italic EndFont End Style MathLetters - LatexType Environment - LatexName mathletters - LabelType No_Label - Align Block - AlignPossible Block, Left, Right, Center + LatexType Environment + LatexName mathletters + LabelType No_Label + Align Block + AlignPossible Block, Left, Right, Center Font - Size Normal + Size Normal EndFont End Style References - Margin First_Dynamic - LatexType Bib_Environment - LatexName thebibliography - Category BackMatter - NextNoIndent 1 - LeftMargin MM - ParSkip 0.4 - ItemSep 0 - TopSep 0.7 - BottomSep 0.7 - ParSep 0.5 - LabelType Bibliography - LabelString "References" - LabelBottomSep 0.7 - Align Block - AlignPossible Block, Left, Right, Center + Margin First_Dynamic + LatexType Bib_Environment + LatexName thebibliography + Category BackMatter + NextNoIndent 1 + LeftMargin MM + ParSkip 0.4 + ItemSep 0 + TopSep 0.7 + BottomSep 0.7 + ParSep 0.5 + LabelType Bibliography + LabelString "References" + LabelBottomSep 0.7 + Align Block + AlignPossible Block, Left, Right, Center LabelFont - Family Roman - Size Normal - Series Bold + Family Roman + Size Normal + Series Bold EndFont End @@ -511,203 +517,203 @@ End # Need reordering below here Style NoteToEditor - Margin Dynamic - LatexType Command - InTitle 0 - LatexName notetoeditor - TopSep 1.2 - ParSkip 0.4 - BottomSep 0.8 - Align Left - AlignPossible Block, Left, Right, Center - LabelType Static - LabelSep M - LabelString "Note to Editor:" + Margin Dynamic + LatexType Command + InTitle 0 + LatexName notetoeditor + TopSep 1.2 + ParSkip 0.4 + BottomSep 0.8 + Align Left + AlignPossible Block, Left, Right, Center + LabelType Static + LabelSep M + LabelString "Note to Editor:" Font - Family Roman - Size Normal - Shape Italic + Family Roman + Size Normal + Shape Italic EndFont End Style TableRefs - Margin First_Dynamic - LatexType Command - InTitle 0 - LatexName tablerefs - TopSep 1.2 - ParSkip 0.4 - BottomSep 0.8 - Align Block - AlignPossible Block, Left, Right, Center - LabelType Static - LabelSep M - LabelString "References. ---" + Margin First_Dynamic + LatexType Command + InTitle 0 + LatexName tablerefs + TopSep 1.2 + ParSkip 0.4 + BottomSep 0.8 + Align Block + AlignPossible Block, Left, Right, Center + LabelType Static + LabelSep M + LabelString "References. ---" Font - Family Roman - Size Normal + Family Roman + Size Normal EndFont End Style TableComments - Margin First_Dynamic - LatexType Command - InTitle 0 - LatexName tablecomments - TopSep 1.2 - ParSkip 0.4 - BottomSep 0.8 - Align Block - AlignPossible Block, Left, Right, Center - LabelType Static - LabelSep M - LabelString "Note. ---" + Margin First_Dynamic + LatexType Command + InTitle 0 + LatexName tablecomments + TopSep 1.2 + ParSkip 0.4 + BottomSep 0.8 + Align Block + AlignPossible Block, Left, Right, Center + LabelType Static + LabelSep M + LabelString "Note. ---" Font - Family Roman - Size Normal + Family Roman + Size Normal EndFont End Style "Table note" - Margin Dynamic - LatexType Command - LatexName tablenotetext - ParSkip 0.4 - Align Block - LabelSep xx - LabelType Static - LabelString "Table note:" + Margin Dynamic + LatexType Command + LatexName tablenotetext + ParSkip 0.4 + Align Block + LabelSep xx + LabelType Static + LabelString "Table note:" LabelFont - Color magenta + Color magenta EndFont End InsetLayout "Flex:tablenotemark" - LyxType custom - LatexType command - LatexName tablenotemark - LabelString "tablenote mark" + LyxType custom + LatexType command + LatexName tablenotemark + LabelString "tablenote mark" Font - Color foreground - Size Small - Family Roman - Shape Up - Series Medium - Misc No_Emph - Misc No_Noun - Misc No_Bar + Color foreground + Size Small + Family Roman + Shape Up + Series Medium + Misc No_Emph + Misc No_Noun + Misc No_Bar EndFont LabelFont - Color magenta - Size Small + Color magenta + Size Small EndFont End Style FigCaption - Margin First_Dynamic - LatexType Command - LatexName figcaption - LabelSep xx - ParSkip 0.4 - TopSep 0.5 - Align Block - AlignPossible Block, Left - LabelType Static - LabelString "Fig. ---" + Margin First_Dynamic + LatexType Command + LatexName figcaption + LabelSep xx + ParSkip 0.4 + TopSep 0.5 + Align Block + AlignPossible Block, Left + LabelType Static + LabelString "Fig. ---" Argument 1 - LabelString "Short Title|S" - Tooltip "The caption as it appears in the list of figures" + LabelString "Short Title|S" + Tooltip "The caption as it appears in the list of figures" EndArgument End # Facility style definition Style Facility - LeftMargin MMM - Margin Dynamic - LatexType Command - InTitle 0 - LatexName facility - ParSkip 0.4 - BottomSep 0.4 - Align Block - AlignPossible Block, Left, Right, Center - LabelType Static - LabelSep M - LabelString "Facility:" + LeftMargin MMM + Margin Dynamic + LatexType Command + InTitle 0 + LatexName facility + ParSkip 0.4 + BottomSep 0.4 + Align Block + AlignPossible Block, Left, Right, Center + LabelType Static + LabelSep M + LabelString "Facility:" Font - Family Roman - Shape Up - Size Normal + Family Roman + Shape Up + Size Normal EndFont LabelFont - Family Roman - Shape Italic - Size Normal + Family Roman + Shape Italic + Size Normal EndFont End # Objectname style definition Style Objectname - LeftMargin MMM - Margin Dynamic - LatexType Command - InTitle 0 - LatexName objectname - ParSkip 0.4 - BottomSep 0.4 - Align Block - AlignPossible Block, Left, Right, Center - LabelType Static - LabelSep M - LabelString "Obj:" + LeftMargin MMM + Margin Dynamic + LatexType Command + InTitle 0 + LatexName objectname + ParSkip 0.4 + BottomSep 0.4 + Align Block + AlignPossible Block, Left, Right, Center + LabelType Static + LabelSep M + LabelString "Obj:" Argument 1 - LabelString "Recognized Name" - Tooltip "Separate the recognized name of an object from text" + LabelString "Recognized Name" + Tooltip "Separate the recognized name of an object from text" EndArgument Font - Family Roman - Shape Up - Size Normal + Family Roman + Shape Up + Size Normal EndFont LabelFont - Family Roman - Shape Italic - Size Normal + Family Roman + Shape Italic + Size Normal EndFont End # Dataset style definition Style Dataset - LeftMargin MMM - Margin Dynamic - LatexType Command - InTitle 0 - LatexName dataset - ParSkip 0.4 - BottomSep 0.4 - Align Block - AlignPossible Block, Left, Right, Center - LabelType Static - LabelSep M - LabelString "Dataset:" + LeftMargin MMM + Margin Dynamic + LatexType Command + InTitle 0 + LatexName dataset + ParSkip 0.4 + BottomSep 0.4 + Align Block + AlignPossible Block, Left, Right, Center + LabelType Static + LabelSep M + LabelString "Dataset:" Argument 1 - LabelString "Recognized Name" - Tooltip "Separate the dataset ID from text" + LabelString "Recognized Name" + Tooltip "Separate the dataset ID from text" EndArgument Font - Family Roman - Shape Up - Size Normal + Family Roman + Shape Up + Size Normal EndFont LabelFont - Family Roman - Shape Italic - Size Normal + Family Roman + Shape Italic + Size Normal EndFont End diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 3fd1a84c32..cab19d82dd 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1193,7 +1193,13 @@ def revert_Argument_to_TeX_brace(document, line, n, nmax, environment): def revert_IEEEtran(document): - " Reverts InsetArgument to old syntax " + ''' + Reverts InsetArgument of + Page headings + Biography + Biography without photo + to TeX-code + ''' i = 0 j = 0 k = 0 @@ -1246,7 +1252,8 @@ def convert_Argument_to_TeX_brace(document, line, n, nmax, environment): lineArg = find_token(document.body, "\\begin_inset ERT", lineArg) if environment == False and lineArg != -1: bracePair = find_token(document.body, "}{", lineArg) - if bracePair == lineArg + 5: # assure that the "}{" is in this ERT + # assure that the "}{" is in this ERT (5 is or files saved with LyX 2.0, 4 for files exported by LyX 2.1) + if bracePair == lineArg + 5 or bracePair == lineArg + 4: end = find_token(document.body, "\\end_inset", bracePair) document.body[lineArg : end + 1] = ["\\end_layout", "", "\\end_inset"] document.body[line + 1 : line + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] @@ -1255,13 +1262,13 @@ def convert_Argument_to_TeX_brace(document, line, n, nmax, environment): lineArg = lineArg + 1 if environment == True and lineArg != -1: opening = find_token(document.body, "{", lineArg) - if opening == lineArg + 5: # assure that the "{" is in this ERT + if opening == lineArg + 5 or opening == lineArg + 4: # assure that the "{" is in this ERT end = find_token(document.body, "\\end_inset", opening) document.body[lineArg : end + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] n = n + 1 lineArg2 = find_token(document.body, "\\begin_inset ERT", lineArg) closing = find_token(document.body, "}", lineArg2) - if closing == lineArg2 + 5: # assure that the "}" is in this ERT + if closing == lineArg2 + 5 or closing == lineArg2 + 4: # assure that the "}" is in this ERT end2 = find_token(document.body, "\\end_inset", closing) document.body[lineArg2 : end2 + 1] = ["\\end_layout", "", "\\end_inset"] else: @@ -1305,6 +1312,32 @@ def convert_IEEEtran(document): return +def revert_AASTeX(document): + " Reverts InsetArgument of Altaffilation to TeX-code " + i = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout Altaffilation", i) + if i != -1: + revert_Argument_to_TeX_brace(document, i, 1, 1, False) + i = i + 1 + if i == -1: + return + + +def convert_AASTeX(document): + " Converts ERT of Altaffilation to InsetArgument " + i = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout Altaffilation", i) + if i != -1: + convert_Argument_to_TeX_brace(document, i, 1, 1, False) + i = i + 1 + if i == -1: + return + + ## # Conversion hub # @@ -1344,11 +1377,11 @@ convert = [ [444, []], [445, []], [446, [convert_latexargs]], - [447, [convert_IEEEtran]] + [447, [convert_IEEEtran, convert_AASTeX]] ] revert = [ - [446, [revert_IEEEtran]], + [446, [revert_IEEEtran, revert_AASTeX]], [445, [revert_latexargs]], [444, [revert_uop]], [443, [revert_biolinum]], diff --git a/lib/templates/aastex.lyx b/lib/templates/aastex.lyx index 0e578fc695..2324d44263 100644 --- a/lib/templates/aastex.lyx +++ b/lib/templates/aastex.lyx @@ -1,5 +1,5 @@ -#LyX 2.0 created this file. For more info see http://www.lyx.org/ -\lyxformat 413 +#LyX 2.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 447 \begin_document \begin_header \textclass aastex @@ -17,13 +17,13 @@ \font_roman default \font_sans default \font_typewriter default +\font_math auto \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 - \graphics default \default_output_format default \output_sync 0 @@ -34,15 +34,21 @@ \use_hyperref false \papersize default \use_geometry false -\use_amsmath 0 -\use_esint 0 -\use_mhchem 1 -\use_mathdots 1 -\cite_engine natbib_authoryear +\use_package amsmath 0 +\use_package amssymb 0 +\use_package esint 0 +\use_package mathdots 1 +\use_package mathtools 0 +\use_package mhchem 1 +\use_package undertilde 0 +\cite_engine natbib +\cite_engine_type authoryear +\biblio_style plainnat \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false +\justification true \use_refstyle 0 \index Index \shortcut idx @@ -132,13 +138,11 @@ status collapsed \end_layout \begin_layout Altaffilation -1 -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +1 \end_layout \end_inset @@ -147,13 +151,11 @@ Visiting Astronomer, etc. \end_layout \begin_layout Altaffilation -2 -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +2 \end_layout \end_inset @@ -162,13 +164,11 @@ Current Address, etc. \end_layout \begin_layout Altaffilation -3 -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +3 \end_layout \end_inset From 0d3e33d7c14aa96484bf49db09c672b3d53278de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 26 Nov 2012 04:04:39 +0100 Subject: [PATCH 3/8] elsarticle: update some strings, no change of functionality --- lib/layouts/elsarticle.layout | 22 ++++++++---- lib/templates/elsarticle.lyx | 63 +++-------------------------------- 2 files changed, 20 insertions(+), 65 deletions(-) diff --git a/lib/layouts/elsarticle.layout b/lib/layouts/elsarticle.layout index 08c7185e40..f3360c4d0d 100644 --- a/lib/layouts/elsarticle.layout +++ b/lib/layouts/elsarticle.layout @@ -128,8 +128,8 @@ Style "Title footnote" Category FrontMatter InTitle 0 Argument 1 - LabelString "Footnote Option" - Tooltip "Optional argument for the footnote" + LabelString "Footnote Label" + Tooltip "Label you refer to in the title" EndArgument ParSkip 0.4 BottomSep 0.5 @@ -150,8 +150,8 @@ Style Author Category FrontMatter InTitle 0 Argument 1 - LabelString "Author Option" - Tooltip "Optional argument for the author" + LabelString "Author Label" + Tooltip "Label you will reference in the address" EndArgument LatexName author LabelSep xxx @@ -193,6 +193,10 @@ Style "Author footnote" CopyStyle "Title footnote" LatexName fntext LabelString "Author footnote:" + Argument 1 + LabelString "Author Footnote Label" + Tooltip "Label you refer to for an author" + EndArgument End @@ -219,7 +223,7 @@ End Style "Corresponding author" - CopyStyle "Title footnote" + CopyStyle "Author footnote" LatexName cortext LabelString "Corresponding author text:" End @@ -232,8 +236,8 @@ Style Address LatexName address InTitle 0 Argument 1 - LabelString "Address Option" - Tooltip "Optional argument for the address" + LabelString "Address Label" + Tooltip "Label of the author you refer to" EndArgument ParSkip 0.4 Align Center @@ -249,6 +253,10 @@ Style Email CopyStyle Address LatexName ead AlignPossible Block + Argument 1 + LabelString "Internet" + Tooltip "if content is 'url', email becomes an Internet address" + EndArgument Font Shape Up EndFont diff --git a/lib/templates/elsarticle.lyx b/lib/templates/elsarticle.lyx index d8553722e9..fa22fffccc 100644 --- a/lib/templates/elsarticle.lyx +++ b/lib/templates/elsarticle.lyx @@ -1,5 +1,5 @@ #LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 423 +\lyxformat 413 \begin_document \begin_header \textclass elsarticle @@ -28,7 +28,6 @@ theorems-std \font_osf false \font_sf_scale 100 \font_tt_scale 100 - \graphics default \default_output_format default \output_sync 0 @@ -39,19 +38,15 @@ theorems-std \use_hyperref false \papersize default \use_geometry false -\use_package amsmath 0 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 0 -\use_package mhchem 1 -\use_package undertilde 1 +\use_amsmath 0 +\use_esint 1 +\use_mathdots 1 +\use_mhchem 1 \cite_engine natbib_authoryear -\biblio_style plainnat \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false -\justification true \use_refstyle 0 \index Index \shortcut idx @@ -185,16 +180,6 @@ t1 \end_inset -\begin_inset Note Note -status open - -\begin_layout Plain Layout -The short title is the label you refer to in the title. -\end_layout - -\end_inset - - \end_layout \begin_layout Title footnote @@ -354,16 +339,6 @@ rvt \end_inset -\begin_inset Note Note -status collapsed - -\begin_layout Plain Layout -The short title is the reference of the address. -\end_layout - -\end_inset - - \end_layout \begin_layout Email @@ -440,24 +415,6 @@ url \end_inset -\begin_inset Note Note -status collapsed - -\begin_layout Plain Layout -When the short title is -\begin_inset Quotes eld -\end_inset - -url -\begin_inset Quotes erd -\end_inset - -, the email becomes an Internet address. -\end_layout - -\end_inset - - \end_layout \begin_layout Author footnote @@ -529,16 +486,6 @@ rvt \end_inset -\begin_inset Note Note -status collapsed - -\begin_layout Plain Layout -The short title is the label you refer to in the authors. -\end_layout - -\end_inset - - \end_layout \begin_layout Address From b0b1d2f8b1673e07c1c9e1225a4d83850dc2340d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 26 Nov 2012 04:21:23 +0100 Subject: [PATCH 4/8] AGUTeX: update layout and example file --- lib/layouts/agutex.layout | 263 +++++++++++++++++++------------------- lib/lyx2lyx/lyx_2_1.py | 30 ++++- lib/templates/AGUTeX.lyx | 56 ++++---- 3 files changed, 189 insertions(+), 160 deletions(-) diff --git a/lib/layouts/agutex.layout b/lib/layouts/agutex.layout index 443db50b0c..7fb6a41bfa 100644 --- a/lib/layouts/agutex.layout +++ b/lib/layouts/agutex.layout @@ -1,4 +1,4 @@ -#% Do not delete the line below; configure depends on this + #% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[agutex]{American Geophysical Union (AGUTeX)} # \DeclareCategory{Articles} # elsarticle textclass definition file. @@ -14,30 +14,30 @@ DefaultStyle Standard Provides natbib 1 ClassOptions - FontSize 10|11|12 + FontSize 10|11|12 end # This is just to show how to declare the default font. # The defaults are exactly those shown here. DefaultFont - Family Roman - Series Medium - Shape Up - Size Normal - Color None + Family Roman + Series Medium + Shape Up + Size Normal + Color None EndFont Style Standard - Margin Static - LatexType Paragraph - LatexName dummy - ParIndent MM - ParSkip 0.4 - Align Block - AlignPossible Block, Left, Right, Center - LabelType No_Label + Margin Static + LatexType Paragraph + LatexName dummy + ParIndent MM + ParSkip 0.4 + Align Block + AlignPossible Block, Left, Right, Center + LabelType No_Label End Input stdcounters.inc @@ -53,171 +53,176 @@ NoStyle Chapter* Style Title - Margin Static - LatexType Command - LatexName title - Category FrontMatter - ParSkip 0.4 - ItemSep 0 - TopSep 0 - BottomSep 1 - ParSep 1 - Align Center - LabelType No_Label + Margin Static + LatexType Command + LatexName title + Category FrontMatter + ParSkip 0.4 + ItemSep 0 + TopSep 0 + BottomSep 1 + ParSep 1 + Align Center + LabelType No_Label Font - Size Largest + Size Largest EndFont End Style Authors - Margin Static - LatexType Command - Category FrontMatter - LatexName authors - LabelSep xxx - ParSkip 0.4 - TopSep 1.3 - BottomSep 0.7 - ParSep 0.7 - Align Center - LabelType No_Label + Margin Static + LatexType Command + Category FrontMatter + LatexName authors + LabelSep xxx + ParSkip 0.4 + TopSep 1.3 + BottomSep 0.7 + ParSep 0.7 + Align Center + LabelType No_Label Font - Size Large + Size Large EndFont End InsetLayout "Flex:Affiliation Mark" - LyxType custom - LatexType command - LatexName altaffilmark - LabelString "Affiliation Mark" + LyxType custom + LatexType command + LatexName altaffilmark + LabelString "Affiliation Mark" Font - Color foreground - Size Small - Family Roman - Shape Up - Series Medium - Misc No_Emph - Misc No_Noun - Misc No_Bar + Color foreground + Size Small + Family Roman + Shape Up + Series Medium + Misc No_Emph + Misc No_Noun + Misc No_Bar EndFont LabelFont - Color latex - Size Small + Color latex + Size Small EndFont End Style "Author affiliation" - Margin Dynamic - LatexType Command - LatexName altaffiltext - Category FrontMatter - ParSkip 0.4 - BottomSep 0.5 - Align Left - LabelSep xx - LabelType Static - LabelString "Author affiliation:" + Margin Dynamic + LatexType Command + LatexName altaffiltext + Category FrontMatter + ParSkip 0.4 + BottomSep 0.5 + Align Left + Argument 1 + Mandatory 1 + LabelString "Number" + Tooltip "Consecutive number for the author affiliations" + EndArgument + LabelSep xx + LabelType Static + LabelString "Author affiliation:" LabelFont - Color Green - Series Bold + Color Green + Series Bold EndFont End Style Abstract - Margin Dynamic - LatexType Environment - LatexName abstract - Category FrontMatter - NextNoIndent 1 - LabelSep xxx - ParSkip 0.4 - TopSep 0.7 - BottomSep 0.4 - Align Block - LabelType Static - LabelString "Abstract." + Margin Dynamic + LatexType Environment + LatexName abstract + Category FrontMatter + NextNoIndent 1 + LabelSep xxx + ParSkip 0.4 + TopSep 0.7 + BottomSep 0.4 + Align Block + LabelType Static + LabelString "Abstract." LabelFont - Series Bold + Series Bold EndFont End Style Paragraph - CopyStyle Subsection* - Category BackMatter - LatexName paragraph - TocLevel 4 + CopyStyle Subsection* + Category BackMatter + LatexName paragraph + TocLevel 4 End Style Notation - Margin Static - LatexType Environment - LatexName notation - Category BackMatter - NextNoIndent 1 - LabelSep xxx - ParSkip 0.4 - TopSep 0.7 - BottomSep 0.4 - Align Block - LabelType Top_Environment - LabelString "Notation" + Margin Static + LatexType Environment + LatexName notation + Category BackMatter + NextNoIndent 1 + LabelSep xxx + ParSkip 0.4 + TopSep 0.7 + BottomSep 0.4 + Align Block + LabelType Top_Environment + LabelString "Notation" LabelFont - Series Bold - Size Larger + Series Bold + Size Larger EndFont End Style Acknowledgments - Margin Dynamic - LatexType Environment - LatexName acknowledgments - Category BackMatter - NextNoIndent 1 - LabelSep xxx - ParSkip 0.4 - TopSep 0.7 - BottomSep 0.4 - Align Block - LabelType Static - LabelString "Acknowledgments." + Margin Dynamic + LatexType Environment + LatexName acknowledgments + Category BackMatter + NextNoIndent 1 + LabelSep xxx + ParSkip 0.4 + TopSep 0.7 + BottomSep 0.4 + Align Block + LabelType Static + LabelString "Acknowledgments." Font - Size Small + Size Small EndFont LabelFont - Series Bold - Size Small + Series Bold + Size Small EndFont End Style Bibliography - Margin First_Dynamic - LatexType Bib_Environment - LatexName thebibliography - Category BackMatter - NextNoIndent 1 - LeftMargin MM - ParSkip 0.4 - ItemSep 0 - TopSep 0.7 - BottomSep 0.7 - ParSep 0.5 - Align Block - AlignPossible Block, Left - LabelType Bibliography - LabelString "References" - LabelBottomSep 1.2 + Margin First_Dynamic + LatexType Bib_Environment + LatexName thebibliography + Category BackMatter + NextNoIndent 1 + LeftMargin MM + ParSkip 0.4 + ItemSep 0 + TopSep 0.7 + BottomSep 0.7 + ParSep 0.5 + Align Block + AlignPossible Block, Left + LabelType Bibliography + LabelString "References" + LabelBottomSep 1.2 LabelFont - Series Bold - Size Larger + Series Bold + Size Larger EndFont End diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index cab19d82dd..15e176ea80 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1338,6 +1338,32 @@ def convert_AASTeX(document): return +def revert_AGUTeX(document): + " Reverts InsetArgument of Author affiliation to TeX-code " + i = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout Author affiliation", i) + if i != -1: + revert_Argument_to_TeX_brace(document, i, 1, 1, False) + i = i + 1 + if i == -1: + return + + +def convert_AGUTeX(document): + " Converts ERT of Author affiliation to InsetArgument " + i = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout Author affiliation", i) + if i != -1: + convert_Argument_to_TeX_brace(document, i, 1, 1, False) + i = i + 1 + if i == -1: + return + + ## # Conversion hub # @@ -1377,11 +1403,11 @@ convert = [ [444, []], [445, []], [446, [convert_latexargs]], - [447, [convert_IEEEtran, convert_AASTeX]] + [447, [convert_IEEEtran, convert_AASTeX, convert_AGUTeX]] ] revert = [ - [446, [revert_IEEEtran, revert_AASTeX]], + [446, [revert_IEEEtran, revert_AASTeX, revert_AGUTeX]], [445, [revert_latexargs]], [444, [revert_uop]], [443, [revert_biolinum]], diff --git a/lib/templates/AGUTeX.lyx b/lib/templates/AGUTeX.lyx index 4b5fe3f230..32299c3092 100644 --- a/lib/templates/AGUTeX.lyx +++ b/lib/templates/AGUTeX.lyx @@ -1,5 +1,5 @@ -#LyX 2.0 created this file. For more info see http://www.lyx.org/ -\lyxformat 413 +#LyX 2.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 447 \begin_document \begin_header \textclass agutex @@ -50,13 +50,13 @@ theorems-std \font_roman default \font_sans default \font_typewriter default +\font_math auto \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 - \graphics default \default_output_format default \output_sync 0 @@ -67,15 +67,21 @@ theorems-std \use_hyperref false \papersize default \use_geometry false -\use_amsmath 0 -\use_esint 1 -\use_mhchem 1 -\use_mathdots 1 -\cite_engine natbib_authoryear +\use_package amsmath 0 +\use_package amssymb 0 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 0 +\use_package mhchem 1 +\use_package undertilde 0 +\cite_engine natbib +\cite_engine_type authoryear +\biblio_style plainnat \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false +\justification true \use_refstyle 0 \index Index \shortcut idx @@ -261,13 +267,11 @@ status collapsed \end_layout \begin_layout Author affiliation -1 -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +1 \end_layout \end_inset @@ -277,13 +281,11 @@ Department of Hydrology and Water Resources, University of Arizona, Tucson, \end_layout \begin_layout Author affiliation -2 -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +2 \end_layout \end_inset @@ -292,13 +294,11 @@ Department of Geography, Ohio State University, Columbus, Ohio, USA. \end_layout \begin_layout Author affiliation -3 -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +3 \end_layout \end_inset @@ -308,13 +308,11 @@ Department of Space Sciences, University of Michigan, Ann Arbor, Michigan, \end_layout \begin_layout Author affiliation -4 -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +4 \end_layout \end_inset @@ -695,7 +693,7 @@ above \align center \begin_inset Tabular - + From 710f2962c5c554152f05ab9280810e65e3eb18f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 26 Nov 2012 04:24:00 +0100 Subject: [PATCH 5/8] agutex.layout: remove a space I accidentally introduced --- lib/layouts/agutex.layout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/layouts/agutex.layout b/lib/layouts/agutex.layout index 7fb6a41bfa..97bdce984e 100644 --- a/lib/layouts/agutex.layout +++ b/lib/layouts/agutex.layout @@ -1,4 +1,4 @@ - #% Do not delete the line below; configure depends on this +#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[agutex]{American Geophysical Union (AGUTeX)} # \DeclareCategory{Articles} # elsarticle textclass definition file. From 13d8aee6099579f3090b827def471aaeffa492ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 26 Nov 2012 05:19:47 +0100 Subject: [PATCH 6/8] IJMPC/D: update layout and template files - add a mandatory argument - remove an optional argument that compiles, but would break the layout of the output completely (is also not documented nor explicitly defined) - also add a safe guard for the lyx2lyx conversion routines --- lib/layouts/ijmpc.layout | 13 +++---- lib/layouts/ijmpd.layout | 13 +++---- lib/lyx2lyx/lyx_2_1.py | 74 +++++++++++++++++++++++++++++----------- lib/templates/IJMPC.lyx | 36 ++++++++++--------- lib/templates/IJMPD.lyx | 34 ++++++++++-------- 5 files changed, 106 insertions(+), 64 deletions(-) diff --git a/lib/layouts/ijmpc.layout b/lib/layouts/ijmpc.layout index 92d5ec9caa..7f2daea758 100644 --- a/lib/layouts/ijmpc.layout +++ b/lib/layouts/ijmpc.layout @@ -67,6 +67,11 @@ Style MarkBoth Category FrontMatter InTitle 1 Align Center + Argument 1 + Mandatory 1 + LabelString "Author Names" + Tooltip "Author names that will appear in the header line" + EndArgument Font Size Small EndFont @@ -121,10 +126,6 @@ Style Author LatexType Command Category FrontMatter InTitle 1 - Argument 1 - LabelString "Author Option" - Tooltip "Optional argument for author" - EndArgument LatexName author LabelSep xxx ParSkip 0.4 @@ -298,8 +299,8 @@ Style RomanList LatexType Item_Environment LatexName romanlist Argument 1 - LabelString "RomanList Option" - Tooltip "Optional argument for RomanList" + LabelString "Numbering Scheme" + Tooltip "Use the largest item number in your list, e.g. '(iv)' for 4 Roman numbered items" EndArgument NextNoIndent 1 LeftMargin MMN diff --git a/lib/layouts/ijmpd.layout b/lib/layouts/ijmpd.layout index 7d089ed22e..b715a58b54 100644 --- a/lib/layouts/ijmpd.layout +++ b/lib/layouts/ijmpd.layout @@ -72,6 +72,11 @@ Style MarkBoth Category FrontMatter InTitle 1 Align Center + Argument 1 + Mandatory 1 + LabelString "Author Names" + Tooltip "Author names that will appear in the header line" + EndArgument Font Size Small EndFont @@ -126,10 +131,6 @@ Style Author LatexType Command Category FrontMatter InTitle 1 - Argument 1 - LabelString "Author Option" - Tooltip "Optional argument for author" - EndArgument LatexName author LabelSep xxx ParSkip 0.4 @@ -301,8 +302,8 @@ Style RomanList LatexType Item_Environment LatexName romanlist Argument 1 - LabelString "RomanList Option" - Tooltip "Optional argument for RomanList" + LabelString "Numbering Scheme" + Tooltip "Use the largest item number in your list, e.g. '(iv)' for 4 Roman numbered items" EndArgument NextNoIndent 1 LeftMargin MMN diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 15e176ea80..26e2131f85 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1193,13 +1193,14 @@ def revert_Argument_to_TeX_brace(document, line, n, nmax, environment): def revert_IEEEtran(document): - ''' - Reverts InsetArgument of - Page headings - Biography - Biography without photo - to TeX-code - ''' + ''' + Reverts InsetArgument of + Page headings + Biography + Biography without photo + to TeX-code + ''' + if document.textclass == "IEEEtran": i = 0 j = 0 k = 0 @@ -1276,13 +1277,14 @@ def convert_Argument_to_TeX_brace(document, line, n, nmax, environment): def convert_IEEEtran(document): - ''' - Converts ERT of - Page headings - Biography - Biography without photo - to InsetArgument - ''' + ''' + Converts ERT of + Page headings + Biography + Biography without photo + to InsetArgument + ''' + if document.textclass == "IEEEtran": i = 0 j = 0 k = 0 @@ -1313,7 +1315,8 @@ def convert_IEEEtran(document): def revert_AASTeX(document): - " Reverts InsetArgument of Altaffilation to TeX-code " + " Reverts InsetArgument of Altaffilation to TeX-code " + if document.textclass == "aastex": i = 0 while True: if i != -1: @@ -1326,7 +1329,8 @@ def revert_AASTeX(document): def convert_AASTeX(document): - " Converts ERT of Altaffilation to InsetArgument " + " Converts ERT of Altaffilation to InsetArgument " + if document.textclass == "aastex": i = 0 while True: if i != -1: @@ -1339,7 +1343,8 @@ def convert_AASTeX(document): def revert_AGUTeX(document): - " Reverts InsetArgument of Author affiliation to TeX-code " + " Reverts InsetArgument of Author affiliation to TeX-code " + if document.textclass == "agutex": i = 0 while True: if i != -1: @@ -1352,7 +1357,8 @@ def revert_AGUTeX(document): def convert_AGUTeX(document): - " Converts ERT of Author affiliation to InsetArgument " + " Converts ERT of Author affiliation to InsetArgument " + if document.textclass == "agutex": i = 0 while True: if i != -1: @@ -1364,6 +1370,34 @@ def convert_AGUTeX(document): return +def revert_IJMP(document): + " Reverts InsetArgument of MarkBoth to TeX-code " + if document.textclass == "ijmpc" or document.textclass == "ijmpd": + i = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout MarkBoth", i) + if i != -1: + revert_Argument_to_TeX_brace(document, i, 1, 1, False) + i = i + 1 + if i == -1: + return + + +def convert_IJMP(document): + " Converts ERT of MarkBoth to InsetArgument " + if document.textclass == "ijmpc" or document.textclass == "ijmpd": + i = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout MarkBoth", i) + if i != -1: + convert_Argument_to_TeX_brace(document, i, 1, 1, False) + i = i + 1 + if i == -1: + return + + ## # Conversion hub # @@ -1403,11 +1437,11 @@ convert = [ [444, []], [445, []], [446, [convert_latexargs]], - [447, [convert_IEEEtran, convert_AASTeX, convert_AGUTeX]] + [447, [convert_IEEEtran, convert_AASTeX, convert_AGUTeX, convert_IJMP]] ] revert = [ - [446, [revert_IEEEtran, revert_AASTeX, revert_AGUTeX]], + [446, [revert_IEEEtran, revert_AASTeX, revert_AGUTeX, revert_IJMP]], [445, [revert_latexargs]], [444, [revert_uop]], [443, [revert_biolinum]], diff --git a/lib/templates/IJMPC.lyx b/lib/templates/IJMPC.lyx index f10b081e19..522fc918ff 100644 --- a/lib/templates/IJMPC.lyx +++ b/lib/templates/IJMPC.lyx @@ -1,5 +1,5 @@ -#LyX 2.0 created this file. For more info see http://www.lyx.org/ -\lyxformat 413 +#LyX 2.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 447 \begin_document \begin_header \textclass ijmpc @@ -12,13 +12,13 @@ \font_roman default \font_sans default \font_typewriter default +\font_math auto \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 - \graphics default \default_output_format default \output_sync 0 @@ -30,15 +30,21 @@ \use_hyperref false \papersize default \use_geometry false -\use_amsmath 0 -\use_esint 0 -\use_mhchem 1 -\use_mathdots 1 +\use_package amsmath 0 +\use_package amssymb 0 +\use_package esint 0 +\use_package mathdots 1 +\use_package mathtools 0 +\use_package mhchem 1 +\use_package undertilde 0 \cite_engine basic +\cite_engine_type numerical +\biblio_style plain \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false +\justification true \use_refstyle 0 \index Index \shortcut idx @@ -128,13 +134,11 @@ Default \end_layout \begin_layout MarkBoth -Authors' Names -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +Authors' Names \end_layout \end_inset @@ -333,8 +337,6 @@ Capitalize the first letter of the first word only. \end_layout \begin_layout Subsection - -\backslash Lists of items \end_layout @@ -355,7 +357,7 @@ Items may also be numbered in lowercase roman numerals: \end_layout \begin_layout RomanList -\begin_inset Argument +\begin_inset Argument 1 status open \begin_layout Plain Layout @@ -373,7 +375,7 @@ item two \begin_deeper \begin_layout RomanList -\begin_inset Argument +\begin_inset Argument 1 status open \begin_layout Plain Layout @@ -674,7 +676,7 @@ status collapsed \begin_inset Tabular - + diff --git a/lib/templates/IJMPD.lyx b/lib/templates/IJMPD.lyx index 499c5812fa..3874b121c9 100644 --- a/lib/templates/IJMPD.lyx +++ b/lib/templates/IJMPD.lyx @@ -1,5 +1,5 @@ -#LyX 2.0 created this file. For more info see http://www.lyx.org/ -\lyxformat 413 +#LyX 2.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 447 \begin_document \begin_header \textclass ijmpd @@ -12,13 +12,13 @@ \font_roman default \font_sans default \font_typewriter default +\font_math auto \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 - \graphics default \default_output_format default \output_sync 0 @@ -30,15 +30,21 @@ \use_hyperref false \papersize default \use_geometry false -\use_amsmath 0 -\use_esint 0 -\use_mhchem 1 -\use_mathdots 1 +\use_package amsmath 0 +\use_package amssymb 0 +\use_package esint 0 +\use_package mathdots 1 +\use_package mathtools 0 +\use_package mhchem 1 +\use_package undertilde 0 \cite_engine basic +\cite_engine_type numerical +\biblio_style plain \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false +\justification true \use_refstyle 0 \index Index \shortcut idx @@ -128,13 +134,11 @@ Default \end_layout \begin_layout MarkBoth -Authors' Names -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +Authors' Names \end_layout \end_inset @@ -359,7 +363,7 @@ Items may also be numbered in lowercase roman numerals: \end_layout \begin_layout RomanList -\begin_inset Argument +\begin_inset Argument 1 status open \begin_layout Plain Layout @@ -377,7 +381,7 @@ item two \begin_deeper \begin_layout RomanList -\begin_inset Argument +\begin_inset Argument 1 status open \begin_layout Plain Layout @@ -674,7 +678,7 @@ status collapsed \begin_inset Tabular - + From e44eb320f3a6087c2241e400c459cd48aa836103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 26 Nov 2012 05:30:00 +0100 Subject: [PATCH 7/8] iopart.layout: rename a tooltip, no change in functionality --- lib/layouts/iopart.layout | 4 ++-- lib/templates/IOP-article.lyx | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/layouts/iopart.layout b/lib/layouts/iopart.layout index db51d2f48b..dd914dbd2b 100644 --- a/lib/layouts/iopart.layout +++ b/lib/layouts/iopart.layout @@ -61,8 +61,8 @@ Style Title Category FrontMatter InTitle 1 Argument 1 - LabelString "Short Title|S" - Tooltip "The title as it appears in the running headers" + LabelString "Short Title|S" + Tooltip "Short title that will appear in header line" EndArgument ParSkip 0.4 ItemSep 0 diff --git a/lib/templates/IOP-article.lyx b/lib/templates/IOP-article.lyx index 694a621032..b8fd9dedd9 100644 --- a/lib/templates/IOP-article.lyx +++ b/lib/templates/IOP-article.lyx @@ -1,4 +1,4 @@ -#LyX 2.0 created this file. For more info see http://www.lyx.org/ +#LyX 2.1 created this file. For more info see http://www.lyx.org/ \lyxformat 413 \begin_document \begin_header @@ -30,7 +30,6 @@ \font_osf false \font_sf_scale 100 \font_tt_scale 100 - \graphics default \default_output_format default \output_sync 0 @@ -43,8 +42,8 @@ \use_geometry true \use_amsmath 0 \use_esint 1 -\use_mhchem 1 \use_mathdots 1 +\use_mhchem 1 \cite_engine basic \use_bibtopic false \use_indices false @@ -147,7 +146,7 @@ footnotes \begin_layout Title Your Title \begin_inset Argument -status collapsed +status open \begin_layout Plain Layout optional short title @@ -403,7 +402,7 @@ key "Parkin2005,LComp2004" placement hb wide false sideways false -status collapsed +status open \begin_layout Plain Layout \begin_inset Caption From c5dccc859aefe84f5bb227337000188631feedb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 26 Nov 2012 05:54:45 +0100 Subject: [PATCH 8/8] JASATeX: update layout and template - fix problem with natbib - add a missing short title that was also already in the template (patch for branch follows) --- lib/layouts/jasatex.layout | 21 +++++++++++++-------- lib/templates/JASA.lyx | 33 +++++---------------------------- 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/lib/layouts/jasatex.layout b/lib/layouts/jasatex.layout index 3d8db6cd28..745e34ef90 100644 --- a/lib/layouts/jasatex.layout +++ b/lib/layouts/jasatex.layout @@ -6,14 +6,15 @@ Format 41 -Columns 1 -Sides 1 -SecNumDepth 3 -TocDepth 3 -DefaultStyle Standard +Columns 1 +Sides 1 +SecNumDepth 3 +TocDepth 3 +DefaultStyle Standard +Provides natbib 1 ClassOptions - FontSize 10|11|12 + FontSize 10|11|12 end Preamble @@ -68,6 +69,10 @@ Style Title ParSep 1 Align Center AlignPossible Left, Right + Argument 1 + LabelString "Short Title|S" + Tooltip "Short title that will appear in header line" + EndArgument LabelType No_Label Font Size Largest @@ -117,8 +122,8 @@ Style "Alternative Affiliation" LatexType Command LatexName altaffiliation Argument 1 - LabelString "Alternative Affiliation Option" - Tooltip "Option to the alternative affiliation command" + LabelString "Affiliation Prefix" + Tooltip "A prefix like 'Also at '" EndArgument End diff --git a/lib/templates/JASA.lyx b/lib/templates/JASA.lyx index aa04278645..7dd4e65c09 100644 --- a/lib/templates/JASA.lyx +++ b/lib/templates/JASA.lyx @@ -1,4 +1,4 @@ -#LyX 2.0 created this file. For more info see http://www.lyx.org/ +#LyX 2.1 created this file. For more info see http://www.lyx.org/ \lyxformat 413 \begin_document \begin_header @@ -19,7 +19,6 @@ \font_osf false \font_sf_scale 100 \font_tt_scale 100 - \graphics default \default_output_format default \output_sync 0 @@ -32,8 +31,8 @@ \use_geometry false \use_amsmath 1 \use_esint 1 -\use_mhchem 1 \use_mathdots 1 +\use_mhchem 1 \cite_engine basic \use_bibtopic false \use_indices false @@ -76,28 +75,6 @@ nopreprint \end_inset -\end_layout - -\begin_layout Standard -\begin_inset Note Note -status collapsed - -\begin_layout Plain Layout - -\series bold -Note -\series default -: Using the citation style -\family sans -Natbib -\family default - in the document settings would lead to LaTeX errors, because JasaTeX uses - its own natbib mechanism. -\end_layout - -\end_inset - - \end_layout \begin_layout Preprint number @@ -159,11 +136,11 @@ Also at \begin_inset Note Note -status collapsed +status open \begin_layout Plain Layout This affiliation appears as footnote. - The short title should be + The prefix should be \begin_inset Quotes eld \end_inset @@ -362,7 +339,7 @@ Bla, bla placement h wide false sideways false -status collapsed +status open \begin_layout Plain Layout \begin_inset Caption