]> git.lyx.org Git - features.git/commitdiff
Merge remote-tracking branch 'origin/master' into features/latexargs
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 20 Nov 2012 17:11:14 +0000 (18:11 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 20 Nov 2012 17:11:14 +0000 (18:11 +0100)
Conflicts:
src/Text3.cpp

68 files changed:
development/FORMAT
lib/examples/MultilingualCaptions.lyx
lib/layouts/IEEEtran.layout
lib/layouts/aastex.layout
lib/layouts/achemso.layout
lib/layouts/aguplus.inc
lib/layouts/amsart.layout
lib/layouts/amsdefs.inc
lib/layouts/apa.layout
lib/layouts/beamer.layout
lib/layouts/bicaption.module
lib/layouts/customHeadersFooters.module
lib/layouts/db_stdstarsections.inc
lib/layouts/dinbrief.layout
lib/layouts/ectaart.layout
lib/layouts/elsart.layout
lib/layouts/elsarticle.layout
lib/layouts/enumitem.module
lib/layouts/europecv.layout
lib/layouts/ijmpc.layout
lib/layouts/ijmpd.layout
lib/layouts/initials.module
lib/layouts/iopart.layout
lib/layouts/jasatex.layout
lib/layouts/memoir.layout
lib/layouts/moderncv.layout
lib/layouts/powerdot.layout
lib/layouts/recipebook.layout
lib/layouts/revtex4-1.layout
lib/layouts/revtex4.layout
lib/layouts/rsphrase.module
lib/layouts/scrclass.inc
lib/layouts/siamltex.layout
lib/layouts/simplecv.layout
lib/layouts/stdinsets.inc
lib/layouts/stdsections.inc
lib/layouts/stdstarsections.inc
lib/layouts/svcommon.inc
lib/layouts/theorems-ams-bytype.inc
lib/layouts/theorems-ams.inc
lib/layouts/theorems-bytype.inc
lib/layouts/theorems-proof.inc
lib/layouts/theorems-starred.inc
lib/layouts/theorems-without-preamble.inc
lib/layouts/theorems.inc
lib/layouts/tufte-book.layout
lib/layouts/tufte-handout.layout
lib/lyx2lyx/lyx_2_1.py
lib/scripts/layout2layout.py
lib/ui/stdmenus.inc
src/Layout.cpp
src/Layout.h
src/LyXAction.cpp
src/Paragraph.cpp
src/Text3.cpp
src/factory.cpp
src/frontends/qt4/Menus.cpp
src/insets/InsetArgument.cpp
src/insets/InsetArgument.h
src/insets/InsetCaption.cpp
src/insets/InsetLayout.cpp
src/insets/InsetLayout.h
src/insets/InsetText.cpp
src/output_latex.cpp
src/output_latex.h
src/tex2lyx/TODO.txt
src/tex2lyx/text.cpp
src/version.h

index 2cb24d31a19fa860004de73e1089c5880aca24ac..391b414ef09c516e2492ab7fa2e969e1629d8a89 100644 (file)
@@ -12,6 +12,20 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
 -----------------------
 
 
+2012-11-19 Jürgen Spitzmüller <spitz@lyx.org>
+       * Format incremented to 446: Change of InsetArgument syntax.
+         InsetArgument now has a numeric identifier which determines
+         its position (in the LaTeX output):
+           \begin_inset Argument 1
+           ...
+           \end_inset
+         Pre-2.1 documents' arguments all get the number "999", and then
+         InsetArgument::updateBuffer() computes the correct number.
+         This is because lyx2lyx has no access to layouts and hence does
+         not know how many optional arguments a layout can have (if a command
+         has two optional and one mandatory arguments and only one optional
+         is actually given, the mandatory arg still must get number 3).
+
 2012-10-20 Liviu Andronic <landronimirc@gmail.com>
        * Format incremented to 445: support for the URW Classico font,
          an Optima clone.
index 3aee8d463df2078ca267576d23b241367e693c37..dd13bb740829eded9bf206b2b8de10f9d1e6f8ec 100644 (file)
@@ -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 446
 \begin_document
 \begin_header
 \textclass scrartcl
@@ -31,13 +31,13 @@ bicaption
 \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
@@ -59,15 +59,21 @@ bicaption
 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue"
 \papersize default
 \use_geometry false
-\use_amsmath 1
-\use_esint 1
-\use_mhchem 1
-\use_mathdots 1
+\use_package amsmath 1
+\use_package amssymb 1
+\use_package esint 1
+\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 true
+\justification true
 \use_refstyle 1
 \notefontcolor #0000ff
 \index Index
@@ -275,7 +281,7 @@ reference "fig:example-figure"
 \end_layout
 
 \begin_layout Caption setup
-\begin_inset Argument
+\begin_inset Argument 1
 status open
 
 \begin_layout Plain Layout
@@ -340,7 +346,7 @@ A figure.
 \end_layout
 
 \begin_layout Bicaption
-\begin_inset Argument
+\begin_inset Argument 1
 status open
 
 \begin_layout Plain Layout
@@ -350,7 +356,7 @@ English short title
 \end_inset
 
 
-\begin_inset Argument
+\begin_inset Argument 2
 status open
 
 \begin_layout Plain Layout
@@ -360,6 +366,18 @@ English Title
 \end_inset
 
 
+\begin_inset Argument 3
+status open
+
+\begin_layout Plain Layout
+
+\lang ngerman
+German short title
+\end_layout
+
+\end_inset
+
+
 \lang ngerman
 German Title
 \lang english
@@ -495,7 +513,7 @@ reference "sec:Float-List-Customization"
 \end_inset
 
 
-\begin_inset Argument
+\begin_inset Argument 1
 status open
 
 \begin_layout Plain Layout
@@ -530,7 +548,7 @@ the label font should be bold, the label separator is a line break instead
 \end_layout
 
 \begin_layout Caption setup
-\begin_inset Argument
+\begin_inset Argument 1
 status open
 
 \begin_layout Plain Layout
@@ -564,7 +582,7 @@ the second language caption text should be sans-serif italic
 \end_layout
 
 \begin_layout Caption setup
-\begin_inset Argument
+\begin_inset Argument 1
 status open
 
 \begin_layout Plain Layout
@@ -629,7 +647,7 @@ A figure.
 \end_layout
 
 \begin_layout Bicaption
-\begin_inset Argument
+\begin_inset Argument 2
 status open
 
 \begin_layout Plain Layout
@@ -836,10 +854,10 @@ key "bicaption"
 \begin_layout Standard
 \begin_inset Tabular
 <lyxtabular version="3" rows="47" columns="2">
-<features booktabs="true" islongtable="true" headBottomDL="true" lastFootEmpty="true" longtabularalignment="center">
+<features rotate="0" booktabs="true" islongtable="true" headBottomDL="true" lastFootEmpty="true" longtabularalignment="center">
 <column alignment="center" valignment="top" width="0pt">
 <column alignment="center" valignment="middle" width="35col%">
-<row caption="true">
+<row endfirsthead="true" caption="true">
 <cell multicolumn="1" alignment="center" valignment="top" usebox="none">
 \begin_inset Text
 
index 714e9be0e8bf3f63db87f97fb594131fa7f369e8..3644ab16f51ece1771641445ef745d3b3d61b224 100644 (file)
@@ -68,7 +68,7 @@ Style Title
   LatexName    title
   Category     FrontMatter
   InTitle      1
-  OptionalArgs 0
+  ResetArgs    1
   ParSkip      0.4
   ItemSep      0
   TopSep       0
@@ -117,7 +117,11 @@ Style Author
   LatexType    Command
   Category     FrontMatter
   InTitle      1
-  OptionalArgs 1
+  Argument 1
+       LabelString   "Short Author"
+       Shortcut      S
+       Tooltip       "A short version of the author name"
+  EndArgument
   LatexName    author
   LabelSep     xxx
   ParSkip      0.4
@@ -236,7 +240,10 @@ Style Appendix
   CopyStyle    Appendices
   LatexName    appendix
   LabelString  "Appendix"
-  OptionalArgs 1
+  Argument 1
+       LabelString   "Appendix Title"
+       Tooltip       "Optional title of the appendix"
+ EndArgument
 End
 
 
@@ -268,7 +275,10 @@ Style Biography
   LaTeXType    Environment
   LaTeXName    IEEEbiography
   Category     BackMatter
-  OptionalArgs 1
+  Argument 1
+       LabelString   "Biography Photo"
+       Tooltip       "Insert a photo to your biography"
+  EndArgument
   Align        Block
   TextFont
     Size       Small
@@ -279,7 +289,7 @@ End
 Style Biography_without_photo
   CopyStyle    Biography
   LaTeXName    IEEEbiographynophoto
-  OptionalArgs 0
+  ResetArgs    1
 End
 
 Style BiographyNoPhoto
@@ -293,7 +303,10 @@ Style Proof
   LatexType    Environment
   LatexName    IEEEproof
   NextNoIndent 1
-  OptionalArgs 1
+  Argument 1
+       LabelString   "Alternative Proof String"
+       Tooltip       "An alternative proof string"
+  EndArgument
   LabelSep     xx
   ParIndent    MMM
   ParSkip      0.4
index ac5e921c116f717e4858785bad49205d1ae51907..95448050b768d4ded50e526fb8455eb70ba18102 100644 (file)
@@ -619,7 +619,11 @@ Style FigCaption
        AlignPossible         Block, Left
        LabelType             Static
        LabelString           "Fig. ---"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The caption as it appears in the list of figures"
+       EndArgument
 End
 
 # Facility style definition
@@ -662,7 +666,10 @@ Style Objectname
        LabelType             Static
        LabelSep              M
        LabelString           "Obj:"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Recognized Name"
+               Tooltip       "Separate the recognized name of an object from text"
+       EndArgument
        Font
          Family              Roman
          Shape               Up
@@ -689,7 +696,10 @@ Style Dataset
        LabelType             Static
        LabelSep              M
        LabelString           "Dataset:"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Recognized Name"
+               Tooltip       "Separate the dataset ID from text"
+       EndArgument
        Font
          Family              Roman
          Shape               Up
index 4c3247f5c6beb3071f1e1a5b46d29f20fca37cfb..d634ba19a61439ebf17288ab80210085310650a6 100644 (file)
@@ -72,7 +72,11 @@ Style Title
   EndFont
   HTMLTag               h1
   HTMLTitle             true
-  OptionalArgs          1
+  Argument 1
+       LabelString   "Short Title"
+       Shortcut      S
+       Tooltip       "Short title which appears in the running headers"
+  EndArgument
 End  
 
 Style Author
@@ -95,7 +99,11 @@ End
 Style Affiliation
   CopyStyle             Author
   LatexName             affiliation
-  OptionalArgs          1
+  Argument 1
+       LabelString   "Short Affiliation"
+       Shortcut      S
+       Tooltip       "Short version of the affiliation"
+  EndArgument
 End
 
 Style Alt_Affiliation
index 09640606b3c1e384d0766c80dbe74068ed5aea3c..e709c0213513b9e8a0ddc126cf2f9ba23d75bc61 100644 (file)
@@ -73,7 +73,7 @@ Style Paragraph*
        Margin                Static
        LatexName             subsubsubsection*
        LabelType             No_Label
-       OptionalArgs          0
+       ResetArgs             1
 End
 
 
index fc97f733af25064551fb0e593c29b1ac298e3017..fedc52cfb2e7b8d2d011a78e72ec0baa83c26a96 100644 (file)
@@ -98,7 +98,7 @@ Style SpecialSection*
        Margin       Static
        LabelType    No_Label
        LabelCounter ""
-       OptionalArgs 0
+       ResetArgs    1
 End
 
 
index c0b299461fff882f62b6db7d2128c3ee627b96ae..3b3fe9110403a4cd8bda7127fea983666f1188a7 100644 (file)
@@ -34,7 +34,11 @@ Style Title
        ParSep                1
        Align                 Center
        LabelType             No_Label
-       OptionalArgs          1
+       Argument shorttitle
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "Short title which appears in the running headers"
+       EndArgument
        Font
          Shape               Smallcaps
          Series              Bold
index 3e84ac0f661ec9fd790ca4ea48797ff7cd9232ee..4a421f415e0d6ded88a6fa73e2c5c6aa8981c467 100644 (file)
@@ -244,7 +244,11 @@ Style CenteredCaption
        Align                 Center
        LabelType             Sensitive
        LabelString           "Senseless!"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The caption as it appears in the list of figures/tables"
+       EndArgument
        LabelFont
          Series              Bold
        EndFont
index 3ac4aae311ad48c4087ff288370c881c3a663a6c..6f722e500bc8db045f1febf0ec3819723f356d0c 100644 (file)
@@ -51,7 +51,11 @@ Style Itemize
   Margin           Static
   LatexType        Item_Environment
   LatexName        itemize
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Overlay Specifications"
+       Shortcut      S
+       Tooltip       "Overlay specifications for this list"
+  EndArgument
   NextNoIndent     1
   LeftMargin       MMN
   LabelSep         xx
@@ -69,7 +73,15 @@ Style Enumerate
   Margin           Static
   LatexType        Item_Environment
   LatexName        enumerate
-  OptionalArgs     2
+  Argument 1
+       LabelString   "Overlay Specifications"
+       Shortcut      S
+       Tooltip       "Overlay specifications for this list"
+  EndArgument
+  Argument 2
+       LabelString   "Mini template"
+       Tooltip       "Mini template for this List"
+  EndArgument
   NextNoIndent     1
   LeftMargin       MMN
   LabelSep         xx
@@ -89,7 +101,15 @@ Style Description
   Margin           First_Dynamic
   LatexType        Item_environment
   LatexName        description
-  OptionalArgs     2
+  Argument 1
+       LabelString   "Overlay Specifications"
+       Shortcut      S
+       Tooltip       "Overlay specifications for this list"
+  EndArgument
+  Argument 2
+       LabelString   "Longest label"
+       Tooltip       "The longest label in this list"
+  EndArgument
   NextNoIndent     1
   LeftMargin       MM
   LabelSep         xx
@@ -112,7 +132,11 @@ Style Part
   Margin           Dynamic
   LatexType        Command
   LatexName        part
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Short Title"
+       Shortcut      S
+       Tooltip       "The part as it appears in the table of contents/running headers"
+  EndArgument
   NeedProtect      1
   NextNoIndent     1
   Labelsep         xx
@@ -155,8 +179,12 @@ Style Section
   LabelType        Counter
   LabelCounter     section
   LabelString      "Section \arabic{section}"
-       RefPrefix        sec
-  OptionalArgs     1
+  RefPrefix        sec
+  Argument 1
+       LabelString   "Short Title"
+       Shortcut      S
+       Tooltip       "The section as it appears in the table of contents/running headers"
+  EndArgument
 
   Font 
     Family         Roman
@@ -178,7 +206,7 @@ Style Section*
   Margin           Static
   LatexName        lyxframeend{}\section*
   LabelType        No_Label
-  OptionalArgs     0
+  ResetArgs        1
 End
 
 # Subsection style definition
@@ -199,7 +227,11 @@ Style Subsection
   LabelCounter     subsection
   LabelString      "Subsection \arabic{section}.\arabic{subsection}"
        RefPrefix        sub
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Short Title"
+       Shortcut      S
+       Tooltip       "The subsection as it appears in the table of contents/running headers"
+  EndArgument
 
   # standard font definition
   Font 
@@ -222,7 +254,7 @@ Style Subsection*
   Margin           Static
   LatexName        lyxframeend{}\subsection*
   LabelType        No_Label
-  OptionalArgs     0
+  ResetArgs        1
 End
 
 # Subsubsection style definition
@@ -243,7 +275,11 @@ Style Subsubsection
   LabelCounter     subsubsection
   LabelString      "Subsubsection \arabic{section}.\arabic{subsection}.\arabic{subsubsection}"
        RefPrefix        sub
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Short Title"
+       Shortcut      S
+       Tooltip       "The subsubsection as it appears in the table of contents/running headers"
+  EndArgument
 
   # standard font definition
   Font 
@@ -266,7 +302,7 @@ Style Subsubsection*
   Margin           Static
   LatexName        lyxframeend{}\subsubsection*
   LabelType        No_Label
-  OptionalArgs     0
+  ResetArgs        1
 End
 
 # Frame control definition
@@ -276,7 +312,10 @@ Style BeginFrame
   KeepEmpty        1
   LatexType        Command
   LatexName        lyxframeend{}\lyxframe
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Frame Options"
+       Tooltip       "Frame options (see beamer manual)"
+  EndArgument
   Margin           First_Dynamic
   NextNoIndent     1
   ParSkip          0
@@ -355,7 +394,15 @@ Style AgainFrame
   KeepEmpty         0
   LatexType         Command
   LatexName         lyxframeend{}\lyxagainframe
-  OptionalArgs      2
+  Argument 1
+       LabelString   "Overlay Specifications"
+       Shortcut      S
+       Tooltip       "Overlay specifications for this list"
+  EndArgument
+  Argument 2
+       LabelString   "Frame Options"
+       Tooltip       "Frame options (see beamer manual)"
+  EndArgument
   Margin            First_Dynamic
   NextNoIndent      1
   ParSkip           0
@@ -430,7 +477,6 @@ Style FrameSubtitle
   ParSep           1
   Align            Center
   LabelType        No_Label
-  OptionalArgs     1
 
   # standard font definition
   Font 
@@ -455,7 +501,10 @@ Style Column
   LabelType        Static
   LabelSep         xx
   LabelString      "Start column (increase depth!), width:"
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Column Options"
+       Tooltip       "Column options (see beamer manual)"
+  EndArgument
   LeftMargin       "Start column (increase depth!), width:xx"
 
   # standard font definition
@@ -564,7 +613,10 @@ Style Pause
   LatexType         Command
   LatexName         pause
   Margin            First_Dynamic
-  OptionalArgs      1
+  Argument 1
+       LabelString   "Pause number"
+       Tooltip       "Number of slide where the pause takes effect"
+  EndArgument
   NextNoIndent      1
   ParSkip           0
   TopSep            0
@@ -791,7 +843,11 @@ Style Title
   ParSep           1
   Align            Center
   LabelType        No_Label
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Short Title"
+       Shortcut      S
+       Tooltip       "Short title which appears in the sidebar/header"
+  EndArgument
 
   # standard font definition
   Font 
@@ -823,7 +879,11 @@ Style Subtitle
   ParSep           1
   Align            Center
   LabelType        No_Label
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Short Subtitle"
+       Shortcut      S
+       Tooltip       "Short subtitle which appears in the sidebar/header"
+  EndArgument
 
   # standard font definition
   Font 
@@ -847,7 +907,11 @@ Style Author
   ParSep           0.7
   Align            Center
   LabelType        No_Label
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Short Author"
+       Shortcut      S
+       Tooltip       "Short author which appears in the sidebar/header"
+  EndArgument
 
   # standard font definition
   Font 
@@ -869,7 +933,11 @@ Style Institute
   ParSep           1
   Align            Center
   LabelType        No_Label
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Short Institute"
+       Shortcut      S
+       Tooltip       "Short institute which appears in the sidebar/header"
+  EndArgument
 
   # standard font definition
   Font 
@@ -912,7 +980,11 @@ Style Date
   ParSep           1
   Align            Center
   LabelType        No_Label
-  OptionalArgs     1
+  Argument 1
+       LabelString   "Short Date"
+       Shortcut      S
+       Tooltip       "Short date which appears in the sidebar/header"
+  EndArgument
 
   # standard font definition
   Font 
@@ -1180,7 +1252,6 @@ Style NoteItem
   LabelType        Static
   LabelSep         xx
   LabelString      "Note:"
-  OptionalArgs     1
   LeftMargin       "Note:xx"
  
   # standard font definition
index 3796ab9d3b80f594497b9956a3eba502eacc0d65..3871098724445f1c1a65924332111a8b18488808 100644 (file)
@@ -11,7 +11,11 @@ Style "Caption setup"
        LatexType               command
        LatexName               captionsetup
        Category                FrontMatter
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Caption Setup Options"
+               Shortcut      S
+               Tooltip       "Options for the caption setup command (see bicaption manual)"
+       EndArgument
        Margin                  Dynamic
        LabelSep                xx
        ParSkip                 0.0
@@ -35,7 +39,20 @@ Style Bicaption
        CopyStyle               "Caption setup"
        LatexName               bicaption
        Category                MainText
-       RequiredArgs            1
+       Argument 1
+               LabelString   "Second Language Caption Short Title"
+               Tooltip       "A short title (for list of figures/tables) in the second language"
+       EndArgument
+       Argument 2
+               Mandatory     1
+               LabelString   "Second Language Caption Text"
+               Shortcut      S
+               Tooltip       "The caption text in the second language"
+       EndArgument
+       Argument 3
+               LabelString   "Main Language Caption Short Title"
+               Tooltip       "A short title (for list of figures/tables) in the main language"
+       EndArgument
        TopSep                  0
        Align                   Center
        AlignPossible           Center
index 17c334492525ebc7f52382b15454102c86ca80d2..e85d06f845520b334d567435a77f14811be8f596 100644 (file)
@@ -16,7 +16,10 @@ Style "Left Header"
   LabelSep             xx
   LatexName            lhead
   LabelString          "Left Header:"
-  OptionalArgs         1
+  Argument even
+       LabelString   "Even Header"
+       Tooltip       "Alternative text for the even header"
+  EndArgument
   KeepEmpty            1
   ParSkip              0
   TopSep               0
index 3b01e9317ed16246435330cea48ce021c9401956..fcdfdea875d65c97d8d92695df7e337628df8d9b 100644 (file)
@@ -28,7 +28,7 @@ Style Chapter*
        InnerTag              "!-- --"
        LatexName             bridgehead
        LabelType             No_Label
-       OptionalArgs          0
+       ResetArgs             1
        LatexParam            renderas="chapter"
 End
 
@@ -40,7 +40,7 @@ Style Section*
        LatexType             Paragraph
        InnerTag              "!-- --"
        LabelType             No_Label
-       OptionalArgs          0
+       ResetArgs             1
        LatexParam            renderas="sect1"
 End
 
@@ -52,7 +52,7 @@ Style Subsection*
        LatexType             Paragraph
        InnerTag              "!-- --"
        LabelType             No_Label
-       OptionalArgs          0
+       ResetArgs             1
        LatexParam            renderas="sect2"
 End
 
@@ -76,7 +76,7 @@ Style Paragraph*
        LatexType             Paragraph
        InnerTag              "!-- --"
        LabelType             No_Label
-       OptionalArgs          0
+       ResetArgs             1
        LatexParam            renderas="sect4"
 End
 
@@ -88,6 +88,6 @@ Style Subparagraph*
        LatexType             Paragraph
        InnerTag              "!-- --"
        LabelType             No_Label
-       OptionalArgs          0
+       ResetArgs             1
        LatexParam            renderas="sect5"
 End
index c6825bf902b90ce151a2a3cdaa22c0a6c00689bc..15f0e747878f35a18d1665d899e33c4494effcdd 100644 (file)
@@ -193,7 +193,11 @@ Style Closing
        CopyStyle       Opening
        LabelString     "Closing:"
        LatexName       closing
-       OptionalArgs    1
+       Argument 1
+               LabelString   "Signature"
+               Shortcut      S
+               Tooltip       "Here you can insert a signature scan"
+       EndArgument
        KeepEmpty       1
 End
 
index 58994804aebcc04063f35ab0c73b35e3421e3805..b446a6cb2f8ca5512961d841e8caedbad981ca4f 100644 (file)
@@ -63,7 +63,10 @@ End
 Style Address
        CopyStyle       RunTitle
        LatexName       address
-       OptionalArgs    1
+       Argument 1
+               LabelString   "Address Option"
+               Tooltip       "Optional argument for the address"
+       EndArgument
        LabelString     "Address:"
 End
 
@@ -71,7 +74,10 @@ Style Email
        Category        FrontMatter
        LatexType       Command
        LatexName       lyxead
-       OptionalArgs    1
+       Argument 1
+               LabelString   "E-Mail Option"
+               Tooltip       "Optional argument for the e-mail"
+       EndArgument
        InTitle         1
        Margin          First_Dynamic
        LabelType       Static
index dcf8b9b01114a45298f29534a0a357431eb90a19..c268cf195e5076e0a7c059a7422bd9892b7d2504 100644 (file)
@@ -122,7 +122,10 @@ Style Author
        ItemSep               0
        ParSep                0
        Align                 Center
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Author Option"
+               Tooltip       "Optional argument for the author"
+       EndArgument
        Font
          Series              Bold
        EndFont
@@ -138,7 +141,10 @@ Style Author_Address
        Labeltype             Static
        LabelSep              M
        LabelString           "Address:"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Address Option"
+               Tooltip       "Optional argument for the address"
+       EndArgument
        LabelFont
          Shape               Italic
        EndFont
@@ -194,7 +200,10 @@ Style Thanks
        LatexType             Command
        LatexName             thanks
        InTitle               1
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Thanks Option"
+               Tooltip       "Optional argument for the thanks statement"
+       EndArgument
        Font
          Size                Small
          Family              Typewriter
index 0b1ca9a5a1019422da06d89f397dd9ef829bb00f..60ff637954388b7899514ff25f43248276ffd3e6 100644 (file)
@@ -84,7 +84,7 @@ Style Title
        LatexName               title
        Category                FrontMatter
        InTitle                 0
-       OptionalArgs            0
+       ResetArgs               1
        ParSkip                 0.4
        ItemSep                 0
        TopSep                  0
@@ -127,7 +127,10 @@ Style "Title footnote"
        LatexName               tnotetext
        Category                FrontMatter
        InTitle                 0
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Footnote Option"
+               Tooltip       "Optional argument for the footnote"
+       EndArgument
        ParSkip                 0.4
        BottomSep               0.5
        Align                   Left
@@ -146,7 +149,10 @@ Style Author
        LatexType               Command
        Category                FrontMatter
        InTitle                 0
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Author Option"
+               Tooltip       "Optional argument for the author"
+       EndArgument
        LatexName               author
        LabelSep                xxx
        ParSkip                 0.4
@@ -225,7 +231,10 @@ Style Address
        Category                FrontMatter
        LatexName               address
        InTitle                 0
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Address Option"
+               Tooltip       "Optional argument for the address"
+       EndArgument
        ParSkip                 0.4
        Align                   Center
        AlignPossible           Left, Right
index bd70fae7ea34fe7e8307dff40a089231d94553f5..e3433a5aade056a7759fa48428a036a40c73ac4d 100644 (file)
@@ -53,15 +53,24 @@ EndPreamble
 # argument. See enumitem.pdf_ for possible values.
 
 IfStyle Itemize
-       OptionalArgs          1
+       Argument option
+               LabelString   "Itemize Options"
+               Tooltip       "Optional arguments for this list (see enumitem manual)"
+       EndArgument
 End
 
 IfStyle Enumerate
-       OptionalArgs          1
+       Argument option
+               LabelString   "Enumerate Options"
+               Tooltip       "Optional arguments for this list (see enumitem manual)"
+       EndArgument
 End
 
 IfStyle Description
-       OptionalArgs          1
+       Argument option
+               LabelString   "Description Options"
+               Tooltip       "Optional arguments for this list (see enumitem manual)"
+       EndArgument
 End
 
 
@@ -93,7 +102,7 @@ End
 Style Enumerate-Resume
        CopyStyle             Enumerate
        LatexParam            [resume]
-       OptionalArgs          0
+       ResetArgs             1
        # a blue label to indicate that this is not a WYSIWYG label
        # because the numbering differs in the output
        LabelFont
index 21d0e278ace95d2c521bed0aebada61050544b00..b9d33fffbd44b630065657c2411435a37be4315d 100644 (file)
@@ -33,7 +33,11 @@ Style Section
        LatexName               ecvsection
        NeedProtect             1
        NextNoIndent            1
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The title as it appears in the header"
+       EndArgument
        ParSkip                 0.4
        TopSep                  1.3
        BottomSep               0.7
@@ -52,7 +56,11 @@ Style Item
        Margin                  Dynamic
        LatexType               Command
        LatexName               ecvitem
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Vertical Space (Item)"
+               Shortcut      S
+               Tooltip       "Adjust the vertical space of this item"
+       EndArgument
        ParSkip                 0.4
        Align                   Block
        LabelSep                xx
@@ -98,7 +106,11 @@ Style MotherTongue
        Margin                  Dynamic
        LatexType               Command
        LatexName               ecvmothertongue
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Vertical Space (Item)"
+               Shortcut      S
+               Tooltip       "Adjust the vertical space of this item"
+       EndArgument
        ParSkip                 0.4
        Align                   Block
        LabelSep                xx
@@ -113,7 +125,7 @@ End
 Style LangHeader
        CopyStyle               MotherTongue
        LatexName               ecvlanguageheader
-       OptionalArgs            0
+       ResetArgs               1
        LabelString             "Language Header:"
 End
 
@@ -132,7 +144,7 @@ End
 Style LangFooter
        CopyStyle               MotherTongue
        LatexName               ecvlanguagefooter
-       OptionalArgs            0
+       ResetArgs               1
        LabelString             "Language Footer:"
 End
 
index 4d324a9008b6d284e8b417899628d884e6c8dfec..aa85dbf84d747e27c6e1f6e415c6b875cad125fa 100644 (file)
@@ -103,7 +103,7 @@ Style Title
   LatexName    title
   Category     FrontMatter
   InTitle      1
-  OptionalArgs 0
+  ResetArgs     1
   ParSkip      0.4
   ItemSep      0
   TopSep       0
@@ -121,7 +121,10 @@ Style Author
   LatexType    Command
   Category     FrontMatter
   InTitle      1
-  OptionalArgs 1
+  Argument 1
+       LabelString   "Author Option"
+       Tooltip       "Optional argument for author"
+  EndArgument
   LatexName    author
   LabelSep     xxx
   ParSkip      0.4
@@ -294,7 +297,10 @@ Style RomanList
   Margin       Static
   LatexType    Item_Environment
   LatexName    romanlist
-  OptionalArgs 1
+  Argument 1
+       LabelString   "RomanList Option"
+       Tooltip       "Optional argument for RomanList"
+  EndArgument
   NextNoIndent 1
   LeftMargin   MMN
   LabelSep     xx
@@ -334,7 +340,7 @@ Style Proof
 End
 
 Style Theorem
-  OptionalArgs 0
+  ResetArgs      1
   LabelString  "Theorem \thetheorem."
   #Font
    #Shape      Up
index 04deab0378389b610530fb5a5253584e10a6627b..177013e71e0b99a5e087fdcfb720a23f73020021 100644 (file)
@@ -108,7 +108,7 @@ Style Title
   LatexName    title
   Category     FrontMatter
   InTitle      1
-  OptionalArgs 0
+  ResetArgs     1
   ParSkip      0.4
   ItemSep      0
   TopSep       0
@@ -126,7 +126,10 @@ Style Author
   LatexType    Command
   Category     FrontMatter
   InTitle      1
-  OptionalArgs 1
+  Argument 1
+       LabelString   "Author Option"
+       Tooltip       "Optional argument for author"
+  EndArgument
   LatexName    author
   LabelSep     xxx
   ParSkip      0.4
@@ -297,7 +300,10 @@ Style RomanList
   Margin       Static
   LatexType    Item_Environment
   LatexName    romanlist
-  OptionalArgs 1
+  Argument 1
+       LabelString   "RomanList Option"
+       Tooltip       "Optional argument for RomanList"
+  EndArgument
   NextNoIndent 1
   LeftMargin   MMN
   LabelSep     xx
@@ -340,7 +346,7 @@ Counter theorem
   Within       section
 End
 Style Theorem
-  OptionalArgs 0
+  ResetArgs      1
   LabelString  "Theorem \thetheorem."
   Font
    Shape       Up
index 8f979c0297af5180b6c93eb291ef62ef65e9968e..93d98154ad0fa7d955504060b0899633106f2df8 100644 (file)
@@ -29,8 +29,15 @@ Style Initial
        Margin                  First_Dynamic
        LabelType               static
        LabelString             Initial
-       OptionalArgs            1
-       RequiredArgs            1
+       Argument option
+               LabelString   "Initial Option"
+               Tooltip       "Optional argument for initial (see lettrine manual)"
+       EndArgument
+       Argument inital
+               Mandatory     1
+               LabelString   "Initial"
+               Tooltip       "Initial letter"
+       EndArgument
        LabelSep                x
        ParIndent               MMM
        ParSkip                 0.4
index ba4ea448381177d08a0fb3a469595251f197acbd..59f285325c74c078079f3b9ac0386900f213f116 100644 (file)
@@ -60,7 +60,11 @@ Style Title
        LatexName               title
        Category                FrontMatter
        InTitle                 1
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The title as it appears in the running headers"
+       EndArgument
        ParSkip                 0.4
        ItemSep                 0
        TopSep                  0
@@ -119,7 +123,7 @@ End
 
 Style Letter
        CopyStyle               Title
-       OptionalArgs            0
+       ResetArgs               1
        LatexName               letter
 End
 
index 58a81f3189ec85b931a3e6917abf929e9f1cea16..0ac94146a29acab44774eb817f1fbdd8e9360e50 100644 (file)
@@ -116,7 +116,10 @@ Style "Alternative Affiliation"
        CopyStyle               Affiliation
        LatexType               Command
        LatexName               altaffiliation
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Alternative Affiliation Option"
+               Tooltip       "Option to the alternative affiliation command"
+       EndArgument
 End
 
 
index af04f6713b9326c431ce32363ab114016cab79cc..003d438a75cd12d92fea15c5e5a77d752dfec456 100644 (file)
@@ -51,49 +51,111 @@ Input numreport.inc
 
 
 Style Part
-       OptionalArgs         1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The part as it appears in the table of contents/running headers"
+       EndArgument
        TocLevel             -1
 End
        
 
 
 Style Chapter
-       OptionalArgs         2
+       Argument 1
+               LabelString   "Short Title (TOC)"
+               Shortcut      S
+               Tooltip       "The chapter as it appears in the table of contents"
+       EndArgument
+       Argument 2
+               LabelString   "Short Title (Header)"
+               Tooltip       "The chapter as it appears in the running headers"
+               Requires      shorttitle
+       EndArgument
        TocLevel             0
 End
 
 
 Style Chapter*
-       OptionalArgs         1
+       Argument 1
+               LabelString   "Short Title (TOC)"
+               Shortcut      S
+               Tooltip       "The chapter as it appears in the table of contents"
+       EndArgument
 End
 
 
 Style Section
-       OptionalArgs         2
+       Argument 1
+               LabelString   "Short Title (TOC)"
+               Shortcut      S
+               Tooltip       "The section as it appears in the table of contents"
+       EndArgument
+       Argument 2
+               LabelString   "Short Title (Header)"
+               Tooltip       "The section as it appears in the running headers"
+               Requires      shorttitle
+       EndArgument
        TocLevel 1
 End
 
 
 Style Subsection
-       OptionalArgs         2
+       Argument 1
+               LabelString   "Short Title (TOC)"
+               Shortcut      S
+               Tooltip       "The subsection as it appears in the table of contents"
+       EndArgument
+       Argument 2
+               LabelString   "Short Title (Header)"
+               Tooltip       "The subsection as it appears in the running headers"
+               Requires      shorttitle
+       EndArgument
        TocLevel 2
 End
 
 
 Style Subsubsection
-       OptionalArgs         2
+       Argument 1
+               LabelString   "Short Title (TOC)"
+               Shortcut      S
+               Tooltip       "The subsubsection as it appears in the table of contents"
+       EndArgument
+       Argument 2
+               LabelString   "Short Title (Header)"
+               Tooltip       "The subsubsection as it appears in the running headers"
+               Requires      shorttitle
+       EndArgument
        TocLevel 3
 End
 
 
 Style Paragraph
-       OptionalArgs         2
+       Argument 1
+               LabelString   "Short Title (TOC)"
+               Shortcut      S
+               Tooltip       "The paragraph as it appears in the table of contents"
+       EndArgument
+       Argument 2
+               LabelString   "Short Title (Header)"
+               Tooltip       "The paragraph as it appears in the running headers"
+               Requires      shorttitle
+       EndArgument
        TocLevel 4
 End
 
 
 Style Subparagraph
-       OptionalArgs         2
+       Argument 1
+               LabelString   "Short Title (TOC)"
+               Shortcut      S
+               Tooltip       "The subparagraph as it appears in the table of contents"
+       EndArgument
+       Argument 2
+               LabelString   "Short Title (Header)"
+               Tooltip       "The subparagraph as it appears in the running headers"
+               Requires      shorttitle
+       EndArgument
        TocLevel 5
 End
 
@@ -129,12 +191,10 @@ Style Epigraph
        Align                 Left
 End
 
-#FIXME: what is actually documented is \PoemTitle
-#but \poemtitle is defined nevertheless. Weird.
 Style Poemtitle
        Category              Section
        LatexType             Command
-       LatexName             poemtitle
+       LatexName             PoemTitle
        NeedProtect           1
        NextNoIndent          1
        LabelSep              xxx
@@ -142,7 +202,16 @@ Style Poemtitle
        TopSep                0.4
        ParSep                0.4
        Align                 center
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title (TOC)"
+               Shortcut      S
+               Tooltip       "The poem title as it appears in the table of contents"
+       EndArgument
+       Argument 2
+               LabelString   "Short Title (Header)"
+               Tooltip       "The poem title as it appears in the running headers"
+               Requires      shorttitle
+       EndArgument
        Font
           Series             Bold
        EndFont
@@ -152,8 +221,12 @@ End
 Style Poemtitle*
        CopyStyle             Poemtitle
        Category              Unnumbered
-       LatexName             poemtitle*
-       OptionalArgs          0
+       LatexName             PoemTitle*
+       Argument 1
+               LabelString   "Short Title (TOC)"
+               Shortcut      S
+               Tooltip       "The poem title as it appears in the table of contents"
+       EndArgument
 End
 
 
index e0e091fb11176094d8fba31315458958ab819466..212151e6caaae99cd6418633f3a5a1cee73bb30c 100644 (file)
@@ -68,7 +68,10 @@ Style Entry
        Margin                  Dynamic
        LatexType               Command
        LatexName               cventry
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Entry Option"
+               Tooltip       "Optional argument to the cventry command"
+       EndArgument
        ParSkip                 0.4
        Align                   Block
        LabelSep                xx
@@ -84,7 +87,10 @@ Style Item
        Margin                  Dynamic
        LatexType               Command
        LatexName               cvitem
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Item Option"
+               Tooltip       "Optional argument to the cvitem command"
+       EndArgument
        ParSkip                 0.4
        Align                   Block
        LabelSep                xx
index 31a8141985d29bb0ab748236bbc5ba2218b2e80f..5897ffafb20d9c343628b76f87b844c609bf1cb0 100644 (file)
@@ -131,7 +131,10 @@ Style Slide
   LabelType     Counter
   LabelCounter  subsection
   LabelString   "    "
-  OptionalArgs  1
+  Argument 1
+       LabelString   "Slide Option"
+       Tooltip       "Optional arguments to the slide command (see powerdot manual)"
+  EndArgument
   Font
     Series      Bold
     Size        Large
@@ -154,7 +157,7 @@ Style EndSlide
   LabelBottomSep    0
   LeftMargin        MMMMMMM
   LabelString       "~=~"
-  OptionalArgs      0
+  ResetArgs         1
 
   Font
     Color       None
@@ -207,7 +210,7 @@ Style Note
   LabelString   "Note:"
   LeftMargin    MMMMMMM
   KeepEmpty     1
-  OptionalArgs  0
+  ResetArgs     1
   Font
     Series      Bold
     Size        Large
index 7eb5bbee7033c2f9d40dd8765d2c1a2d202e44c5..e35a97f0c15203c9bdb1dbd8fad9f64a97788682 100644 (file)
@@ -114,7 +114,10 @@ End
 Style Ingredients
   LatexType            Command
   LatexName            ingred
-  OptionalArgs         1
+  Argument 1
+       LabelString   "Ingredients Header"
+       Tooltip       "Specify an optional ingredients header"
+  EndArgument
   Margin               Static
   LeftMargin           Ingredients_for_some:xx
   LabelSep             xx
index 6615179d2c79849ed3a6b6acadeaea9e20efbdab..3c3e57f3b48017b013f1990dac46985da22b8b71 100644 (file)
@@ -99,7 +99,11 @@ Style Affiliation_(alternate)
        CopyStyle             Affiliation
        LatexName             altaffiliation
        LabelString           "Affiliation (alternate):"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Alternate Affiliation Option"
+               Shortcut      S
+               Tooltip       "Optional argument to the altaffiliation command"
+       EndArgument
        PassThru              1
 End
 
@@ -125,7 +129,11 @@ Style Author_Email
        CopyStyle             Affiliation
        LatexName             email
        LabelString           "Electronic Address:"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Electronic Address Option"
+               Shortcut      S
+               Tooltip       "Optional argument to the email command"
+       EndArgument
        PassThru              1
        TextFont
          Family              Typewriter
@@ -140,7 +148,11 @@ Style Author_URL
        CopyStyle             Author_Email
        LatexName             homepage
        LabelString           "URL:"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Author URL Option"
+               Shortcut      S
+               Tooltip       "Optional argument to the homepage command"
+       EndArgument
        PassThru              1
 End
 
@@ -201,7 +213,11 @@ End
 
 
 Style Title
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "Short title as it appears in the running headers"
+       EndArgument
        Font
          Series              Bold
          Size                Large
index d84c973a9197d10acf002804d2bd67de24f87c21..00abcdb99b841466692abb6b8a542968323bde6e 100644 (file)
@@ -154,7 +154,11 @@ Style Affiliation_(alternate)
        PassThru              1
        ParbreakIsNewline     1
        LatexName             altaffiliation
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Alternate Affiliation Option"
+               Shortcut      S
+               Tooltip       "Optional argument to the altaffiliation command"
+       EndArgument
        LabelString           "Affiliation (alternate):"
 End
 
@@ -200,7 +204,11 @@ Style Author_Email
        PassThru              1
        ParbreakIsNewline     1
        LatexName             email
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Electronic Address Option"
+               Shortcut      S
+               Tooltip       "Optional argument to the email command"
+       EndArgument
        LabelString           "Electronic Address:"
        TextFont
          Family              Typewriter
@@ -216,7 +224,11 @@ Style Author_URL
        PassThru              1
        ParbreakIsNewline     1
        LatexName             homepage
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Author URL Option"
+               Shortcut      S
+               Tooltip       "Optional argument to the homepage command"
+       EndArgument
        LabelString           "URL:"
 End
 
index cf5dfe8bff895e6ec907edd8e7cd45d93279fa82..9a4fd4ec4f0b9700a270a81bd7c72675d231d4a4 100644 (file)
@@ -44,7 +44,11 @@ Style "Safety phrase"
        LatexName               rsphrase
        Category                MainText
        NextNoIndent            1
-       OptionalArgs            1
+       Argument 1
+               LabelString   "Safety Phrase Option"
+               Shortcut      S
+               Tooltip       "Optional argument to the rsphrase command"
+       EndArgument
        KeepEmpty               1
        Margin                  Dynamic
        LabelSep                xx
index 20f10d4739e7d725fd5b30c0dd12409357acf7cb..85e722ec7e8f2d3fbdfe48d987ee0f6a329755bf 100644 (file)
@@ -110,21 +110,33 @@ Input stdstarsections.inc
 Style Addpart
        CopyStyle             Part*
        LatexName             addpart
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The part as it appears in the table of contents/running headers"
+       EndArgument
 End
 
 
 Style Addchap
        CopyStyle             Chapter*
        LatexName             addchap
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The chapter as it appears in the table of contents/running headers"
+       EndArgument
 End
 
 
 Style Addsec
        CopyStyle             Section*
        LatexName             addsec
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The section as it appears in the table of contents/running headers"
+       EndArgument
 End
 
 
@@ -263,7 +275,11 @@ Style Captionabove
        Align                 Center
        LabelType             Sensitive
        LabelString           "Senseless!"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The caption as it appears in the list of figures/tables"
+       EndArgument
        LabelFont
          Series              Bold
        EndFont
@@ -283,7 +299,11 @@ Style Captionbelow
        Align                 Center
        LabelType             Sensitive
        LabelString           "Senseless!"
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The caption as it appears in the list of figures/tables"
+       EndArgument
        LabelFont
          Series              Bold
        EndFont
@@ -300,7 +320,10 @@ Style Dictum
        BottomSep            1.5
        ParSep               1.5
        Align                Left
-       OptionalArgs         1
+       Argument 1
+               LabelString   "Dictum Author"
+               Tooltip       "The author of this dictum"
+       EndArgument
        Font
          Size               Normal
        EndFont
index 7b533630d864261621db363ac9f7008a9096c2e0..164ec1c4837dde4a874e05dd579e29aff5b2b8ed 100644 (file)
@@ -158,7 +158,10 @@ Style Proof
        LatexType             Environment
        LatexName             proof
        NextNoIndent          1
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Alternative Proof String"
+               Tooltip       "An alternative proof string"
+       EndArgument
        LabelSep              xx
        ParIndent             MMM
        ParSkip               0.4
@@ -198,7 +201,11 @@ Style Title
        ParSep                1
        Align                 Center
        LabelType             No_Label
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The title as it appears in the running headers"
+       EndArgument
        Font
          Shape               Smallcaps
          Series              Bold
index 990b3bc4247d660b50307a676e5a4c7b2e3b492f..0768cbc58724450dcb6bee31e94fa08103b8ded5 100644 (file)
@@ -45,7 +45,11 @@ Style Section
          Series              Bold
        EndFont
                TocLevel 1
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The section as it appears in the table of contents/running headers"
+       EndArgument
 End
 
 
index f0e434d6edcf5613d6fafc9dc9d21ebc97b29424..f6db1bf70b5fefca067593988219a2a1340f8188 100644 (file)
@@ -469,6 +469,11 @@ InsetLayout Info:shortcuts
 End
 
 InsetLayout Caption
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The caption as it appears in the list of figures/tables"
+       EndArgument
        HTMLStyle
                div.float-caption {
                        text-align: center;
index 613d7641042a68157a9b5f13dc376e390c9ccbd7..a17f67ef36b2ef450c83e04ce0951ffa94f6514c 100644 (file)
@@ -27,7 +27,11 @@ Style Part
        ParSep                0.8
        Align                 Center
        Alignpossible         Center
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The part as it appears in the table of contents/running headers"
+       EndArgument
        Font
          Series              Bold
          Size                Huge
@@ -53,7 +57,11 @@ Style Chapter
        BottomSep             0.8
        ParSep                0.8
        Align                 Block
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The chapter as it appears in the table of contents/running headers"
+       EndArgument
        Font
          Series              Bold
          Size                Huge
@@ -78,7 +86,11 @@ Style Section
        BottomSep             0.7
        ParSep                0.7
        Align                 Block
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The section as it appears in the table of contents/running headers"
+       EndArgument
        Font
          Series              Bold
          Size                Larger
index 712cf7f4ddd6a489e7c7c379f2dbca8ee9fdfcb0..a196ed03b507af0e26301bf790442b97b8b38f14 100644 (file)
@@ -17,7 +17,7 @@ Style Part*
        LatexName       part*
        LabelType       No_Label
        LabelCounter    ""
-       OptionalArgs    0
+       ResetArgs       1
 End
 
 
@@ -28,7 +28,7 @@ Style Chapter*
        LatexName       chapter*
        LabelType       No_Label
        LabelCounter    ""
-       OptionalArgs    0
+       ResetArgs       1
 End
 
 
@@ -39,7 +39,7 @@ Style Section*
        LatexName       section*
        LabelType       No_Label
        LabelCounter    ""
-       OptionalArgs    0
+       ResetArgs       1
 End
 
 
@@ -50,7 +50,7 @@ Style Subsection*
        LatexName       subsection*
        LabelType       No_Label
        LabelCounter    ""
-       OptionalArgs    0
+       ResetArgs       1
 End
 
 
@@ -61,7 +61,7 @@ Style Subsubsection*
        LatexName       subsubsection*
        LabelType       No_Label
        LabelCounter    ""
-       OptionalArgs    0
+       ResetArgs       1
 End
 
 
@@ -72,7 +72,7 @@ Style Paragraph*
        LatexName       paragraph*
        LabelType       No_Label
        LabelCounter    ""
-       OptionalArgs    0
+       ResetArgs       1
 End
 
 
@@ -83,5 +83,5 @@ Style Subparagraph*
        LatexName       subparagraph*
        LabelType       No_Label
        LabelCounter    ""
-       OptionalArgs    0
+       ResetArgs       1
 End
index 1e7d7fc99d85722991dadfcf89fd9041b7d706f0..2eb1cfea7bcf049e626f9098e1bd52d7483a19bc 100644 (file)
@@ -69,7 +69,7 @@ Style Front_Matter
        LatexType       Command
        LatexName       frontmatter
        KeepEmpty       1
-       OptionalArgs    0
+       ResetArgs       1
        Margin          First_Dynamic
        NextNoIndent    1
        ParSkip         0
@@ -135,7 +135,11 @@ Style PartBacktext
          Shape         Up
          Size          normal
        EndFont
-       RequiredArgs    1
+       Argument 1
+               Mandatory     1
+               LabelString   "Part Title"
+               Tooltip       "The title of this part"
+       EndArgument
        Preamble
          \newenvironment{svmultpartbacktext}[1]{\begin{partbacktext}
          \part{#1}}{\end{partbacktext}}
@@ -510,7 +514,10 @@ Style Foreword
        BottomSep       0.8
        ParSep          0.8
        Align           Block
-       OptionalArgs    1
+       Argument 1
+               LabelString   "Alternative Foreword Heading"
+               Tooltip       "Alternative foreword heading"
+       EndArgument
        Font
          Series        Bold
          Size          Huge
@@ -586,7 +593,10 @@ Style Bibliography
 End
 
 Style Description
-       OptionalArgs    1
+       Argument 1
+               LabelString   "Longest Description Label"
+               Tooltip       "Longest description label"
+       EndArgument
        LabelFont
          Series        Medium
        EndFont
index 411cf3ca4b06565b1baf18b503701b73fe815fd2..46fb0b9d3135d2258b179d709dd9314884d825e4 100644 (file)
@@ -53,7 +53,10 @@ Style Theorem
        LatexType             Environment
        LatexName             thm
        NextNoIndent          1
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Alternative Theorem String"
+               Tooltip       "Alternative theorem string"
+       EndArgument
        LabelSep              xx
        ParIndent             MMM
        ParSkip               0.4
index f3af8d6f97b33d0c3d175f82b68ac3fc4b1d0c12..93eebcd4f094ba6ce055ee58c5498d603547dbeb 100644 (file)
@@ -27,7 +27,10 @@ Style Theorem
        LatexType             Environment
        LatexName             thm
        NextNoIndent          1
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Alternative Theorem String"
+               Tooltip       "Alternative theorem string"
+       EndArgument
        LabelSep              xx
        ParIndent             MMM
        ParSkip               0.4
index e193992af04f04ea55e0ee4ca41e4e2cf9f899c4..2e5003445c9cc1b9e79f67d0a7edcbf508957b61 100644 (file)
@@ -29,7 +29,10 @@ Style Theorem
        LatexType             Environment
        LatexName             thm
        NextNoIndent          1
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Alternative Theorem String"
+               Tooltip       "Alternative theorem string"
+       EndArgument
        LabelSep              xx
        ParIndent             MMM
        ParSkip               0.4
index b722fe3983ddf60305bf754ba886881298b860d3..bc83fed9793d266457355472c80e12b0368a6518 100644 (file)
@@ -16,7 +16,10 @@ Style Proof
        LatexType             Environment
        LatexName             proof
        NextNoIndent          1
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Alternative Proof String"
+               Tooltip       "Alternative proof string"
+       EndArgument
        LabelSep              xx
        ParIndent             MMM
        ParSkip               0.4
index d275d48b73e0d02c524ff9e5839882fecec34a01..c76cdd080b681df35fd79eb5f34246ddc46e7eb0 100644 (file)
@@ -28,7 +28,10 @@ Style Theorem*
        LabelType             Static
        LabelString           "Theorem."
        NextNoIndent          1
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Alternative Theorem String"
+               Tooltip       "Alternative theorem string"
+       EndArgument
        LabelSep              xx
        ParIndent             MMM
        ParSkip               0.4
index 3ba499e438ad1ace215cf4086f3d5a8d01f29e03..5ca15316a8de74eaad65a8f6de9c2ec70934c29a 100644 (file)
@@ -37,7 +37,10 @@ Style Theorem
        LatexType       Environment
        LatexName       theorem
        NextNoIndent    1
-       OptionalArgs    1
+       Argument 1
+               LabelString   "Alternative Theorem String"
+               Tooltip       "Alternative theorem string"
+       EndArgument
        LabelSep        xx
        ParIndent       MMM
        ParSkip         0.4
@@ -243,7 +246,7 @@ Style Prob
        LabelString     "\theprob."
        RefPrefix       pro
        NextNoIndent    1
-       OptionalArgs    0
+       ResetArgs       1
        LabelSep        xx
        ParIndent       MMM
        ParSkip         0.4
@@ -281,7 +284,11 @@ Style Sol
        LatexName       sol
        LabelType       Static
        LabelString     "# [number of Prob]"
-       RequiredArgs    1
+       Argument 1
+               Mandatory     1
+               LabelString   "Solution"
+               Tooltip       "Mandatory argument to the sol environment"
+       EndArgument
 End
 
 
index 94bb4fcdddf0c9abd966eab139bf5b74ef5c444e..ab0b47fd1dd2d969198a4023eac3d1db3ac5d026 100644 (file)
@@ -27,7 +27,10 @@ Style Theorem
        LatexType             Environment
        LatexName             thm
        NextNoIndent          1
-       OptionalArgs          1
+       Argument 1
+               LabelString   "Alternative Theorem String"
+               Tooltip       "Alternative theorem string"
+       EndArgument
        LabelSep              xx
        ParIndent             MMM
        ParSkip               0.4
index d712e7157363e5d6bba7715d75056ff7b3365b05..9e696a6bce4f99d27468f9617f3b0fe269606609 100644 (file)
@@ -76,7 +76,11 @@ Style Chapter
        ParSep          0.8
        Align           Block
        RefPrefix chap
-       OptionalArgs    1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The chapter as it appears in the table of contents/running headers"
+       EndArgument
        Font
          Series        Bold
          Size          Huge
@@ -100,7 +104,11 @@ Style Section
        ParSep          0.7
        Align           Block
        RefPrefix sec
-       OptionalArgs    1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The section as it appears in the table of contents/running headers"
+       EndArgument
        Font
          Series        Bold
          Size          Larger
index ea89f4e2c69ce5fe56aee43998bf8979488ea9ab..1aa38b6d916140414bc0a8e017b4e36e7ef8dd03 100644 (file)
@@ -36,7 +36,11 @@ Style Part
        ParSep          0.8
        Align           Center
        Alignpossible   Center
-       OptionalArgs    1
+       Argument 1
+               LabelString   "Short Title"
+               Shortcut      S
+               Tooltip       "The part as it appears in the table of contents/running headers"
+       EndArgument
        Font
          Series        Bold
          Size          Huge
index a4da821742ea29e3a6bc24d4e97c41ad2f0e9e1c..38c399f9ad24aec6204691bb5bc0ad958bfc8e38 100644 (file)
@@ -1130,6 +1130,32 @@ def revert_uop(document):
                 document.header[i] = "\\font_sans default"
 
 
+def convert_latexargs(document):
+    " Convert InsetArgument to new syntax "
+
+    i = 0
+    while True:
+      i = find_token(document.body, "\\begin_inset Argument", i)
+      if i == -1:
+        return
+      # We cannot do more here since we have no access to the layout.
+      # InsetArgument itself will do the real work
+      # (see InsetArgument::updateBuffer())
+      document.body[i] = "\\begin_inset Argument 999"
+      i = i + 1
+
+
+def revert_latexargs(document):
+    " Revert InsetArgument to old syntax "
+
+    # What needs to be done is this:
+    # * find all arguments in a paragraph and reorder them
+    #   according to their ID (which is deleted)
+    # So: \\begin_inset Argument 2 ... \\begin_inset Argument 1
+    # => \\begin_inset Argument ... \\begin_inset Argument
+    #    with correct order.
+
+
 ##
 # Conversion hub
 #
@@ -1167,10 +1193,12 @@ convert = [
            [442, []],
            [443, []],
            [444, []],
-           [445, []]
+           [445, []],
+           [446, [convert_latexargs]]
           ]
 
 revert =  [
+           [445, [revert_latexargs]],
            [444, [revert_uop]],
            [443, [revert_biolinum]],
            [442, []],
index 068755cad2c854019146b07040ca9c653c4e76d3..6f001b37d0e4adf332e6456be7ff739bc33e1295 100644 (file)
@@ -138,6 +138,9 @@ import os, re, string, sys
 # Incremented to format 40, 10 October 2012 by rgh
 # Re-do layout names for layout categories
 
+# Incremented to format 41, 20 November 2012 by spitz
+# New Argument syntax
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -145,7 +148,7 @@ import os, re, string, sys
 # development/tools/updatelayouts.sh script to update all
 # layout files to the new format.
 
-currentFormat = 40
+currentFormat = 41
 
 
 def usage(prog_name):
@@ -247,6 +250,9 @@ def convert(lines):
     re_ExtractCategory = re.compile(r'^(#\s*\\Declare\w+Class(?:\[[^]]*?\])?){([^(]+?)\s+\(([^)]+?)\)\s*}\s*$')
     ConvDict = {"article": "Articles", "book" : "Books", "letter" : "Letters", "report": "Reports", \
                 "presentation" : "Presentations", "curriculum vitae" : "Curricula Vitae", "handout" : "Handouts"}
+    # Arguments
+    re_OptArgs = re.compile(r'^(\s*)OptionalArgs(\s+)(\d+)\D*$', re.IGNORECASE)
+    re_ReqArgs = re.compile(r'^(\s*)RequiredArgs(\s+)(\d+)\D*$', re.IGNORECASE)
 
 
     # counters for sectioning styles (hardcoded in 1.3)
@@ -294,6 +300,8 @@ def convert(lines):
     formatline = 0
     usemodules = []
     flexstyles = []
+    opts = 0
+    reqs = 0
 
     while i < len(lines):
         # Skip comments and empty lines
@@ -350,6 +358,70 @@ def convert(lines):
                 i += 1
             continue
 
+        if format == 40:
+            # reset counters on Style beginning
+            match = re_Style.match(lines[i])
+            if match:
+                opts = 0
+                reqs = 0
+                i += 1
+                continue
+            match = re_OptArgs.match(lines[i])
+            if match:
+                # Save number of optional arguments
+                space1 = match.group(1)
+                opts = int(match.group(3))
+                # OptionalArgs 0 > ResetArgs 1
+                if opts == 0:
+                    lines[i] = space1 + "ResetArgs\t1"
+                    i += 1
+                else:
+                    del lines[i]
+                continue
+            match = re_ReqArgs.match(lines[i])
+            if match:
+                # Save number of required arguments
+                space1 = match.group(1)
+                reqs = int(match.group(3))
+                del lines[i]
+                continue
+            # Insert the required number of arguments at the end of the style definition
+            match = re_End.match(lines[i])
+            if match:
+                newarg = ['']
+                # First the optionals (this is the required order pre 2.1)
+                if opts > 0:
+                    if opts == 1:
+                        newarg = [ '%sArgument 1' % (space1),
+                                   '%s\tLabelString\t\"Optional Layout Argument\"' % (space1),
+                                   '%sEndArgument' % (space1)]
+                    elif opts > 1:
+                        actopt = 1
+                        while actopt < (opts + 1):
+                            newarg += [ '%sArgument %d' % (space1, actopt),
+                               '%s\tLabelString\t\"Optional Layout Argument %d\"' % (space1, actopt),
+                               '%sEndArgument' % (space1)]
+                            actopt += 1
+                # Now the mandatories
+                if reqs > 0:
+                    actopt = opts + 1
+                    while actopt < (opts +  reqs + 1):
+                        newarg += [ '%sArgument %d' % (space1, actopt),
+                           '%s\tLabelString\t"Required Layout Argument %d"' % (space1, actopt - opts),
+                           '%s\tMandatory\t1' % (space1),
+                           '%sEndArgument' % (space1)]
+                        actopt += 1
+                # Since we replace the "End" line, re-add this line
+                if len(newarg) > 1:
+                    newarg += ['End']
+                    lines[i:i+1] = newarg
+                    i += len(newarg)
+                # Reset the counters
+                opts = 0
+                reqs = 0
+            i += 1
+            continue
+        
         if format == 39:
             # There is a conversion with format 40, but it is done within the
             # initial comment block and so is above.
index f1fd9e1487777f64de0da33ed3a7d69c916c82c0..323085d6b18c2773b49093fdcbcdcac3fde06cb5 100644 (file)
@@ -369,7 +369,7 @@ Menuset
                Item "Hyperlink...|k" "href-insert"
                Item "Footnote|F" "footnote-insert"
                Item "Marginal Note|M" "marginalnote-insert"
-               Item "Short Title|S" "argument-insert"
+               Arguments
                Item "TeX Code|X" "ert-insert"
                Item "Program Listing[[Menu]]" "listing-insert"
                Item "Date" "date-insert"
index 97594b706e0991c594450251e2ae58be061db2b5..1524f9c640e6449e506b9fd67d588e9ba9abd76b 100644 (file)
@@ -40,6 +40,7 @@ const int Layout::NOT_IN_TOC = -1000;
 enum LayoutTags {
        LT_ALIGN = 1,
        LT_ALIGNPOSSIBLE,
+       LT_ARGUMENT,
        LT_MARGIN,
        LT_BOTTOMSEP,
        LT_CATEGORY,
@@ -67,7 +68,6 @@ enum LayoutTags {
        LT_ENDLABELTYPE,
        LT_LATEXNAME,
        LT_LATEXPARAM,
-       LT_OPTARGS,
        LT_LATEXTYPE,
        LT_LEFTMARGIN,
        LT_NEED_PROTECT,
@@ -101,7 +101,7 @@ enum LayoutTags {
        LT_HTMLTITLE,
        LT_SPELLCHECK,
        LT_REFPREFIX,
-       LT_REQARGS,
+       LT_RESETARGS,
        LT_INTITLE // keep this last!
 };
 
@@ -143,8 +143,6 @@ Layout::Layout()
        htmlforcecss_ = false;
        htmltitle_ = false;
        spellcheck = true;
-       optargs = 0;
-       reqargs = 0;
 }
 
 
@@ -154,6 +152,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
        LexerKeyword layoutTags[] = {
                { "align",          LT_ALIGN },
                { "alignpossible",  LT_ALIGNPOSSIBLE },
+               { "argument",       LT_ARGUMENT },
                { "babelpreamble",  LT_BABELPREAMBLE },
                { "bottomsep",      LT_BOTTOMSEP },
                { "category",       LT_CATEGORY },
@@ -201,7 +200,6 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                { "newline",        LT_NEWLINE },
                { "nextnoindent",   LT_NEXTNOINDENT },
                { "obsoletedby",    LT_OBSOLETEDBY },
-               { "optionalargs",   LT_OPTARGS },
                { "parbreakisnewline", LT_PARBREAK_IS_NEWLINE },
                { "parindent",      LT_PARINDENT },
                { "parsep",         LT_PARSEP },
@@ -209,8 +207,8 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                { "passthru",       LT_PASS_THRU },
                { "preamble",       LT_PREAMBLE },
                { "refprefix",      LT_REFPREFIX },
-               { "requiredargs",   LT_REQARGS },
                { "requires",       LT_REQUIRES },
+               { "resetargs",      LT_RESETARGS },
                { "rightmargin",    LT_RIGHTMARGIN },
                { "spacing",        LT_SPACING },
                { "spellcheck",     LT_SPELLCHECK },
@@ -317,12 +315,15 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                        lex >> toclevel;
                        break;
 
-               case LT_OPTARGS:
-                       lex >> optargs;
+               case LT_RESETARGS:
+                       bool reset;
+                       lex >> reset;
+                       if (reset)
+                               latexargs_.clear();
                        break;
 
-               case LT_REQARGS:
-                       lex >> reqargs;
+               case LT_ARGUMENT:
+                       readArgument(lex);
                        break;
 
                case LT_NEED_PROTECT:
@@ -858,6 +859,79 @@ void Layout::readSpacing(Lexer & lex)
 }
 
 
+void Layout::readArgument(Lexer & lex)
+{
+       latexarg arg;
+       arg.mandatory = false;
+       bool error = false;
+       bool finished = false;
+       unsigned int nr;
+       lex >> nr;
+       while (!finished && lex.isOK() && !error) {
+               lex.next();
+               string const tok = ascii_lowercase(lex.getString());
+
+               if (tok.empty()) {
+                       continue;
+               } else if (tok == "endargument") {
+                       finished = true;
+               } else if (tok == "labelstring") {
+                       lex.next();
+                       arg.labelstring = lex.getDocString();
+               } else if (tok == "mandatory") {
+                       lex.next();
+                       arg.mandatory = lex.getBool();
+               } else if (tok == "leftdelim") {
+                       lex.next();
+                       arg.ldelim = lex.getDocString();
+               } else if (tok == "rightdelim") {
+                       lex.next();
+                       arg.rdelim = lex.getDocString();
+               } else if (tok == "tooltip") {
+                       lex.next();
+                       arg.tooltip = lex.getDocString();
+               } else if (tok == "shortcut") {
+                       lex.next();
+                       arg.shortcut = lex.getString();
+               } else if (tok == "requires") {
+                       lex.next();
+                       arg.requires = lex.getString();
+               } else {
+                       lex.printError("Unknown tag");
+                       error = true;
+               }
+       }
+       if (arg.labelstring.empty())
+               LYXERR0("Incomplete Argument definition!");
+       else
+               latexargs_[nr] = arg;
+}
+
+
+int Layout::optArgs() const
+{
+       int nr = 0;
+       LaTeXArgMap::const_iterator it = latexargs_.begin();
+       for (; it != latexargs_.end(); ++it) {
+               if (!(*it).second.mandatory)
+                       ++nr;
+       }
+       return nr;
+}
+
+
+int Layout::requiredArgs() const
+{
+       int nr = 0;
+       LaTeXArgMap::const_iterator it = latexargs_.begin();
+       for (; it != latexargs_.end(); ++it) {
+               if ((*it).second.mandatory)
+                       ++nr;
+       }
+       return nr;
+}
+
+
 string const & Layout::htmltag() const 
 { 
        if (htmltag_.empty())
index 08c049d8d6ac054140e2005cf49a867091a59696..c115c549a8b569b4fe8667bddcde694e86b41dba 100644 (file)
 #include "FontInfo.h"
 #include "LayoutEnums.h"
 #include "Spacing.h"
+#include "support/debug.h"
 #include "support/docstring.h"
 
+#include <map>
 #include <set>
 #include <string>
 
@@ -72,6 +74,8 @@ public:
        ///
        void readSpacing(Lexer &);
        ///
+       void readArgument(Lexer &);
+       ///
        docstring const & name() const { return name_; }
        ///
        void setName(docstring const & n) { name_ = n; }
@@ -83,6 +87,24 @@ public:
        std::string const & latexname() const { return latexname_; }
        ///
        void setLatexName(std::string const & n) { latexname_ = n; }
+       /// The arguments of this layout
+       struct latexarg {
+               docstring labelstring;
+               bool mandatory;
+               docstring ldelim;
+               docstring rdelim;
+               docstring tooltip;
+               std::string shortcut;
+               std::string requires;
+       };
+       ///
+       typedef std::map<unsigned int, latexarg> LaTeXArgMap;
+       ///
+       LaTeXArgMap const & latexargs() const { return latexargs_; }
+       ///
+       int optArgs() const;
+       ///
+       int requiredArgs() const;
        ///
        docstring const & labelstring(bool in_appendix) const 
        { return in_appendix ? labelstring_appendix_ : labelstring_; }
@@ -238,15 +260,6 @@ public:
        bool intitle;
        /// Is the content to go in the preamble rather than the body?
        bool inpreamble;
-       /// Number of requried arguments for this command or environment
-       unsigned int reqargs;
-       /// Number of optional arguments for this command or environment
-       /// These MUST come at the beginning, so:
-       ///  \cmd[opt1][opt2]{req1}{here is the text from LyX}
-       /// is fine. But:
-       ///  \cmd[opt1]{req1}[opt2]{here is the text from LyX}
-       /// is not.
-       unsigned int optargs;
        /// Which counter to step
        docstring counter;
        /// Prefix to use when creating labels
@@ -374,6 +387,8 @@ private:
        docstring babelpreamble_;
        /// Packages needed for this layout
        std::set<std::string> requires_;
+       ///
+       LaTeXArgMap latexargs_;
 };
 
 } // namespace lyx
index d64d6725b6c66bdaca1344c5fc0c8f3c447a11dd..68ce15d5d7dad0af064668705daf9143ceaf1971 100644 (file)
@@ -319,7 +319,8 @@ void LyXAction::init()
 /*!
  * \var lyx::FuncCode lyx::LFUN_ARGUMENT_INSERT
  * \li Action: Inserts an argument (short title) inset.
- * \li Syntax: argument-insert
+ * \li Syntax: argument-insert <argument nr>
+ * \li Params: <argument nr>: see layout declarations
  * \li Origin: vermeer, 12 Aug 2002
  * \endvar
  */
index 223d2eb53eb2942e2ab2cd29461bd551527ce9f6..8429b015d6eacd1d621de6239f2c207ce5ab0738 100644 (file)
@@ -1461,9 +1461,9 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                        // we have to provide all the optional arguments here, even though
                        // the last one is the only one we care about.
                        // Separate handling of optional argument inset.
-                       if (layout_->optargs != 0 || layout_->reqargs != 0)
+                       if (layout_->latexargs().size() != 0)
                                latexArgInsets(*owner_, os, features.runparams(),
-                                       layout_->reqargs, layout_->optargs);
+                                              layout_->latexargs());
                        else
                                os << from_ascii(layout_->latexparam());
                }
index 850003c16dec6e965c17da12e67035b6245728d5..7a7269668fe87cd43c724f909d66b53fdbaf5a53 100644 (file)
@@ -51,6 +51,7 @@
 #include "frontends/Clipboard.h"
 #include "frontends/Selection.h"
 
+#include "insets/InsetArgument.h"
 #include "insets/InsetCollapsable.h"
 #include "insets/InsetCommand.h"
 #include "insets/InsetExternal.h"
@@ -2518,9 +2519,32 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_ARGUMENT_INSERT: {
                code = ARG_CODE;
                allow_in_passthru = true;
+               string const arg = cmd.getArg(0);
+               if (arg.empty()) {
+                       enable = false;
+                       break;
+               }
                Layout const & lay = cur.paragraph().layout();
-               int const numargs = lay.reqargs + lay.optargs;
-               enable = cur.paragraph().insetList().count(ARG_CODE) < numargs;
+               Layout::LaTeXArgMap args = lay.latexargs();
+               Layout::LaTeXArgMap::const_iterator const lait =
+                               args.find(convert<unsigned int>(arg));
+               if (lait != args.end()) {
+                       enable = true;
+                       InsetList::const_iterator it = cur.paragraph().insetList().begin();
+                       InsetList::const_iterator end = cur.paragraph().insetList().end();
+                       for (; it != end; ++it) {
+                               if (it->inset->lyxCode() == ARG_CODE) {
+                                       InsetArgument const * ins =
+                                               static_cast<InsetArgument const *>(it->inset);
+                                       if (ins->name() == arg) {
+                                               // we have this already
+                                               enable = false;
+                                               break;
+                                       }
+                               }
+                       }
+               } else
+                       enable = false;
                break;
        }
        case LFUN_INDEX_INSERT:
index e25a2630490b1598042ec1c890f750d24ed2bae1..b640c6b2ae09a60412fe9540254d538c0aca5be4 100644 (file)
@@ -154,8 +154,14 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
                case LFUN_MARGINALNOTE_INSERT:
                        return new InsetMarginal(buf);
 
-               case LFUN_ARGUMENT_INSERT:
-                       return new InsetArgument(buf);
+               case LFUN_ARGUMENT_INSERT: {
+                       string arg = cmd.getArg(0);
+                       if (arg.empty()) {
+                               LYXERR0("argument-insert needs an argument!");
+                               return 0;
+                       }
+                       return new InsetArgument(buf, arg);
+               }
 
                case LFUN_FLOAT_INSERT: {
                        string argument = to_utf8(cmd.argument());
@@ -618,7 +624,7 @@ Inset * readInset(Lexer & lex, Buffer * buf)
                } else if (tmptok == "Newline") {
                        inset.reset(new InsetNewline);
                } else if (tmptok == "Argument") {
-                       inset.reset(new InsetArgument(buf));
+                       inset.reset(new InsetArgument(buf, tmptok));
                } else if (tmptok == "Float") {
                        inset.reset(new InsetFloat(buf, string()));
                } else if (tmptok == "Wrap") {
index 279ccaea3c7dbf50638c053e42ae683cdcc75247..3e1687925975495868f6e79ec5409b671630f86c 100644 (file)
@@ -40,6 +40,7 @@
 #include "IndicesList.h"
 #include "KeyMap.h"
 #include "Language.h"
+#include "Layout.h"
 #include "Lexer.h"
 #include "LyXAction.h"
 #include "LyX.h"
@@ -172,7 +173,10 @@ public:
                /// Words suggested by the spellchecker.
                SpellingSuggestions,
                /** Used Languages */
-               LanguageSelector
+               LanguageSelector,
+               /** This is the list of arguments available
+                   for insertion into the current layout. */
+               Arguments
        };
 
        explicit MenuItem(Kind kind) : kind_(kind), optional_(false) {}
@@ -348,6 +352,7 @@ public:
        void expandGraphicsGroups(BufferView const *);
        void expandSpellingSuggestions(BufferView const *);
        void expandLanguageSelector(Buffer const * buf);
+       void expandArguments(BufferView const *);
        ///
        ItemList items_;
        ///
@@ -455,10 +460,12 @@ void MenuDefinition::read(Lexer & lex)
                md_toolbars,
                md_graphicsgroups,
                md_spellingsuggestions,
-               md_languageselector
+               md_languageselector,
+               md_arguments
        };
 
        LexerKeyword menutags[] = {
+               { "arguments", md_arguments },
                { "bookmarks", md_bookmarks },
                { "branches", md_branches },
                { "charstyles", md_charstyles },
@@ -616,6 +623,10 @@ void MenuDefinition::read(Lexer & lex)
                        add(MenuItem(MenuItem::IndicesListsContext));
                        break;
 
+               case md_arguments:
+                       add(MenuItem(MenuItem::Arguments));
+                       break;
+
                case md_optsubmenu:
                        optional = true;
                        // fallback to md_submenu
@@ -1527,6 +1538,33 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
        }
 }
 
+
+void MenuDefinition::expandArguments(BufferView const * bv)
+{
+       if (!bv)
+               return;
+
+       Inset const * inset = &bv->cursor().inset();
+       Layout::LaTeXArgMap args;
+       if (inset && bv->cursor().paragraph().layout().latexargs().empty())
+               args = inset->getLayout().latexargs();
+       else
+               args = bv->cursor().paragraph().layout().latexargs();
+       if (args.empty())
+               return;
+       Layout::LaTeXArgMap::const_iterator lait = args.begin();
+       Layout::LaTeXArgMap::const_iterator const laend = args.end();
+       for (; lait != laend; ++lait) {
+               Layout::latexarg arg = (*lait).second;
+               QString item = toqstr(translateIfPossible(arg.labelstring));
+               if (!arg.shortcut.empty())
+                       item += "|" + toqstr(arg.shortcut);
+               add(MenuItem(MenuItem::Command, item,
+                            FuncRequest(LFUN_ARGUMENT_INSERT,
+                                        convert<docstring>((*lait).first))));
+       }
+}
+
 } // namespace anon
 
 
