LyXMakros for text

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
gandi
Posts: 23
Joined: Tue Oct 20, 2009 2:45 pm

Makros for text

Post by gandi »

Is it possible to define makros for text (rather than for math mode) together with formatting? I'm thinking of things like "et al." (in italics) or formulae of chemical compounds which are tedious to write.

Of course one could use MathMacros and \textrm, but that looks like a dodgy workaround to me. Using ERT isn't very satisfying either.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
ihiribar
Posts: 4
Joined: Wed Mar 10, 2010 5:30 pm

Makros for text

Post by ihiribar »

you could do something like

Code: Select all

\newcommand{\etal}{\textit{et al.}}
...
Santa \etal have written an article
... 
and Claus \etal made the pictures
the command \etal will simply be substituted with the text between {...} everytime it is used
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Makros for text

Post by phi »

ihiribar wrote:you could do something like

Code: Select all

\newcommand{\etal}{\textit{et al.}}
...
Santa \etal have written an article
... 
and Claus \etal made the pictures
This will gobble the space after the command name. You have to use "\etal\ " or the xspace package.
gandi
Posts: 23
Joined: Tue Oct 20, 2009 2:45 pm

Re: Makros for text

Post by gandi »

Thanks, ihiribar, but that still only works with ERT. I was looking for something a bit more "LyX-style", where you can actually see in LyX what it's finally going to look like, rather than the LaTeX macro.
Post Reply