Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
LaTeX Beginner's Guide

You're reading from   LaTeX Beginner's Guide When there‚Äôs a scientific or technical paper to write, the versatility of LaTeX is very attractive. But where can you learn about the software? The answer is this superb beginner‚Äôs guide, packed with examples and explanations.

Arrow left icon
Product type Paperback
Published in Mar 2011
Publisher Packt
ISBN-13 9781847199867
Length 336 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Table of Contents (21) Chapters Close

LaTeX
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with LaTeX FREE CHAPTER 2. Formatting Words, Lines, and Paragraphs 3. Designing Pages 4. Creating Lists 5. Creating Tables and Inserting Pictures 6. Cross-Referencing 7. Listing Content and References 8. Typing Math Formulas 9. Using Fonts 10. Developing Large Documents 11. Enhancing Your Documents Further 12. Troubleshooting 13. Using Online Resources Pop Quiz Answers Index

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:

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 name will appear. If we later decide to change the name or its formatting, we just need to change this \newcommand line. Then it will be applied for the complete document.

You may use formatting commands inside your command definition. Let's say you would like to change the formatting of all occurrences of this name to be typeset in small caps...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime