europeCV: complete revision of layout and example file

- also fix in the generic conversion routine the cases
  - that there are one or more optional arguments before the mandatory ones
  - that the conversion does not start with the first argument of a command
This commit is contained in:
Uwe Stöhr 2012-12-04 00:55:39 +01:00
parent 39ec866f68
commit 5dc6293d07
3 changed files with 709 additions and 308 deletions

View File

@ -1,38 +1,12 @@
#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 \lyxformat 449
\begin_document \begin_document
\begin_header \begin_header
\textclass europecv \textclass europecv
\begin_preamble \begin_preamble
\usepackage{graphicx} % to handle the picture
% only load the package of not already loaded
% Define personal data \@ifundefined{rotatebox}{\usepackage{graphicx}}{}
\ecvname{Testmann, Paul}
\ecvfootername{Paul Testmann}
\ecvnationality{Swiss}
\ecvdateofbirth{June 23, 1962}
\ecvaddress{Teststreet\newline 03333 Nicecity\newline Switzerland}
\ecvemail{testman@testman.xx}
% the optional phnoe number is for the mobile
\ecvtelephone[+43(0)777 7777]{+43(0)999 9999}
% for the gender and fax number
%\ecvgender{male}
%\ecvfax{fax}
% define text or image alignment and position:
% in this case the image is shifted 6cm to the right
\ecvbeforepicture{\hspace{6cm}}
% image
\ecvpicture[height=3cm]{CV-image}
% define text or space after the image
% in this case the following shifted 2cm to the image
\ecvafterpicture{\ecvspace{-2cm}}
% if you e.g. only want the page number to be printed in the footer
%\ecvpage{\thepage}
\end_preamble \end_preamble
\options nologo \options nologo
\use_default_options false \use_default_options false
@ -44,13 +18,13 @@
\font_roman default \font_roman default
\font_sans default \font_sans default
\font_typewriter default \font_typewriter default
\font_math auto
\font_default_family default \font_default_family default
\use_non_tex_fonts false \use_non_tex_fonts false
\font_sc false \font_sc false
\font_osf false \font_osf false
\font_sf_scale 100 \font_sf_scale 100
\font_tt_scale 100 \font_tt_scale 100
\graphics default \graphics default
\default_output_format default \default_output_format default
\output_sync 0 \output_sync 0
@ -61,15 +35,21 @@
\use_hyperref false \use_hyperref false
\papersize default \papersize default
\use_geometry true \use_geometry true
\use_amsmath 1 \use_package amsmath 1
\use_esint 1 \use_package amssymb 1
\use_mhchem 1 \use_package esint 1
\use_mathdots 1 \use_package mathdots 1
\use_package mathtools 0
\use_package mhchem 1
\use_package undertilde 0
\cite_engine basic \cite_engine basic
\cite_engine_type numerical
\biblio_style plain
\use_bibtopic false \use_bibtopic false
\use_indices false \use_indices false
\paperorientation portrait \paperorientation portrait
\suppress_date false \suppress_date false
\justification true
\use_refstyle 0 \use_refstyle 0
\index Index \index Index
\shortcut idx \shortcut idx
@ -79,8 +59,8 @@
\topmargin 2cm \topmargin 2cm
\rightmargin 2cm \rightmargin 2cm
\bottommargin 3cm \bottommargin 3cm
\secnumdepth 3 \secnumdepth 1
\tocdepth 3 \tocdepth 1
\paragraph_separation skip \paragraph_separation skip
\defskip medskip \defskip medskip
\quotes_language english \quotes_language english
@ -96,12 +76,72 @@
\begin_body \begin_body
\begin_layout Begin \begin_layout Name
\begin_inset Note Note Testmann, Paul
\end_layout
\begin_layout FooterName
Paul Testmann
\end_layout
\begin_layout Nationality
Swiss
\end_layout
\begin_layout Birthday
June 23, 1962
\end_layout
\begin_layout Address
Teststreet
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
newline
\end_layout
\end_inset
03333 Nicecity
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
newline
\end_layout
\end_inset
Switzerland
\end_layout
\begin_layout Email
testman@testman.ch
\end_layout
\begin_layout Telephone
\begin_inset Argument 1
status open status open
\begin_layout Plain Layout \begin_layout Plain Layout
Keep entries with green labels empty! +43(0)777 7777
\end_layout
\end_inset
+43(0)999 9999
\begin_inset Note Note
status collapsed
\begin_layout Plain Layout
The mobile number is optional.
\end_layout \end_layout
\end_inset \end_inset
@ -109,17 +149,128 @@ Keep entries with green labels empty!
\end_layout \end_layout
\begin_layout Standard \begin_layout Gender
Male
\begin_inset Note Note \begin_inset Note Note
status collapsed
\begin_layout Plain Layout
optional
\end_layout
\end_inset
\end_layout
\begin_layout Fax
Fax number
\begin_inset Note Note
status collapsed
\begin_layout Plain Layout
optional
\end_layout
\end_inset
\end_layout
\begin_layout BeforePicture
\begin_inset space \hspace*{}
\length 6cm
\end_inset
\begin_inset Note Note
status collapsed
\begin_layout Plain Layout
optional, alignment and position of the picture or text, in this case the
picture is shifted 6
\begin_inset space \thinspace{}
\end_inset
cm to the right
\end_layout
\end_inset
\end_layout
\begin_layout Picture
\begin_inset Argument 1
status open status open
\begin_layout Plain Layout \begin_layout Plain Layout
height=3cm
\end_layout
\series bold \end_inset
Note:
\series default CV-image
The personal data like your name, image, address, etc. \begin_inset Note Note
are set in the document preamble. status collapsed
\begin_layout Plain Layout
The name of the image file.
The optional size is in this case the height the photo is resized to.
\end_layout
\end_inset
\end_layout
\begin_layout AfterPicture
\begin_inset Flex VerticalSpace
status open
\begin_layout Plain Layout
-2cm
\end_layout
\end_inset
\begin_inset Note Note
status collapsed
\begin_layout Plain Layout
optional, in this case the following material is shifted 2
\begin_inset space \thinspace{}
\end_inset
cm to the picture
\end_layout
\end_inset
\end_layout
\begin_layout Page
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
thepage
\end_layout
\end_inset
\begin_inset Note Note
status collapsed
\begin_layout Plain Layout
optional, redefines what is printed in the footer, in this case only the
page number
\end_layout \end_layout
\end_inset \end_inset
@ -133,7 +284,34 @@ status open
\begin_layout Plain Layout \begin_layout Plain Layout
The europecv-class offers lots of customization possibilities; to find out The europecv-class offers lots of customization possibilities; to find out
more, look at its documentation. more, look at its documentation:
\end_layout
\begin_layout Plain Layout
\begin_inset Flex URL
status open
\begin_layout Plain Layout
http://mirrors.ctan.org/macros/latex/contrib/europecv/europecv.pdf
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Begin
\begin_inset Note Note
status open
\begin_layout Plain Layout
Keep entries with green labels empty!
\end_layout \end_layout
\end_inset \end_inset
@ -159,13 +337,11 @@ Education
\end_layout \end_layout
\begin_layout Item \begin_layout Item
2003--2006 \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
2003--2006
}{
\end_layout \end_layout
\end_inset \end_inset
@ -174,13 +350,11 @@ Master of Economics, Institution, City, Country, Description
\end_layout \end_layout
\begin_layout Item \begin_layout Item
2001--2003 \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
2001--2003
}{
\end_layout \end_layout
\end_inset \end_inset
@ -193,13 +367,11 @@ Master Thesis
\end_layout \end_layout
\begin_layout BulletedItem \begin_layout BulletedItem
Title \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
Title
}{
\end_layout \end_layout
\end_inset \end_inset
@ -210,13 +382,11 @@ Title of the thesis
\end_layout \end_layout
\begin_layout BulletedItem \begin_layout BulletedItem
Supervisors \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
Supervisors
}{
\end_layout \end_layout
\end_inset \end_inset
@ -225,13 +395,11 @@ Names of supervisors
\end_layout \end_layout
\begin_layout BulletedItem \begin_layout BulletedItem
Description \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
Description
}{
\end_layout \end_layout
\end_inset \end_inset
@ -246,13 +414,11 @@ Experience
\end_layout \end_layout
\begin_layout Item \begin_layout Item
February 2006--current \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
2006--current
}{
\end_layout \end_layout
\end_inset \end_inset
@ -261,13 +427,11 @@ Maintainer of OpenSource projects
\end_layout \end_layout
\begin_layout Item \begin_layout Item
2005--2006 \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
2005--2006
}{
\end_layout \end_layout
\end_inset \end_inset
@ -281,8 +445,8 @@ Languages
\end_layout \end_layout
\begin_layout MotherTongue \begin_layout MotherTongue
\begin_inset Argument \begin_inset Argument 1
status collapsed status open
\begin_layout Plain Layout \begin_layout Plain Layout
10pt 10pt
@ -315,8 +479,8 @@ The optional parameter is the vertical height behind the item; negative
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
Inserts the language level explanation and sets the symbol for the reference Optional, inserts the language level explanation and sets the symbol for
footnote. the reference footnote.
\end_layout \end_layout
@ -326,18 +490,20 @@ Inserts the language level explanation and sets the symbol for the reference
\end_layout \end_layout
\begin_layout Language \begin_layout Language
German \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
German
}{
\end_layout \end_layout
\end_inset \end_inset
\begin_inset Argument 3
status open
\begin_layout Plain Layout
\begin_inset ERT \begin_inset ERT
status collapsed status collapsed
@ -351,17 +517,15 @@ ecvBTwo
\end_inset \end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
\begin_inset Argument 4
status open
\begin_layout Plain Layout
\begin_inset ERT \begin_inset ERT
status collapsed status collapsed
@ -375,17 +539,15 @@ ecvCOne
\end_inset \end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
\begin_inset Argument 5
status open
\begin_layout Plain Layout
\begin_inset ERT \begin_inset ERT
status collapsed status collapsed
@ -399,17 +561,15 @@ ecvATwo
\end_inset \end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
\begin_inset Argument 6
status open
\begin_layout Plain Layout
\begin_inset ERT \begin_inset ERT
status collapsed status collapsed
@ -423,12 +583,6 @@ ecvATwo
\end_inset \end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
@ -447,12 +601,22 @@ ecvBOne
\end_inset \end_inset
\begin_inset Note Note
status collapsed
\begin_layout Plain Layout
The last info is the level how good you think you can write.
\end_layout
\end_inset
\begin_inset Note Note \begin_inset Note Note
status open status open
\begin_layout Plain Layout \begin_layout Plain Layout
The language level codes can be found in the documentation of the europecv-packa The language level codes can be found in the documentation of the package
ge. europecv.
\end_layout \end_layout
\end_inset \end_inset
@ -461,18 +625,20 @@ ge.
\end_layout \end_layout
\begin_layout LastLanguage \begin_layout LastLanguage
Italian \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
Italian
}{
\end_layout \end_layout
\end_inset \end_inset
\begin_inset Argument 3
status open
\begin_layout Plain Layout
\begin_inset ERT \begin_inset ERT
status collapsed status collapsed
@ -486,17 +652,15 @@ ecvATwo
\end_inset \end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
\begin_inset Argument 4
status open
\begin_layout Plain Layout
\begin_inset ERT \begin_inset ERT
status collapsed status collapsed
@ -510,17 +674,15 @@ ecvBOne
\end_inset \end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
\begin_inset Argument 5
status open
\begin_layout Plain Layout
\begin_inset ERT \begin_inset ERT
status collapsed status collapsed
@ -534,17 +696,15 @@ ecvAOne
\end_inset \end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
\begin_inset Argument 6
status open
\begin_layout Plain Layout
\begin_inset ERT \begin_inset ERT
status collapsed status collapsed
@ -558,12 +718,6 @@ ecvAOne
\end_inset \end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
@ -607,7 +761,7 @@ Computer skills
\end_layout \end_layout
\begin_layout Item \begin_layout Item
\begin_inset Argument \begin_inset Argument 1
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
@ -616,13 +770,12 @@ status collapsed
\end_inset \end_inset
OS
\begin_inset ERT \begin_inset Argument 2
status collapsed status open
\begin_layout Plain Layout \begin_layout Plain Layout
OS
}{
\end_layout \end_layout
\end_inset \end_inset
@ -631,13 +784,11 @@ Linux, Unix, Windows, administration, Apache, Mailman
\end_layout \end_layout
\begin_layout Item \begin_layout Item
Programming \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
Programming
}{
\end_layout \end_layout
\end_inset \end_inset
@ -650,7 +801,7 @@ Java
\end_layout \end_layout
\begin_layout Item \begin_layout Item
\begin_inset Argument \begin_inset Argument 1
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
@ -659,13 +810,12 @@ status collapsed
\end_inset \end_inset
Scientific
\begin_inset ERT \begin_inset Argument 2
status collapsed status open
\begin_layout Plain Layout \begin_layout Plain Layout
Scientific
}{
\end_layout \end_layout
\end_inset \end_inset
@ -674,17 +824,15 @@ Matlab, Autocad, Abaqus, typography, LaTeX, ConTeXt, Scribus, QuarkXPress
\end_layout \end_layout
\begin_layout Item \begin_layout Item
\begin_inset Argument 2
status open
\begin_layout Plain Layout
Web Web
\begin_inset space ~ \begin_inset space ~
\end_inset \end_inset
design design
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
@ -697,7 +845,7 @@ Interests
\end_layout \end_layout
\begin_layout Item \begin_layout Item
\begin_inset Argument \begin_inset Argument 1
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
@ -706,17 +854,16 @@ status collapsed
\end_inset \end_inset
\begin_inset Argument 2
status open
\begin_layout Plain Layout
Adventure Adventure
\begin_inset space ~ \begin_inset space ~
\end_inset \end_inset
sports sports
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}{
\end_layout \end_layout
\end_inset \end_inset
@ -728,7 +875,7 @@ I like practicing adventure sports like skiing, rock climbing and scuba
\end_layout \end_layout
\begin_layout Item \begin_layout Item
\begin_inset Argument \begin_inset Argument 1
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
@ -737,13 +884,12 @@ status collapsed
\end_inset \end_inset
Travelling
\begin_inset ERT \begin_inset Argument 2
status collapsed status open
\begin_layout Plain Layout \begin_layout Plain Layout
Travelling
}{
\end_layout \end_layout
\end_inset \end_inset
@ -758,13 +904,11 @@ Publications
\end_layout \end_layout
\begin_layout Item \begin_layout Item
References \begin_inset Argument 2
\begin_inset ERT status open
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
References
}{
\end_layout \end_layout
\end_inset \end_inset
@ -835,12 +979,11 @@ You can also use BibTeX references:
\end_layout \end_layout
\begin_layout Item \begin_layout Item
\begin_inset ERT \begin_inset Argument 2
status collapsed status open
\begin_layout Plain Layout \begin_layout Plain Layout
References
}{
\end_layout \end_layout
\end_inset \end_inset

View File

@ -27,10 +27,107 @@ End
Input stdcounters.inc Input stdcounters.inc
Input stdinsets.inc Input stdinsets.inc
Style Name
Margin Dynamic
LatexType Command
LatexName ecvname
Category FrontMatter
InPreamble 1
ParSkip 0.4
LabelSep xx
LabelType Static
LabelString "Name:"
LabelFont
Series Bold
Color Blue
EndFont
End
Style FooterName
CopyStyle Name
LatexName ecvfootername
LabelString "Footer name:"
End
Style Nationality
CopyStyle Name
LatexName ecvnationality
LabelString "Nationality:"
End
Style Birthday
CopyStyle Name
LatexName ecvdateofbirth
LabelString "Date of birth:"
End
Style Address
CopyStyle Name
LatexName ecvaddress
LabelString "Address:"
End
Style Email
CopyStyle Name
LatexName ecvemail
LabelString "E-mail:"
End
Style Telephone
CopyStyle Name
LatexName ecvtelephone
LabelString "Telephone:"
Argument 1
LabelString "Mobile"
Tooltip "Mobile phone number"
EndArgument
End
Style Gender
CopyStyle Name
LatexName ecvgender
LabelString "Gender:"
End
Style Fax
CopyStyle Name
LatexName ecvfax
LabelString "Fax:"
End
Style BeforePicture
CopyStyle Name
LatexName ecvbeforepicture
LabelString "Space before picture:"
End
Style Picture
CopyStyle Name
LatexName ecvpicture
LabelString "Picture:"
Argument 1
LabelString "Size"
Tooltip "Size the photo is resized to"
EndArgument
End
Style AfterPicture
CopyStyle Name
LatexName ecvafterpicture
LabelString "Space after picture:"
End
Style Page
CopyStyle Name
LatexName ecvpage
LabelString "Page:"
End
Style Section Style Section
Margin Dynamic Margin Dynamic
LatexType Command LatexType Command
LatexName ecvsection LatexName ecvsection
Category MainText
NeedProtect 1 NeedProtect 1
NextNoIndent 1 NextNoIndent 1
Argument 1 Argument 1
@ -55,9 +152,15 @@ Style Item
Margin Dynamic Margin Dynamic
LatexType Command LatexType Command
LatexName ecvitem LatexName ecvitem
Category MainText
Argument 1 Argument 1
LabelString "Vertical Space (Item)|S" LabelString "Vertical Space"
Tooltip "Adjust the vertical space of this item" Tooltip "Additional vertical space"
EndArgument
Argument 2
Mandatory 1
LabelString "Summary"
Tooltip "Summary of the item, can also be the time"
EndArgument EndArgument
ParSkip 0.4 ParSkip 0.4
Align Block Align Block
@ -80,7 +183,9 @@ Style Begin
Margin Dynamic Margin Dynamic
LatexType Command LatexType Command
LatexName begin{europecv} LatexName begin{europecv}
Category FrontMatter
KeepEmpty 1 KeepEmpty 1
TopSep 1
BottomSep 1 BottomSep 1
ParSkip 0.4 ParSkip 0.4
Align Block Align Block
@ -96,6 +201,7 @@ End
Style PersonalInfo Style PersonalInfo
CopyStyle Begin CopyStyle Begin
LatexName ecvpersonalinfo{} LatexName ecvpersonalinfo{}
TopSep 0
BottomSep 0 BottomSep 0
LabelString "Personal Info" LabelString "Personal Info"
End End
@ -104,15 +210,19 @@ Style MotherTongue
Margin Dynamic Margin Dynamic
LatexType Command LatexType Command
LatexName ecvmothertongue LatexName ecvmothertongue
Category MainText
Argument 1 Argument 1
LabelString "Vertical Space (Item)|S" LabelString "Vertical Space"
Tooltip "Adjust the vertical space of this item" Tooltip "Additional vertical space"
EndArgument EndArgument
ParSkip 0.4 ParSkip 0.4
Align Block Align Block
LabelSep xx LabelSep xx
LabelType Static LabelType Static
LabelString "Mother Tongue:" LabelString "Mother Tongue:"
Font
Series Bold
EndFont
LabelFont LabelFont
Series Bold Series Bold
Color Blue Color Blue
@ -130,18 +240,42 @@ Style Language
CopyStyle MotherTongue CopyStyle MotherTongue
LatexName ecvlanguage LatexName ecvlanguage
LabelString "Language:" LabelString "Language:"
Argument 2
Mandatory 1
LabelString "Language"
Tooltip "Name of the language"
EndArgument
Argument 3
Mandatory 1
LabelString "Listening"
Tooltip "Level how good you think you can listen"
EndArgument
Argument 4
Mandatory 1
LabelString "Reading"
Tooltip "Level how good you think you can read"
EndArgument
Argument 5
Mandatory 1
LabelString "Interaction"
Tooltip "Level how good you think you can conversate"
EndArgument
Argument 6
Mandatory 1
LabelString "Production"
Tooltip "Level how good you think you can freely talk"
EndArgument
End End
Style LastLanguage Style LastLanguage
CopyStyle MotherTongue CopyStyle Language
LatexName ecvlastlanguage LatexName ecvlastlanguage
LabelString "Last Language:" LabelString "Last Language:"
End End
Style LangFooter Style LangFooter
CopyStyle MotherTongue CopyStyle LangHeader
LatexName ecvlanguagefooter LatexName ecvlanguagefooter
ResetArgs 1
LabelString "Language Footer:" LabelString "Language Footer:"
End End
@ -149,6 +283,7 @@ Style End
Margin Dynamic Margin Dynamic
LatexType Command LatexType Command
LatexName end{europecv} LatexName end{europecv}
Category BackMatter
KeepEmpty 1 KeepEmpty 1
TopSep 1 TopSep 1
ParSkip 0.4 ParSkip 0.4
@ -162,3 +297,25 @@ Style End
EndFont EndFont
End End
InsetLayout "Flex:VerticalSpace"
LyxType custom
LatexType command
LatexName ecvspace
Decoration Conglomerate
LabelString "Vertical space"
Font
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
EndFont
End

View File

@ -1373,7 +1373,8 @@ def revert_IEEEtran(document):
def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment): def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment):
''' '''
Converts TeX code to an InsetArgument Converts TeX code for mandatory arguments to an InsetArgument
The conversion of TeX code for optional arguments must be done with another routine
!!! Be careful if the braces are different in your case as expected here: !!! Be careful if the braces are different in your case as expected here:
- "}{" separates mandatory arguments of commands - "}{" separates mandatory arguments of commands
- "}" + "{" separates mandatory arguments of commands - "}" + "{" separates mandatory arguments of commands
@ -1387,18 +1388,36 @@ def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment):
isInset must be true, if braces inside an InsetLayout needs to be converted isInset must be true, if braces inside an InsetLayout needs to be converted
isEnvironment must be true, if the layout is for a LaTeX environment isEnvironment must be true, if the layout is for a LaTeX environment
Note: this routine can currently handle only one mandatory argument of environments Todo: this routine can currently handle only one mandatory argument of environments
''' '''
lineArg = line lineERT = line
while lineArg != -1 and n < nmax + 1: endn = line
lineArg = find_token(document.body, "\\begin_inset ERT", lineArg) loop = 1
if environment == False and lineArg != -1: while lineERT != -1 and n < nmax + 1:
bracePair = find_token(document.body, "}{", lineArg) lineERT = find_token(document.body, "\\begin_inset ERT", lineERT)
if environment == False and lineERT != -1:
bracePair = find_token(document.body, "}{", lineERT)
# assure that the "}{" is in this ERT # assure that the "}{" is in this ERT
if bracePair == lineArg + 5: if bracePair == lineERT + 5:
end = find_token(document.body, "\\end_inset", bracePair) end = find_token(document.body, "\\end_inset", bracePair)
document.body[lineArg : end + 1] = ["\\end_layout", "", "\\end_inset"] document.body[lineERT : end + 1] = ["\\end_layout", "", "\\end_inset"]
if n == 1: if loop == 1:
# in the case that n > 1 we have optional arguments before
# therefore detect them if any
if n > 1:
# first check if there is an argument
lineArg = find_token(document.body, "\\begin_inset Argument", line)
if lineArg < lineERT and lineArg != -1:
# we have an argument, so now search backwards for its end
# we must now assure that we don't find other insets like e.g. a newline
endInsetArg = lineERT
endLayoutArg = endInsetArg
while endInsetArg != endLayoutArg + 2 and endInsetArg != -1:
endInsetArg = endInsetArg - 1
endLayoutArg = endInsetArg
endInsetArg = find_token_backwards(document.body, "\\end_inset", endInsetArg)
endLayoutArg = find_token_backwards(document.body, "\\end_layout", endLayoutArg)
line = endInsetArg + 1
if inset == False: if inset == False:
document.body[line + 1 : line + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] document.body[line + 1 : line + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"]
else: else:
@ -1407,16 +1426,33 @@ def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment):
document.body[endn : endn] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] document.body[endn : endn] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"]
n = n + 1 n = n + 1
endn = end endn = end
loop = loop + 1
# now check the case that we have "}" + "{" in two ERTs # now check the case that we have "}" + "{" in two ERTs
else: else:
endBrace = find_token(document.body, "}", lineArg) endBrace = find_token(document.body, "}", lineERT)
if endBrace == lineArg + 5: if endBrace == lineERT + 5:
beginBrace = find_token(document.body, "{", endBrace) beginBrace = find_token(document.body, "{", endBrace)
# assure that the ERTs are consecutive (11 or 12 depending if there is a space between the ERTs or not) # assure that the ERTs are consecutive (11 or 12 depending if there is a space between the ERTs or not)
if beginBrace == endBrace + 11 or beginBrace == endBrace + 12: if beginBrace == endBrace + 11 or beginBrace == endBrace + 12:
end = find_token(document.body, "\\end_inset", beginBrace) end = find_token(document.body, "\\end_inset", beginBrace)
document.body[lineArg : end + 1] = ["\\end_layout", "", "\\end_inset"] document.body[lineERT : end + 1] = ["\\end_layout", "", "\\end_inset"]
if n == 1: if loop == 1:
# in the case that n > 1 we have optional arguments before
# therefore detect them if any
if n > 1:
# first check if there is an argument
lineArg = find_token(document.body, "\\begin_inset Argument", line)
if lineArg < lineERT and lineArg != -1:
# we have an argument, so now search backwards for its end
# we must now assure that we don't find other insets like e.g. a newline
endInsetArg = lineERT
endLayoutArg = endInsetArg
while endInsetArg != endLayoutArg + 2 and endInsetArg != -1:
endInsetArg = endInsetArg - 1
endLayoutArg = endInsetArg
endInsetArg = find_token_backwards(document.body, "\\end_inset", endInsetArg)
endLayoutArg = find_token_backwards(document.body, "\\end_layout", endLayoutArg)
line = endInsetArg + 1
if inset == False: if inset == False:
document.body[line + 1 : line + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] document.body[line + 1 : line + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"]
else: else:
@ -1424,26 +1460,27 @@ def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment):
else: else:
document.body[endn : endn] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] document.body[endn : endn] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"]
n = n + 1 n = n + 1
loop = loop + 1
# set the line where the next argument will be inserted # set the line where the next argument will be inserted
if beginBrace == endBrace + 11: if beginBrace == endBrace + 11:
endn = end - 11 endn = end - 11
else: else:
endn = end - 12 endn = end - 12
else: else:
lineArg = lineArg + 1 lineERT = lineERT + 1
if environment == True and lineArg != -1: if environment == True and lineERT != -1:
opening = find_token(document.body, "{", lineArg) opening = find_token(document.body, "{", lineERT)
if opening == lineArg + 5 or opening == lineArg + 4: # assure that the "{" is in this ERT if opening == lineERT + 5: # assure that the "{" is in this ERT
end = find_token(document.body, "\\end_inset", opening) end = find_token(document.body, "\\end_inset", opening)
document.body[lineArg : end + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] document.body[lineERT : end + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"]
n = n + 1 n = n + 1
lineArg2 = find_token(document.body, "\\begin_inset ERT", lineArg) lineERT2 = find_token(document.body, "\\begin_inset ERT", lineERT)
closing = find_token(document.body, "}", lineArg2) closing = find_token(document.body, "}", lineERT2)
if closing == lineArg2 + 5 or closing == lineArg2 + 4: # assure that the "}" is in this ERT if closing == lineERT2 + 5: # assure that the "}" is in this ERT
end2 = find_token(document.body, "\\end_inset", closing) end2 = find_token(document.body, "\\end_inset", closing)
document.body[lineArg2 : end2 + 1] = ["\\end_layout", "", "\\end_inset"] document.body[lineERT2 : end2 + 1] = ["\\end_layout", "", "\\end_inset"]
else: else:
lineArg = lineArg + 1 lineERT = lineERT + 1
def convert_IEEEtran(document): def convert_IEEEtran(document):
@ -1636,6 +1673,70 @@ def convert_SIGGRAPH(document):
return return
def revert_EuropeCV(document):
" Reverts InsetArgument of Flex CRcat to TeX-code "
if document.textclass == "europecv":
i = 0
j = 0
k = 0
m = 0
while True:
if i != -1:
i = find_token(document.body, "\\begin_layout Item", i)
if i != -1:
revert_Argument_to_TeX_brace(document, i, 2, 2, False)
i = i + 1
if j != -1:
j = find_token(document.body, "\\begin_layout BulletedItem", j)
if j != -1:
revert_Argument_to_TeX_brace(document, j, 2, 2, False)
j = j + 1
if k != -1:
k = find_token(document.body, "\\begin_layout Language", k)
if k != -1:
revert_Argument_to_TeX_brace(document, k, 2, 6, False)
k = k + 1
if m != -1:
m = find_token(document.body, "\\begin_layout LastLanguage", m)
if m != -1:
revert_Argument_to_TeX_brace(document, m, 2, 6, False)
m = m + 1
if i == -1 and j == -1 and k == -1 and m == -1:
return
def convert_EuropeCV(document):
" Converts ERT of Flex CRcat to InsetArgument "
if document.textclass == "europecv":
i = 0
j = 0
k = 0
m = 0
while True:
if i != -1:
i = find_token(document.body, "\\begin_layout Item", i)
if i != -1:
convert_TeX_brace_to_Argument(document, i, 2, 2, False, False)
i = i + 1
if j != -1:
j = find_token(document.body, "\\begin_layout BulletedItem", j)
if j != -1:
convert_TeX_brace_to_Argument(document, j, 2, 2, False, False)
j = j + 1
if k != -1:
k = find_token(document.body, "\\begin_layout Language", k)
if k != -1:
convert_TeX_brace_to_Argument(document, k, 2, 6, False, False)
k = k + 1
if m != -1:
m = find_token(document.body, "\\begin_layout LastLanguage", m)
if m != -1:
convert_TeX_brace_to_Argument(document, m, 2, 6, False, False)
m = m + 1
if i == -1 and j == -1 and k == -1 and m == -1:
return
def revert_literate(document): def revert_literate(document):
" Revert Literate document to old format " " Revert Literate document to old format "
if del_token(document.header, "noweb", 0): if del_token(document.header, "noweb", 0):
@ -1733,7 +1834,7 @@ convert = [
[444, []], [444, []],
[445, []], [445, []],
[446, [convert_latexargs]], [446, [convert_latexargs]],
[447, [convert_IEEEtran, convert_AASTeX, convert_AGUTeX, convert_IJMP, convert_SIGPLAN, convert_SIGGRAPH]], [447, [convert_IEEEtran, convert_AASTeX, convert_AGUTeX, convert_IJMP, convert_SIGPLAN, convert_SIGGRAPH, convert_EuropeCV]],
[448, [convert_literate]], [448, [convert_literate]],
[449, []] [449, []]
] ]
@ -1741,7 +1842,7 @@ convert = [
revert = [ revert = [
[448, [revert_itemargs]], [448, [revert_itemargs]],
[447, [revert_literate]], [447, [revert_literate]],
[446, [revert_IEEEtran, revert_AASTeX, revert_AGUTeX, revert_IJMP, revert_SIGPLAN, revert_SIGGRAPH]], [446, [revert_IEEEtran, revert_AASTeX, revert_AGUTeX, revert_IJMP, revert_SIGPLAN, revert_SIGGRAPH, revert_EuropeCV]],
[445, [revert_latexargs]], [445, [revert_latexargs]],
[444, [revert_uop]], [444, [revert_uop]],
[443, [revert_biolinum]], [443, [revert_biolinum]],