On 2010-06-02, RGH wrote:
> On 06/02/2010 10:59 AM, Rob Oakes wrote:
>> Dear LyX-Users,
>> I am in the process of creating a custom of modules for personal use
>> (one for easily creating dropcaps via letrine and the stringstrings
>> package, and another for the creation of epigraphs). For the epigraph
>> module to work correctly, it is important that I be able to use multiple
>> input arguments. For example, the LaTeX code for the epigraph command
>> has the form \epigraph{Quotation}{Source}.
>> \epigraph{If a picture isn't worth a thousand words, the hell with
>> it.}{Ad Reinhardt}
>> Is anyone aware of a way to create an inset that could support this type
>> of macro? I've looked through several of the examples shipped with LyX
>> and wasn't able to find a similar example.
The dinbrief.layout uses the following workaround in a similar case::
# dinbrief's \phone has 2 args, area and number. We define an empty
# command that can be set by the Area_Code style
Preamble
\newcommand{\areacode}{}
EndPreamble
...
# dinbrief's \phone has 2 args, area and number,
# define both as distinct styles
Style Area_Code
CopyStyle DinBrief
LabelString "Vorwahl:"
LatexName "renewcommand{\areacode}"
End
Style Telephone
CopyStyle DinBrief
LabelString "Telefon:"
LatexName phone
LatexParam {\areacode}
End
...
> I have occasionally thought about how to resolve
> it, but I've done no actual work on it. My idea was to use a "Short
> Title" like inset, and in effect to force it to be present, the way we
> force InsetBibitem to be present in Bibliography paragraphs.
This would be a welcome addition.
> Presumably, you could use "Short Title", too. (Set OptionalArgs 1 in the
> layout.) Of course, Short Title presently generates an optional
> argument, whereas you want two required ones, but this can of course be
> overcome with a LaTeX redefinition, e.g.:
> \newcommand\myepigraph[2][]{\epigraph{#1}{#2}}
> Note that you can also do:
> \newcommand\myepigraph[2][]{\epigraph{#2}{#1}}
> if it is more natural to have the second argument be the "optional" one.
Günter