How to make LyX math macros available across documents?

Tobias Hilbricht hilbricht at linopus.de
Fri Aug 6 09:52:50 UTC 2021


Dear readers of this list,

in my worksheets in chemistry I have to write chemical formulas and
physical quantities very often. But while that is very easy to do in
LyX out of the box with chemical formulas due to the integration of
mhchem and its macro \ce, I am still trying to achieve something
similar for physical quantities with siunitx and its macro \qty.

What I have so far is a working LyX math macro (in LyX Ctrl+M on
\newcommand{\mqty}[2]{\qty{#1}{#1}}) which I can invoke with a keyboard
shortcut (Alt+Q for "command-sequence math-insert \mqty; char-left;
char-left").

But I have to copy this custom LyX macro from document to document
(siunitx loaded, of course). By contrast, I can invoke the macro \ce in
math mode with a keyboard shortcut without further ado in every
document and enjoy the immediate preview and avoid ERT.

How is it possible to have custom macros available across documents in
the same way?

Thanks for helpful hints in advance!

Yours
Tobias

    



More information about the lyx-users mailing list