I'm trying to define a LyX macro, Insert -> Math -> Macro on the menus. It's a very simple macro. Source code under View -> View Source:
\global\long\def\Z{\mathbb{Z}}
The file compiles nicely if I don't use the macro. However, once I put a \Z
inside a Math formula and try to compile, it gives me an Undefined control sequence with the following error message:
! Undefined control sequence.
\Z ->\mathbb
{Z}
l.32 d$\Z
$
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
Now, the most peculiar thing is that I have used this exact same macro on other files, where it works perfectly.
In case it might be of any help, I'm using the article document class on LyX 2.0.0. Could it be that the document encoding or document class make a difference? Or maybe the document language setting?
A complete log of the LaTeX errors is available at this link.
Thanks!
\mathbb
. Do you load theamssymb
package?\global
and\long
are not doing anything for a top level definition with no arguments.\mathbb
is the undefined command, as I suspected. Neitheramssymb
noramsfonts
that would define it are loaded, according to the log. I really don't know how to coerce LyX into loadingamssymb
, but this is the thing you should try to do.amssymb
one can do either 1) Document --> Settings --> Math options, and check Use AMS Package, or 2) Document --> Settings --> LaTeX preamble, and add\usepackage{amssymb}
.