# LaTeX Beginner's Guide La Te X Stefan Kottwitz

User Manual: Pdf

Open the PDF directly: View PDF .
Page Count: 661

LaTeX

Beginner's Guide

LaTeX
Credits
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
What just happened?
Pop quiz
Have a go hero - heading
Customer support
Errata
Piracy
Questions
1. Getting Started with LaTeX
What is LaTeX?
How we can benefit
The virtues of open source
Separation of form and content
Portability
Comparing it to word processor software
What are the challenges?
Installing LaTeX
Time for action – installing TeX Live using the net installer wizard
What just happened?
Time for action – installing TeX Live offline
What just happened?
Installation on other operating systems

Creating our first document
Time for action – writing our first document with TeXworks
What just happened?
Have a go hero – checking out advanced LaTeX editors
Summary
2. Formatting Words, Lines, and Paragraphs
Understanding logical formatting
Time for action – titling your document
What just happened?
Exploring the document structure
Understanding LaTeX commands
Time for action – trying out the effect of spaces, line breaks, and empty
lines
What just happened?
Printing out special symbols
Time for action – writing special characters in our text
What just happened?
Formatting text – fonts, shapes, and styles
Time for action – tuning the font shape
What just happened?
Choosing the font family
Time for action – switching to sans-serif and to typewriter fonts
What just happened?
Switching fonts
Time for action – switching the font family
What just happened?
Summarizing font commands and declarations
Delimiting the effect of commands
Time for action – exploring grouping by braces
What just happened?
Time for action – exploring font sizes
What just happened?
Using environments
Time for action – using an environment to adjust the font size
What just happened?
Saving time and effort – creating your own commands
Time for action – creating our first command using it as anabbreviation
What just happened?
Gentle spacing after commands
Time for action – adding intelligent spacing to command output

What just happened?
Creating more universal commands – using arguments
Time for action – creating a macro for formatting keywords
What just happened?
Using optional arguments
Time for action – marking keywords with optional formatting
What just happened?
Pop quiz – commands
Have a go hero – saving effort using optional arguments
Using boxes to limit the width of paragraphs
Time for action – creating a narrow text column
What just happened?
Common paragraph boxes
Have a go hero – exploring further features of \parbox
Boxes containing more text
Time for action – using the minipage environment
What just happened?
Have a go hero – creating a footnote inside a minipage
Understanding environments
Breaking lines and paragraphs
Improving hyphenation
Time for action – stating division points for words
What just happened?
Have a go hero – exploiting the hyphenat package
Improving the justification further
Time for action – using microtype
What just happened?
Breaking lines manually
Time for action – using line breaks
What just happened?
Have a go hero – exploring line breaking options
Preventing line breaks
Managing line breaks wisely
Exploring the fine details
Time for action – exploring ligatures
What just happened?
Understanding ligatures
Choosing the right dash
Setting dots
Time for action – using differently spaced dots
What just happened?
Time for action – comparing dots to ellipsis

What just happened?
Setting accents
Time for action – experimenting with accents
What just happened?
Using special characters directly in the editor
Time for action – using accents directly
What just happened?
Turning off full justification
Time for action – justifying a paragraph to the left
What just happened?
Creating ragged-left text
Time for action – centering a title
What just happened?
Using environments for justification
Time for action – centering verses
What just happened?
Displaying quotes
Time for action – quoting a scientist
What just happened?
Quoting longer text
Time for action – quoting TeX's benefits
What just happened?
Time for action – spacing between paragraphs instead of indentation
What just happened?
Pop quiz – lines and paragraphs
Summary
3. Designing Pages
Defining the overall layout
Time for action – writing a book with chapters
What just happened?
Reviewing LaTeX's default page layout
Defining the margins yourself
Time for action – specifying margins
What just happened?
Using the geometry package
Choosing the paper size
Specifying the text area
Setting the margins
Obtaining package documentation
Time for action – finding the geometry package manual
What just happened?
Have a go hero – constructing the page layout with typearea

Changing the line spacing
Time for action – increasing line spacing
What just happened?
Have a go hero – examining a package source file
Using class options to configure the document style
Time for action – creating a two-column landscape document
What just happened?
Have a go hero – trying KOMA-Script classes
What just happened?
Sectioning and the contents
Time for action – shortening the table of content entries
What just happened?
Time for action – customizing headers with the fancyhdr package
What just happened?
Understanding page styles
Using decorative lines in header or footer
Breaking pages
Time for action – inserting page breaks
What just happened?
Have a go hero – exploring page breaking options
Enlarging a page
Time for action – sparing an almost empty page
What just happened?
Using footnotes
Time for action – using footnotes in text and in headings
What just happened?
Modifying the dividing line
Time for action – redefining the footnote line
What just happened?
Using packages to expand footnote styles
Pop quiz
Summary
4. Creating Lists
Building a bulleted list
Time for action – listing LaTeX packages
What just happened?
Nesting lists

Time for action – listing packages by topic
What just happened?
Creating a numbered list
Time for action – writing a step-by-step tutorial
What just happened?
Customizing lists
Saving space with compact lists
Time for action – shrinking our tutorial
What just happened?
Choosing bullets and numbering format
Time for action – modifying lists using enumitem
What just happened?
Suspending and continuing lists
Producing a definition list
Time for action – explaining capabilities of packages
What just happened?
Have a go hero – adjusting the dimensions of lists
Pop quiz
Summary
5. Creating Tables and Inserting Pictures
Writing in columns
Time for action – lining up information using the tabbing environment
What just happened?
Time for action – lining up font commands
What just happened?
Typesetting tables
Time for action – building a table of font family commands
What just happened?
Drawing lines in tables
Understanding formatting arguments
Increasing the row height
Beautifying tables
Time for action – adding nicer horizontal lines with the booktabs package
What just happened?
Have a go hero – adjusting lengths
Spanning entries over multiple columns
Time for action – merging cells
What just happened?
Inserting code column-wise
Time for action – using the array package
What just happened?
Spanning entries over multiple rows

Time for action – merging cells using the multirow package
What just happened?
Time for action – adding a caption to our font table
What just happened?
Placing captions above
Have a go hero – customizing captions
Auto-fitting columns to the table width
Generating multi-page tables
Coloring tables
Using landscape orientation
Aligning columns at the decimal point
Handling narrow columns
Pop quiz – tables
Inserting pictures
Time for action – including a picture
What just happened?
Scaling pictures
Choosing the optimal file type
Including whole pages
Putting images behind the text
Managing floating environments
Time for action – letting a figure float
What just happened?
Understanding float placement options
Forcing the output of floats
Limiting floating
Avoiding floating at all
Spanning figures and tables over text columns
Letting text flow around figures
Time for action – embedding a picture within text
What just happened?
Breaking figures and tables into pieces
Pop quiz – pictures and floats
Summary
6. Cross-Referencing
Setting labels and referencing
Time for action – referencing items of a top list
What just happened?
Assigning a key
Referring to a key
Referring to a page

Producing intelligent page references
Time for action – introducing variable references
What just happened?
Fine-tuning page references
Referring to page ranges
Using automatic reference names
Time for action – referring cleverly
What just happened?
Combing cleveref and varioref
Referring to labels in other documents
Have a go hero – turning references into hyperlinks
Pop quiz
Summary
7. Listing Content and References
What just happened?
Adjusting the depth of the TOC
Shortening entries
Creating and customizing lists of figures
Time for action – creating a list of diagrams
What just happened?
Creating a list of tables
Using packages for customization
Generating an index
Time for action – marking words and building the index
What just happened?
Defining index entries and subentries
Specifying page ranges
Using symbols and macros in the index
Referring to other index entries
Fine-tuning page numbers
Designing the index layout
Creating a bibliography
Time for action – citing texts and listing the references
What just happened?
Using the standard bibliography environment
Using bibliography databases with BibTeX
Time for action – creating and using a BibTeX database
What just happened?
Looking at the BibTeX entry fields

Understanding BibTeX entry types
Choosing the bibliography style
Listing references without citing
Have a go hero – using natbib
Pop quiz
Summary
8. Typing Math Formulas
Writing basic formulas
Time for action – discussing quadratic equations and roots
What just happened?
Embedding math expressions within text
Displaying formulas
Numbering equations
Extracting roots
Writing fractions
Greek letters
Script letters
Producing an ellipsis
Comparing in-line formulas to displayed formulas
Changing the font, style, and size
Customizing displayed formulas
Time for action – typesetting multi-line formulas
What just happened?
Aligning multi-line equations
Numbering rows in multi-line formulas
Inserting text into formulas
Fine-tuning formulas
Using operators
Exploring the wealth of math symbols
Binary operation symbols
Binary relation symbols
Inequality relation symbols
Subset and superset symbols
Variable sized operators
Arrows
Harpoons
Symbols derived from letters
Variable sized delimiters
Miscellaneous symbols
Writing units

Building math structures
Creating arrays
Writing binomial coefficients:
Typesetting matrices
Stacking expressions
Underlining and overlining
Setting accents
Putting a symbol above another
Writing theorems and definitions
Have a go hero – checking out the mathtools package
Pop quiz
Summary
9. Using Fonts
Preparing the encoding
Time for action – directly using special characters
What just happened?
Choosing the main font
Time for action – comparing Computer Modern to Latin Modern
What just happened?
Latin Modern – a replacement for the standard font
Kp-fonts – a full set of fonts
Serif fonts
Times Roman
Charter
Palatino
Bookman
New Century Schoolbook
Concrete Roman
Sans-serif fonts
Helvetica
Bera Sans
Computer Modern Bright
Kurier
Typewriter fonts
Courier
Inconsolata
Bera Mono
Exploring the world of LaTeX fonts
Pop quiz
Summary

10. Developing Large Documents
Splitting the input
Time for action – swapping out preamble and chapter contents
What just happened?
Including small pieces of code
Including bigger parts of a document
Compiling parts of a document
Creating front and back matter
Time for action – adding a dedication and an appendix
What just happened?
Designing a title page
Time for action – creating a title page
What just happened?
Working with templates
Time for action – starting with a template
What just happened?
Have a go hero – evaluating and enhancing templates
Pop quiz
Summary
What just happened?
Time for action – customizing the hyperlink appearance
What just happened?
Time for action – editing PDF metadata
What just happened?
Creating bookmarks manually
Math formulas and special symbols in bookmarks
Benefitting from other packages
Time for action – visiting the TeX Catalogue Online
What just happened?
Time for action – installing a LaTeX package
What just happened?
Time for action – designing chapter and section headings
What just happened?
Have a go hero – creating colorful tables
Pop quiz
Summary

12. Troubleshooting
Understanding and fixing errors
Time for action – interpreting and fixing an error
What just happened?
Using commands and environments
Writing math formulas
Handling the preamble and document body
Working with files
Creating tables and arrays
Working with lists
Working with floating figures and tables
General syntax errors
Handling warnings
Time for action – emphasizing on a sans-serif font
What just happened?
Justifying text
Referencing
Choosing fonts
Placing figures and tables
Customizing the document class
Avoiding obsolete classes and packages
General troubleshooting
Have a go hero – examining LaTeX's log files
Pop quiz – troubleshooting
Summary
13. Using Online Resources
Web forums, discussion boards, and Q&A sites
Usenet groups
comp.text.tex
Newsgroups in other languages
Web forums
LaTeX-Community.org
TeX and LaTeX on Stack Exchange
Time for action – asking a question online
What just happened?
UK TeX FAQ
Visual LaTeX FAQ
MacTeX FAQ
AMS-Math FAQ
LaTeX Picture FAQ
Mailing lists

texhax
tex-live
texworks
List collections
TeX user group sites
TUG – the TeX users group
The LaTeX project
UK TUG – TeX in the United Kingdom
Local user groups
Homepages of LaTeX software and editors
LaTeX distributions
LaTeX editors
Cross-platform
Windows
Linux
Mac OS X
LaTeX archives and catalogs
CTAN – the Comprehensive TeX Archive Network
The TeX Catalogue Online
The LaTeX Font Catalogue
TeX Resources on the Web
Friends of LaTeX
XeTeX
LuaTeX
ConTeXt
LyX
LaTeX blogs
The TeXblog
Some TeX Developments
LaTeX Alive
LaTeX for Humans
The TeX community aggregator
Summary
Chapter 2: Formatting Words, Lines, and Paragraphs
Commands
Lines and paragraphs
Chapter 3: Designing Pages
Chapter 4: Creating Lists
Chapter 5: Creating Tables and Inserting Pictures
Tables
Pictures and floats

Chapter 6: Cross-Referencing
Chapter 7: Listing Content and References
Chapter 8: Typing Math Formulas
Chapter 9: Using Fonts
Chapter 10: Developing Large Documents
Chapter 11: Enhancing Your Documents Further
Chapter 12: Troubleshooting
Index

LaTeX

Beginner's Guide

LaTeX
Beginner's Guide
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
the companies and products mentioned in this book by the appropriate use of
capitals. However, Packt Publishing cannot guarantee the accuracy of this
information.
First published: March 2011
Production Reference: 1150311
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-847199-86-7
www.packtpub.com
Cover Image by Asher Wishkerman ()

Credits
Author
Stefan Kottwitz
Reviewers
Kevin C. Klement
Joseph Wright
Acquisition Editor
Eleanor Duffy
Development Editor
Hyacintha D'Souza
Technical Editor
Sakina Kaydawala
Copy Editor
Leonard D'Silva
Indexer
Hemangini Bari
Mithun Sehgal
Lata Basantani
Project Coordinator
Vishal Bodwani
Aaron Nash
Graphics
Nilesh Mohite
Production Coordinator

Cover Work

Stefan Kottwitz studied mathematics in Jena and Hamburg. Afterwards, he
worked as an IT Administrator and Communication Officer onboard cruise ships
for AIDA Cruises and for Hapag-Lloyd Cruises. Following 10 years of sailing
around the world, he is now employed as a Network & IT Security Engineer for
AIDA Cruises, focusing on network infrastructure and security such as managing
firewall systems for headquarters and fleet.
In between contracts, he worked as a freelance programmer and typography
designer. For many years he has been providing LaTeX support in online forums.
He became a moderator of the web forum http://latex-community.org/ and of the
site http://golatex.de/. Recently, he began supporting the newly established Q&A
site http://tex.stackexchange.com/ as a moderator.
He publishes ideas and news from the TeX world on his blog at http://texblog.net.
I would like to thank Joseph Wright and Kevin C. Klement for reviewing this
book. Special thanks go to Markus Kohm for his great valuable input. I would
also like to thank the people of Packt Publishing, who worked with me on this
book, in particular my development editor Hyacintha D'Souza.

Kevin C. Klement is an Associate Professor of Philosophy at the University of
Massachusetts, Amherst. Besides using LaTeX in his academic work in the
history of logic and analytic philosophy, he is a maintainer of the PhilTeX blog,
and an active participant in many online LaTeX communities, including PhilTeX,
LaTeX Community, and TeX.SE.
Joseph Wright is a research assistant at the University of East Anglia. As well as
using LaTeX for his academic work as a chemist, he is a member of the LaTeX3
Project, runs the blog Some TeX Developments and is one of the moderators on
the TeX.SE site.

www.PacktPub.com

Support files, eBooks, discount offers,
and more
Did you know that Packt offers eBook versions of every book published, with
PDF and ePub files available? You can upgrade to the eBook version at
www.PacktPub.com and as a print book customer, you are entitled to a discount
on the eBook copy. Get in touch with us at  for more
details.
At www.PacktPub.com, you can also read a collection of free technical articles,
on Packt books and eBooks.

http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online
digital book library. Here, you can access, read, and search across Packt's entire
library of books.

Why Subscribe?
Copy and paste, print, and bookmark content
On demand and accessible via web browser

Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to
access PacktLib today and view nine entirely free books. Simply use your login
credentials for immediate access.

Preface
LaTeX is a high-quality open source typesetting software that produces
professional prints and PDF files. However, as LaTeX is a powerful and
complex tool, getting started can be intimidating. There is no official support and
certain aspects such as layout modifications can seem rather complicated. It may
seem more straightforward to use Word or other WYSIWG programs, but once
you've become acquainted, LaTeX's capabilities far outweigh any initial
difficulties. This book guides you through these challenges and makes beginning
with LaTeX easy. If you are writing mathematical, scientific, or business papers,
then this is the perfect book for you.
LaTeX Beginner's Guide offers you a practical introduction to LaTeX. Beginning
with the installation and basic usage, you will learn to typeset documents
containing tables, figures, formulas, and common book elements like
fine-tuning text, formulas and page layout and go on to managing complex
documents and using modern PDF features. It's easy to use LaTeX, when you have
LaTeX Beginner's Guide at hand.
This practical book will guide you through the essential steps of Latex, from
installing LaTeX, formatting, and justification, to page design. Finally, you will
learn how to manage complex documents and how to benefit from modern PDF
features. Right from the beginning, you will learn to use macros and styles to
maintain a consistent document structure while saving typing work. This book
will help you learn to create professional looking tables as well as include
figures and write complex mathematic formulas. You will see how to generate
bibliographies and indexes with ease. Detailed information about online
resources like software archives, web forums, and online compilers complement
this introductory guide.

What this book covers
Chapter 1, Getting Started with LaTeX, introduces LaTeX and explains its
benefits. It guides you through the download and installation of a comprehensive
LaTeX distribution and shows you how to create your first LaTeX document.
Chapter 2, Formatting Words, Lines, and Paragraphs, explains how to vary font,
shape, and style of text. It deals with centering and justification of paragraphs and
how you can improve line breaks and hyphenation. It introduces the concept of
logical formatting and teaches you how to define macros and how to use
environments and packages.
Chapter 3, Designing Pages, shows how you can adjust the margins and change
the line spacing. It demonstrates portrait, landscape, and two-column layout. In
this chapter, we will create dynamic headers and footers and learn how to control
page breaking and how to use footnotes. Along the way, you will also learn about
redefining existing commands and using class options. Furthermore, you will get
familiar with accessing package documentation.
Chapter 4, Creating Lists, deals with arranging text in bulleted, numbered, and
definition lists. We will learn how to choose bullets and numbering style and how
to design the overall layout of lists.
Chapter 5, Creating Tables and Inserting Pictures , shows you how to create
professional-looking tables and how to include external pictures in your
documents. It deals with typesetting captions to tables and figures. We will learn
how to benefit from LaTeX's automated tables and figures placement and how to
fine-tune it.
Chapter 6, Cross-Referencing, introduces means of intelligent referencing to
sections, footnotes, tables, figures, and numbered environments in general.
Chapter 7, Listing Content and References, deals with creating and customizing
to cite books, how to create bibliographies, and how to generate an index.
Chapter 8, Typing Math Formulas, explains mathematical typesetting in depth. It
starts with basic formulas and continues with centered and numbered equations. It
shows how to align multi-line equations. In detail, it shows how to typeset math
symbols such as roots, arrows, Greek letters, and operators. Moreover, you will
learn how to build complex math structures such as fractions, stacked
expressions, and matrices.
Chapter 9, Using Fonts, takes us into the world of fonts and demonstrates various
fonts for Roman, sans-serif, and typewriter fonts in different shapes. By the way,

