\x1
and \x2
to save typing time. One try uses the standard \newcommand
and the other the TeX \def but both fails. Using may questions, I am unable to get some help from Google. Unfortunately The TeXBook's chapter 20---with all those bends and double-bends---is too difficult for me to follow.Below please find the two cases which both fail. The error message is included at the beginning as a LaTeX comment.
Hopefully someone could help me out of this trouble.
Regards,
ChG
First try:
Code: Select all
Code, edit and compile here:
%% ! LaTeX Error: \mathbf allowed only in math mode.% ...% l.6 \newcommand{\x1}{\mathbf{x}_1}%\documentclass[12pt,a4paper]{article}\begin{document}\pagestyle{empty}\newcommand{\x1}{\mathbf{x}_1}\newcommand{\x2}{\mathbf{x}_2}\begin{displaymath}\x1+\x2\end{displaymath}\end{document}
Code: Select all
Code, edit and compile here:
% ! Use of \x doesn't match its definition.% l.9 \x1% +\x2\documentclass[12pt,a4paper]{article}\def\x1{\mathbf{x}_1}\def\x2{\mathbf{x}_2}\begin{document}\pagestyle{empty}\begin{displaymath}\x1+\x2\end{displaymath}\end{document}