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.
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.