From 5c5e8817e39dfa760f01074592ca2c6341c6b3ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Fri, 30 Nov 2012 01:54:57 +0100 Subject: [PATCH] sigplanconf: complete revision of layout and templates/ACM-sigplan.lyx - additionally some fixes for the generic insetArgument lyx2lyx routines --- lib/layouts/sigplanconf.layout | 188 +++++++++++++++++++-------------- lib/lyx2lyx/lyx_2_1.py | 70 ++++++++++-- lib/templates/ACM-sigplan.lyx | 136 ++++++++++++------------ 3 files changed, 241 insertions(+), 153 deletions(-) diff --git a/lib/layouts/sigplanconf.layout b/lib/layouts/sigplanconf.layout index e093fc643a..b1ee35f3b0 100644 --- a/lib/layouts/sigplanconf.layout +++ b/lib/layouts/sigplanconf.layout @@ -16,11 +16,11 @@ Format 41 -Columns 1 -Sides 1 +Columns 1 +Sides 1 SecNumDepth 3 TocDepth 3 -DefaultStyle Standard +DefaultStyle Standard ClassOptions FontSize 9|10|11 @@ -55,138 +55,166 @@ Input stdstarsections.inc # don't use the following styles NoStyle Part -NoCounter part +NoCounter part NoStyle Part* NoStyle Chapter -NoCounter chapter +NoCounter chapter NoStyle Chapter* NoStyle Subparagraph -NoCounter subparagraph +NoCounter subparagraph NoStyle Subparagraph* Style Conference - Margin Dynamic - LatexType Command - LatexName conferenceinfo - Category FrontMatter - InTitle 1 - ParSkip 0.4 - BottomSep 0.5 - Align Left - LabelSep xx - LabelType Static - LabelString "Conference:" + Margin Dynamic + LatexType Command + LatexName conferenceinfo + Category FrontMatter + InTitle 1 + ParSkip 0.4 + BottomSep 0.5 + Align Left + Argument 1 + Mandatory 1 + LabelString "Name" + Tooltip "Name of the conference" + EndArgument + LabelSep xx + LabelType Static + LabelString "Conference:" LabelFont - Color Green - Series Bold + Color Green + Series Bold EndFont End Style CopyrightYear - CopyStyle Conference - LatexName CopyrightYear - LabelString "Copyright year:" + CopyStyle Conference + ResetArgs 1 + LatexName CopyrightYear + LabelString "Copyright year:" End Style Copyrightdata - CopyStyle Conference - LatexName copyrightdata - LabelString "Copyright data:" + CopyStyle CopyrightYear + LatexName copyrightdata + LabelString "Copyright data:" End -Input stdtitle.inc -Input stdstruct.inc +Style TitleBanner + CopyStyle CopyrightYear + LatexName titlebanner + LabelString "Title banner:" +End -Style Title - CopyStyle Title - AlignPossible Block +Style PreprintFooter + CopyStyle CopyrightYear + LatexName preprintfooter + LabelString "Preprint footer:" End +Input stdtitle.inc +Input stdstruct.inc + + Style Subtitle - CopyStyle Title - LatexName subtitle + CopyStyle Title + LatexName subtitle Font - Size Larger + Size Larger EndFont End # overwrite the Author definition from stdtitle.inc Style Author - Margin Static - LatexType Command - LatexName authorinfo - Category FrontMatter - InTitle 1 - LabelSep xxx - ParSkip 0.4 - TopSep 1.3 - BottomSep 0.7 - ParSep 0.7 - Align Center - LabelType No_Label + Margin Static + LatexType Command + LatexName authorinfo + Category FrontMatter + InTitle 1 + LabelSep xxx + ParSkip 0.4 + TopSep 1.3 + BottomSep 0.7 + ParSep 0.7 + Align Center + Argument 1 + Mandatory 1 + LabelString "Name" + Tooltip "Name of the author" + Font + Size Large + EndFont + EndArgument + Argument 2 + Mandatory 1 + LabelString "Affiliation" + Tooltip "Affiliation and/or address of the author" + EndArgument + LabelType No_Label Font - Size Large + Family Sans + Size Normal EndFont End Style Terms - CopyStyle Conference - LatexName terms - InTitle 0 - LabelString "Terms:" + CopyStyle CopyrightYear + LatexName terms + InTitle 0 + LabelString "Terms:" End Style Keywords - CopyStyle Terms - LatexName keywords - LabelString "Keywords:" + CopyStyle CopyrightYear + LatexName keywords + LabelString "Keywords:" End Style Abstract - Margin Static - LatexType Environment - LatexName abstract - Category FrontMatter - NextNoIndent 1 - LeftMargin MMM - RightMargin MMM - ParIndent MM - ItemSep 0 - TopSep 0.7 - BottomSep 0.7 - ParSep 0 - Align Block - AlignPossible Block - LabelType Centered_Top_Environment - LabelString "Abstract" - LabelBottomSep 0.5 + Margin Static + LatexType Environment + LatexName abstract + Category FrontMatter + NextNoIndent 1 + LeftMargin MMM + RightMargin MMM + ParIndent MM + ItemSep 0 + TopSep 0.7 + BottomSep 0.7 + ParSep 0 + Align Block + AlignPossible Block + LabelType Centered_Top_Environment + LabelString "Abstract" + LabelBottomSep 0.5 Font - Size Small + Size Small EndFont LabelFont - Series Bold - Size Large + Series Bold + Size Large EndFont End Style Acknowledgments - CopyStyle Abstract - LatexName acks - Category BackMatter - InTitle 0 - LabelBottomsep 0 - LabelType Top_Environment - LabelString "Acknowledgments" + CopyStyle Abstract + LatexType Command + LatexName acks + Category BackMatter + LabelBottomsep 0 + LabelType Top_Environment + LabelString "Acknowledgments" End diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 503a038aed..110b6339b0 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1181,13 +1181,21 @@ def revert_Argument_to_TeX_brace(document, line, n, nmax, environment): 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) + # we have to assure that no other inset is in the Argument + beginInset = find_token(document.body, "\\begin_inset", beginPlain) + endInset = find_token(document.body, "\\end_inset", beginPlain) + k = beginPlain + 1 + l = k + while beginInset < endInset and beginInset != -1: + beginInset = find_token(document.body, "\\begin_inset", k) + endInset = find_token(document.body, "\\end_inset", l) + k = beginInset + 1 + l = endInset + 1 if environment == False: - document.body[endLayout : endInset + 1] = put_cmd_in_ert("}{") + document.body[endInset - 2 : endInset + 1] = put_cmd_in_ert("}{") del(document.body[lineArg : beginPlain + 1]) else: - document.body[endLayout : endInset + 1] = put_cmd_in_ert("}") + document.body[endInset - 2 : endInset + 1] = put_cmd_in_ert("}") document.body[lineArg : beginPlain + 1] = put_cmd_in_ert("{") n = n + 1 @@ -1257,8 +1265,12 @@ def convert_Argument_to_TeX_brace(document, line, n, nmax, environment): 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"] + if n == 1: + document.body[line + 1 : line + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] + else: + document.body[endn + 1 : endn + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] n = n + 1 + endn = end else: lineArg = lineArg + 1 if environment == True and lineArg != -1: @@ -1397,6 +1409,47 @@ def convert_IJMP(document): if i == -1: return + +def revert_SIGPLAN(document): + " Reverts InsetArgument of MarkBoth to TeX-code " + if document.textclass == "sigplanconf": + i = 0 + j = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout Conference", 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 Author", j) + if j != -1: + revert_Argument_to_TeX_brace(document, j, 1, 2, False) + j = j + 1 + if i == -1 and j == -1: + return + + +def convert_SIGPLAN(document): + " Converts ERT of MarkBoth to InsetArgument " + if document.textclass == "sigplanconf": + i = 0 + j = 0 + while True: + if i != -1: + i = find_token(document.body, "\\begin_layout Conference", 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 Author", j) + if j != -1: + convert_Argument_to_TeX_brace(document, j, 1, 2, False) + j = j + 1 + if i == -1 and j == -1: + return + + def revert_literate(document): " Revert Literate document to old format " if del_token(document.header, "noweb", 0): @@ -1409,6 +1462,7 @@ def revert_literate(document): document.body[i] = "\\begin_layout Scrap" i = i + 1 + def convert_literate(document): " Convert Literate document to new format" i = find_token(document.header, "\\textclass", 0) @@ -1429,6 +1483,7 @@ def convert_literate(document): document.body[i] = "\\begin_layout Chunk" i = i + 1 + def revert_itemargs(document): " Reverts \\item arguments to TeX-code " while True: @@ -1446,6 +1501,7 @@ def revert_itemargs(document): document.body[lastlay + 1:lastlay + 1] = subst i = i + 1 + ## # Conversion hub # @@ -1485,7 +1541,7 @@ convert = [ [444, []], [445, []], [446, [convert_latexargs]], - [447, [convert_IEEEtran, convert_AASTeX, convert_AGUTeX, convert_IJMP]], + [447, [convert_IEEEtran, convert_AASTeX, convert_AGUTeX, convert_IJMP, convert_SIGPLAN]], [448, [convert_literate]], [449, []] ] @@ -1493,7 +1549,7 @@ convert = [ revert = [ [448, [revert_itemargs]], [447, [revert_literate]], - [446, [revert_IEEEtran, revert_AASTeX, revert_AGUTeX, revert_IJMP]], + [446, [revert_IEEEtran, revert_AASTeX, revert_AGUTeX, revert_IJMP, revert_SIGPLAN]], [445, [revert_latexargs]], [444, [revert_uop]], [443, [revert_biolinum]], diff --git a/lib/templates/ACM-sigplan.lyx b/lib/templates/ACM-sigplan.lyx index 3cb301a515..9c87823ab3 100644 --- a/lib/templates/ACM-sigplan.lyx +++ b/lib/templates/ACM-sigplan.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 449 \begin_document \begin_header \textclass sigplanconf @@ -13,13 +13,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 @@ -31,15 +31,21 @@ \use_hyperref 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 @@ -62,7 +68,7 @@ \begin_body -\begin_layout Title +\begin_layout Standard \begin_inset Note Note status open @@ -90,35 +96,33 @@ http://wiki.lyx.org/Examples/AcmSigplan \end_layout \begin_layout Conference -PLDI ’05 -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +PLDI ’05 \end_layout \end_inset June 12--15, 2005, Chicago, Illinois, USA. -\begin_inset Note Note -status open - -\begin_layout Plain Layout -The Conference expects 2 infos that are separated by -\begin_inset Quotes eld -\end_inset +\end_layout +\begin_layout CopyrightYear +2005 +\end_layout -\series bold -}{ -\series default +\begin_layout Copyrightdata +1-59593-057-4/05/0004 +\end_layout -\begin_inset Quotes erd -\end_inset +\begin_layout TitleBanner +Banner above paper title +\begin_inset Note Note +status collapsed - in TeX code. +\begin_layout Plain Layout +is ignored unless document class option 'preprint' is used \end_layout \end_inset @@ -126,12 +130,18 @@ The Conference expects 2 infos that are separated by \end_layout -\begin_layout CopyrightYear -2005 +\begin_layout PreprintFooter +Short description of paper +\begin_inset Note Note +status collapsed + +\begin_layout Plain Layout +is ignored unless document class option 'preprint' is used \end_layout -\begin_layout Copyrightdata -1-59593-057-4/05/0004 +\end_inset + + \end_layout \begin_layout Title @@ -150,9 +160,23 @@ This work was supported by ... \begin_layout Subtitle Subtitle +\begin_inset Note Note +status open + +\begin_layout Plain Layout +optional +\end_layout + +\end_inset + + \end_layout \begin_layout Author +\begin_inset Argument 1 +status open + +\begin_layout Plain Layout Suzi Smith \begin_inset ERT status collapsed @@ -168,23 +192,16 @@ and Paul C. Anagnostopoulos -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -}{ \end_layout \end_inset -Princeton University -\begin_inset ERT -status collapsed -\begin_layout Plain Layout +\begin_inset Argument 2 +status open -}{ +\begin_layout Plain Layout +Princeton University \end_layout \end_inset @@ -199,19 +216,6 @@ status open \begin_layout Plain Layout At least one autor is required. - The Author field expects 3 infos that are separated by -\begin_inset Quotes eld -\end_inset - - -\series bold -}{ -\series default - -\begin_inset Quotes erd -\end_inset - - in TeX code. \end_layout \end_inset @@ -220,17 +224,20 @@ At least one autor is required. \end_layout \begin_layout Author -Fred Flymuffin -\begin_inset ERT -status collapsed +\begin_inset Argument 1 +status open \begin_layout Plain Layout - -}{ +Fred Flymuffin \end_layout \end_inset + +\begin_inset Argument 2 +status collapsed + +\begin_layout Plain Layout Washington University in St. Louis \begin_inset Newline newline @@ -246,12 +253,6 @@ Department of Electrical and Computer Engineering St. Louis, XX 60616, USA -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -}{ \end_layout \end_inset @@ -287,6 +288,9 @@ ed into hardware] \end_inset +\end_layout + +\begin_layout Standard \begin_inset Note Note status open @@ -350,7 +354,7 @@ Bla, bla \end_layout \begin_layout Acknowledgments -We would like to thank ... +Acknowledgments, if needed. \end_layout \begin_layout Section -- 2.39.2