How to make LyX math macros available across documents?

Richard Kimberly Heck rikiheck at lyx.org
Sat Aug 7 14:52:46 UTC 2021


On 8/6/21 5:52 AM, Tobias Hilbricht wrote:
> 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?

I have several child documents containing different sorts of macros I
use for different purposes. If I need one, then I just include it.

Riki




More information about the lyx-users mailing list