From 7c98a16fbb7fc5fcd840c1760b2c4ad19e49d28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Thu, 7 Feb 2013 02:01:57 +0100 Subject: [PATCH] IEEEtran.layout: support command \IEEEPARstart --- lib/layouts/IEEEtran.layout | 19 ++++++++- lib/lyx2lyx/lyx_2_1.py | 28 ++++++++++++- lib/templates/IEEEtran.lyx | 78 ++++++++++++------------------------- 3 files changed, 69 insertions(+), 56 deletions(-) diff --git a/lib/layouts/IEEEtran.layout b/lib/layouts/IEEEtran.layout index b921397203..b0d960ed99 100644 --- a/lib/layouts/IEEEtran.layout +++ b/lib/layouts/IEEEtran.layout @@ -33,7 +33,7 @@ EndFont Style Standard - Category MainText + Category MainText Margin Static LatexType Paragraph LatexName dummy @@ -225,6 +225,23 @@ Style Keywords End +InsetLayout Flex:Paragraph_Start + LyxType custom + LatexType command + LaTeXName IEEEPARstart + LabelString "Paragraph Start" + Argument 1 + Mandatory 1 + AutoInsert 1 + LabelString "First Char" + Tooltip "First character of first word" + EndArgument + Font + Size Small + EndFont +End + + Style Appendices Margin Dynamic LatexType Command diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 1c7ca482d8..d5b507a19e 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1578,6 +1578,7 @@ def revert_IEEEtran(document): ''' if document.textclass == "IEEEtran": i = 0 + i2 = 0 j = 0 k = 0 while True: @@ -1586,6 +1587,11 @@ def revert_IEEEtran(document): if i != -1: revert_Argument_to_TeX_brace(document, i, 1, 1, False) i = i + 1 + if i2 != -1: + i2 = find_token(document.body, "\\begin_inset Flex Paragraph Start", i2) + if i2 != -1: + revert_Argument_to_TeX_brace(document, i2, 1, 1, False) + i2 = i2 + 1 if j != -1: j = find_token(document.body, "\\begin_layout Biography without photo", j) if j != -1: @@ -1601,7 +1607,25 @@ def revert_IEEEtran(document): # 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: + if i == -1 and i2 == -1 and j == -1 and k == -1: + return + + +def revert_IEEEtran_2(document): + ''' + Reverts Flex Paragraph Start to TeX-code + ''' + if document.textclass == "IEEEtran": + begin = 0 + while True: + if begin != -1: + begin = find_token(document.body, "\\begin_inset Flex Paragraph Start", begin) + if begin != -1: + end1 = find_end_of_inset(document.body, begin) + document.body[end1 - 2 : end1 + 1] = put_cmd_in_ert("}") + document.body[begin : begin + 4] = put_cmd_in_ert("\\IEEEPARstart{") + begin = begin + 5 + if begin == -1: return @@ -3537,7 +3561,7 @@ revert = [ [449, [revert_garamondx, revert_garamondx_newtxmath]], [448, [revert_itemargs]], [447, [revert_literate]], - [446, [revert_IEEEtran, revert_AASTeX, revert_AGUTeX, revert_IJMP, revert_SIGPLAN, revert_SIGGRAPH, revert_EuropeCV, revert_Initials, revert_ModernCV]], + [446, [revert_IEEEtran, revert_IEEEtran_2, revert_AASTeX, revert_AGUTeX, revert_IJMP, revert_SIGPLAN, revert_SIGGRAPH, revert_EuropeCV, revert_Initials, revert_ModernCV]], [445, [revert_latexargs]], [444, [revert_uop]], [443, [revert_biolinum]], diff --git a/lib/templates/IEEEtran.lyx b/lib/templates/IEEEtran.lyx index f47ba7f527..2b509ed688 100644 --- a/lib/templates/IEEEtran.lyx +++ b/lib/templates/IEEEtran.lyx @@ -96,7 +96,7 @@ status open \begin_layout Plain Layout This is a template LyX file for articles to be submitted to journals of the Institute of Electrical and Electronics Engineers (IEEE). - For general infos see + For general info see \begin_inset Flex URL status open @@ -120,9 +120,11 @@ http://wiki.lyx.org/Examples/IEEE status open \begin_layout Plain Layout -You find the IEEEtran document class documentation here: +It is important that you use the correct document class options for your + document.. + These are explained in the IEEEtran document: \begin_inset Flex URL -status collapsed +status open \begin_layout Plain Layout @@ -334,20 +336,6 @@ et al. \end_inset : Your Title -\begin_inset Note Note -status open - -\begin_layout Plain Layout -left side -\series bold -}{ -\series default -right side -\end_layout - -\end_inset - - \end_layout \begin_layout Publication ID @@ -398,6 +386,25 @@ Introduction \end_layout \begin_layout Standard +\begin_inset Flex Paragraph Start +status open + +\begin_layout Plain Layout +\begin_inset Argument 1 +status open + +\begin_layout Plain Layout +H +\end_layout + +\end_inset + +ere +\end_layout + +\end_inset + + \begin_inset Note Note status collapsed @@ -408,42 +415,7 @@ The \backslash IEEEPARstart \series default - command is needed in the first paragraph fo the document. -\end_layout - -\end_inset - - -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -IEEEPARstart{ -\end_layout - -\end_inset - -H -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -}{ -\end_layout - -\end_inset - -ere -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -} + command is needed in the first paragraph of the document. \end_layout \end_inset