you will learn about character encoding and font encoding.
Chapter 10, Developing Large Documents, helps in managing large documents by
splitting them into several files. It shows how to swap out settings, how to reuse
code, and how to compile just parts of a bigger documents. After reading this
chapter, you will be able to create complex projects building upon sub-files.
Furthermore, we deal with front matter and back matter with different page
numbering and separate title pages. We will work it out by creating an example
book. By doing this, you will get familiar with using document templates, finally
being able to write our own thesis, book, or report.
Chapter 11, Enhancing Your Documents Further , brings color into your
documents. It shows you how to modify headings of chapters and all kinds of
sections. We will learn how to create feature-rich PDF documents with
bookmarks, hyperlinks, and meta-data. While doing this, we visit the TeX
Catalogue Online to look out for further useful LaTeX packages and we will go
through a package installation.
Chapter 12, Troubleshooting, provides us with tools for problem-solving. We
will learn about different kinds of LaTeX's errors and warnings and how to deal
with them. After reading this chapter, you will understand LaTeX's messages and
you will know how to use them for fixing errors.
Chapter 13, Using Online Resources, guides you through the vast amount of
LaTeX information on the Internet. We will visit a LaTeX online forum and a
LaTeX Question & Answer site. This chapter points the way to huge LaTeX
software archives, to homepages of TeX user groups, to mailing lists, Usenet
groups, and LaTeX blogs. It tells you where you can download LaTeX capable
editors and where you can find enhanced versions of TeX, such as XeTeX,
LuaTeX, and ConTeXt. Finally, you will know how to access the knowledge of
the world-wide LaTeX community and how to become a part of it.

What you need for this book
You need access to a computer with LaTeX on it. An online connection would be
operating systems, so you can use Windows, Linux, Mac OS X, or Unix.
This book uses the freely available TeX Live distribution, which runs on all
mentioned platforms. You just need an online connection or the TeX Live DVD to
install it. In the book, we work with the cross-platform editor TeXworks, but you
could use any editor you like.

Who this book is for
If you are about to write mathematical or scientific papers, seminar handouts, or
even plan to write a thesis, then this book offers you a fast-paced and practical
introduction. Particularly when studying in school and university you will benefit
a lot, as a mathematician and a physicist as well as an engineer or a humanist.
Everybody with high expectations who plans to write a paper or a book may be
delighted by this stable software.

Conventions
In this book, you will find several headings appearing frequently. To give clear
instructions of how to complete a procedure or task, we use:

1. Action 1
2. Action 2
3. Action 3
Instructions often need some extra explanation so that they make sense, so they are
followed with:

What just happened?
This heading explains the working of tasks or instructions that you have just
completed.
You will also find some other learning aids in the book, including:

Pop quiz
understanding.

Have a go hero - heading
These set practical challenges and give you ideas for experimenting with what
you have learned.
You will also find a number of styles of text that distinguish between different
kinds of information. Here are some examples of these styles, and an explanation
of their meaning.
Code words in text are shown as follows: "The command \chapter produced a
large heading. This command will always begin on a new page."
A block of code is set as follows:
\documentclass[a4paper,12pt]{book}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\chapter{Exploring the page layout}
In this chapter we will study the layout of pages.
\section{Some filler text}
\blindtext
\section{A lot more filler text}
More dummy text will follow.
\subsection{Plenty of filler text}
\blindtext[10]
\end{document}

When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
\documentclass[a4paper,11pt]{book}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage[a4paper, inner=1.5cm, outer=3cm, top=2cm,
bottom=3cm, bindingoffset=1cm]{geometry}
\begin{document}
\chapter{Exploring the page layout}
In this chapter we will study the layout of pages.
\section{Some filler text}
\blindtext
\section{A lot more filler text}
More dummy text will follow.
\subsection{Plenty of filler text}
\blindtext[3]
\end{document}

Any command-line input or output is written as follows:
texdoc geometry

New terms and important words are shown in bold. Words that you see on the

screen, in menus or dialog boxes for example, appear in the text like this: "Save
the document and Typeset it."

Note
Warnings or important notes appear in a box like this.

Tip
Tips and tricks appear like this.

Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important
for us to develop titles that you really get the most out of.
To

send

us

general

feedback, simply send an e-mail to
, and mention the book title via the subject of your
message.
If there is a book that you need and would like to see us publish, please send us a
note in the SUGGEST A TITLE form on www.packtpub.com or e-mail
.
If there is a topic that you have expertise in and you are interested in either
writing or contributing to a book on, see our author guide on
www.packtpub.com/authors.

Customer support
Now that you are the proud owner of a Packt book, we have a number of things to

You can download the example code files for all Packt books you have purchased
from your account at http://www.PacktPub.com. If you purchased this book
elsewhere, you can visit http://www.PacktPub.com/support and register to have
the files e-mailed directly to you.

Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text
or the code—we would be grateful if you would report this to us. By doing so,
you can save other readers from frustration and help us improve subsequent
versions of this book. If you find any errata, please report them by visiting
http://www.packtpub.com/support, selecting your book, clicking on the errata
verified, your submission will be accepted and the errata will be uploaded on our
website, or added to any list of existing errata, under the Errata section of that
title. Any existing errata can be viewed by selecting your title from
http://www.packtpub.com/support.

Piracy
Piracy of copyright material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very
seriously. If you come across any illegal copies of our works, in any form, on the
immediately so that we can pursue a remedy.
pirated material.
We appreciate your help in protecting our authors, and our ability to bring you
valuable content.

Questions
with any aspect of the book, and we will do our best to address it.

Chapter 1. Getting Started with
LaTeX
Are you ready to leave those "what you see is what you get" word processors
behind and to enter the world of real, reliable, and high-quality typesetting?
Then let's go together!
It's great that you decided to learn LaTeX. This book will guide you along the
and the challenges, and then we shall prepare our tools.
In this chapter, we will:
Get to know LaTeX and talk about the pros and cons compared to word
processors
Install a complete LaTeX software bundle, including an editor
Write our first LaTeX document
So, let's get started.

What is LaTeX?
LaTeX is a software for typesetting documents. In other words, it's a document
preparation system. LaTeX is not a word processor, but is used as a document
markup language.
LaTeX is a free, open source software. It was originally written by Leslie
Lamport and is based on the TeX typesetting engine by Donald Knuth. People
often refer to it as just TeX, meaning LaTeX. It has a long history; you can read
about it at http://www.tug.org/whatis.html. For now, let's continue by looking at
how we can make the best use of it.

How we can benefit
LaTeX is especially well-suited for scientific and technical documents. Its
superior typesetting of mathematical formulas is legendary. If you are a student or
a scientist, then LaTeX is by far the best choice, and even if you don't need its
scientific capabilities, there are other uses — it produces very high quality output,
it is extremely stable, and handles complex documents easily no matter how large
they are.
Further remarkable strengths of LaTeX are its cross-referencing capabilities, its
automatic numbering and generation of lists of contents, figures and tables,
indexes, glossaries, and bibliographies. It is multilingual with language-specific
features, and it is able to use PostScript and PDF features.
Apart from being perfect for scientists, LaTeX is incredibly flexible—there are
templates for letters, presentations, bills, philosophy books, law texts, music
scores, and even for chess game notations. Hundreds of LaTeX users have written
thousands of templates, styles, and tools useful for every possible purpose. It is
collected and categorized online on archiving servers.
You could benefit from its impressive high quality by starting with its default
styles relying on its intelligent formatting, but you are free to customize and to
modify everything. People of the TeX community have already written a lot of
extensions addressing nearly every formatting need.

The virtues of open source
The sources of LaTeX are completely free and readable for everyone. This
enables you to study and to change everything, from the core of LaTeX to the
latest extension packages. But what does this mean for you as a beginner? There's
a huge LaTeX community with a lot of friendly, helpful people. Even if you
cannot benefit from the open source code directly, they can read the sources and
assist you. Just join a LaTeX web forum and ask your questions there. Helpers
will, if necessary, dig into LaTeX sources and in all probability find a solution
for you, sometimes by recommending a suitable package, often providing a
redefinition of a default command.
Today, we're already profiting from about 30 years of development by the TeX
community. The open source philosophy made it possible, as every user is invited
to study and improve the software and develop it further. Chapter 13, Using
Online Resources, will point the way to the community.

Separation of form and content
A basic principle of LaTeX is that the author should not be distracted too much by
the formatting issues. Usually, the author focuses on the content and formats
logically, for example, instead of writing a chapter title in big bold letters, you
just tell LaTeX that it's a chapter heading—you could let LaTeX design the
heading or you decide in the document's settings what the headings will look like
—just once for the whole document.
LaTeX uses style files extensively called classes and packages , making it easy
to design and to modify the appearance of the whole document and all of its
details.

Portability
LaTeX is available for nearly every operating system, like Windows, Linux, Mac
OS X, and many more. Its file format is plain text—readable and editable, on all
operating systems. LaTeX will produce the same output on all systems. Though
there are different LaTeX software packages, so called TeX distributions , we
will focus on TeX Live , because this distribution is available for Windows,
Linux, and Mac OS X.
LaTeX itself doesn't have a graphical user interface; that's one of the reasons why
it's so portable. You can choose any text editor. There are many editors, even
specialized in LaTeX, for every operating system. Some editors are available for
several systems. For instance, TeXworks runs on Windows, Linux, and Mac OS
X; that's one of the reasons why we will use it in our book. Another very
important reason is that it's probably best-suited for beginners.
LaTeX generates PDF output—printable and readable, on most computers and
looks identical regardless of the operating system. Besides PDF, it supports DVI,
PostScript, and HTML output, preparing the ground for distribution both in print
and online, on screen, electronic book readers, or smart phones.
To sum up, LaTeX is portable in three ways—source, its implementation, and
output.

LaTeX documents are stored in human readable text format, not in some obscure
word processing format, that may be altered in a different version of the same
software. Try to open a 20 year old document written with a commercial word
processor. What might your modern software show? Even if you can read the file,
its visual appearance would certainly be different than before. LaTeX promises
that the document will always be readable and will result in the same output.
Though it's being further developed, it will remain backwards compatible.
Word processor documents could be infected with viruses, malicious macros
could destroy the data. Did you ever hear of a virus "hiding" in a text file? LaTeX
is not threatened by viruses.

Comparing it to word processor software
compared to word processing software. While LaTeX encourages structured
writing, other word processors may compel you to work inconsistently. They
might hide the real formatting structure and encrypt your document in some
proprietary file format. Compatibility is a big problem, even between versions of
the same software.
There are some interesting articles available online comparing LaTeX to other
software. Of course, they are expressions of opinion. Some are years old and
therefore do not cover the most recent software, but they discuss important points
that are still valid today. You will find them listed in Chapter 13, Using Online
Resources.

What are the challenges?
The learning curve could be steep, but this book will to help you master it.
Though writing LaTeX looks like programming, don't be afraid. Soon you will
know the frequently used commands. Text editors with auto completion and
keyword highlighting will support you. They might even provide menus and
dialogs with commands for you.
Do you now think it will take a long time until you would learn to achieve
creditable results? Don't worry; this book will give you a quick start. You will
learn by practicing with a lot of examples. Many more examples can be read and
downloaded from the Internet. In Chapter 13, we will explore the Internet
resources.
We shall continue with the setup of LaTeX on our computer.

Installing LaTeX
Let's start off with the installation of the LaTeX distribution–TeX Live . This
distribution is available for Windows, Linux, Mac OS X, and other Unix-like
operating systems. TeX Live is well maintained and it is being actively
developed.

Note
Another very good and user-friendly LaTeX distribution for Windows is
MiKTeX. It's easy to install like any other Windows application, but it's not
available for other systems like Linux or Mac OS X. You can download it from
http://miktex.org.
At first, we will visit the TeX Live homepage and take a survey of the installation
possibilities. Feel free to explore the homepage in depth to study the information
offered there.
Open the TeX Live homepage at http://tug.org/texlive.

We will cover two ways of installation. The first will be online and requires an

Internet connection. The other method starts with a huge download, but may be
finished offline.
Let's check out the two installation methods.

Time for action – installing TeX Live
using the net installer wizard
We will download the TeX Live net installer and install the complete TeX Live
distribution on our computer.
1. Click

over

the

net
http://tug.org/texlive/acquire-netinstall.

or

navigate

to

3. Extract the file install-tl.zip using your favorite archiving program. For
example, WinZip, WinRar, or 7-Zip can do it for you.
4. Open the folder install-tl-* and double-click the Windows batch file
install-tl:

5. The net installer will automatically detect your language. If it's showing the
wrong language, you can force the choice of the language using the lang
option at the command prompt such as install-tl –lang=en:

6. The installation wizard will pop up, as shown in the following screenshot:

7. Click on the Next button, now it offers to change the installation folder, but
it's fine to retain it. In our book, we will refer to this default location:

8. Click on the Next button. As shown in the following screenshot, choose one
of the options, for example, for the creation of shortcuts:

9. Click on the Next button. You can then confirm the settings and actually start
the installation by clicking on the Install button:

10. The next screenshot shows how you can monitor the installation progress:

11. Finally, click on the Finish button and you're done.

What just happened?
You have completed the installation of TeX Live 2010. Now your Start menu
contains a folder called TeX Live 2010 containing six programs:

DVIOUT DVI viewer—a viewer program for the classic LaTeX output
format DVI. Today, most people choose PDF output, so you probably won't
need it.
PS_VIEW—a viewer program for the PostScript format; again you probably
won't need it, except if you would like to use the PostScript language or read
such documents.
TeX Live documentation—well, that's useful regarding setup and use of
TeX Live Manager—that's your tool for package management, for example,
installation and update of LaTeX packages.
amount of LaTeX-related information. There's a lot of it stored in your
computer by now. Use it to gather information whenever needed; it could be
quicker than searching online.
TeXworks editor—this is an editor developed to create LaTeX documents
comfortably. We will make extensive use of it.

Note
TeXworks is also shipped with MiKTeX 2.8 and higher.
If you would like to stay in control over what should be installed on your

users.
Now, we will go through the offline installation of TeX Live 2010.

Time for action – installing TeX Live
offline
We will download a compressed ISO image of TeX Live 2010 with a size of
about 1.2 gigabytes. After extraction, we can choose to burn it on DVD or to
extract it to our hard disk drive and run the installation from there:
especially if your Internet connection is not stable.
3. Extract texlive2010.xz and you will get the file texlive2010.iso. If
your archiving program doesn't support the .xz file format, obtain, for
instance, the program 7-Zip version 9 or later from http://7zip.org and use it
for extraction.
4. Either burn the ISO file on a DVD using a burning software supporting the
ISO format or extract it to your hard disk drive. 7-Zip is also capable of
doing that for you.
5. Among the extracted files or on your DVD, you will find the installer batch
Choose one, start it, and go through the installation like in the previous
installation.

What just happened?
It was similar to the first installation, but this time you've got all the data and you
recommended if it's foreseeable that you will do another installation of TeX Live
later or if you would like to give it to friends or colleagues.

Note
After an offline installation, it's recommended to run an update of TeX Live soon,
because packages on a DVD or within an image could already be outdated. Use
the TeX Live Manager to keep your system up-to-date if you are connected to the
Internet.

Installation on other operating systems
If you work on Mac OS X, you may download a customized version of TeX Live
it to install.
On most Linux systems, installation is easy. Use your system's package manager.
With Ubuntu, you may use Synaptic, on SUSE systems use YaST, with Red Hat a
RPM frontend, and on Debian systems use Aptitude. In the respective package
manager, look out for texlive.
If you want to stay on the edge, you could download and install the most current
version of TeX Live from its homepage, instead of the version from the operating
system's repositories. But be aware that installing third party sources may harm
Now that we've prepared the ground, let's start to write LaTeX!

Creating our first document
We have installed TeX and launched the editor; now let's jump in at the deep end
by writing our first LaTeX document.

Time for action – writing our first
document with TeXworks
Our first goal is to create a document that's printing out just one sentence. We
want to use it to understand the basic structure of a LaTeX document.
1. Launch the TeXworks editor by clicking on the desktop icon or open it in the
2. Click on the New button.
3. Enter the following lines:
\documentclass{article}
\begin{document}
This is our first document.
\end{document}

4. Click on the Save button and save the document. Choose a location where
you want to store your LaTeX documents, ideally in its own folder.
5. In the drop-down field in the TeXworks toolbar, choose pdfLaTeX:

6. Click the Typeset button
.
7. The output window will automatically open. Have a look at it:

What just happened?
You have just seen the first few minutes of the life of a LaTeX document. Its
following hours and days will be determined by editing, typesetting, and so on.
Don't forget to save your document frequently.
As announced in contrary to the classic word processor software, you cannot see
the effect of changes immediately—but the result is just one click away.

Have a go hero – checking out advanced LaTeX
editors
Do you have experience in working with complex programs? Do you like using a
feature-rich and powerful editor? Then have a look at these LaTeX editors. Visit
TeXnicCenter—
a
http://texniccenter.org/

very

powerful

editor

for

Windows,

Kile— a user-friendly editor for operating systems with KDE, such as Linux,
http://kile.sourceforge.net/
TeXShop—an easy-to-use and very popular editor for Mac OS X,
http://pages.uoregon.edu/koch/texshop/
Texmaker—a cross-platform editor running on Linux, Mac OS X, Unix, and
Windows systems, http://www.xm1math.net/texmaker/
The mentioned editors are free open source software.

Summary
We learned in this chapter about the benefits of LaTeX. It will be our turn to use
the virtues of LaTeX to achieve the best possible results.
Furthermore, we covered:
Installation of TeX Live
Using the editor TeXworks
Creation of a LaTeX document and generation of output
Now that we've got a functional and tested LaTeX system, we're ready to write
our own LaTeX documents. In the next chapter, we will work out the formatting of
text in detail.

