1

I would like to create inset layouts for LaTeX commands without argument, e.g. \meter from siunitx package, so that there is no box presented to the user. This exists for standard commands like \tableofcontents but I can't figure out how to get it for personalized commands.

The problem is that LyX assume that there is at least one argument and shows a box next to the label. For instance, adding the following lines to the local format of some LyX document

Format 60

AddToPreamble
    \usepackage{siunitx}
EndPreamble

InsetLayout Flex:metre
    LyXType     custom
    LabelString "m"
    LatexType   Command
    LatexName   metre
    Decoration  classic
End

will provide an entry "metre" in the insert menu, as expected, and when used it will show a red box at the right of the "m" label, where the user could add some text or other material as shown below.

"m" label followed by a red box

I could not find how to get rid of this useless red box in the LyX customization guide section on inset layouts. The LaTeX command \metre doesn't require any argument, so should the LyX inset.

The idea behind this is to prevent the user to type any ERT in the document, and to have all the needs in the UI.

0

I came across "Math macros" which provide something similar. They only work in math environments and you have to type a latex-like command "\mymacro". But once you typed the macro, they show their definition instead of the latex command.

I use this as a work-around, since I was facing the same problem as you.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.