@@ -1670,7 +1708,8 @@ struct Menus::Impl {
        /// Expands some special entries of the menu
        /** The entries with the following kind are expanded to a
            sequence of Command MenuItems: Lastfiles, Documents,
-           ViewFormats, ExportFormats, UpdateFormats, Branches, Indices
+           ViewFormats, ExportFormats, UpdateFormats, Branches,
+           Indices, Arguments
        */
        void expand(MenuDefinition const & frommenu, MenuDefinition & tomenu,
                BufferView const *) const;
@@ -1891,6 +1930,10 @@ void Menus::Impl::expand(MenuDefinition const & frommenu,
                        tomenu.expandLanguageSelector(buf);
                        break;
 
+               case MenuItem::Arguments:
+                       tomenu.expandArguments(bv);
+                       break;
+
                case MenuItem::Submenu: {
                        MenuItem item(*cit);
                        item.setSubmenu(MenuDefinition(cit->submenuname()));
index fb78b227eb38a21a1e6c005372f943bef065b048..949bf332ababe1440dbbac1f973f0fafa837dc46 100644 (file)
 
 #include "InsetArgument.h"
 
+#include "InsetList.h"
+#include "Layout.h"
+#include "Lexer.h"
+#include "ParIterator.h"
+
+#include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
 #include "support/gettext.h"
+#include "support/lstrings.h"
 
 using namespace std;
 
 namespace lyx {
 
 
-InsetArgument::InsetArgument(Buffer * buf)
-       : InsetCollapsable(buf)
+InsetArgument::InsetArgument(Buffer * buf, string const & name)
+    : InsetCollapsable(buf), name_(name), labelstring_(docstring())
 {}
 
 
 void InsetArgument::write(ostream & os) const
 {
-       os << "Argument" << "\n";
+       os << "Argument " << name_ << "\n";
        InsetCollapsable::write(os);
 }
 
+void InsetArgument::read(Lexer & lex)
+{
+       lex >> name_;
+       InsetCollapsable::read(lex);
+}
+
+void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
+{
+       Layout::LaTeXArgMap args;
+       bool const insetlayout = &it.inset() && it.paragraph().layout().latexargs().empty();
+       if (insetlayout)
+               args = it.inset().getLayout().latexargs();
+       else
+               args = it.paragraph().layout().latexargs();
+
+       // Handle pre 2.1 ArgInsets (lyx2lyx cannot classify them)
+       if (name_ == "999") {
+               int req = insetlayout ? it.inset().getLayout().requiredArgs()
+                                     : it.paragraph().layout().requiredArgs();
+               int opts = insetlayout ? it.inset().getLayout().optArgs()
+                                     : it.paragraph().layout().optArgs();
+               int nr = 0;
+               int ours = 0;
+               InsetList::const_iterator parit = it.paragraph().insetList().begin();
+               InsetList::const_iterator parend = it.paragraph().insetList().end();
+               for (; parit != parend; ++parit) {
+                       if (parit->inset->lyxCode() == ARG_CODE) {
+                               ++nr;
+                               if (parit->inset == this)
+                                       ours = nr;
+                       }
+               }
+               bool done = false;
+               int realopts = 0;
+               if (nr > req) {
+                       // We have optional arguments
+                       realopts = nr - req;
+                       if (ours <= realopts) {
+                               name_ = convert<string>(ours);
+                               done = true;
+                       }
+               }
+               if (!done) {
+                       // This is a mandatory argument. We have to consider
+                       // non-given optional arguments for the numbering
+                       int offset = opts - realopts;
+                       ours += offset;
+                       name_ = convert<string>(ours);
+               }
+       }
+       Layout::LaTeXArgMap::const_iterator const lait =
+                       args.find(convert<unsigned int>(name_));
+       if (lait != args.end()) {
+               labelstring_ = translateIfPossible((*lait).second.labelstring);
+               tooltip_ = translateIfPossible((*lait).second.tooltip);
+       } else {
+               labelstring_ = _("Unknown Argument");
+               tooltip_ = _("Argument not known in this Layout. Will be supressed in the output.");
+       }
+       setButtonLabel();
+       InsetCollapsable::updateBuffer(it, utype);
+}
+
+void InsetArgument::setButtonLabel()
+{
+       setLabel(labelstring_);
+}
+
+docstring InsetArgument::toolTip(BufferView const & bv, int, int) const
+{
+       if (isOpen(bv))
+               return tooltip_;
+       return toolTipText(tooltip_ + from_ascii(":\n"));
+}
+
 void InsetArgument::latexArgument(otexstream & os,
-               OutputParams const & runparams, bool optional) const
+               OutputParams const & runparams, docstring const & ldelim,
+               docstring const & rdelim) const
 {
        TexRow texrow;
        odocstringstream ss;
        otexstream ots(ss, texrow);
        InsetText::latex(ots, runparams);
        docstring str = ss.str();
-       if (optional && str.find(']') != docstring::npos)
+       if (ldelim != "{" && support::contains(str, rdelim))
                str = '{' + str + '}';
-       os << (optional ? '[' : '{') << str
-          << (optional ? ']' : '}');
+       os << ldelim << str << rdelim;
 }
 
 
index 37805ce3355bec9df2c14bb3280419fa40ba3ffe..e3718b1b97491d035073c64d33be393ff8e4c914 100644 (file)
@@ -9,8 +9,8 @@
  * Full author contact details are available in file CREDITS.
  */
 
-#ifndef INSETOPTARG_H
-#define INSETOPTARG_H
+#ifndef INSETARGUMENT_H
+#define INSETARGUMENT_H
 
 
 #include "InsetCollapsable.h"
@@ -27,11 +27,13 @@ class InsetArgument : public InsetCollapsable
 {
 public:
        ///
-       InsetArgument(Buffer *);
+       InsetArgument(Buffer *, std::string const &);
 
        /// Outputting the parameter of a LaTeX command
        void latexArgument(otexstream &, OutputParams const &,
-                       bool optional) const;
+                       docstring const&, docstring const &) const;
+
+       std::string name() const { return name_; }
 
        /// \name Public functions inherited from Inset class
        //@{
@@ -41,6 +43,8 @@ public:
        InsetCode lyxCode() const { return ARG_CODE; }
        ///
        docstring layoutName() const { return from_ascii("Argument"); }
+       /// Update the label string of this inset
+       void updateBuffer(ParIterator const &, UpdateType);
        ///
        void latex(otexstream &, OutputParams const &) const { }
        ///
@@ -49,12 +53,29 @@ public:
        int docbook(odocstream &, OutputParams const &) const { return 0; }
        ///
        docstring xhtml(XHTMLStream &, OutputParams const &) const 
-               { return docstring(); };
+               { return docstring(); }
        ///
        void write(std::ostream & os) const;
        ///
+       void read(Lexer & lex);
+       ///
        bool neverIndent() const { return true; }
        //@}
+       /// \name Public functions inherited from InsetCollapsable class
+       //@{
+       ///
+       void setButtonLabel();
+       //@}
+
+private:
+       ///
+       docstring toolTip(BufferView const & bv, int, int) const;
+       ///
+       std::string name_;
+       ///
+       docstring labelstring_;
+       ///
+       docstring tooltip_;
 
 protected:
        /// \name Protected functions inherited from Inset class
@@ -67,4 +88,4 @@ protected:
 
 } // namespace lyx
 
-#endif // INSETOPTARG_H
+#endif // INSETARGUMENT_H
index b1c4e08d1a4b1a9c0b51763c16c95db3ff32ff61..a637d90e5adeaa3eca0fa0b393b6e033a3408bf5 100644 (file)
@@ -201,10 +201,6 @@ bool InsetCaption::getStatus(Cursor & cur, FuncRequest const & cmd,
                status.setEnabled(false);
                return true;
 
-       case LFUN_ARGUMENT_INSERT:
-               status.setEnabled(cur.paragraph().insetList().find(ARG_CODE) == -1);
-               return true;
-
        case LFUN_INSET_TOGGLE:
                // pass back to owner
                cur.undispatched();
@@ -232,7 +228,7 @@ void InsetCaption::latex(otexstream & os,
        // optional argument.
        runparams.moving_arg = true;
        os << "\\caption";
-       latexArgInsets(paragraphs()[0], os, runparams, 0, 1);
+       getOptArg(os, runparams);
        os << '{';
        InsetText::latex(os, runparams);
        os << "}\n";
@@ -287,7 +283,7 @@ void InsetCaption::getArgument(otexstream & os,
 void InsetCaption::getOptArg(otexstream & os,
                        OutputParams const & runparams) const
 {
-       latexArgInsets(paragraphs()[0], os, runparams, 0, 1);
+       latexArgInsets(paragraphs()[0], os, runparams, getLayout().latexargs());
 }
 
 
index f92a5e6ab7d4020da90156866e08ebf55eb1d986..8c34f0769c4e8f57713f6b75b3a1f701953d0f10 100644 (file)
@@ -15,6 +15,7 @@
 #include "InsetLayout.h"
 
 #include "ColorSet.h"
+#include "Layout.h"
 #include "Lexer.h"
 #include "TextClass.h"
 
@@ -76,6 +77,7 @@ InsetLayout::InsetLaTeXType translateLaTeXType(std::string const & str)
 bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
 {
        enum {
+               IL_ARGUMENT,
                IL_BABELPREAMBLE,
                IL_BGCOLOR,
                IL_CONTENTASLABEL,
@@ -120,6 +122,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
 
 
        LexerKeyword elementTags[] = {
+               { "argument", IL_ARGUMENT },
                { "babelpreamble", IL_BABELPREAMBLE },
                { "bgcolor", IL_BGCOLOR },
                { "contentaslabel", IL_CONTENTASLABEL },
@@ -309,6 +312,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                        labelfont_ = font_;
                        break;
                }
+               case IL_ARGUMENT:
+                       readArgument(lex);
+                       break;
                case IL_BGCOLOR:
                        lex >> tmp;
                        bgcolor_ = lcolor.getFromLyXName(tmp);
@@ -474,5 +480,76 @@ docstring InsetLayout::htmlstyle() const
        return retval;
 }
 
+void InsetLayout::readArgument(Lexer & lex)
+{
+       Layout::latexarg arg;
+       arg.mandatory = false;
+       bool error = false;
+       bool finished = false;
+       unsigned int nr;
+       lex >> nr;
+       while (!finished && lex.isOK() && !error) {
+               lex.next();
+               string const tok = support::ascii_lowercase(lex.getString());
+
+               if (tok.empty()) {
+                       continue;
+               } else if (tok == "endargument") {
+                       finished = true;
+               } else if (tok == "labelstring") {
+                       lex.next();
+                       arg.labelstring = lex.getDocString();
+               } else if (tok == "mandatory") {
+                       lex.next();
+                       arg.mandatory = lex.getBool();
+               } else if (tok == "leftdelim") {
+                       lex.next();
+                       arg.ldelim = lex.getDocString();
+               } else if (tok == "rightdelim") {
+                       lex.next();
+                       arg.rdelim = lex.getDocString();
+               } else if (tok == "tooltip") {
+                       lex.next();
+                       arg.tooltip = lex.getDocString();
+               } else if (tok == "shortcut") {
+                       lex.next();
+                       arg.shortcut = lex.getString();
+               } else if (tok == "requires") {
+                       lex.next();
+                       arg.requires = lex.getString();
+               } else {
+                       lex.printError("Unknown tag");
+                       error = true;
+               }
+       }
+       if (arg.labelstring.empty())
+               LYXERR0("Incomplete Argument definition!");
+       else
+               latexargs_[nr] = arg;
+}
+
+int InsetLayout::optArgs() const
+{
+       int nr = 0;
+       Layout::LaTeXArgMap::const_iterator it = latexargs_.begin();
+       for (; it != latexargs_.end(); ++it) {
+               if (!(*it).second.mandatory)
+                       ++nr;
+       }
+       return nr;
+}
+
+
+int InsetLayout::requiredArgs() const
+{
+       int nr = 0;
+       Layout::LaTeXArgMap::const_iterator it = latexargs_.begin();
+       for (; it != latexargs_.end(); ++it) {
+               if ((*it).second.mandatory)
+                       ++nr;
+       }
+       return nr;
+}
+
 
 } //namespace lyx
index 4619abcb0a363fe520009af7d7cae1ce7677649b..33fcffaddd980d5e56a4c6402b30d5797db221d5 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "ColorCode.h"
 #include "FontInfo.h"
+#include "Layout.h"
 
 #include "support/docstring.h"
 
@@ -81,6 +82,12 @@ public:
        ///
        ColorCode bgcolor() const { return bgcolor_; }
        ///
+       Layout::LaTeXArgMap latexargs() const { return latexargs_; }
+       ///
+       int optArgs() const;
+       ///
+       int requiredArgs() const;
+       ///
        docstring preamble() const { return preamble_; }
        /// Get language dependent macro definitions needed for this inset
        docstring const langpreamble() const { return langpreamble_; }
@@ -159,6 +166,8 @@ private:
        ///
        std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
        ///
+       void readArgument(Lexer &);
+       ///
        docstring name_;
        /**
                * This is only used (at present) to decide where to put them on the menus.
@@ -245,6 +254,8 @@ private:
        bool resetsfont_;
        ///
        bool display_;
+       ///
+       Layout::LaTeXArgMap latexargs_;
 };
 
 ///
index 85eca0c305991174abcc5cdb594a14890b46ec76..06644ad6579b79c7981c3d3c9b512a115afd51ca 100644 (file)
@@ -13,6 +13,7 @@
 #include "InsetText.h"
 
 #include "insets/InsetArgument.h"
+#include "insets/InsetLayout.h"
 
 #include "buffer_funcs.h"
 #include "Buffer.h"
@@ -30,6 +31,7 @@
 #include "InsetList.h"
 #include "Intl.h"
 #include "Language.h"
+#include "Layout.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "lyxfind.h"
@@ -54,6 +56,7 @@
 #include "frontends/alert.h"
 #include "frontends/Painter.h"
 
+#include "support/convert.h"
 #include "support/debug.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
@@ -329,6 +332,37 @@ bool InsetText::getStatus(Cursor & cur, FuncRequest const & cmd,
                return target_inset;
        }
 
+       case LFUN_ARGUMENT_INSERT: {
+               string const arg = cmd.getArg(0);
+               if (arg.empty()) {
+                       status.setEnabled(false);
+                       return true;
+               }
+               if (&buffer().inset() == this || !cur.paragraph().layout().latexargs().empty())
+                       return text_.getStatus(cur, cmd, status);
+               Layout::LaTeXArgMap args = getLayout().latexargs();
+               Layout::LaTeXArgMap::const_iterator const lait =
+                               args.find(convert<unsigned int>(arg));
+               if (lait != args.end()) {
+                       status.setEnabled(true);
+                       InsetList::const_iterator it = cur.paragraph().insetList().begin();
+                       InsetList::const_iterator end = cur.paragraph().insetList().end();
+                       for (; it != end; ++it) {
+                               if (it->inset->lyxCode() == ARG_CODE) {
+                                       InsetArgument const * ins =
+                                               static_cast<InsetArgument const *>(it->inset);
+                                       if (ins->name() == arg) {
+                                               // we have this already
+                                               status.setEnabled(false);
+                                               return true;
+                                       }
+                               }
+                       }
+               } else
+                       status.setEnabled(false);
+               return true;
+       }
+
        default:
                // Dispatch only to text_ if the cursor is inside
                // the text_. It is not for context menus (bug 5797).
index 585ef8a3ec11f8ab14fea870570c84ab3dd3dd82..2112b80e7065b202fb1baf3c50d801e32737a903 100644 (file)
 #include "insets/InsetArgument.h"
 
 #include "support/lassert.h"
+#include "support/convert.h"
 #include "support/debug.h"
 #include "support/lstrings.h"
 
+#include <algorithm>
 #include <boost/next_prior.hpp>
 #include <list>
 
@@ -160,8 +162,8 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf,
 
        if (style.isEnvironment()) {
                os << "\\begin{" << from_ascii(style.latexname()) << '}';
-               if (style.optargs != 0 || style.reqargs != 0)
-                       latexArgInsets(*pit, os, runparams, style.reqargs, style.optargs);
+               if (style.latexargs().size() != 0)
+                   latexArgInsets(*pit, os, runparams, style.latexargs());
                if (style.latextype == LATEX_LIST_ENVIRONMENT) {
                        os << '{'
                           << pit->params().labelWidthString()
@@ -311,53 +313,85 @@ void TeXEnvironment(Buffer const & buf, Text const & text,
 
 
 void latexArgInsets(Paragraph const & par, otexstream & os,
-       OutputParams const & runparams, unsigned int reqargs,
-       unsigned int optargs)
+       OutputParams const & runparams, Layout::LaTeXArgMap latexargs)
 {
-       unsigned int totalargs = reqargs + optargs;
-       list<InsetArgument const *> ilist;
+       map<int, InsetArgument const *> ilist;
+       vector<string> required;
 
        InsetList::const_iterator it = par.insetList().begin();
        InsetList::const_iterator end = par.insetList().end();
        for (; it != end; ++it) {
                if (it->inset->lyxCode() == ARG_CODE) {
-                       if (ilist.size() >= totalargs) {
-                               LYXERR0("WARNING: Found extra argument inset.");
-                               continue;
-                       }
                        InsetArgument const * ins =
                                static_cast<InsetArgument const *>(it->inset);
-                       ilist.push_back(ins);
+                       if (ins->name().empty())
+                               LYXERR0("Error: Unnamed argument inset!");
+                       else {
+                               unsigned int const nr = convert<unsigned int>(ins->name());
+                               ilist[nr] = ins;
+                               Layout::LaTeXArgMap::const_iterator const lit =
+                                               latexargs.find(nr);
+                               if (lit != latexargs.end()) {
+                                       Layout::latexarg arg = (*lit).second;
+                                       if (!arg.requires.empty()) {
+                                               vector<string> req = getVectorFromString(arg.requires);
+                                               required.insert(required.end(), req.begin(), req.end());
+                                       }
+                               }
+                       }
                }
        }
 
-       if (!reqargs && ilist.empty())
+       unsigned int const argnr = latexargs.size();
+       if (argnr == 0)
                return;
 
-       bool const have_optional_args = ilist.size() > reqargs;
-       if (have_optional_args) {
-               unsigned int todo = ilist.size() - reqargs;
-               for (unsigned int i = 0; i < todo; ++i) {
-                       InsetArgument const * ins = ilist.front();
-                       ilist.pop_front();
-                       ins->latexArgument(os, runparams, true);
+       for (unsigned int i = 1; i <= argnr; ++i) {
+               map<int, InsetArgument const *>::const_iterator lit = ilist.find(i);
+               bool inserted = false;
+               if (lit != ilist.end()) {
+                       InsetArgument const * ins = (*lit).second;
+                       if (ins) {
+                               Layout::LaTeXArgMap::const_iterator const lait =
+                                               latexargs.find(convert<unsigned int>(ins->name()));
+                               if (lait != latexargs.end()) {
+                                       Layout::latexarg arg = (*lait).second;
+                                       docstring ldelim = arg.mandatory ?
+                                                       from_ascii("{") : from_ascii("[");
+                                       docstring rdelim = arg.mandatory ?
+                                                       from_ascii("}") : from_ascii("]");
+                                       if (!arg.ldelim.empty())
+                                               ldelim = arg.ldelim;
+                                       if (!arg.rdelim.empty())
+                                               rdelim = arg.rdelim;
+                                       ins->latexArgument(os, runparams, ldelim, rdelim);
+                                       inserted = true;
+                               }
+                       }
                }
-       }
-
-       // we should now have no more insets than there are required
-       // arguments.
-       LASSERT(ilist.size() <= reqargs, /* */);
-       if (!reqargs)
-               return;
-
-       for (unsigned int i = 0; i < reqargs; ++i) {
-               if (ilist.empty())
-                       // a required argument wasn't given, so we output {}
-                       os << "{}";
-               else {
-                       InsetArgument const * ins = ilist.front();
-                       ilist.pop_front();
-                       ins->latexArgument(os, runparams, false);
+               if (!inserted) {
+                       Layout::LaTeXArgMap::const_iterator lait = latexargs.begin();
+                       Layout::LaTeXArgMap::const_iterator const laend = latexargs.end();
+                       for (; lait != laend; ++lait) {
+                               if ((*lait).first == i) {
+                                       Layout::latexarg arg = (*lait).second;
+                                       if (arg.mandatory) {
+                                               docstring ldelim = arg.ldelim.empty() ?
+                                                               from_ascii("{") : arg.ldelim;
+                                               docstring rdelim = arg.rdelim.empty() ?
+                                                               from_ascii("}") : arg.rdelim;
+                                               os << ldelim << rdelim;
+                                       } else if (find(required.begin(), required.end(),
+                                                  convert<string>((*lait).first)) != required.end()) {
+                                               docstring ldelim = arg.ldelim.empty() ?
+                                                               from_ascii("[") : arg.ldelim;
+                                               docstring rdelim = arg.rdelim.empty() ?
+                                                               from_ascii("]") : arg.rdelim;
+                                               os << ldelim << rdelim;
+                                       } else
+                                               break;
+                               }
+                       }
                }
        }
 }
@@ -373,8 +407,8 @@ void parStartCommand(Paragraph const & par, otexstream & os,
                os << '\\' << from_ascii(style.latexname());
 
                // Separate handling of optional argument inset.
-               if (style.optargs != 0 || style.reqargs != 0)
-                       latexArgInsets(par, os, runparams, style.reqargs, style.optargs);
+               if (style.latexargs().size() != 0)
+                       latexArgInsets(par, os, runparams, style.latexargs());
                else
                        os << from_ascii(style.latexparam());
                break;
index d29c4b7f4781281344091c1feb8758e1dd584168..ee0419b2319e73447914c57b211001269a6f9a38 100644 (file)
@@ -15,6 +15,7 @@
 #include <utility>
 
 #include "support/docstream.h"
+#include "Layout.h"
 #include "Paragraph.h"
 #include "ParIterator.h"
 #include "ParagraphList.h"
@@ -37,7 +38,7 @@ class Text;
 /// must all come first.
 void latexArgInsets(Paragraph const & par,
                otexstream & os, OutputParams const & runparams,
-               unsigned int reqargs, unsigned int optargs);
+               Layout::LaTeXArgMap latexargs);
 
 /** Export \p paragraphs of buffer \p buf to LaTeX.
     Don't use a temporary stringstream for \p os if the final output is
index ee927a3b36be518ccf163b2848923cc2c529f17d..3e4c02d32e2ce151bc7009e2bfc61a9641577ed4 100644 (file)
@@ -78,6 +78,8 @@ Format LaTeX feature                        LyX feature
        libertine-legacy.sty
 445    URW Classico LaTeX font              \font_sans uop
        \renewcommand{\sffamily}{uop}
+446    Optional and required arguments      InsetArgument
+       now numbered by order
 
 
 General
index 01626f3a500892313a2afbde6d830c93171e0657..af811e297aaf9d7a7c96d7f380d61ce4111a2634 100644 (file)
@@ -628,27 +628,40 @@ void output_command_layout(ostream & os, Parser & p, bool outer,
        }
        context.check_deeper(os);
        context.check_layout(os);
-       unsigned int optargs = 0;
-       while (optargs < context.layout->optargs) {
+       // FIXME: Adjust to format 446!
+       // Since format 446, layouts do not require anymore all optional
+       // arguments before the required ones. Needs to be implemented!
+       int optargs = 0;
+       while (optargs < context.layout->optArgs()) {
                eat_whitespace(p, os, context, false);
                if (p.next_token().cat() == catEscape ||
                    p.next_token().character() != '[')
                        break;
                p.get_token(); // eat '['
-               begin_inset(os, "Argument\n");
+               // FIXME: Just a workaround. InsetArgument::updateBuffer
+               //        will compute a proper ID for all "999" Arguments
+               //        (which is also what lyx2lyx produces).
+               //        However, tex2lyx should be able to output proper IDs
+               //        itself.
+               begin_inset(os, "Argument 999\n");
                os << "status collapsed\n\n";
                parse_text_in_inset(p, os, FLAG_BRACK_LAST, outer, context);
                end_inset(os);
                eat_whitespace(p, os, context, false);
                ++optargs;
        }
-       unsigned int reqargs = 0;
-       while (reqargs < context.layout->reqargs) {
+       int reqargs = 0;
+       while (reqargs < context.layout->requiredArgs()) {
                eat_whitespace(p, os, context, false);
                if (p.next_token().cat() != catBegin)
                        break;
                p.get_token(); // eat '{'
-               begin_inset(os, "Argument\n");
+               // FIXME: Just a workaround. InsetArgument::updateBuffer
+               //        will compute a proper ID for all "999" Arguments
+               //        (which is also what lyx2lyx produces).
+               //        However, tex2lyx should be able to output proper IDs
+               //        itself.
+               begin_inset(os, "Argument 999\n");
                os << "status collapsed\n\n";
                parse_text_in_inset(p, os, FLAG_BRACE_LAST, outer, context);
                end_inset(os);
@@ -1597,14 +1610,15 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                }
                context.check_deeper(os);
                // handle known optional and required arguments
-               // layouts require all optional arguments before the required ones
+               // FIXME: Since format 446, layouts do not require anymore all optional
+               // arguments before the required ones. Needs to be implemented!
                // Unfortunately LyX can't handle arguments of list arguments (bug 7468):
                // It is impossible to place anything after the environment name,
                // but before the first \\item.
                if (context.layout->latextype == LATEX_ENVIRONMENT) {
                        bool need_layout = true;
-                       unsigned int optargs = 0;
-                       while (optargs < context.layout->optargs) {
+                       int optargs = 0;
+                       while (optargs < context.layout->optArgs()) {
                                eat_whitespace(p, os, context, false);
                                if (p.next_token().cat() == catEscape ||
                                    p.next_token().character() != '[')
@@ -1614,15 +1628,20 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                                        context.check_layout(os);
                                        need_layout = false;
                                }
-                               begin_inset(os, "Argument\n");
+                               // FIXME: Just a workaround. InsetArgument::updateBuffer
+                               //        will compute a proper ID for all "999" Arguments
+                               //        (which is also what lyx2lyx produces).
+                               //        However, tex2lyx should be able to output proper IDs
+                               //        itself.
+                               begin_inset(os, "Argument 999\n");
                                os << "status collapsed\n\n";
                                parse_text_in_inset(p, os, FLAG_BRACK_LAST, outer, context);
                                end_inset(os);
                                eat_whitespace(p, os, context, false);
                                ++optargs;
                        }
-                       unsigned int reqargs = 0;
-                       while (reqargs < context.layout->reqargs) {
+                       int reqargs = 0;
+                       while (reqargs < context.layout->requiredArgs()) {
                                eat_whitespace(p, os, context, false);
                                if (p.next_token().cat() != catBegin)
                                        break;
@@ -1631,7 +1650,12 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                                        context.check_layout(os);
                                        need_layout = false;
                                }
-                               begin_inset(os, "Argument\n");
+                               // FIXME: Just a workaround. InsetArgument::updateBuffer
+                               //        will compute a proper ID for all "999" Arguments
+                               //        (which is also what lyx2lyx produces).
+                               //        However, tex2lyx should be able to output proper IDs
+                               //        itself.
+                               begin_inset(os, "Argument 999\n");
                                os << "status collapsed\n\n";
                                parse_text_in_inset(p, os, FLAG_BRACE_LAST, outer, context);
                                end_inset(os);
@@ -2724,10 +2748,12 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        begin_inset(os, "Caption\n");
                        Context newcontext(true, context.textclass, 0, 0, context.font);
                        newcontext.check_layout(os);
+                       // FIXME InsetArgument is now properly implemented in InsetLayout
+                       //       (for captions, but also for others)
                        if (p.next_token().cat() != catEscape &&
                            p.next_token().character() == '[') {
                                p.get_token(); // eat '['
-                               begin_inset(os, "Argument\n");
+                               begin_inset(os, "Argument 1\n");
                                os << "status collapsed\n";
                                parse_text_in_inset(p, os, FLAG_BRACK_LAST, outer, context);
                                end_inset(os);
index dbea8533d52d08f010a4b72584db8cd4574eb34a..a305e9ce119152ba370a487421ee8c2d02102fd5 100644 (file)
@@ -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 445 // landroni: support for the URW Classico LaTeX font
-#define LYX_FORMAT_TEX2LYX 445 // landroni: support for the URW Classico LaTeX font
+#define LYX_FORMAT_LYX 446 // spitz: InsetArgument revision
+#define LYX_FORMAT_TEX2LYX 446 // landroni: InsetArgument revision
 
 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
 #ifndef _MSC_VER