Re: LatexParam before Argument
Am Samstag, dem 08.04.2023 um 15:45 + schrieb Ehud Behar: > I actually adopted the "add a second argument" approach, but I like > the first solution. Just out of curiosity: What sense would it make to have a mandatory argument that cannot be set (the "first solution")? -- Jürgen -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: LatexParam before Argument
I actually adopted the "add a second argument" approach, but I like the first solution. Thanks very much! -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: LatexParam before Argument
Am Samstag, dem 08.04.2023 um 15:20 + 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" > AutoInsert1 > LeftDelim "[" > 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" Mandatory1 EndArgument Argument 2 LabelString"entry 1" AutoInsert1 LeftDelim "[" EndArgument End HTH, Jürgen > > A screenshot is here. -- Jürgen -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: LatexParam before Argument
On Sat, Apr 8, 2023 at 6:20 PM Ehud Behar 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" > AutoInsert1 > LeftDelim "[" > 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" AutoInsert1 LeftDelim "[" RightDelim "]" EndArgument End Or you can add a second argument: Style myenv LatexType Environment LatexName myenv Argument 1 LabelString"Something" Mandatory1 EndArgument Argument 2 LabelString"entry 1" AutoInsert1 LeftDelim "[" 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
LatexParam before Argument
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 "[" 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? A screenshot is here [1]. Links: -- [1] https://gcdnb.pbrd.co/images/x59ATebvzVOr.png -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users