Error in latex command \def … “Undefined control sequence”

latex

I have the following Latex code, which defines the \fmiso command with the command \def, but it seems that this definition does not work.
What is wrong?

...

\usepackage{epsfig}
\usepackage{subfigure}
\usepackage{calc}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{multicol}
\usepackage{pslatex}
\usepackage{apalike}
\usepackage{SCITEPRESS}    
\graphicspath{ {images/} }

\subfigtopskip=0pt
\subfigcapskip=0pt
\subfigbottomskip=0pt

\def\fmiso{\mbox{FMI-S$_O$}\xspace}
\def\fmis{\mbox{FMI-S}\xspace}


\begin{document}

...

which is the model implemented in \fmiso

...

Then I am getting the error:

Undefined control sequence... which is the model implemented in \fmiso

What am I doing wrong?

Best Answer

Another case of TeX's error messages being cryptic. I'm getting this full error:

! Undefined control sequence.
\fmiso ->\mbox {FMI-S$_O$}\xspace 

l.28 wich is the model impletented in \fmiso

So (at least for me, in this minimal example), \fmiso gets expanded just fine. The "undefined control sequence" is always the last one on the line printed, in this case \xspace.

This is a bit clearer if we add another command inside the \fmiso definition, which is then shifted to the next line:

! Undefined control sequence.
\fmiso ->\mbox {FMI-S$_O$}\xspace 
                                 \TeX

I could resolve it simply by adding:

\usepackage{xspace}

Aside: in LaTeX, it's better to use LaTeX to define new commands:

\newcommand{\fmiso}{\mbox{FMI-S$_O$}\xspace}
Related Topic