On Sat, Apr 8, 2023 at 6:20 PM Ehud Behar <ehud.be...@posteo.pm> wrote:
>
> 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}

As the customization guide states, the LatexParam will be output as is
after all LaTeX Arguments.


> Any idea how to solve it? Or a different approach to get the code I want?

You can add the extra curly brackets to the LatexName, e.g.,

Style myenv
    LatexType             Environment
    LatexName             myenv}{
    Argument              1
            LabelString    "entry 1"
            AutoInsert    1
            LeftDelim "<br/>["
            RightDelim "]"
    EndArgument
End

Or you can add a second argument:

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

But my approach feels a bit hackey.
Maybe someone else will have a better
solution.

> --
> lyx-users mailing list
> lyx-users@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-users
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to