Chapter 2. Formatting Words, Lines,
and Paragraphs
In the last chapter, we installed LaTeX and used the TeXworks editor to write
our first document. Now we will speak about the structure of a document and
we will focus on the text details and its formatting.
In this chapter, we shall:
Learn how to modify font, shape, and style of text
Use boxes to limit the text width
See how to break lines and how to improve hyphenation
Explore justification and formatting of paragraphs
By working with examples and trying out new features, we shall learn some basic
concepts of LaTeX. By the end of this chapter, we will be familiar with
commands and environments. You will even be able to define your own
commands.

Understanding logical formatting
In the previous chapter, we wrote a small example document. Let's extend it a bit
to get an illustrative example for understanding the typical document structure.

Time for
document

action

–

titling

your

We will take the first example and insert some commands that will produce a
nice-looking title.
1. Type the following code in the editor; modify the previous example if you
like:
\documentclass[a4paper,11pt]{article}
\begin{document}
\title{Example 2}
\author{My name}
\date{January 5, 2011}
\maketitle
\section{What's this?}
This is our second document. It contains a title and a
section with text.
\end{document}

2. Click the Typeset button.
3. View the output:

What just happened?
In the first chapter, we talked about logical formatting. First, let's look at this
example from that point of view. We told LaTeX that:
Our document is of the type article. It will be printed on A4 paper using a
size of 11 points for the base font.
The title is "Example 2".
You are the author.
The document was written on January 5, 2011.
Concerning the content of the document:
It begins with a title.
The first section shall have the heading "What's this?"
The following text is "This is our second document."
Note, we did not choose the font size of the title or heading; neither did we make
something bold or centered. Such formatting is done by LaTeX but nevertheless
you're free to tell LaTeX how it actually should look.

Note
We did not need to press the Save button. TeXworks automatically saves the
document if we click the Typeset button.

Exploring the document structure
Let's look at the details. A LaTeX document doesn't stand alone—commonly the
document is based on a versatile template. Such a fundamental template is called
a class . It provides customizable features, usually built for a certain purpose.
There are classes for books, for journal articles, for letters, for presentations, for
posters, and many more; hundreds of reliable classes can be found in Internet
archives but also on your computer now, after you've installed TeX Live. Here
we have chosen the article class, a standard LaTeX class suitable for smaller
documents.
The first line starts with \documentclass. This word begins with a backslash;
such a word is called a command . We used commands to specify the class and to
state document properties: title, author, and date.
This first part of the document is called the preamble of the document. This is
where we choose the class, specify properties, and in general, make documentwide definitions.
\begin{document} marks the end of the preamble and the beginning of the actual
document. \end{document} marks the end of it. Everything that follows would
be ignored by LaTeX. Such a piece of code, framed by a \begin … \end

command pair, is called an environment .
In the actual document, we've used the command \maketitle that prints the title,
author, and date in a nicely formatted manner. By the \section command, we
produced a heading, bigger and bolder than normal text. Then we let some text
follow. What we wrote here, in the document environment, will be printed out.
On the contrary, the preamble will never produce any output.
Let's look at commands in detail.

Understanding LaTeX commands
LaTeX commands begin with a backslash, followed by big or small letters.
LaTeX commands are usually named with small letters and in a descriptive way.
There are exceptions: you will see some commands consisting of a backslash and
just one special character.
Commands may have arguments , given in curly braces or in square brackets.
Calling a command looks like the following:
\command

Or:
\command{argument}

Or:
\command[optional argument]{argument}

There could be several arguments, each of them in braces or brackets. Arguments
in curly braces are mandatory. If a command is defined to require an argument,
one has to be given. For example, calling \documentclass would be futile if we

Note
Arguments in square brackets are optional; they may be given but it's not a must. If
no optional argument is provided, the command will use a default one. For
instance, in the first example in Chapter 1, Getting Started with LaTeX, we wrote
\documentclass{article}. This document has been typeset with a base font
size of 10pt, because this is the class default base font size. In the second
document, we wrote \documentclass[a4paper,11pt]{article}; this way, we
replaced default values with the given values, so now the document will be
adjusted for A4 paper using a base font size of 11pt.
There are commands generating output—try \LaTeX—and commands setting
properties, changing fonts or layout. Generally, the names of commands are
chosen according to their purpose. We will have a more detailed look in this
chapter, but first let's see how LaTeX treats what we type.

Before we continue writing, let's look at how LaTeX understands what you've
written in the editor.

Time for action – trying out the effect
of spaces, line breaks, and empty lines
We will take the first example and insert spaces and line breaks.
1. Modify the previous example as follows:
\documentclass[a4paper,11pt]{article}
\begin{document}
\title{Example 3}
\author{My name}
\date{January 5, 2011}
\maketitle
\section{What's this?}
This
is
our
second document.
It contains two paragraphs. The first line of a paragraph
will be
indented, but not when it follows a heading.
% Here's a comment.
\end{document}

2. Typeset.
3. View the output:

What just happened?
Though we've inserted some spaces, the distances between the words in the
output remained the same. The reason is that LaTeX treats multiple spaces just
like a single space. Also, a single line break has the same effect like a single
space. It doesn't matter how you arrange your text in the editor using spaces or
breaks, the output will stay the same.
A blank line denotes a paragraph break. Like spaces, multiple empty lines are
treated as one.
Briefly said, spaces separate words, empty lines separate paragraphs.

You've seen that the last line seems to be missing in the output. That's because the
percent sign introduces a comment . Everything following a percent sign until the
end of the line will be ignored by LaTeX and won't be printed out. This enables
you to insert notes into your document. It's often used in templates to inform the
user what the template does at that certain place. Note also that the end of the line,
normally behaving like a space, will be ignored after a percent sign.

Tip
Easing experimenting by trial and error
If you want to disable a command temporarily, it may be favorable to insert a
change easily by removing the %.
If the percent sign behaves that way, what should we do if we want to write
100% in our text? Let's figure out how to do it.

Printing out special symbols
Common text mostly contains upper and lowercase letters, digits, and punctuation
characters. Simply type them with your editor. However, some characters are
reserved for LaTeX commands; they cannot be used directly. We already
encountered such characters, and besides the percent sign, there are the curly
braces and so on. There are LaTeX commands to print such symbols.

Time for action – writing special
characters in our text
We will write a very short example printing out an amount of dollars and a
percent number, then we shall try more symbols:
1. Create a new document and enter the following lines:
\documentclass{article}
\begin{document}
Statement \#1:
50\% of \$100 makes \$50.
More special symbols are \&, \_, \{ and \}.
\end{document}

2. Typeset and view the output:

What just happened?
By putting a backslash before such a special symbol, we turned it into a LaTeX
command. This command has the only purpose of printing out that symbol.

Note
The command for printing a backslash is \textbackslash. If you would like to
know what \\ might be used for, it is used as a shortcut for a line break command.
That's a bit odd, but line breaks occur frequently whereas backslashes are rarely
needed in the output, therefore this shortcut has been chosen.
There's a wealth of symbols that we can use for math formulas, chess notation,
zodiac signs, music scores, and more. We don't need to deal with those symbols
for now, but we shall return to that subject in Chapter 8, Typing Math Formulas,
when we will need symbols to typeset math formulas.
Now that we know how to enter pure text, let's find out how we can format it.

Formatting text – fonts, shapes, and
styles
LaTeX already does some formatting. For example, we've seen that section
headings are bigger than normal text and bold faced. Now we will learn how to
modify the appearance of the text ourselves.

Time for action – tuning the font
shape
We will emphasize an important word in a text and we will see how to make
words appear bold, italic, or slanted. We shall figure out how to highlight words
in a part of some text that's already emphasized:
1. Create a new document containing the following code:
\documentclass{article}
\begin{document}
Text can be \emph{emphasized}.
Besides being \textit{italic} words could be \textbf{bold},
\textsl{slanted} or typeset in \textsc{Small Caps}.
Such commands can be \textit{\textbf{nested}}.
\emph{See how \emph{emphasizing} looks when nested.}
\end{document}

2. Typeset and have a look at the output:

What just happened?
At first, we used the command \emph, giving one word as an argument to this
command. This argument will be typeset in italic shape, because this is the default
way how LaTeX emphasizes text.
Text-formatting commands usually look like \text**{argument}, where **
stands for a two letter abbreviation like bf for bold face, it for italic, and sl for
slanted. The argument will then be formatted accordingly like we've seen. After
the command, the subsequent text will be typeset as it was before the command—
precisely after the closing curly brace marking the end of the argument. We
checked it out.
We've nested the commands \textit and \textbf , which allowed us to achieve
a combination of those styles, and the text appears both italic and bold.
Most font commands will show the same effect if they are applied twice like
\textbf{\textbf{words}}: the words won't become bolder. Only \emph
behaves differently. We've seen that emphasized text will be italic, but if we use
\emph onto a piece of this text again, it will change from italic to normal font.
Imagine an important theorem completely typeset in italics—you should still have
the opportunity to highlight words inside this theorem.
is so called semantic markup , because it refers to the meaning, not just to
the appearance of text.
\emph

Tip
Emphasizing twice, such as marking bold and italic at the same time, might be
considered to be a questionable style. Change the font shape wisely—and
consistently.

Choosing the font family
Compare the font of our examples and the standard font you see in this book.
While the LaTeX font has a decorative appearance, the text font of this book looks
simple and clean. Our code examples are different in another way: every letter
has the same width. Let's see how we can implement this in our writings.

Time for action – switching to sansserif and to typewriter fonts
Imagine that we start to write an article about LaTeX's Internet resources. To get
a clearly readable heading, we shall use a font without frills. The body text will
contain a web address; we choose a typewriter font to stress it:
1. Create a LaTeX document with the following code:
\documentclass{article}
\begin{document}
\section{\textsf{\LaTeX\ resources on the internet}}
CTAN.
\end{document}

2. Typeset and look at the result:

What just happened?
We encountered more font commands. By using \textsf, we've chosen the sansserif font in the section heading. We used the command \texttt to get the
typewriter font for the web address. Those commands can be used just like the
font commands we've learned before.
The letters in the LaTeX standard font have so-called serifs , those small
decorative details at the end of a letter's strokes. Serifs shall improve readability
by leading the reader's eyes along the line. Therefore, they are widely used in
body text. Such fonts are also called Roman fonts . This name led to the command
\textrm for the Roman text—the default font with serifs.
Headings are often done without serifs; the used font is called a sans-serif font .
Such fonts are also a good choice for screen text because of the better readability
on lower resolutions. So you might want to choose a sans-serif font when you
produce an e-book.
If every letter of a font has the same width, the font is called monospaced or a
typewriter font. Besides, on typewriters, such fonts were used with early
computers; today they are still preferred for writing source code of computer
programs, both in print and in text editors. So if you want to typeset a program
listing or LaTeX source code, consider using a typewriter font. Like we did in the
previous example, this book is using a typewriter font to distinguish code and
web addresses from the normal text.

Switching fonts
Putting too much text into a command's argument could be unhandy. Sometimes we
would like to set font properties of longer passages of text. LaTeX provides other
commands, which work like switches.

Time for action – switching the font
family
We will modify the previous example using font family switching commands:
1. Modify the example to get the following code:
\documentclass{article}
\begin{document}
\section{\sffamily\LaTeX\ resources in the internet}
CTAN.
\end{document}

2. Typeset and compare the output to the previous one; it's the same.

What just happened?
By using the command \sffamily, we switched over to sans serif font. This
change has been made inside an argument, so it's valid only there.
We used the command \ttfamily to switch to a typewriter font. The typewriter
font will be used from this point onwards. By using \rmfamily, we returned to
Roman font.
These commands don't produce any output, but they will affect the following text.
We will call such a command a declaration .
Now have a closer look at the section number: it's a digit with serifs, which
doesn't match the remaining sans-serif heading. Moreover, changing the font
within a \section command feels wrong—and rightly so! The better way is to
declare the section heading font once for the complete document. We will learn
how to globally modify heading fonts in Chapter 11, Enhancing Your Documents
Further, after we prepared some more tools.

Summarizing font commands and declarations
Let's list the font commands and their corresponding declarations together with
their meanings:

Note
The corresponding declaration to \emph is \em.

Delimiting the effect of commands
In the previous example, we've reversed the effect of \ttfamily by writing
\rmfamily. To be safe, we could write \normalfont to switch back to the base
font. However, there's an easier way.

Time for action – exploring grouping
by braces
We shall use curly braces to tell LaTeX where to apply a command and where to
stop that:
1. Modify our first font shape example to get this code:
\documentclass{article}
\begin{document}
{\sffamily
Text can be {\em emphasized}.
Besides being {\itshape italic} words could be {\bfseries
bold},
{\slshape slanted} or typeset in {\scshape Small Caps}.
Such commands can be {\itshape\bfseries nested}.}
{\em See how {\em emphasizing} looks when nested.}
\end{document}

2. Typeset and check out the output:

What just happened?
We started with an opening curly brace. The effect of the following command
\sffamily lasted until we stopped it with the corresponding closing brace. That
closing brace came at the end of the highlighted code. This highlighting shows the
area of the code where \sffamily is valid.
We replaced every font command by the corresponding declaration. Remember,
\em is the declaration version of \emph. Further, we surrounded every
declaration and the affected text by curly braces.
An opening curly brace tells LaTeX to begin a so called group . The following
commands are valid for the subsequent text until a closing curly brace appears
causing LaTeX to stop using the commands or declarations written in this group.
Till a command is valid, that's called its scope .
Groups can be nested as follows:
Normal text, {\sffamily sans serif text {\bfseries and bold}}.

We have to be careful to close each group; opening and closing braces should
match.

Note
Braces which enclose an argument of a command don't form a group. Together
with the argument, these braces are gobbled by the command. If necessary, use

Time for action – exploring font sizes
We will try out every font size available by LaTeX's default font size commands.
For testing, we exceptionally use them in the body text—their main use is in the
macro definitions:
1. Create a document with the following code:
\documentclass{article}
\begin{document}
\noindent\tiny We \scriptsize start \footnotesize \small
small,
\normalsize get \large big \Large and \LARGE bigger,
\huge huge and \Huge gigantic!
\end{document}

2. Typeset and observe the output:

What just happened?
At first, we used \noindent . This command suppresses the paragraph
indentation. Then we used all 10 available size declarations, starting small with
\tiny and ending really big with \Huge. There are no corresponding commands
taking arguments, so we would have to use curly braces to delimit their scope, as
we learned to before.
The actual resulting font size depends on the base font. If your document has a
base font of 12 pt, then \tiny would result in text bigger than with a base font of
10 pt. We have to see it in relation. Use \footnotesize , if you wish to get the
same size like LaTeX uses for footnotes; use \scriptsize , if you create a style
with a size matching LaTeX subscripts and superscripts. It's still a kind of logical
formatting though they are quite low-level commands.
Normally, font size declarations are used only in definitions of macros in the
preamble, just as it does apply to the other font commands. You will rarely
encounter font size or shape commands in good body texts, except freely designed
passages like title pages—and test examples like the ones here.

Using environments
When you use several declarations and you group them by curly braces, will you
always know which closing brace matches which of the previously entered
declarations? An environment forms a group. Using an environment instead of just

Time for action – using an
environment to adjust the font size
We will produce a title with a larger and bigger font:
1. Create another small document with this code:
\documentclass{article}
\begin{document}
\begin{huge}
\bfseries
A small example
\end{huge}
\bigskip
This is just another small illustrative example.
\end{document}

2. Typeset to see the result:

What just happened?
By writing \begin{huge}, we told LaTeX to switch to a huge font size just like
with the \huge command. \end{huge} informs LaTeX that this size change
should end now. From this point onwards, the font size is the same as before
\begin{huge}.
Inside this environment, we use the declaration \bfseries . Note that the effect
of this declaration ended together with the end of the environment.
The empty line before \end{huge} denotes a paragraph break. Using the
command \bigskip , we skipped some space vertically.
For every declaration there's a corresponding environment carrying the same
name except the backslash. Using environments instead of braces might make
complex code easily understandable.

Note
Commonly it's advisable to end the paragraph before a font size change, not after
it. That's because TeX calculates the interline spacing depending on the current
font size when it reaches the end of the paragraph. That's the reason we used the
blank line before \end{huge} instead of afterwards.

Saving time and effort – creating your
own commands
If you're frequently using the same term in your document, it would be annoying to
type it again and again. What if you later decided to change that term or its
formatting? To avoid searching and replacing in the whole document, LaTeX
allows you to define your own commands in your preamble. They are also called
macros . Give it a name. Later in the document you just need to use this name
whenever you want to change this term. We need to do it just once in the macro
definition. This will affect the whole document. Let's see how it works.

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?
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.
\newcommand

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; just change the definition to the following:
\newcommand{\TUG}{\textsc{TeX Users Group}}

You have also seen that we've used the command \TeX . This command just prints
out the name of the basic typesetting system formatted like in its logo. It's an
abbreviation command like we've written now and \LaTeX works similarly. Note
that we had to use a backslash after \TeX! The following space would just
separate the command from the following text; it won't produce a space in the
output. Using the backslash followed by a space forces the output of the space that
would otherwise be ignored. You may try omitting that backslash to be convinced.

Gentle spacing after commands
A backslash following a command could easily be forgotten. Can't we modify the
command in order to automate that? Tasks like this, which aren't supported by
LaTeX directly, could be solved by using packages. These are collections of
styles and commands.

Time for action – adding intelligent
spacing to command output
We will load the package xspace. Its only purpose is to fulfill this need.
1. Modify the previous example to get the following code:
\documentclass{article}
\usepackage{xspace}
\newcommand{\TUG}{\textsc{TeX Users Group}\xspace}
\begin{document}
\section{The \TUG}
The \TUG is an organization for people who are interested in
\TeX\ or \LaTeX.
\end{document}

2. Typeset, see that the spacing between the words is correct, even without the
backslash:

What just happened?
tells LaTeX to load the package called xspace and to
read in all of its definitions. From now on we may use all commands contained in
that package. This package provides the command \xspace that inserts a space
depending on the following character: If a dot, a comma, an exclamation, or a
quotation mark follows, it won't insert a space, but if a normal letter follows, then
it will. Usually, that's exactly what we want.
\usepackage{xspace}

Imagine you've mentioned the TUG several times in your document and now
you've got the idea to use the TeX logo style in its name. There's no need for
changes in the document. Now only the command in the preamble needs
\newcommand{\TUG}{\textsc{\TeX\ Users Group}\xspace}

Tip
The heading in our last example doesn't contain small caps—have you seen it?
Not all font properties can be combined, depending on the chosen font. For
instance, fonts with small caps together with variations like bold and italic are
rare. Therefore, some people even fake small caps if they don't want to change to
a more complex font.
By defining and using commands, you can ensure that the formatting remains

Creating more
arguments

universal

commands

–

using

Imagine that your text contains a lot of keywords that you want to be printed in
bold. If you use the \textbf{} command on all the keywords, what would
happen if you later decide to use an italic shape instead or a typewriter font? You
would have to change that formatting for each keyword. There's a better way:
defining your own macro and using \textbf{} only inside that.

Time for action – creating a macro
for formatting keywords
We will use \newcommand again, but this time we will introduce a parameter that
will contain our keyword. Let's just use it on some terms that we've got to know in
this chapter:
1. Type this code example:
\documentclass{article}
\newcommand{\keyword}[1]{\textbf{#1}}
\begin{document}
\keyword{Grouping} by curly braces limits the
\keyword{scope} of \keyword{declarations}.
\end{document}

2. Typeset and notice the look of the keywords in the output:

What just happened?
Let's look at the highlighted line in the code. The number 1 in the square brackets
marks the number of arguments that we want to use in the command. #1 will be
replaced by the value of the first argument. #2 would refer to a second argument,
and so on.
Now if you want to modify the appearance of all keywords to be italic, just
modify the definition of \keyword and the change will be global.

Using optional arguments
In one preceding example, we've used \newcommand with two arguments. In the
previous example, there were three arguments. The additional argument has been
put in square brackets. That's the way we mark optional arguments : those
arguments may be given or may be omitted. If omitted, they would have a default
value. We've already noticed that with the \documentclass command. But how
can we define a command with optional arguments ourselves?

Time for action – marking keywords
with optional formatting
We will use \newcommand another time, this time with an optional parameter
concerning the formatting and a mandatory argument for the keyword:
1. Modify the previous example to get this code:
\documentclass{article}
\newcommand{\keyword}[2][\bfseries]{{#1#2}}
\begin{document}
\keyword{Grouping} by curly braces limits the
\keyword{scope} of \keyword[\itshape]{declarations}.
\end{document}

2. Typeset and check out the result:

What just happened?
Let's look again at the bold marked line in the code. By using [\bfseries], we
introduced an optional parameter. We refer to it with #1. Its default value is
\bfseries. Since we used a declaration this time, we added a pair of braces to
ensure that only the keyword is affected by the declaration.
Later in the document, we gave [\itshape] to \keyword, changing the default
formatting to italics.
Here's the definition of the \newcommand:
\newcommand{command}[arguments][optional]{definition}
command

The name of the new command, starting with a backslash followed by lowercase and/or
uppercase letters or a backslash followed by a single non-letter symbol. That name must not be
already defined and is not allowed to begin with \end.

arguments

An integer from 1 to 9, the number of arguments of the new command. If omitted, the
command will have no arguments.

optional

If this is present, then the first of the arguments would be optional with a default value given
here. Otherwise all arguments are mandatory.

definition

Every occurrence of the command will be replaced by definition and every occurrence of the
form #n will then be replaced by the nth argument.

is our key to introduce logical formatting. We should avoid using
LaTeX font commands inside the document—you are on the right track if they
appear only in the preamble of the document. Use \newcommand to create styles
for keywords, code snippets, web addresses, names, notes, information boxes, or
differently emphasized text. How did we achieve the consistent structure of this
book? Using styles is the key!
\newcommand

Pop quiz – commands
1. Imagine your document contains some addresses of websites. Let's say we
want them to be typeset in typewriter font. According to this book, which of
the following possibilities would be the best way to print out, for instance,
http://ctan.org?
a. \texttt{http://ctan.org}
b. {\ttfamilyhttp://ctan.org}
c . \newcommand{\CTAN}{\texttt{http://ctan.org}} in the preamble
and \CTAN in the body text
{http://ctan.org} in the preamble and \site{\CTAN} in the body text
2. Which kind of punctuation marks are used to enclose optional arguments?
a. Parentheses: ()
b. Square brackets: []
c. Curly braces: {}

Have a go hero – saving effort using optional
arguments
Most website addresses begin with http://. But there are sites that differ—
some may start with ftp://, so called FTP server, some sites begin with
https://, so called secure web server. Visit, for instance, ftp://ctan.org, and you
will enter a file server instead of a web server.
Extend the definition of \site of our last pop quiz. Introduce an optional
argument denoting the protocol of the site, that is, how the address starts. Default
\site{www.tug.org}

prints out http://www.tug.org in typewriter font

\site[ftp]{ctan.org}

prints out ftp://ctan.org in typewriter font

Tip
There's a package called url designed for typesetting web addresses. Write
\usepackage{url} in your preamble; this will provide the command \url. This
command takes an address for the argument and will print it out with typewriter
font. Furthermore, it is able to handle special characters in addresses like
underscores and percent signs. It even enables hyphenation in addresses, which is
useful for websites with a very long name.

Using boxes to limit the width of
paragraphs
We won't always write the text just from left to right over the complete text width.
Sometimes, we'd like a paragraph to have a smaller width, for instance, when we
would like to put text and a picture side-by-side.

Time for action – creating a narrow
text column
We would like to explain the acronym TUG in a text column of only 3 cm width:
1. Create a new document containing these four lines:
\documentclass{article}
\begin{document}
\parbox{3cm}{TUG is an acronym. It means \TeX\ Users Group.}
\end{document}

2. Typeset and take a critical look at the output:

What just happened?
We used the command \parbox to create a column. We stated the width of 3 cm
in the first argument and the contained text in the second argument to \parbox.
takes the argument text and formats the output to fit the specified width.
We see that the text is fully justified. Our example shows an obvious problem:
insisting on full justification could lead to undesirable big gaps in the text.
Possible solutions are:
\parbox

Introducing hyphenation: the word acronym could easily be divided
Improving justification: LaTeX could do better
Giving up full justification: narrow text could look better when it's only left
justified
We will check out all of these options. But first, let's see how \parbox is
working.

Common paragraph boxes
Usually we just need a text box with a certain width; occasionally we would like
to have some additional alignment to the surrounding text. So the common
definition of the \parbox command is:
\parbox[alignment]{width}{text}
alignment

Optional argument for the vertical alignment. State t to align at the top line of the box; write b to
align at its bottom line. The default behavior is to place the box such that its center is in line with
the center of the current text line.

width

The width of the box. It can be given for example in ISO units like 3 cm, 44 mm, or 2 in.

text

The text that you want to put in that box. It should be a short piece of common text. For
complicated contents, we will get to know other methods.

Here's a demonstration of the effect of the alignment parameters:
\documentclass{article}
\begin{document}
Text line
\quad\parbox[b]{1.8cm}{this parbox is aligned at its bottom
line}
\quad\parbox[t]{2cm}{another parbox aligned at its top line}
\end{document}

The command \quad produces some space; we used it to separate the boxes a bit.
Here's the output:

From now on we will call such a box a parbox.

Have a go hero – exploring further features of \parbox
\parbox

is capable of doing even more. Here's the complete definition:

\parbox[alignment][height][inner alignment]{width}{text}
height

If this optional argument isn't given, the box will have just the natural height of the text inside.
Use this argument if you want to change the height of the box to make it bigger or smaller.
Especially, if the height of the box is different to the natural height of the contained text, you
might want to adjust the text position. The argument means:
c—vertically center

inner
alignment

the text in the box

t—place

text at the top of the box

b—place

text at its bottom

s—stretch the

text vertically if possible

If you omit this argument, the alignment argument will be used here as the default value.

Take our previous demonstration example and try the effect of the optional
arguments. Use the command \fbox that helps to visualize the effect; if you write
\fbox{\parbox[...]{...}{text}}, the complete parbox will be framed.

Boxes containing more text
Parboxes are suitable for boxes with only a little text inside. In case of a box
containing a large amount of text, the closing brace could easily be forgotten or
overlooked. The minipage environment would then be a better choice.

Time for action – using the minipage
environment
We will use the minipage environment instead of \parbox to get a text with a
width of just 3 cm.
1. Modify the parbox example to get the following code:
\documentclass{article}
\begin{document}
\begin{minipage}{3cm}
TUG is an acronym. It means \TeX\ Users Group.
\end{minipage}
\end{document}

2. Typeset and look at the output:

What just happened?
By using \begin{minipage}, we started a "page in a page". We specified the
width of 3cm by the mandatory argument. From this point onwards, the text lines
will have a width of 3cm. They will be automatically wrapped and fully justified.
We ended this restriction with \end{minipage}. Any text typed afterwards
would run over the complete body text width.
Note: There won't be a page break in such a "minipage".
Have you been a hero struggling with the \parbox and all of its optional
arguments? The minipage environment accepts all those arguments as well with
the same meaning.

Have a go hero – creating a footnote inside a minipage
Of course, LaTeX supports footnotes. You guessed it right—the corresponding
command is called \footnote{text}. Try it in one of our examples. You will
get a footnote mark inside the text and the text of the footnote will be put into the
bottom of the page.
A minipage is like a small page inside a normal page. Think of using a footnote
inside such a "page"; do you want to see the footnote text inside this small page?
The minipage environment supports it, just try it—use \footnote inside the
minipage in the previous example.

Understanding environments
LaTeX environments are started with \begin and ended with \end. Both
commands require the name of the environment as their argument.
Simple environments look like the following:
\begin{name}
…
\end{name}

Such environments can be used for each declaration called \name.
Like commands, environments may also have arguments. Exactly like in the case
of commands, mandatory arguments are written in curly braces and optional
arguments in square brackets. So you will encounter:
\begin{name}{argument}
…
\end{name}

And:
\begin{name}[optional argument]{argument}
…
\end{name}

Environments are like declarations with a built-in scope. With \begin, the
environment introduces a change in layout, font, or other properties. There must
be an \end command, where this change will be canceled. The effect of the
environment name is delimited to the piece of code between \begin{name} and
\end{name}.
Furthermore, the effect of all local declarations used inside an environment will
end together with the surrounding environment.

Breaking lines and paragraphs
Generally, when you're writing text, you don't need to care about the line
wrapping. Just type the text with your editor; LaTeX will make it fit to the line
and take care of the justification. If you want to begin a new paragraph, in
consequence of getting a line break in the output, just insert an empty line before
Now we will find out how to control the line wrapping. First we will see how to
improve the automatic line breaking. Then we will learn commands to insert
breaks directly.

Improving hyphenation
If you look at longer texts, you will notice that it's outstanding how the text is fully
justified by LaTeX and how the spacing between words is evenly distributed on
the lines. If necessary, LaTeX will divide words and put hyphens at the end of the
line in order to break the lines in a better way. LaTeX already uses very good
algorithms to hyphenate words, but it may happen that it can't find an acceptable
way to divide a word. The previous example pointed out this problem: breaking
the word acronym would improve the output, but LaTeX does not know where to
divide it. We shall find out how to solve that.

Time for action – stating division
points for words
No matter how good the justification skill is, text in very narrow columns is
extremely hard to justify. The previous example showed it pitiless. We will tell
LaTeX how a word could be divided:
1. Insert the following line into the preamble of the previous example:
\hyphenation{acro-nym}

2. Typeset and look at the output:

What just happened?
We've told LaTeX that the word acronym may have a division point between
acro and nym. That means a hyphen might be put after acro at the end of the line
and nym goes to the following line.
The \hyphenation command tells LaTeX where the division points of a word
may be. Its argument may contain several words separated by spaces. For each
word, we can indicate several points. For instance we could extend the argument
by more division points and more word variants like this:
\hyphenation{ac-ro-nym ac-ro-nym-ic a-cro-nym-i-cal-ly}

You could also indicate division points in the body text by inserting a backslash
followed by a hyphen, like ac\-ro\-nym. But if you do it in the preamble, you'll
collect all rules there and they will be used consistently. Use it especially in the
rare cases when LaTeX's automation fails.

Tip
Preventing hyphenation
If you want to prevent the hyphenation of a certain word at all, there are two
ways: either declare it in the preamble by using it in the \hyphenation argument
without any division points, like \hyphenation{indivisible}, or you protect it
inside the text using the \mbox command: The following word is
\mbox{indivisible}.

Have a go hero – exploiting the hyphenat package
The hyphenat package extends the possibilities:
\usepackage[none]{hyphenat}

prevents hyphenation throughout the

document.
enables hyphenation for typewriter text.
Otherwise such monospaced fonts won't be hyphenated by LaTeX.
\usepackage[htt]{hyphenat}

Such optional arguments to \usepackage are called package options. They
configure the behavior of a package. The mentioned options may be combined,
separated by commas. Even if you don't use the option none, you can disable
hyphenation for short pieces of text using the command \nohyphens{text}. Try
out these features if you want to profit from them. The package documentation
explains more features that you might need sometimes, such as hyphenation after
special characters like numerals and punctuation characters—TeX would not
break there.

Improving the justification further
Today's most popular TeX compiler is pdfTeX, which directly produces PDF
output. When Hàn Thế Thành developed pdfTeX, he extended TeX by microtypographic capabilities. When we typeset directly to PDF, we're actually using
pdfLaTeX and we can benefit from the new features by using the microtype
package.

Time for action – using microtype
We will improve our previous example by loading the microtype package :
1. Insert the following line into the preamble of the previous example:
\usepackage{microtype}

2. Typeset and look at the output:

What just happened?
We have loaded the microtype package without any options, relying on its
default behavior. It introduces font expansion to tweak the justification and uses
hanging punctuation to improve the optical appearance of the margins. This may
reduce the need of hyphenation and improves the "grayness" of the output. You've
seen its effect on a narrow column—imagine the improvement on wide text—keep
that in mind and try it out later!
Though microtype provides powerful features and options for the advanced
typesetter, we usually won't need to do more than just load it to profit from it.
There's an extensive package documentation if you want to study it in depth.
does nice tweaking, but it's not a cure-all; we should still take care of
proper hyphenation.
microtype

Breaking lines manually
We might choose to end a line overriding the automatism. There are several
commands with different effects.

Time for action – using line breaks
We will type the beginning of a famous poem by Edgar Allan Poe. As the author
has specified where a verse has to end, we shall insert line breaks there.
1. Create a document containing these lines:
\documentclass{article}
\begin{document}
\emph{Annabel Lee}\\
It was many and many a year ago,\\
In a kingdom by the sea,\\
That a maiden there lived whom you may know\\
By the name of Annabel Lee
\end{document}

2. Typeset and view the output:

What just happened?
The very short command \\ ended a line; the following text was put to the next
line. That's different to a paragraph break: we're still in the same paragraph. The
command called \newline has the same effect.
There's another command called \linebreak, which tells LaTeX to end the line
but to keep the full justification. Therefore, the space between the words would
be stretched to reach the right margin. This could cause unpleasant gaps—that's
why that command is rarely used.

Have a go hero – exploring line breaking options
Both introduced commands understand optional arguments.
If the \emph{discrimimant} $$\Delta$$ with
$\Delta = b^2 - 4ac$
is zero, then the equation (\ref{quad}) has a double
solution: (\ref{root}) becomes
$x = - \frac{b}{2a}.$
\end{document}

5. Typeset twice and look at the result:

What just happened?
Just as we said in Chapter 1, writing formulas also looks a lot like programming.
However, this chapter will help you master it, and the results are worth the effort.
The formulas have been built with commands: there are commands with
arguments, like for roots and fractions, and simple commands for symbols, like
for the Greek letter. Most symbols have to be within a math environment and don't
simply work within normal text.
The equation environment created a displayed formula; that formula has been
horizontally centered, some vertical space has been added before and after,
further these formulas are consecutively numbered.
However,
out.

$…$

and $$…$$

are also, in truth, environments. Let's sort this

Embedding math expressions within text
LaTeX provides the math environment in-text formulas:
\begin{math}
expression
\end{math}

Since it's very laborious to write this environment for each small expression or
symbol, LaTeX offers an alias that's doing the same:
$$expression$$

You may write it without line breaks, such as $$expression$$.
A third way is by using a shortcut, coming from TeX:
$expression$

A disadvantage of the latter is that the commands for beginning and ending the
math environment are the same, which may easily lead to errors. However, it's
much easier to type, which may be the reason why it's still popular among LaTeX
users.

Tip
might cause problems in moving arguments like in headings. To prevent
any such problems, just load the package fixltx2e , which fixes this as well as
other issues.
$$…$$

Displaying formulas
For displayed formulas, which have to be centered, LaTeX offers the
displaymath environment:
\begin{displaymath}
expression
\end{displaymath}

The effect of this environment is that the paragraph will be ended, some vertical
space follows, then the centered formula plus the following vertical space. As
this math environment takes care of the spacing, don't leave empty lines before
and after it! This would cause additional vertical space because of the
superfluous paragraph breaks.
Also for this environment there's a shortcut. We already used it:
$expression$

In this case, putting the shortcuts $and$ on separate lines commonly improves
the readability as the formula is also kind of displayed in the source code.
There's also a TeX low level command:
$$expression$$

However, it's strongly recommended to use
environment handles vertical spacing better.

$…$,

because this LaTeX

For the rest of this chapter, all pieces of code use math mode. Either we explicitly
use a math environment or we imagine that we are already in math mode, for short
pieces of code.

Numbering equations
Equations and formulas in general may be numbered. However, this applies only
to displayed formulas. The equation environment is responsible for this:
$$\label{key} expression$$

It looks similar to displaymath but numbered this time. The number will be
displayed in parentheses on the right side of the equation.

As exponents and indexes are frequently used, there are very short commands for
typesetting them, for example, _ gives an index or subscript, ^ produces an
exponent or superscript. Use braces to mark the concerned expression. So, the
common forms are as follows:
{expression}_{subscript}

And:
{expression}^{superscript}

This may be nested. If you use subscripts and superscripts to the same expression,
the order of ^ and _ is not important. In the case of single letters, numerals, or
symbols, you can omit the braces. Let's look at an example:
$x_1^2 + x_2^2 = 1, \quad 2^{2^x} = 64$

Extracting roots
Our example contained a square root: \sqrt{value}. As there are roots of higher
order, this command accepts an optional argument for the order. The complete
definition is:
\sqrt[order]{value}

The size of the root symbol will be automatically adjusted to the height and the
width of the value expression. Roots may be nested. Both can be seen in this
example:
\sqrt[64]{x} = \sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{x}}}}}}

Writing fractions
Within text formulas, you may just write / to denote fractions, such as $$(a+b)/2$$. For larger fractions, there's the \frac command:
\frac{numerator}{denumerator}

This command may also be used for in-text formulas. However, the line spacing
could increase.
$\frac{n(n+1)}{2}, \quad \frac{\frac{\sqrt{x}+1}{2}-x}{y^2}$

Greek letters
Mathematicians like to use Greek letters, for instance, to denote constants. To get
a lowercase Greek letter, just write the name with a backslash for the command.
Here are the lowercase Greek letters with their corresponding LaTeX commands:

For some letters, variants are available:

As the omicron just looks like an o, there's no command for it. It's similar for most
uppercase Greek letters, which are equal to Roman letters. The remaining
uppercase Greek letters are produced as follows:

For upright Greek letters, you may use the upgreek package.

Script letters
For the twenty-six uppercase letters A, B, C, … , Z, there's a calligraphic shape,
produced by \mathcal:
$\mathcal{A}, \mathcal{B}, \mathcal{C}, \ldots, \mathcal{Z}$

Note
There are packages offering different calligraphic fonts, such as zapfino and xits.

Producing an ellipsis
You already know \ldots for a low ellipsis. It also works in math mode. We use
the low ellipsis mainly between letters and commas. Between operation and
relation symbols, a centered ellipsis is commonly used. Furthermore, a matrix
may require a vertical ellipsis. Here's how all of them may be produced:

Comparing in-line formulas to displayed formulas
Writing formulas in-line saves space and allows fluent explanations. This is
recommendable for short math expressions within text.
Formulas in the displayed style are outstanding; they are centered and require
more space. Furthermore, they can be numbered and you may refer to them using
the \label and \ref techniques that you learned in Chapter 5, Creating Tables
and Inserting Pictures.
Choose the style that is optimal for the readability of your text.

Changing the font, style, and size
I n Chapter 2, Formatting Words, Lines, and Paragraphs , we learned how to
modify the font of common text. There are further commands changing the font
style in math mode:

Though letters in math mode are italic, they are considered to be separate
symbols, which results in a different spacing than that of an italic word. For
instance, in math mode, fi may be the product of the variables f and i, but not the
ligature fi. Compare:
\textit{Definition}, $$Definition$$

Also, \mathit treats the argument as text in italic math font. So, for text within
formulas, use a text or math font command, or even better: use \text{…} of
If you wish to switch to bold typeface for a complete math expression, you can
use the declaration \boldmath before the expression, that is, already outside math
mode. The declaration \unboldmath switches back to the normal typeface. The
latter has to be used outside math mode as well.
To make parts of a formula bold, you can switch to the left-to-right mode by
\mbox and by using \boldmath in its argument.
Four math styles are available, determining the way of typesetting and the font
size:
Style

Command

Meaning

display

\displaystyle

Default for letters and symbols in displayed formulas

text

\textstyle

Default for letters and symbols within in-text formulas

script

\scriptstyle

Smaller font size, used for subscripts and for superscripts

scriptscript

\scriptscriptstyle

Even smaller font size, for nested script style

T h e textstyle differs from the displaystyle in mainly two ways; in
textstyle, variable sized symbols are smaller and subscripts and superscripts
are usually placed beside the expression instead of below and above,
respectively. Otherwise the font size is the same.
LaTeX switches the style automatically; if you write a simple exponent, it will be
typeset in script style, that is, with a smaller font size.
You may force a desired style using one of the commands in the aforementioned
table. This allows you, for instance, to:
Type formulas within the text exactly like they would appear in a displayed
formula: bigger fraction, bigger sum signs, further subscripts are set below,
and superscripts are set above. Note, all of this increases the line spacing.
Write exponents or indexes with bigger symbols.

Customizing displayed formulas
There are two options that modify the way the formulas are displayed:
fleqn

"left equation
numbers"

This causes all displayed formulas to be aligned at the left margin.

leqno

"left equation
numbers"

All numbered formulas would get the numbers on the left side instead of the
right.

Often, formulas are not displayed just standalone. We may encounter situations
where:
A formula is too long to fit on one line
Several formulas are listed row-by-row
An equation shall be transformed step-by-step
A chain of inequalities spans over more than one line
Several formulas shall be aligned at relation symbols
We may also encounter similar situations, where we have to write multi-line
formulas, often with some kind of alignment. The amsmath package offers
specialized environments for nearly every such need.

Time for action – typesetting multiline formulas
We shall use the amsmath package to experiment with a very long formula and
with a system of equations:
1. Start a new document on an A6 paper and load the amsmath package.
\documentclass{article}
\usepackage[a6paper]{geometry}
\usepackage{amsmath}
\begin{document}

2. Use the multline environment to span a long equation over three lines. End
the lines with \\:
\begin{multline}
\sum = a + b + c + d + e \\
+ f + g + h + i + j + \\
+ k + l + m + n
\end{multline}
\end{document}

3. Typeset and look at the formula:

4. Now we handle a system of equations. Use the gather environment to add
these equations. Again, end lines with \\:
\begin{gather}
x + y + z = 0 \\
y - z = 1
\end{gather}

5. Typeset and look at the equations:

6. Commonly, equation systems are aligned at the equal sign. Let's do this. Use
the & symbol to mark the point that we wish to align:
\begin{align}
x + y + z &= 0 \\
y - z&= 1
\end{align}

7. Typeset; now the equations are aligned as desired:

What just happened?
math environments.
Each line in such an environment is ended by \\, except the last one. The alignment
depends on the environment, as we've seen:
multline: The first line is left-aligned, the last line right-aligned, and all
other lines in between are centered
gather: All lines are centered
align: The lines are aligned at marked relation signs
Let's have a closer look.

Aligning multi-line equations
Here's a list of the amsmath multi-line environments:
Name

Meaning

multline

First line is left-aligned, last line is right-aligned, all others are centered.

gather

Each line is centered.

align

Use & to mark a symbol where the formulas shall be aligned. Use another & to end a
column, if you need several aligned columns.

flalign

Similar to align with more than one column, but the columns are flushed to the left
and the right margin, respectively.

alignat

Alignment at several places, each has to be marked by &.

split

Similar to align, but within another math environment, thus unnumbered.

aligned, gathered,
alignedat

Used for an aligned block within a math environment. This can be displayed math or
in-line math.

Numbering rows in multi-line formulas
In multi-line math environments, each line would be numbered like a normal
equation. If you wish to suppress the numbering of a line, write \notag before the
end of the line.
Use the starred variant like align*, or gather*, if you would like to avoid
numbering completely.

Inserting text into formulas
To insert some text into a formula, standard LaTeX provides the
amsmath offers further commands:

\mbox

command.

inserts text within a math formula. The size is adjusted
according to the current math style, that is, \text produces smaller text
within subscripts or superscripts.
\text{words}

suspends the formula, the text follows in a separate
paragraph, then the multi-line formula is resumed, keeping the alignment. Use
it for longer text.
\intertext{text}

These commands are the best choice, when you would like to use text within math
environments.

Fine-tuning formulas
If we go beyond writing variables and basic math operators, we may need many
symbols for special purposes: certain relation signs, unary and binary operators,
function-like operators, sum and integral symbols and variants of the latter,
arrows, and many more. LaTeX and additional packages offer thousands of
symbols for many purposes. We shall have a look at some of them. But firstly,
let's figure out how to write functions.

Using operators
Trigonometric functions, logarithm functions, and other analytic and algebraic
functions are commonly written with upright Roman letters. Simply typing log
would otherwise look like a product of the three variables, namely, l, o, and g. To
ease the input, there are commands for many common functions or so called
operators. Here's an alphabetical list of the predefined ones:
\arccos, \arcsin, \arctan, \arg, \cos, \cosh, \cot, \coth, \scs, \deg,
\det, \dim, \exp, \gcd, \hom, \inf, \ker, \lg, \lim, \liminf, \limsup, \ln,
\log, \max, \min, \Pr, \sec, \sin, \sinh, \sup, \tan, \tanh

The modulo function may be written in two ways, either by using \bmod for a
binary relation or by using \pmod{argument} for a modulo expression in
parentheses.
Some operators support subscripts which are set as follows:
\[ \lim_{n=1, 2, \ldots} a_n, \qquad \max_{x not
available
(Font) Font shape OT1/cmss/m/sl' tried instead on input line 4.
3. Check the output:

What just happened?
The macro \familydefault stands for the default font family which shall be
used in the LaTeX document. For this macro, we specified the value \sfdefault,
which means the default sans-serif font. This means simply that sans-serif is now
default, no matter which font has been chosen. As you can imagine, other possible
values are \rmdefault and \ttdefault. By changing \familydefault, we
don't have to write \sffamily again and again.
But then we emphasized our text and got a warning! The message means that
simply there's no Computer Modern Sans Serif font (cmss) in OT1 encoding (just
standard), in medium weight (m) and italic shape (it) in 10pt size. Further,
LaTeX told us how it tried to repair that; instead of italic it chose a slanted shape.
That's not too bad; at least it looks similar and the output is produced.
This is basically what happens when warnings occur: LaTeX informs about a
potential problem or disadvantage, but it tries to choose the best alternative and
continues typesetting. It's not uncommon that a longer document produces dozens
of warnings, most often dealing with horizontal or vertical justification.
Often, it doesn't hurt if you ignore warnings, which don't seem very serious.
Though following them up is a good habit. Who desires to have a perfect
document, fixes all warnings. This way you cannot overlook a potential real
problem.
Let's have a look at very common warning messages, what they mean, and how
we could fix them.

Justifying text
These warnings are the most frequently occurring:
Overfull \hbox: A line is too long and doesn't fit to the text width. This may
result in text extending past the margin. This may be caused by hyphenation
problems, which can be fixed by using \hyphenation, as you already
learned, or by inserting \-. You could break the line manually or polish your
words otherwise.
Underfull \hbox: The opposite to the previous warning; a line is not wide
enough to fit to the text width. This could be caused by \linebreak, if
there's not enough text on the line. Also, \\ or \newline may cause it, such
as \\\\.
Overfull \vbox: The page is too long because TeX could not break it
accordingly. The text might hang out past the bottom margin.
Underfull \vbox: There's not enough text on the page. TeX had to break the
page too early.
I n Chapter 2, Formatting Words, Lines, and Paragraphs , we learned how to
microtype package may help a bit.

Tip
The declaration \sloppy switches to a pretty relaxed typesetting, thus avoiding
many such warnings. It's counterpart is \fuzzy, switching back to the default
behavior. If you ever use \sloppy, maybe in a kind of emergency, it's better to
keep it local by grouping or use the respective environment
—\begin{sloppypar} … \end{sloppypar}. Additionally, check out
recommendations and alternatives regarding \sloppy in l2tabu, which has been
mentioned in Chapter 10.

Referencing
Many warnings deal with referencing. Common mistakes are missing label or cite
keys or keys that have been used twice. Sometimes LaTeX just tells you that
another typeset run is required.
Label multiply defined: \label or \bibitem has been used with a label
name that's already been used. Make label names unique.
There were multiply-defined labels: Like the previous warning, but after
processing the complete document; a label has been defined by two \label
commands.
Labels may have changed. Rerun to get cross-references right: Just
typeset again to let LaTeX correct the referencing.
Reference ... on page ... undefined: \ref or \pageref has been used
without a corresponding \label definition. Insert a \label command at a
suitable place.
Citation ... on page ... undefined: A \cite command did not have a
corresponding \bibitem command.
There were undefined references or citations: Summarizing after
processing—any \ref or \cite command did not have a corresponding
\label or \bibitem command.

Tip
Whenever you get warnings regarding referencing, it’s a good idea to simply
rerun typesetting. Often, such warnings then disappear, because LaTeX couldn’t
resolve all references in the first run itself.

Choosing fonts
We already encountered the first of the following warnings in our example:
Font shape … in size <…> not available: You chose a font that's not
available. This may be a result of combining font commands that results in a
non-existing font. Also, it could just be of an unavailable size. LaTeX would
choose a different font or size and inform you about that choice in detail.
Some font shapes were not available, defaults substituted: LaTeX prints
this after processing the entire document if any of the chosen fonts had been
unavailable.

Placing figures and tables
We already encountered the first of the following warnings in our example:
Float too large for page: A figure or table is too large to fit the page. It
would be output, but on an oversize page.
h float specifier changed to ht: If you specified an h option to a floating
figure or table which doesn't fit there, it would be placed on top of the next
page and that warning would be issued. The same can occur for !h and !ht.

Customizing the document class
A warning may be issued if you use an illegal class option:
Unused global option(s): You specified an option to \documentclass,
which is unknown to the class and to any loaded package. This could be, for
example, a base font size which is not supported. Just check the option which
Also packages may print out warnings if they foresee any problem. All these

Avoiding
packages

obsolete

classes

and

At the end of Chapter 10, we talked about the dangers of outdated information.
LaTeX exists since decades, and so do tutorials, examples, packages, and
templates. Many are totally outdated and some even refer to the old LaTeX
standard 2.09, where even document classes didn't exist. In Chapter 10, we
pointed to the definitive guide l2tabu that comes to the rescue.
Many problems just occur because of the use of obsolete packages. For example,
some that aren't maintained any more may conflict with newer packages. Often,
you just need to find the recommended successor of an obsolete package and use
that.
Here's a short list for helping you in that matter:
Obsolete packages Recommended successors
a4, a4wide, anysize

geometry, typearea

backrefx

backref

bitfield

bytefield

caption2

caption

dinat

natdin

doublespace

setspace

dropping

lettrine

eps, epsfig

graphicx

eurotex

inputenx

fancyhdr

floatfig

floatflt

glossary

glossaries

here

float

isolatin, isolatin1 inputenc
mathpple

mathpazo

mathptm

mathptmx

nthm

ntheorem

palatino

mathpazo

picinpar

floatflt, picins, wrapfig

prosper, HA-prosper powerdot, beamer
ps4pdf

pst-pdf

raggedr

ragged2e

scrlettr

scrlttr2

scrpage

scrpage2

seminar

powerdot, beamer

subfigure

subfig, subcaption

t1enc

fontenc

times

mathptmx

utopia

fourier

vmargin

geometry, typearea

That's not set in stone. Of course, you may still use the so-called obsolete
packages. They may work well even today. But check out their description on
An up-to-date version of that list can also be found on http://texblog.net/packages.
There's an ongoing discussion at http://mrunix.de on the creation and maintenance
of such a list.

General troubleshooting
There may be situations where we cannot solve a problem simply by reading and
acting on warnings or error messages. Imagine a mysterious error, an untraceable
error location, irresolvable references, or just unclear messages from classes or
packages.
Locating the cause by the line number which LaTeX printed out or by knowing
what we've done since the previous typesetting run, usually helps. Once a
problematic line or chunk is located, it could be removed or fixed. Otherwise, it
might become difficult.
Here are the general first steps we might go through then:
Compile several times. This may be necessary for correct referencing,
bibliography, and lists of tables and figures.
Check the order in which you load the packages. Some packages, like
hyperref, don't work well if loaded before or after certain packages. You
may just swap some lines to correct or to test that.
Remove auxiliary files. If anything strange happens, it's sometimes a good
idea to remove all files created by LaTeX during typesetting. These files
have the same name as the main document but have extensions such as .aux,
.toc, .lot, .lof, .bbl, .idx, or .nav, just to name some examples.
If the problem persists, we could try to isolate the cause.
1. Create a copy of your document. If necessary, copy the complete folder.
From now on, work on the copy.
2. Remove a part of the document which probably is not involved in the
problem.
3. Typeset, to ensure that the problem persists. If this is the case, go back to
step 2. If the problem is gone, you isolated the problem within the part you
just removed. In this latter case, restore the deleted part, you may delete
other parts.
4. After some repetitions, you located the problem. If you didn't already, reduce
the number of loaded packages, repeating step 2 and typesetting.
5. You end up with a really tiny but complete example document which

reproduces the error.
Removing or rewriting that identified part of your document could help. What if
you really want to use that part and would like to fix that error? Now that your
problem can be shown with such a very small example code, you could post that
problem to an online LaTeX forum and ask for help.

Have a go hero – examining LaTeX's log files
You are not dependent on just the errors and warnings that your editor shows to
you! LaTeX keeps track of any information, each warning, and every error. All of
these will be collected in a file with the same name like your document but
carrying the extension .log. This is an ordinary text file and may be opened with
any editor, including your LaTeX editor.
For instance, the log file for our second example looks like the following:
This is pdfTeX, Version 3.1415926-1.40.10 (Web2C 2009)
(format=pdflatex 2010.6.25) 20JAN 2011 23:16
entering extended mode
%&-line parsing enabled.
**helloworld.tex
(./helloworld.tex
LaTeX2e <2009/09/24>
Babel  and hyphenation patterns for english, ... loaded.
(c:/texlive/2009/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document
class
(c:/texlive/2009/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size
option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (./warning.aux)
\openout1 = warning.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input
line 3.
LaTeX Font Info: ... okay on input line 3.
...
LaTeX Font Warning: Font shape OT1/cmss/m/it' in size <10> not
available
(Font) Font shape OT1/cmss/m/sl' tried instead on input line 4.
[1
{c:/Users/guest/.texlive2009/texmfvar/fonts/map/pdftex/updmap/pdftex.map}]
(./helloworld.aux) )
Output written on helloworld.pdf (1 page, 17376 bytes).

Check out the log files of some documents you produced until now. The

information therein makes a very technical impression, but this might help you a
lot in troubleshooting.

Pop quiz – troubleshooting
1. If you get several error messages during one typesetting run, which one is the
most important, according to the text?
a. The first
b. The last
c. All error messages should be dealt with before another typesetting run
2. Which it the extension of the file containing errors, warnings, and
information?
a. aux
b. toc
c. log
d. lof

Summary
This chapter prepared us to solve problems that might occur.
Locating and fixing errors
Understanding warning messages
Analyzing LaTeX's typesetting log
Correcting errors is absolutely necessary. Dealing with warnings is a valuable
bonus.
If you encounter any problem which you aren't able to solve on your own, don't
hesitate to ask for help on a LaTeX Internet forum. You've got the tools within this
chapter, and also:
You know how to create a tiny but complete example which demonstrates the
problem
You are able to report an error message
You know about the log file and could provide its information
For LaTeX friends online, it's often an easy task to use this information in solving
your problem, and definitely a lot of LaTeX enthusiasts have fun in helping other
LaTeX users.
The next chapter will point the way to LaTeX web forums and also to many other
online resources.

Chapter 13. Using Online Resources
There's a vast amount of LaTeX information and material on the Internet, and
it has grown over many years. Today, thanks to the virtues of free and open
source software, a huge TeX community exists, sharing knowledge and
expertise.
On the Internet, you can find:
Software archives offering nearly all LaTeX material available
Web forums, where LaTeX users talk about problems and solutions
Homepages of user groups, TeX distributions, and free editors
Blogs of individual LaTeX users
LaTeX mailing lists you may subscribe to
As you know how to navigate through the World Wide Web, this chapter does not
contain practical examples. Instead, let's take a walk through the Internet.

Web forums, discussion boards, and
Q&A sites
Before we proceed to software archives and homepages, let's go where the online
worldtakes place!

Usenet groups
It all began with the Usenet. Around 1980, a long time before the World Wide
Web was born, this discussion network emerged. It consists of many thousands of
groups, so-called newsgroups, each dedicated to a certain subject. Not to our
surprise, there's a TeX newsgroup!

comp.text.tex
The easiest way is just to access this URL hosted by Google. Just browse it using
its web interface. Alternatively, you could install a Usenet reader program and
connect to a Usenet web server. At this point, you should familiarize yourself
better with Usenet. A great starting point is its Wikipedia entry at
http://en.wikipedia.org/wiki/Usenet. There you would find an introduction, links
to necessary software, and further reading.
comp.text.tex is the classic TeX discussion board. Then and now, there are
distinguished experts reading and posting messages. You can search and browse
an archive reaching back over more than 20 years.

Newsgroups in other languages
If you understand the language, you could check out the German or French Usenet
TeX groups:

Web forums
During the last few years, web forums emerged. They offer an easier and more
user-friendly access to discussion groups. Initially, LaTeX has been the topic in
sub forums of more general computer forums, among other software. After LaTeX
became more and more popular, websites dedicated to it have been founded.

LaTeX-Community.org
http://www.latex-community.org/
In January 2007, the originator of the LaTeX editor TeXnicCenter—Sven
Wiegand, founded the web forum LaTeX Community. This site has been the first
forum with the single topic LaTeX. It is split into many sub forums, each dealing
with a certain LaTeX topic, such as Math and Science or Fonts and Character
Sets, with a certain LaTeX distribution or a specific LaTeX editor.
Today it's supplemented by a news section and a know-how section containing
articles and essays of the community.
The author of this book supports the fellow community members as a moderator
on that site.
Participating is as easy as in any other web forum. You don't need to register for
reading, as it's freely available. Just for writing, you need to register once,
support other users who turned there looking for help.
Questions are very welcome! They are the foundation of the site. You may
Quoting the error or warning messages you've got
Including a code example, which allows others to reproduce the problem
The latter is the optimal approach. There's even a website explaining why and
how at http://www.minimalbeispiel.de, in English and German. Once a problem
could be reproduced, it's nearly solved, even if it seems to be difficult at first
sight. Experienced users who are familiar with the source code of the LaTeX
kernel and packages can explain how something works and are able to create
solutions for nearly any problem.

TeX and LaTeX on Stack Exchange
http://tex.stackexchange.com/
There are question and answer sites, which are different to classical web forums.
While in the web forums, people talk and discuss, these Q&A sites have a
simpler structure. There's a question, followed by answers. There's no discussion,

Time for action – asking a question
online
Is there anything you wanted to know about LaTeX? Did you encounter any
serious problem you could not solve? Then post a question on
http://tex.stackexchange.com/:
1. Visit http://tex.stackexchange.com :

2. In the upper-right corner, click on Ask Question:

3. Fill out the Title field and type in your question, and choose some
meaningful keywords for the Tags field. When you are done, click on Post
Your Question. The final question will look like the following:

What just happened?
That wasn't really hard! Besides editing our question we:
Chose a meaningful title to get readers interested in checking out our
question
Specified some keywords, so called tags, which are used to filter the site's
contents
Stack Exchange is a network of free, community-driven Q&A sites. The TeX site,
often briefly called TeX.SE, was founded in 2010 specifically for users of TeX
and LaTeX.
You don't have to register to post questions and answers—you could simply start
off just as we saw! Like in the LaTeX Community web forum, nearly all questions
will be answered, because on this site also, TeX users are happy to share their
expertise with everybody. It's extremely rare that a question would not get a
satisfactory answer. Until now, that happened only with very unclear questions
without details which nobody could answer at all. If you think of the advice
aforementioned regarding formulating good questions, this won't happen to you.
This TeX Q&A site is developed to an easily accessible knowledge base,
because:
Questions are tagged. For each question, one or more tags should be chosen,
describing the subject. For example, if your question is about a problem with
\label and \ref for equations, choose the tags cross-referencing and
equations. This makes it easy to find answers to certain subjects.
Specialized experts watch their favorite tags.
misinformation is voted down. This way, the best answer floats to the top.
So you don't have to read through an entire multi-page thread to find the best
solution, like it's necessary in classical web forums.
Both tagging and voting enhance the information access. They may be used for
sorting and refining search results.
There's another concept called reputation . You don't need to care about that, but
perhaps you would like to know what it means. Users who post good questions
and useful answers earn reputation points depending on the votes on their
questions and answers. A certain amount of reputation points allows going

You can create new tags or retag questions
You are able to edit other users posts
The reputation is a rough measurement for the user status in the community. A user
with high reputation is so trusted by the community that we can be sure he/she
would act carefully. Thus, the site is community-moderated and shows aspects of
a collaborative Wiki.
The site offers a list of frequently asked questions that explain all the details—
check it out. Such lists are common, so let's have a look at LaTeX-specific lists
next.

Now you know where to ask for help. However, during the long existence of
online LaTeX communities, the probability that another user has had the same
problem like you is very high! There's a bunch of questions which appear again
and again. If you post such a question, the community member might point you to a
FAQ. This is an abbreviation for "Frequently Asked Questions" and refers to a
list of such questions that also contains answers to them.

UK TeX FAQ
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes
This is a FAQ site maintained by the UK TeX Users' Group, especially by Robin
Fairbairns. It is regularly posted to comp.text.tex. It contains several hundred
and that list is still growing and is continuously being improved.

Visual LaTeX FAQ
http://www.ctan.org/tex-archive/help/Catalogue/entries/visualfaq.html
This is a very different approach: the Visual FAQ is a PDF document containing
hundreds of text and graphic elements, such as tables, figures, lists, footnotes, and
math formulas: thirty pages full of samples. At all these objects, key positions are
marked and hyperlinked. Just click on any marked object and you will be lead to
the corresponding UK TeX FAQ entry. Take a look—it's a fancy interface.

MacTeX FAQ
http://tug.org/mactex/faq/
Are you a Mac user? Then this FAQ is made for you. It covers installation and
use of the MacTeX LaTeX distribution and the popular Mac LaTeX editor
TeXShop.

AMS-Math FAQ
http://www.ams.org/tex/amsmath-faq.html
As you know, amsmath is the most recommended math package. There's a list of
questions and answers to amsmath and AMS classes and packages on the website
of the American Mathematical Society.

LaTeX Picture FAQ
http://ctan.org/pkg/l2picfaq
As a lot of questions are about including pictures, this How-to has been
developed. It deals, for example, with the various image file formats, conversion
tools, picture manipulation, and placement of floating figures. The document
contains a lot of small code examples and is a very useful small resource for a
LaTeX beginner.
As it originates in a German LaTeX forum, http://mrunix.de, it's been written in
German. It has been translated into English, but the translation is not yet published
on CTAN.

Mailing lists
Now we come again to a classic media: electronic mailing lists. They are both
used for announcements and for discussion. If you subscribe to such a list, you
will receive announcements and discussion contributions by other subscribers.
You could silently receive and read all the messages, and you could send e-mails
to the list address which would then be sent to all other subscribers. Now you
know you should read an FAQ before.
Today many people prefer easier accessible media, such as web forums.
However, these lists still exist and might be as long as e-mail is popular.

texhax
http://tug.org/mailman/listinfo/texhax
This is a list for general TeX discussion, a companion to comp.text.tex,
established in the 1980s. It has hundreds of subscribers and there are many
experts among them.

tex-live
http://tug.org/mailman/listinfo/tex-live
The name says it all: it deals with the TeX Live collection. If you installed this
software distribution, you might be interested in subscribing to get the latest news

texworks
http://tug.org/mailman/listinfo/texworks
This list supports the user of the LaTeX editor—TeXworks, that we used in the
first chapter. If you decided to use that editor later on and you are interested in the
latest builds, tricks, scripts, and news, you may subscribe.

List collections
Aforementioned were some especially useful examples matching the software
used in this book. There's a lot more that you can find here:
http://tug.org/mailman/listinfo : More than 50 mailing lists for TeX and
LaTeX-specific subjects such as bibliographies, hyphenation, PostScript,
pdfTeX, and development.
http://gmane.org/lists.php : A collection of mailing lists; some of them are
(La)TeX related.
TeX user groups as well as developers of LaTeX editors and other software often
provide mailing lists, especially for announcements. You can read about that on
their homepages. We shall now look at some of them.

TeX user group sites
TeX user groups are organizations for people interested in TeX and LaTeX. They
provide support for their members, but also for TeX and LaTeX users in general.

TUG – the TeX users group
http://www.tug.org/
That's a big institution. It was founded in 1980 and has always had a great
influence on the development and popularity of TeX. Their homepage is a portal
to the TeX world with links to support, documentation, and software.

The LaTeX project
http://www.latex-project.org/
The LaTeX3 project team maintains the LaTeX 2e standard and develops the next
version of LaTeX, called LaTeX3. This website informs about their work and

UK TUG – TeX in the United Kingdom
http://uk.tug.org/
This user group supports and promotes TeX in the UK. Also this site is a good
starting point to explore TeX resources but specifically those offered by the UK
TUG.

Local user groups
http://www.tug.org/usergroups.html
http://www.ntg.nl/lug/
These pages list local TeX user groups from many countries in the world. Their
websites often contain material in national languages and further information on
the TeX world.

Homepages of LaTeX software and
editors
Like most software manufacturers and distributors, free and open source software
projects offer information on their homepages.

LaTeX distributions
Today there are two big LaTeX distributions, both very modern and
comprehensive, plus some descendants:
TeX Live : http://tug.org/texlive/ is a cross-platform LaTeX software
collection. It runs on Windows, Mac OS X, Linux, and Unix.
MiKTeX: http://www.miktex.org/ is a very user-friendly and popular
LaTeX distribution specifically for the Windows operating system.
proTeXt: http://www.tug.org/protext/ is a MiKTeX-based distribution for
Windows that especially focuses on easy installation.
MacTeX: http://www.tug.org/mactex/ is derived from TeX Live and has
been customized specifically for Mac OS X.

LaTeX editors
There are many LaTeX editors available, from easy-to-use to complex and
professional.

Cross-platform
These editors support many systems including Windows, Mac OS X, Linux, and
Unix:
TeXworks: http://tug.org/texworks/ is light-weight and comfortable.
Texmaker: http://www.xm1math.net/texmaker/ offers many features.
TexmakerX: http://texmakerx.sourceforge.net/ is derived from Texmaker
Emacs: http://www.tug.org/mactex/ is extensible and very customizable,
though not easy-to-use for everybody. However, it's great together with
AUCTeX: http://www.gnu.org/software/auctex/.
vim: http://www.vim.org/ is based on commands given in a text interface.
It's enhanced by the vim LaTeX-suite: http://vim-latex.sourceforge.net/.

Windows
These editors are specifically for the Windows operating system, running on most
versions:
TeXnicCenter: http://www.texniccenter.org/ is an enormously feature-rich
editor, a great tool for developing complex TeX projects.
LEd: http://www.latexeditor.org/ is a free-to-use multilingual LaTeX editor
with project management.
WinShell: http://www.winshell.de/ is a free and multilingual customizable
editor, also with project management and wizards.
MeWa LaTeX editor : http://www.meshwalk.com/latexeditor/ is another
LaTeX editor with a graphical user interface similar to TeXnicCenter.
WinEdt: http://www.winedt.com/ is powerful and very popular. This one is
distributed as shareware. Also see the WinEdt community site on
http://www.winedt.org/.

Linux
Besides the cross-platform editors, TeXworks, Texmaker, TexmakerX, Emacs,
and vim there are:
Kile: http://kile.sourceforge.net/ is very powerful and designed for the KDE
window system, but also runs on other window managers like GNOME, if
KDE libraries are installed. Just this editor is worth using KDE also on
GNOME.
gedit: http://www.gnome.org/projects/gedit/ is the light-weight GNOME
standard
editor
and
there's
a
LaTeX
plugin:
http://live.gnome.org/Gedit/LaTeXPlugin.

Mac OS X
Though cross-platform editors run on Macs, there's one very popular Mac LaTeX
editor:
TeXshop: http://www.uoregon.edu/~koch/texshop/ is believed to have led
many new users to LaTeX because of its outstanding usability.

LaTeX archives and catalogs
There are websites archiving and sharing LaTeX tools and packages and
providing catalogs for easy look-up.

CTAN – the Comprehensive TeX Archive Network
http://ctan.org/
This network consists of many servers world-wide, which store the biggest
collection of TeX-related material. Nearly every serious LaTeX package can be
found in this archive. On the homepage, you will find search features or you may
just start browsing the archive directories.

The TeX Catalogue Online
http://texcatalogue.sarovar.org/
This catalog offers a topical, a hierarchical, a brief, and an alphabetical index to
nearly 4,000 TeX and LaTeX packages and tools. It is closely related to CTAN,
which actually stores the software. This site is great for browsing especially if
you work on a topic, but don't know which packages may exist for that purpose.

The LaTeX Font Catalogue
http://www.tug.dk/FontCatalogue/
Nearly all fonts available for use with LaTeX are listed here. About a dozen
categories, such as Sans-Serif, Typewriter, and Calligraphy fonts, assist in
finding the right font. The fonts are displayed both briefly in overviews but also
extensively with several style and math examples. The cherries on the cake are
concrete code examples.

TeX Resources on the Web
http://www.tug.org/interest.html
This extensive collection of TeX-related Internet resources is maintained by the
TeX users group. An index and a substantial amount of links point you the way to

Friends of LaTeX
Some software builds on LaTeX or is closely related and offers different
interesting approaches.

XeTeX
http://scripts.sil.org/xetex
XeTeX extends TeX by Unicode support and modern font technologies for using
OpenType and TrueType fonts and Apple Advanced Typography. It natively
supports Unicode.
The LaTeX version is called XeLaTeX.
Initially developed for Mac OS X, XeTeX is now available for Windows and
Linux/Unix as well. For example, you can use it with TeXworks by choosing
XeTeX, XeLaTeX respectively, as typesetng engine

LuaTeX
http://www.luatex.org/
LuaTeX is an extended version of pdfTeX. It uses Lua as its scripting language.
The LuaTeX project aims to develop an enhanced TeX version while keeping
downward compatibility.
Lua is a fast and powerful but light-weight and portable scripting language. You

ConTeXt
http://wiki.contextgarden.net/
Like LaTeX, ConTeXt is a document markup language based on TeX. Unlike
LaTeX, it offers a direct interface for handling typography giving the user more
control over the formatting. It supports both pdfTeX and LuaTeX.

LyX
http://www.lyx.org/
LyX looks and feels like word processor software, but is built on LaTeX. It
combines an easy-to-use graphical user interface with the power and structure of
LaTeX. You can develop documents mainly using LyX's toolbars and menus, but
you may insert LaTeX code at any point.
The LyX wiki offers an extensive documentation at http://www.lyx.org/.
support. As LyX is very popular, it's also the subject of discussions at
http://www.latex-community.org/. Questions about LyX are also welcome at
http://tex.stackexchange.com/.

LaTeX blogs
Are you interested in LaTeX news and expert opinions? Then LaTeX blogs may
supply you with current LaTeX reading.

The TeXblog
http://texblog.net/
This is the blog of the author of this book. It regularly brings LaTeX-related news,
offers a lot of tips and tricks, and provides a structured link collection, sorted by
subject. And of course, it contains all code examples of this book, plus
supplementary material.

Some TeX Developments
http://www.texdev.net/
Joseph Wright, a member of the LaTeX project and author of LaTeX tools, writes
this blog.

LaTeX Alive
http://latex-alive.tumblr.com/
This is the blog of the LaTeX developer Will Robertson. It provides interesting
insights.

LaTeX for Humans
http://latexforhumans.wordpress.com/
This blog supports LaTeX in the humanities, with a special focus on Middle
Eastern Studies.

The TeX community aggregator
http://www.texample.net/community/
updated.

Summary
While you have learned about the LaTeX fundamentals in this book, this chapter
Accessing the world wide LaTeX community knowledge
Getting the latest news from blogs
Asking questions online if you would encounter any problem that you cannot
solve alone.
TeX friends will welcome you on any community website. As you have learned
much in this book, you may soon become an experienced LaTeX user who
supports LaTeX novices. At some time, you might be the advisor who answers
questions on LaTeX web forums.

Chapter 2: Formatting Words, Lines,
and Paragraphs

Commands
1

d.

2

b.

Lines and paragraphs
1

c.

2

c.

3

b.

Chapter 3: Designing Pages
1

c.

2

a.

3

b.

4

d.

5

d.

Chapter 4: Creating Lists
1

c.

2

b.

3

c.

Chapter 5: Creating Tables and
Inserting Pictures

Tables
1

a.

2

d.

Pictures and floats
1

b.

2

d.

Chapter 6: Cross-Referencing
1

b.

2

c.

Chapter 7: Listing Content and
References
1

a.

2

c.

3

a.

Chapter 8: Typing Math Formulas
1

b.

2

b.

3

d.

Chapter 9: Using Fonts
1

b.

2

c.

Chapter 10:
Documents
1

a.

2

b.

Developing

Large

Chapter
11:
Enhancing
Documents Further
1

d.

2

c.

Your

Chapter 12: Troubleshooting
1

a.

2

c.

Index

A
accents, ligatures
setting / Setting accents
experimenting with / Time for action – experimenting with accents
using / Time for action – using accents directly
afterpage package / Forcing the output of floats
all caps
alpha / What just happened?
AMS-Math FAQ
URL / AMS-Math FAQ
amsmath matrix environments
smallmatrix / Typesetting matrices
Vmatrix / Typesetting matrices
vmatrix / Typesetting matrices
Bmatrix / Typesetting matrices
bmatrix / Typesetting matrices
pmatrix / Typesetting matrices
matrix / Typesetting matrices
amsmath package
amssymb package
about / Exploring the wealth of math symbols
arguments / Understanding LaTeX commands
arrays
creating / Creating arrays

arrows
asparaenum, numbered lists / What just happened?
asparaitem, bulleted lists / What just happened?
automatic line breaking
improving / Breaking lines and paragraphs
hyphenation, improving / Improving hyphenation
division points, stating for words / Time for action – stating division
points for words, What just happened?
hyphenat package, exploiting / Have a go hero – exploiting the hyphenat
package
justification further, improving / Improving the justification further,
What just happened?
microtype package, using / Time for action – using microtype
automatic reference names
using / Using automatic reference names
cleveref, using / Time for action – referring cleverly, What just
happened?

B
babel package / What just happened?, Changing the headings
back matter, document
creating / Creating front and back matter
about / Creating front and back matter
appendix, adding / Time for action – adding a dedication and an
appendix, What just happened?
backtick / What just happened?
beamer class / Have a go hero – creating colorful tables
Bera Mono, typewriter fonts
Bera Sans, sans-serif fonts
biblatex package / Time for action – installing a LaTeX package
bibliography
creating / Creating a bibliography
references, listing / Time for action – citing texts and listing the
references, Listing references without citing
texts, citing / Time for action – citing texts and listing the references
standard bibliography environment, using / Using the standard
bibliography environment
bibliography databases, using with BibTeX / Using bibliography
databases with BibTeX
BibTeX entry fields / Looking at the BibTeX entry fields
BibTeX entry types / Understanding BibTeX entry types
bibliography style, selecting / Choosing the bibliography style
bibliography style
selecting / Choosing the bibliography style
plain / Choosing the bibliography style

unsrt / Choosing the bibliography style
alpha / Choosing the bibliography style
abbrv / Choosing the bibliography style
BibTeX
about / Time for action – creating and using a BibTeX database
BibTeX database
using / Time for action – creating and using a BibTeX database , What
just happened?
creating / Time for action – creating and using a BibTeX database ,
What just happened?
BibTeX entry fields
address / Looking at the BibTeX entry fields
annote / Looking at the BibTeX entry fields
author / Looking at the BibTeX entry fields
booktitle / Looking at the BibTeX entry fields
chapter / Looking at the BibTeX entry fields
crossref / Looking at the BibTeX entry fields
edition / Looking at the BibTeX entry fields
editor / Looking at the BibTeX entry fields
howpublished / Looking at the BibTeX entry fields
institution / Looking at the BibTeX entry fields
journal / Looking at the BibTeX entry fields
key / Looking at the BibTeX entry fields
month / Looking at the BibTeX entry fields
note / Looking at the BibTeX entry fields
number / Looking at the BibTeX entry fields
organization / Looking at the BibTeX entry fields
pages / Looking at the BibTeX entry fields
publisher / Looking at the BibTeX entry fields
school / Looking at the BibTeX entry fields

series / Looking at the BibTeX entry fields
title / Looking at the BibTeX entry fields
type / Looking at the BibTeX entry fields
volume / Looking at the BibTeX entry fields
year / Looking at the BibTeX entry fields
BibTeX entry types
article / Understanding BibTeX entry types
book / Understanding BibTeX entry types
booklet / Understanding BibTeX entry types
conference / Understanding BibTeX entry types
manual / Understanding BibTeX entry types
mastersthesis / Understanding BibTeX entry types
misc / Understanding BibTeX entry types
phdthesis / Understanding BibTeX entry types
proceedings / Understanding BibTeX entry types
techreport / Understanding BibTeX entry types
unpublished / Understanding BibTeX entry types
BibTeX reference / Understanding BibTeX entry types
binary operation symbols
binary relation symbols
binomial coefficients
writing / Writing binomial coefficients:
bitmap formats / Choosing the optimal file type
blindtext package / Have a go hero – evaluating and enhancing templates
Bookman, serif fonts
bookman package

bookmarks
creating manually / Creating bookmarks manually
special symbols / Math formulas and special symbols in bookmarks
math formulas / Math formulas and special symbols in bookmarks
booktabs package / Time for action – adding nicer horizontal lines with the
booktabs package
bulleted list
building / Building a bulleted list
LaTeX packages, listing / Time for action – listing LaTeX packages ,
What just happened?
nesting / Nesting lists
packages, listing by topic / Time for action – listing packages by topic,
What just happened?
compactitem / What just happened?
inparaitem / What just happened?
asparaitem / What just happened?

C
captionof command / Avoiding floating at all
captions
adding, to font table / Time for action – adding a caption to our font
table, What just happened?
placing above / Placing captions above
customizing / Have a go hero – customizing captions
cells
merging, \multicolumn used / Time for action – merging cells
merging, multirow used / Time for action – merging cells using the
multirow package, What just happened?
center environment / What just happened?
Charter, serif fonts
cite package / Using the standard bibliography environment
class / Exploring the document structure
class options
using, for document style configuration / Using class options to
configure the document style
cleveref
using / Time for action – referring cleverly, What just happened?
combining with, varioref / Combing cleveref and varioref
cleverev package
about / Using automatic reference names
cm-super package / Installing additional fonts
cmbright package
color package / Coloring your document

colortbl package / Coloring tables
command / Exploring the document structure
comment / Commenting your source text
common complaints
about / Using commands and environments
comp.text.tex
compactenum, numbered lists / What just happened?
compactitem, bulleted lists / What just happened?
Computer Modern
comparing, to Latin Modern / Time for action – comparing Computer
Modern to Latin Modern, What just happened?
Computer Modern Bright, sans-serif fonts
Computer Modern Roman
concrete package
Concrete Roman, serif fonts
control sequence
Cork encoding / What just happened?
counter / Adjusting the depth of the TOC
Courier, typewriter fonts
cross-referencing
referencing, setting / Setting labels and referencing
labels, setting / Setting labels and referencing
top list items, referencing / Time for action – referencing items of a top

list, What just happened?
intelligent page references, creating / Producing intelligent page
references
custom commands
creating / Saving time and effort – creating your own commands, What
just happened?
intelligent spacing, adding / Gentle spacing after commands, What just
happened?
universal commands, creating / Creating more universal commands –
using arguments
macro, creating for formatting keywords / Time for action – creating a
macro for formatting keywords
optional arguments, using / Using optional arguments
keywords, marking with optional formatting / Time for action – marking
keywords with optional formatting, What just happened?

D
dcolumn package / Aligning columns at the decimal point
declaration / What just happened?
definition list
creating / Producing a definition list
packages capabilities, explaining / Time for action – explaining
capabilities of packages, What just happened?
dimensions, adjusting / Have a go hero – adjusting the dimensions of
lists
delimiters
description environment / Time for action – explaining capabilities of
packages
displayed formulas, customizing
options / Customizing displayed formulas
fleqn / Customizing displayed formulas
leqno / Customizing displayed formulas
multi-line formulas, typesetting / Time for action – typesetting multiline formulas
multi-line equations, aligning / Aligning multi-line equations
rows in multi-line formulas, numbering / Numbering rows in multi-line
formulas
text, inserting into formulas / Inserting text into formulas
displaymath environment / Displaying formulas
document
chapter and section headings, designing / Time for action – designing
chapter and section headings, What just happened?
documentclass / Time for action – swapping out preamble and chapter
contents

document page layout
defining / Defining the overall layout
margins, defining / Defining the margins yourself
margins, specifying / Time for action – specifying margins, What just
happened?
geometry package, using / Using the geometry package
package documentation, obtaining / Obtaining package documentation
constructing, typearea used / Have a go hero – constructing the page
layout with typearea
line spacing, changing / Changing the line spacing
documents
text, inserting in columns / Writing in columns
table, typesetting / Typesetting tables
picture, inserting / Inserting pictures
pictures, inserting / Inserting pictures
floating environments, managing / Managing floating environments
documents, developing
input, splitting / Splitting the input
preamble and chapter contents, swapping out / Time for action –
swapping out preamble and chapter contents, What just happened?
codes, including / Including small pieces of code
one or more pages, including / Including bigger parts of a document
partial document, compiling / Compiling parts of a document
front matter, creating / Creating front and back matter
back matter, creating / Creating front and back matter
title page, designing / Designing a title page
templates, working with / Working with templates
documents, enhancing

hyperlink appearance, customizing / Time for action – customizing the
PDF metadata, editing / Time for action – editing PDF metadata, What
just happened?
bookmarks, creating manually / Creating bookmarks manually
texts, coloring / Coloring your document
colorful tables, creating / Have a go hero – creating colorful tables
document style
configuring, class options used / Using class options to configure the
document style
two-column landscape document, creating / Time for action – creating a
two-column landscape document, What just happened?
dots, ligatures
setting / Setting dots
differently spaced dots, using / Time for action – using differently
spaced dots, What just happened?
comparing, to ellipsis / Time for action – comparing dots to ellipsis
doublespace / What just happened?
dvips
about / Choosing the optimal file type

E
ellipsis, math formulas
producing / Producing an ellipsis
entries, in TOC
shortening / Shortening entries
enumerate environment / What just happened?
enumitem commands
\setlist / What just happened?
\setitemize / What just happened?
\setenumerate / What just happened?
parameters / What just happened?
enumitem package / Choosing bullets and numbering format
environment / Exploring the document structure
environments
using, for adjusting font size / Using environments, What just happened?
epstopdf
about / Choosing the optimal file type
errors
fixing / Understanding and fixing errors, Time for action – interpreting
and fixing an error
interpreting / Time for action – interpreting and fixing an error
commands and
environments

environments,

using

/ Using commands

and

math formulas, writing / Writing math formulas
preamble and document body, handling / Handling the preamble and
document body
files, working with / Working with files
tables and arrays, creating / Creating tables and arrays

lists, working with / Working with lists
floating figures and tables, working with / Working with floating figures
and tables
syntax errors / General syntax errors
eso-pic package / Putting images behind the text
expressions
stacking / Stacking expressions
overlining / Underlining and overlining
underlining / Underlining and overlining
accents, setting / Setting accents
symbol, putting above another / Putting a symbol above another

F
fancy / What just happened?
fancyhdr package / Time for action – customizing headers with the fancyhdr
package
fancyref package / What just happened?
fancyunits / Writing units
FAQs
UK TeX FAQ / UK TeX FAQ
Visual LaTeX FAQ / Visual LaTeX FAQ
MacTeX FAQ / MacTeX FAQ
AMS-Math FAQ / AMS-Math FAQ
LaTeX Picture FAQ / LaTeX Picture FAQ
fixltx2e package / Embedding math expressions within text
floating
limiting / Limiting floating
floating environments
managing / Managing floating environments
testing / Time for action – letting a figure float, What just happened?
float placement options / Understanding float placement options
float output, forcing / Forcing the output of floats
floating, limiting / Limiting floating
floating, avoiding / Avoiding floating at all
figures and tables, spanning over text columns / Spanning figures and
tables over text columns
text, flowing around figures / Letting text flow around figures
picture, embedding within text / Time for action – embedding a picture
within text, What just happened?

figures and tables, grouping / Breaking figures and tables into pieces
floats
flushleft / What just happened?
flushright / What just happened?
font, math formulas
modifying / Changing the font, style, and size
fontenc / What just happened?
font packages
Latin Modern / Latin Modern – a replacement for the standard font
Kp-fonts / Kp-fonts – a full set of fonts
fonts, LaTeX
encoding, preparing / Preparing the encoding
special characters, using / Time for action – directly using special
characters, What just happened?
main font, selecting / Choosing the main font
reference link / Exploring the world of LaTeX fonts
exploring / Exploring the world of LaTeX fonts
footnotes
using / Using footnotes
using, in text and headings / Time for action – using footnotes in text
dividing line, modifying / Modifying the dividing line
footnote line, redefining / Time for action – redefining the footnote line,
What just happened?
expanding, packages used / Using packages to expand footnote styles
fourier math fonts
fractions, math formulas

writing / Writing fractions
front matter, documents
creating / Creating front and back matter
about / Creating front and back matter
dedication, adding / Time for action – adding a dedication and an
appendix, What just happened?
full justification
disabling / Turning off full justification
paragraph, justifying to left / Time for action – justifying a paragraph to
the left, What just happened?
ragged-left text, creating / Creating ragged-left text
title, centering / Time for action – centering a title, What just happened?
environments, using / Using environments for justification
verses, centering / Time for action – centering verses, What just
happened?

G
general modes, LaTeX
paragraph mode / Writing basic formulas
left-to-right mode / Writing basic formulas
math mode / Writing basic formulas
geometry package, document page layout
using / Using the geometry package
paper size, selecting / Choosing the paper size
text area, specifying / Specifying the text area
margins, setting / Setting the margins
German umlauts
working / Time for action – directly using special characters
graphicx package / Inserting pictures
Greek letters, math formulas
grffile package / What just happened?
group / What just happened?

H
harpoons
customizing, fancyhdr package used / Time for action – customizing
headers with the fancyhdr package, What just happened?
headers, customizing with fancyhdr package / Time for action –
customizing headers with the fancyhdr package, What just happened?
page styles / Understanding page styles
customizing / Customizing header and footer
decorative lines, using / Using decorative lines in header or footer
changing, natbib using / Have a go hero – using natbib
chapter and section headings, designing / Time for action – designing
chapter and section headings, What just happened?
Helvetic, sans-serif fonts
homepage, TeX Live
demo / Installing LaTeX
horizontal lines
adding, to table / Time for action – adding nicer horizontal lines with
the booktabs package
customizing / Time for action – customizing the hyperlink appearance

creating manually / Creating hyperlinks manually
hyperref
hyperref package
options / What just happened?
meta-information options / What just happened?
user commands / Creating hyperlinks manually
hyperref package, options
draft / What just happened?
final / What just happened?
debug / What just happened?
pageanchor / What just happened?
backref / What just happened?
hyperindex / What just happened?
hyperfootnotes / What just happened?
anchorcolor / What just happened?
citecolor / What just happened?
filecolor / What just happened?
urlcolor / What just happened?
bookmarks / What just happened?

bookmarksopen / What just happened?
bookmarksnumbered / What just happened?
pdfstartpage / What just happened?
hyphenat package
exploiting / Have a go hero – exploiting the hyphenat package

I
Imagemagick
about / Choosing the optimal file type
in-line formulas
comparing, to displayed formulas / Comparing in-line formulas to
displayed formulas
Inconsolata, typewriter fonts
index, generating
words, marking / Time for action – marking words and building the
index, What just happened?
subentries, defining / Defining index entries and subentries
index entries, defining / Defining index entries and subentries
page ranges, specifying / Specifying page ranges
symbols and macros, using / Using symbols and macros in the index
cross-reference / Referring to other index entries
page numbers, emphasizing / Fine-tuning page numbers
index layout, designing / Designing the index layout
inequality relation symbols
inparaenum, numbered lists / What just happened?
inparaitem, bulleted lists / What just happened?
input, LaTeX
spaces, inserting / Time for action – trying out the effect of spaces, line
breaks, and empty lines
line breaks, inserting / Time for action – trying out the effect of spaces,
line breaks, and empty lines
source text, commenting / Commenting your source text
special symbols, printing out / Printing out special symbols

special characters, writing / Time for action – writing special
characters in our text
inputenc / What just happened?
inputenc package / What just happened?
installation, LaTex
TeX Live, installing using net installer wizard / Time for action –
installing TeX Live using the net installer wizard
offline installation / Time for action – installing TeX Live offline
intelligent page references
creating / Producing intelligent page references
variable references, introducing / Time for action – introducing
variable references, What just happened?
page references, fine-tuning / Fine-tuning page references
page ranges, referring to / Referring to page ranges
automatic reference names, using / Using automatic reference names
cleveref and varioref, combining / Combing cleveref and varioref
labels, referring to / Referring to labels in other documents
references, turning into hyperlinks / Have a go hero – turning references
itemize environment / What just happened?

K
Kile
about / Have a go hero – checking out advanced LaTeX editors
URL / Have a go hero – checking out advanced LaTeX editors
KOMA-Script classes
about / Have a go hero – trying KOMA-Script classes
KOMA-Script documentation / What just happened?
Kp-fonts
about / Kp-fonts – a full set of fonts
kpathsea library / Have a go hero – examining a package source file
kpsewhich tool / Have a go hero – examining a package source file
Kurier, sans-serif fonts

L
l2tabu / Have a go hero – evaluating and enhancing templates
labels and referencing, cross-referencing
setting / Setting labels and referencing
top list items, referencing / Time for action – referencing items of a top
list, What just happened?
key, assigning / Assigning a key
key, referring to / Referring to a key
page, referring to / Referring to a page
landscape orientation
using / Using landscape orientation
LaTeX
overview / What is LaTeX?
reference link / What is LaTeX?
benefits / How we can benefit
features / How we can benefit, Protection for your work
merits / The virtues of open source
basic principle / Separation of form and content
classes / Separation of form and content
packages / Separation of form and content
portability / Portability
protection, for work / Protection for your work
comparing, with word processor software / Comparing it to word
processor software
challenges / What are the challenges?
installing / Installing LaTeX
logical formatting / Understanding logical formatting

text formatting / Formatting text – fonts, shapes, and styles
macros, creating / Saving time and effort – creating your own
commands
paragraph width, limiting / Using boxes to limit the width of paragraphs
line breaking / Breaking lines and paragraphs
ligatures, exploring / Exploring the fine details
full justification, disabling / Turning off full justification
quotes, displaying / Displaying quotes
book, writing with chapters / Time for action – writing a book with
chapters, What just happened?
default page layout, reviewing / Reviewing LaTeX's default page layout
page breaking / Breaking pages
page, enlarging / Enlarging a page
empty page, sparing / Time for action – sparing an almost empty page,
What just happened?
footnotes, using / Using footnotes
bulleted list / Building a bulleted list
numbered list / Creating a numbered list
lists, customizing / Customizing lists
definition list / Producing a definition list
lists of figures, creating / Creating and customizing lists of figures
lists of figures, customizing / Creating and customizing lists of figures
list of tables, creating / Creating a list of tables
packages, for customization / Using packages for customization
index, generating / Generating an index
bibliography, creating / Creating a bibliography
basic formulas, writing / Writing basic formulas
general modes / Writing basic formulas

mathtools package / Have a go hero – checking out the mathtools
package
common complaints / Using commands and environments
warning messages, handling / Handling warnings
troubleshooting / General troubleshooting
web forums / Web forums, discussion boards, and Q, Web forums
Usenet groups / Usenet groups
LaTeX-Community.org
URL / LaTeX-Community.org
LaTeX base classes
letter / What just happened?
beamer / What just happened?
powerdot / What just happened?
article / What just happened?
book / What just happened?
report / What just happened?
slides / What just happened?
options / What just happened?
LaTeX commands
LaTeX distribution
TeX Live / Installing LaTeX
LaTeX distributions
TeX Live / LaTeX distributions
MiKTeX / LaTeX distributions
proTeXt / LaTeX distributions
MacTeX / LaTeX distributions

LaTeX document
creating, TeXworks used / Time for action – writing our first document
with TeXworks, What just happened?
LaTeX editors
about / Have a go hero – checking out advanced LaTeX editors
Kile / Have a go hero – checking out advanced LaTeX editors
TeXShop / Have a go hero – checking out advanced LaTeX editors
Texmaker / Have a go hero – checking out advanced LaTeX editors
Cross-platform / Cross-platform
Windows / Windows
Linux / Linux
Mac OS X / Mac OS X
LaTeX environments
LaTeX macros / Have a go hero – adjusting the dimensions of lists
LaTeX package
installing / Time for action – installing a LaTeX package
LaTeX packages
listing / Time for action – listing LaTeX packages, What just happened?
LaTeX Picture FAQ
URL / LaTeX Picture FAQ
LaTeX project
URL / The LaTeX project
latexsym package / Exploring the wealth of math symbols
LaTeX typesetting
errors / Understanding and fixing errors
Latin Modern
about / Latin Modern – a replacement for the standard font

layouts / Have a go hero – adjusting the dimensions of lists
left-to-right mode
length macros / Have a go hero – adjusting the dimensions of lists
letter-like symbols
about / Symbols derived from letters
letterspacing
ligatures
exploring / Exploring the fine details, Time for action – exploring
ligatures, What just happened?
understanding / Understanding ligatures
dash, selecting / Choosing the right dash
dots, setting / Setting dots
accents, setting / Setting accents
special characters, using in editor / Using special characters directly in
the editor
line breaking, manually
line breaks, using / Time for action – using line breaks, What just
happened?
line breaking options, exploring / Have a go hero – exploring line
breaking options
linebreaks, preventing / Preventing line breaks
linebreaks, managing / Managing line breaks wisely
line spacing, document page layout
changing / Changing the line spacing
increasing / Time for action – increasing line spacing, What just
happened?
package source file, examining / Have a go hero – examining a package
source file
lipsum package / Have a go hero – evaluating and enhancing templates

list of diagrams
creating / Time for action – creating a list of diagrams, What just
happened?
list of tables
creating / Creating a list of tables
lists, customization
compact lists, saving space with / Saving space with compact lists,
Time for action – shrinking our tutorial, What just happened?
bullets and numbering format, selecting / Choosing bullets and
numbering format, Time for action – modifying lists using enumitem,
What just happened?
enumitem, using / Time for action – modifying lists using enumitem
lists, continuing / Suspending and continuing lists
lists, suspending / Suspending and continuing lists
local user groups
URLs / Local user groups
logical formatting
document, tilting / Time for action – titling your document
document structure, exploring / Exploring the document structure
longtable package / Generating multi-page tables
ltablex package / Generating multi-page tables
ltxtable package / Generating multi-page tables

M
Mac OS X
LaTex, installing / Installation on other operating systems
macros
MacTeX
URL / LaTeX distributions
MacTeX FAQ
URL / MacTeX FAQ
mailing lists
texhax / texhax
tex-live / tex-live
texworks / texworks
main font
selecting / Choosing the main font
Computer Modern, comparing to Latin Modern / Time for action –
comparing Computer Modern to Latin Modern, What just happened?
serif fonts / Times Roman
sans-serif fonts / Sans-serif fonts
typewriter fonts / Courier
margins, geometry package
setting / Setting the margins
math accents / Setting accents

math expressions
embedding, within text / Embedding math expressions within text
math formulas
writing / Writing basic formulas
general modes / Writing basic formulas
equations and roots
math expressions, embedding within text / Embedding math expressions
within text
displaying / Displaying formulas
equations, numbering / Numbering equations
roots, extracting / Extracting roots
fractions, writing / Writing fractions
Greek letters / Greek letters
Script letters / Script letters
ellipsis, producing / Producing an ellipsis
in-line formulas, comparing to displayed formulas / Comparing in-line
formulas to displayed formulas
font, modifying / Changing the font, style, and size
style, modifying / Changing the font, style, and size
size, modifying / Changing the font, style, and size
displayed formulas, customizing / Customizing displayed formulas
fine-tuning / Fine-tuning formulas
operators, using / Using operators
math symbols, exploring / Exploring the wealth of math symbols
units / Writing units
theorems and definitions, writing / Writing theorems and definitions
math mode

mathpazo package
mathptmx package / Times Roman
math structures
building / Building math structures
arrays, creating / Creating arrays
binomial coefficients, writing / Writing binomial coefficients:
matrices, typesetting / Typesetting matrices
math styles
display / Changing the font, style, and size
text / Changing the font, style, and size
script / Changing the font, style, and size
scriptscript / Changing the font, style, and size
math symbols
about / Exploring the wealth of math symbols
binary operation symbols / Binary operation symbols
binary relation symbols / Binary relation symbols
inequality relation symbols / Inequality relation symbols
subset and superset symbols / Subset and superset symbols
variable sized operators / Variable sized operators
arrows / Arrows
harpoons / Harpoons
letter-like symbols / Symbols derived from letters
delimiters / Variable sized delimiters
miscellaneous symbols / Miscellaneous symbols
mathtools package
about / Have a go hero – checking out the mathtools package
features / Have a go hero – checking out the mathtools package

matrices
typesetting / Typesetting matrices
memoir class / Creating front and back matter
meta-information options, hyperref package
pdftitle / What just happened?
pdfauthor / What just happened?
pdfsubject / What just happened?
pdfcreator / What just happened?
pdfproducer / What just happened?
pdfkeywords / What just happened?
microtype package / Time for action – using microtype
MiKTeX
about / Installing LaTeX, LaTeX distributions
URL / LaTeX distributions
minipage environment
using / Time for action – using the minipage environment
footnote, creating / Have a go hero – creating a footnote inside a
minipage
miscellaneous symbols
monospaced font / What just happened?
multi-line equations
aligning / Aligning multi-line equations
multi-line formulas
typesetting / Time for action – typesetting multi-line formulas
multi-page tables
generating / Generating multi-page tables
multicols package / What just happened?

N
natbib package / Choosing the bibliography style
newcent package
New Century Schoolbook, serif fonts
numbered list
creating / Creating a numbered list
step-by-step tutorial, writing / Time for action – writing a step-by-step
tutorial, What just happened?
compactenum / What just happened?
inparaenum / What just happened?
asparaenum / What just happened?

O
onehalfspace / What just happened?
onehalfspacing / What just happened?
operators
optional arguments
marking / Using optional arguments

P
package documentation
obtaining / Obtaining package documentation
geometry package manual, searching / Time for action – finding the
geometry package manual
packages, for customization
using / Using packages for customization
tocloft / Using packages for customization
titletoc / Using packages for customization
multitoc / Using packages for customization
minitoc / Using packages for customization
tocbibind / Using packages for customization
page breaking
page breaking options
exploring / Have a go hero – exploring page breaking options
page breaks
inserting / Time for action – inserting page breaks, What just happened?
page styles
Palatino, serif fonts
pangram / Choosing the main font
paper size, geometry package
selecting / Choosing the paper size
paragraph mode
paragraph mode, basic formulas

paragraph width, limiting
narrow text column, creatiing / Time for action – creating a narrow text
column, What just happened?
common paragraph boxes / Common paragraph boxes
minipage environment, using / Boxes containing more text, What just
happened?
footnote, creating inside a minipage / Have a go hero – creating a
footnote inside a minipage
parameters, enumitem commands
font / What just happened?
label / What just happened?
align / What just happened?
start / What just happened?
resume* / What just happened?
resume / What just happened?
noitemsep / What just happened?
nolistsep / What just happened?
parskip package / What just happened?
pdfjam / What just happened?
editing / Time for action – editing PDF metadata, What just happened?
pdfpages package / What just happened?
pictures
inserting in tables / Inserting pictures, Time for action – including a
picture, What just happened?
scaling / Scaling pictures
optimal file type, selecting / Choosing the optimal file type
whole pages, including / Including whole pages
putting, behind text / Putting images behind the text

placeins package / Limiting floating
preamble / Exploring the document structure
proTeXt
URL / LaTeX distributions
ps2pdf
about / Choosing the optimal file type

Q
quotation environment / Quoting longer text
quote environment / What just happened?
quotes
scientist, quoting / Time for action – quoting a scientist, What just
happened?
longer text, quoting / Quoting longer text
TeX benefits, quoting / Time for action – quoting TeX's benefits
paragraphs, seperating by vertical space / Time for action – spacing

R
raster graphics / Choosing the optimal file type
rccol package / Aligning columns at the decimal point
reputation
Roman fonts / What just happened?
roots, math formulas
extracting / Extracting roots
rotating package / Using landscape orientation
row height, table
increasing / Increasing the row height
rows, in multi-line formulas
numbering / Numbering rows in multi-line formulas

S
sans-serif font / What just happened?
sans-serif fonts
Helvetica / Helvetica
Bera Sans / Bera Sans
Computer Modern Bright / Computer Modern Bright
Kurier / Kurier
scope / What just happened?
scrbook class / Creating front and back matter
Script letters, math formulas
semantic markup / What just happened?
serif fonts
Times Roman / Times Roman
Charter / Charter
Palatino / Palatino
Bookman / Bookman
New Century Schoolbook / New Century Schoolbook
Concrete Roman / Concrete Roman
setspace package / What just happened?
singlespace / What just happened?
siunits / Writing units
siunitx package / Aligning columns at the decimal point, Writing units
size, math formulas
modifying / Changing the font, style, and size
smallmatrix environment / Typesetting matrices
special characters

using / Time for action – directly using special characters
stabular package / Generating multi-page tables
Stack Exchange
about / TeX and LaTeX on Stack Exchange, What just happened?
question, asking online / Time for action – asking a question online,
What just happened?
standard bibliography environment
using / Using the standard bibliography environment
style, math formulas
modifying / Changing the font, style, and size
style file / Have a go hero – examining a package source file
subcaption package / Breaking figures and tables into pieces
subfig package / Breaking figures and tables into pieces
subset and superset symbols
about / Subset and superset symbols
supertabular package / Generating multi-page tables
syntax errors

T
T1 font encoding / Time for action – directly using special characters
tabbing environment
using / Time for action – lining up information using the tabbing
environment
tables
coloring / Coloring tables
tables, typesetting
table, building / Time for action – building a table of font family
commands, What just happened?
lines, drawing / Drawing lines in tables
arguments, formatting / Understanding formatting arguments
row height, increasing / Increasing the row height
horizontal lines, adding with booktabs package / Time for action –
adding nicer horizontal lines with the booktabs package, What just
happened?
entries, spanning over multiple columns / Spanning entries over
multiple columns
cells, merging / Time for action – merging cells, What just happened?
code, inserting column-wise / Inserting code column-wise
array package, using / Time for action – using the array package
entries, spanning over multiple rows / Spanning entries over multiple
rows
cells, merging using multirow package / Time for action – merging cells
using the multirow package
captions, adding to font table / Time for action – adding a caption to our
font table, What just happened?
captions, placing above / Placing captions above

captions, customizing / Have a go hero – customizing captions
columns, auto-fitting to table width / Auto-fitting columns to the table
width
multi-page tables, generating / Generating multi-page tables
tables, coloring / Coloring tables
landscape orientation, using / Using landscape orientation
columns, aligning at decimal point / Aligning columns at the decimal
point
narrow columns, handling / Handling narrow columns
tabular environment
tabularx package / Auto-fitting columns to the table width
tabulary package / Auto-fitting columns to the table width
templates
working with / Working with templates
creating / Working with templates , Time for action – starting with a
template
enhancing / Have a go hero – evaluating and enhancing templates
evaluating / Have a go hero – evaluating and enhancing templates
tex-live
URL / tex-live
TeX.SE
TeX Catalogue
visiting online / Time for action – visiting the TeX Catalogue Online
TeX discussion board
comp.text.tex / comp.text.tex
TeX distributions

texdoc / What just happened?
texhax
URL / texhax
TeX Live
about / Portability, Installing LaTeX, LaTeX distributions
URL / Installing LaTeX, LaTeX distributions
homepage / Installing LaTeX
installing, net installer wizard used / Time for action – installing TeX
Live using the net installer wizard
offline installation / Time for action – installing TeX Live offline
installing, on other operating systems / Installation on other operating
systems
TeX Live 2010
DVIOUT DVI viewer / What just happened?
PS_VIEW / What just happened?
TeX Live documentation / What just happened?
TeX Live Manager / What just happened?
TeXdoc GUI / What just happened?
TeXworks editor / What just happened?
Texmaker
about / Have a go hero – checking out advanced LaTeX editors
URL / Have a go hero – checking out advanced LaTeX editors
TeXnicCenter
about / Choosing the optimal file type
TeX Q&A site
TeXShop
URL / Have a go hero – checking out advanced LaTeX editors
about / Have a go hero – checking out advanced LaTeX editors

text
inserting, into formulas / Inserting text into formulas
text, aligning in columns
information, lining up using tabbing environment / Time for action –
lining up information using the tabbing environment, What just
happened?
font commands, lining up / Time for action – lining up font commands,
What just happened?
text area, geometry package
specifying / Specifying the text area
text formatting
font shape, tuning / Time for action – tuning the font shape, What just
happened?
font family, selecting / Choosing the font family
typewriter fonts, switching to / Time for action – switching to sans-serif
and to typewriter fonts, What just happened?
sans-serif, switching to / Time for action – switching to sans-serif and
to typewriter fonts, What just happened?
serifs fonts / What just happened?
Roman fonts / What just happened?
sans-serif font / What just happened?
monospaced font / What just happened?
typewriter font / What just happened?
fonts, switching / Switching fonts
font family, switching / Time for action – switching the font family,
What just happened?
declarations,
declarations

summarizing

/ Summarizing font commands and

font commands, summarizing / Summarizing font commands and
declarations
command effect, delimiting / Delimiting the effect of commands
grouping, exploring by braces / Time for action – exploring grouping by

braces, What just happened?
font sizes, exploring / Time for action – exploring font sizes, What just
happened?
font sizes, adjusting using environments / Using environments, What just
happened?
textpos package / Putting images behind the text
TeX user group sites
about / TeX user group sites
TUG / TUG – the TeX users group
LaTeX project / The LaTeX project
UK TUG / UK TUG – TeX in the United Kingdom
local user groups / Local user groups
TeX users group
URL / TUG – the TeX users group
about / TUG – the TeX users group
texworks
URL / texworks
TeXworks
thebibliography environment / What just happened?
theorems and definitions
writing / Writing theorems and definitions
TikZ package / Have a go hero – creating colorful tables
times package / Times Roman
Times Roman, serif fonts
title page, document
designing / Designing a title page
creating / Time for action – creating a title page, What just happened?

titlepage environment / What just happened?
titlesec
titling package / What just happened?
TOC
entries, shortening / Sectioning and the contents, What just happened?,
Shortening entries
just happened?
troubleshooting
log files, examining / Have a go hero – examining LaTeX's log files
TUG
URL / TUG – the TeX users group
tutorial, lists
shrinking / Time for action – shrinking our tutorial, What just
happened?
two-column landscape document
creating / Time for action – creating a two-column landscape document,
What just happened?
txfonts package / Times Roman
typearea package / Have a go hero – constructing the page layout with
typearea
typewriter fonts
Courier / Courier
Inconsolata / Inconsolata
Bera Mono / Bera Mono

U
UK TeX FAQ
URL / UK TeX FAQ
UK TUG
URL / UK TUG – TeX in the United Kingdom
about / UK TUG – TeX in the United Kingdom
unicode / What just happened?
unicode encoding / Time for action – directly using special characters
units
writing / Writing units
Usenet groups
comp.text.tex / comp.text.tex
German or French Usenet TeX group / Newsgroups in other languages
user commands, hyperref package

V
variable sized operators
varioref commands
\vref / Time for action – introducing variable references
\vpageref / Time for action – introducing variable references, Referring
to page ranges
\vpagerefrange / Referring to page ranges
varioref package / Referring to a page
combining with, cleveref / Combing cleveref and varioref
vector graphics format / Choosing the optimal file type
verbatim text
Visual LaTeX FAQ
URL / Visual LaTeX FAQ

W
warning messages
handling / Handling warnings
sans-serif font, emphasizing / Time for action – emphasizing on a sansserif font
text, justifying / Justifying text
referencing / Referencing
fonts, selecting / Choosing fonts
figures and tables, placing / Placing figures and tables
document class, customizing / Customizing the document class
obsolete packages, avoiding / Avoiding obsolete classes and packages
web forums, LaTeX
LaTeX-Community.org / LaTeX-Community.org
Stack Exchange / TeX and LaTeX on Stack Exchange
wide accents / Setting accents
wrapfig package / Letting text flow around figures
wrapfigure environment / What just happened?

X
xcolor package / Coloring your document, Have a go hero – creating colorful
tables
xtab package / Generating multi-page tables



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
Linearized                      : No
Author                          : Stefan Kottwitz
Create Date                     : 2016:07:28 16:10:08+00:00
Producer                        : calibre 1.48.0 [http://calibre-ebook.com]
Description                     :
Title                           : LaTeX Beginner's Guide
Publisher                       : Packt Publishing
Subject                         :
Creator                         : Stefan Kottwitz
Date                            : 2011:03:21 00:00:00+08:00
Language                        : en
Identifier Scheme               : mobi-asin
Identifier                      : B0073FTN5I