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 ...

Get LaTeX Beginners Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.