O'Reilly logo

LaTeX Beginners Guide by Stefan Kottwitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating our first command using it as anabbreviation

We will define a short command printing out the name of the TeX Users Group:

  1. Type this code into a new document:
    \documentclass{article}
    \newcommand{\TUG}{TeX Users Group}
    \begin{document}
    \section{The \TUG}
    The \TUG\ is an organization for people who are interested in \TeX\ or \LaTeX.
    \end{document}
  2. Typeset and look at the result:
    Time for action – creating our first command using it as anabbreviation

What just happened?

\newcommand in the highlighted line defines our command. The first argument is the name we chose for it, and the second argument is the text we want it to put out in the document.

Now, whenever we type \TUG in our document, the complete ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required