InsetArgument revision, first working version

This commit is contained in:
Juergen Spitzmueller 2012-11-19 14:21:02 +01:00
parent 63295f9dc5
commit 2e69c66195
64 changed files with 1097 additions and 239 deletions

View 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

View 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

View 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

View File

@ -73,7 +73,7 @@ Style Paragraph*
Margin Static
LatexName subsubsubsection*
LabelType No_Label
OptionalArgs 0
ResetArgs 1
End

View File

@ -98,7 +98,7 @@ Style SpecialSection*
Margin Static
LabelType No_Label
LabelCounter ""
OptionalArgs 0
ResetArgs 1
End

View 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

View 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

View 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 "Short title for TOC and running headers"
EndArgument
NeedProtect 1
NextNoIndent 1
Labelsep xx
@ -156,7 +180,11 @@ Style Section
LabelCounter section
LabelString "Section \arabic{section}"
RefPrefix sec
OptionalArgs 1
Argument 1
LabelString "Short Title"
Shortcut S
Tooltip "Short title for TOC and 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 "Short title for TOC and 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 "Short title for TOC and 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"
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"
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"
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"
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"
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

View File

@ -11,7 +11,11 @@ Style "Caption setup"
LatexType command
LatexName captionsetup
Category FrontMatter
OptionalArgs 1
Argument options
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,12 @@ Style Bicaption
CopyStyle "Caption setup"
LatexName bicaption
Category MainText
RequiredArgs 1
Argument options
Mandatory 1
LabelString "Second language caption text"
Shortcut S
Tooltip "The caption text in the second language"
EndArgument
TopSep 0
Align Center
AlignPossible Center

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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 TOC"
EndArgument
TocLevel -1
End
Style Chapter
OptionalArgs 2
Argument 1
LabelString "Short Title (TOC)"
Shortcut S
Tooltip "The Part as it appears in the TOC"
EndArgument
Argument 2
LabelString "Short Title (Header)"
Tooltip "The Part as it appears in the Header"
Requires shorttitle
EndArgument
TocLevel 0
End
Style Chapter*
OptionalArgs 1
Argument 1
LabelString "Short Title (TOC)"
Shortcut S
Tooltip "The Part as it appears in the TOC"
EndArgument
End
Style Section
OptionalArgs 2
Argument 1
LabelString "Short Title (TOC)"
Shortcut S
Tooltip "The Part as it appears in the TOC"
EndArgument
Argument 2
LabelString "Short Title (Header)"
Tooltip "The Part as it appears in the Header"
Requires shorttitle
EndArgument
TocLevel 1
End
Style Subsection
OptionalArgs 2
Argument 1
LabelString "Short Title (TOC)"
Shortcut S
Tooltip "The Part as it appears in the TOC"
EndArgument
Argument 2
LabelString "Short Title (Header)"
Tooltip "The Part as it appears in the Header"
Requires shorttitle
EndArgument
TocLevel 2
End
Style Subsubsection
OptionalArgs 2
Argument 1
LabelString "Short Title (TOC)"
Shortcut S
Tooltip "The Part as it appears in the TOC"
EndArgument
Argument 2
LabelString "Short Title (Header)"
Tooltip "The Part as it appears in the Header"
Requires shorttitle
EndArgument
TocLevel 3
End
Style Paragraph
OptionalArgs 2
Argument 1
LabelString "Short Title (TOC)"
Shortcut S
Tooltip "The Part as it appears in the TOC"
EndArgument
Argument 2
LabelString "Short Title (Header)"
Tooltip "The Part as it appears in the Header"
Requires shorttitle
EndArgument
TocLevel 4
End
Style Subparagraph
OptionalArgs 2
Argument 1
LabelString "Short Title (TOC)"
Shortcut S
Tooltip "The Part as it appears in the TOC"
EndArgument
Argument 2
LabelString "Short Title (Header)"
Tooltip "The Part as it appears in the Header"
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 Part as it appears in the TOC"
EndArgument
Argument 2
LabelString "Short Title (Header)"
Tooltip "The Part as it appears in the Header"
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 Part as it appears in the TOC"
EndArgument
End

View 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

View 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

View File

@ -114,7 +114,10 @@ End
Style Ingredients
LatexType Command
LatexName ingred
OptionalArgs 1
Argument 1
LabelString "Ingredients Header"
Tooltip "Ingredients Header"
EndArgument
Margin Static
LeftMargin Ingredients_for_some:xx
LabelSep xx

View 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

View 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

View 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

View 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 will appeasr in the TOC and Headers"
EndArgument
End
Style Addchap
CopyStyle Chapter*
LatexName addchap
OptionalArgs 1
Argument 1
LabelString "Short Title"
Shortcut S
Tooltip "The Chapter as it will appeasr in the TOC and Headers"
EndArgument
End
Style Addsec
CopyStyle Section*
LatexName addsec
OptionalArgs 1
Argument 1
LabelString "Short Title"
Shortcut S
Tooltip "The Section as it will appeasr in the TOC and 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

View 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

View 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 TOC/Headers"
EndArgument
End

View 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;

View 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 TOC"
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 TOC"
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 TOC"
EndArgument
Font
Series Bold
Size Larger

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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 TOC/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 TOC/Headers"
EndArgument
Font
Series Bold
Size Larger

View 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 TOC/Headers"
EndArgument
Font
Series Bold
Size Huge

View File

@ -1130,6 +1130,31 @@ 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
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 name (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 +1192,12 @@ convert = [
[442, []],
[443, []],
[444, []],
[445, []]
[445, []],
[446, [convert_latexargs]]
]
revert = [
[445, [revert_latexargs]],
[444, [revert_uop]],
[443, [revert_biolinum]],
[442, []],

View 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"

View 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())

View File

@ -17,8 +17,10 @@
#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

View 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
*/

View 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());
}

View 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"
@ -2516,9 +2517,32 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
break;
case LFUN_ARGUMENT_INSERT: {
code = ARG_CODE;
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()) {
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;
}
}
}
enable = true;
} else
enable = false;
break;
}
case LFUN_INDEX_INSERT:

View 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") {

View 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()));

View File

@ -12,38 +12,120 @@
#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;
}

View 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

View 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());
}

View 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

View 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_;
};
///

View 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()) {
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;
}
}
}
status.setEnabled(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).

View File

@ -30,9 +30,11 @@
#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 (!reqargs && ilist.empty())
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);
}
}
// 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 << "{}";
if (ins->name().empty())
LYXERR0("Error: Unnamed argument inset!");
else {
InsetArgument const * ins = ilist.front();
ilist.pop_front();
ins->latexArgument(os, runparams, false);
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());
}
}
}
}
}
unsigned int const argnr = latexargs.size();
if (argnr == 0)
return;
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;
}
}
}
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;

View 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

View File

@ -628,8 +628,8 @@ 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) {
int optargs = 0;
while (optargs < context.layout->optArgs()) {
eat_whitespace(p, os, context, false);
if (p.next_token().cat() == catEscape ||
p.next_token().character() != '[')
@ -642,8 +642,8 @@ void output_command_layout(ostream & os, Parser & p, bool outer,
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;
@ -1603,8 +1603,8 @@ void parse_environment(Parser & p, ostream & os, bool outer,
// 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() != '[')
@ -1621,8 +1621,8 @@ void parse_environment(Parser & p, ostream & os, bool outer,
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;

View 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