LatexParam before Argument

Jürgen Spitzmüller jspitzm at gmail.com
Sat Apr 8 15:43:55 UTC 2023


Am Samstag, dem 08.04.2023 um 15:20 +0000 schrieb Ehud Behar:
> I want to create the following latex code in my Lyx document:
> 
> \begin{myenv}{}
> [arg 1]
> code
> \end{myenv}
> 
> So I inserted this into the Local Layout:
> 
> Style myenv
>     LatexType             Environment
>     LatexName             myenv
>     LatexParam "{}"
>     Argument              1
>             LabelString    "entry 1"
>             AutoInsert    1
>             LeftDelim "<br/>["
>             RightDelim "]"
>     EndArgument
> End
> 
> But turns out that LyX sweeps the order of "Argument" and
> "LatexParam", because what this local layout gives is
> \begin{myenv}
> [arg 1]{}
> code
> \end{myenv}
> 
> Any idea how to solve it? Or a different approach to get the code I
> want?

LatexParam (which is a kludge anyway) always comes last, you cannot
change that. Use a proper argument for the mandatory argument as well.
BTW there is also no need for the right delim, as this is "]" by
default (if Mandatory is not changed):

Style myenv
    LatexType             Environment
    LatexName             myenv
    Argument              1
            LabelString    "foo"
            Mandatory    1
    EndArgument
    Argument              2
            LabelString    "entry 1"
            AutoInsert    1
            LeftDelim "<br/>["
    EndArgument
End

HTH,
Jürgen

> 
> A screenshot is here.

-- 
Jürgen


More information about the lyx-users mailing list