The Not So Short
Introduction to L
A
T
E
X 2
ε
Or L
A
T
E
X 2
ε
in 139 minutes
by Tobias Oetiker
Hubert Partl, Irene Hyna and Elisabeth Schlegl
    
ii
        
             
            
           
            without
any warranty       merchantability  fitness for
a particular purpose         
            
             
   
Thank you!
           
 
    
  <partl@mail.boku.ac.at>
Zentraler Informatikdienst der Universität für Bodenkultur Wien
  <Irene.Hyna@bmwf.ac.at>
Bundesministerium für Wissenschaft und Forschung Wien
  <noemail>
in Graz
           
 
ε
   CTAN://info/lshort/german
iv Thank you!
        
              
            
              
             
 
             
  https://github.com/oetiker/lshort    

         
         
         
         
           
          
          
            
           
         
        
          
        
           
         
           
          
          
           
          
           
           
           
         
          
         
         
         
Preface
         
          
           
  

   
   
ε
   
  
       

     
Chapter 1       
ε
 
        
   
      

Chapter 2          
   
    
            
      
Chapter 3      
  
     
    
          

Chapter 4        
  
Chapter 5    
     
           
  
      

  
Chapter 6        
     
    
         

      
vi Preface
              
            
       
            
           
          
 
     Local Guide   
           
      not         
            
 

       
      
 
      
 http://www.ctan.org
          
          
       CTAN:  
        
    
        
  CTAN://systems
             
          
            
   
  <tobi@oetiker.ch>
 
 
 

        
CTAN://info/lshort
Contents
Thank you! iii
Preface v
1 Things You Need to Know 1
       

   

   
     
       
      
     

   
     
      

  
     
     
      
         
    
    
       
       
       
2 Typesetting Text 15
         
        
     
      
       
       
viii CONTENTS
     
        
    
       
       
     e   
       
      
       
      
     
       
       
       
      
     
      
     
       
       
      
       
    
       
       
3 Typesetting Mathematical Formulae 43
  A
M
S
     
     
     
        
          
     
     
     
       
      
       
    
        
     
       
       
       
CONTENTS ix
4 Specialities 73
      
        
       
      
      

      
       
      
      
  
    
       
  
 

       
5 Producing Mathematical Graphics 89
      
  picture    
       
       
      
      
      
 \multiput  \linethickness   
      
       
        
    
        
       
6 Customising L
A
T
E
X 103
        
     
     
     
 
  
        
      
        
       
    
      
       
x CONTENTS
       
     
       
       
       
      
        
A Installing L
A
T
E
X 121
          
      

    

   
 
   
       

    
 
  

   
       
        

        
Bibliography 125
Index 128
List of Figures
 
    
       
         
     test.png   
  fancyhdr      
     beamer      
       
          
List of Tables
      
        
      
   
     
   
          
       
    graphicx    
      
      
       
       
       
       
      
        
      
     
       
     
 A
M
S      
 A
M
S        
     
 A
M
S     
 A
M
S     
 A
M
S      
 A
M
S      
 A
M
S      
       
        
       
xiv LIST OF TABLES
         
       

   
Chapter 1
Things You Need to Know
The first part of this chapter presents a short overview of the philosophy and
history of L
A
T
E
X 2
ε
. The second part focuses on the basic structures of a L
A
T
E
X
document. After reading this chapter, you should have a rough knowledge of
how L
A
T
E
X works, which you will need to understand the rest of this book.
1.1 A Bit of History
1.1.1 T
E
X
           
         
           
          
            
           
            
          
          
            
   π     3.141592653
          

           
     
        
    
 TeX
              
              
   I do not get angry when people pronounce T
E
X in their favorite way
and in Germany many use a soft ch because the X follows the vowel e, not the harder ch
that follows the vowel a. In Russia, ‘tex’ is a very common word, pronounced ‘tyekh’. But I
believe the most proper pronunciation is heard in Greece, where you have the harsher ch of
ach and Loch.
2 Things You Need to Know
1.1.2 L
A
T
E
X
           
     
 
       
   
   
  

        

     LaTeX
ε
  
   LaTeX2e
1.2 Basics
1.2.1 Author, Book Designer, and Typesetter
        
            
           
           
        
            
         
          
   


       

    
     
          
           
   

      
   
    MS Word  LibreOffice    
         
              
   
 
          
            
    
      
      
1.2.2 Layout Design
         
           
         
      
1.2 Basics 3
               
         
   
            
         
             
        
       
      
 
        logical   

     
1.2.3 Advantages and Disadvantages
         
 
    
     
             
            
 
        
 
    
       
    
        
         
         
        
         
     
         
   
      
       
          
The L
A
T
E
X Companion 
       
 
  
4 Things You Need to Know
    
ε
    
         
           
            
;-)
          
       
           
  
         
        
        
1.3 L
A
T
E
X Input Files
  
         
            
            
         
   
  
    
1.3.1 Spaces
          

 Several consecutive     
one           
      
           
Several        one     
                
       
It does not matter whether you
enter one or several spaces
after a word.
An empty line starts a new
paragraph.
       
    
     
               
 
1.3 L
A
T
E
X Input Files 5
1.3.2 Special Characters
          
 
           
           
      
# $ % ^ & _ { } ~ \
            
    
\# \$ \% \^{} \& \_ \{ \} \~{}
\textbackslash
          
          not
         \\   
      \textbackslash  
1.3.3 L
A
T
E
X Commands
          

     \       
        
  
       
         
   
         
          {}  
          
 {} 
         

New \TeX users may miss whitespaces
after a command. % renders wrong
Experienced \TeX{} users are
\TeX perts, and know how to use
whitespaces. % renders correct

    
    


      

          
  { }        
6 Things You Need to Know
          
 [ ]
\command[optional parameter]{parameter}
    
    
   
You can \textsl{lean} on me!
  lean  
Please, start a new line
right here!\newline
Thank you!
     
 
1.3.4 Comments

 %        
              
    
             
    
This is an % stupid
% Better: instructive <----
example: Supercal%
ifragilist%
icexpialidocious
    

 %            
     
       comment  
 verbatim     \usepackage{verbatim}  
          
This is another
\begin{comment}
rather stupid,
but helpful
\end{comment}
example for embedding
comments in your document.
     
   
          

1.4 Input File Structure 7
1.4 Input File Structure

ε
          
         
\documentclass{...}
            
           
     
     
 
\usepackage{...}
      
       
 
\begin{document}
        

       
\end{document}
   
         
   

      
ε
  
       
1.5 A Typical Command Line Session
         
  
     
     
             
 
      
          
   \documentclass  \begin{document}    preamble
\documentclass{article}
\begin{document}
Small is beautiful.
\end{document}
   

8 Things You Need to Know
         
 
           
 
     
  
        
            
            Plain Text 
           
.tex
      cd       
   
        
  .pdf      
  
           
   
       
    ctrl-D       
xelatex foo.tex
               
;-)
\documentclass[a4paper,11pt]{article}
% define the title
\author{H.~Partl}
\title{Minimalism}
\begin{document}
% generates the title
\maketitle
% insert the table of contents
\tableofcontents
\section{Some Interesting Words}
Well, and here begins my lovely article.
\section{Good Bye World}
\ldots{} and here it ends.
\end{document}
           
           
1.6 The Layout of the Document 9
1.6 The Layout of the Document
1.6.1 Document Classes
  
        
             
\documentclass 
\documentclass[options]{class}
 class            
      
ε

         
 options         
           
       
    
     
\documentclass[11pt,twoside,a4paper]{article}
  
      article   
   eleven points       double sided
  A4 paper
   
article         
  
proc        
minimal               
      
report         

book   
slides             
     
10 Things You Need to Know
    
10pt 11pt 12pt            
   10pt  
a4paper letterpaper        
letterpaper   a5paper b5paper executivepaper
 legalpaper  
fleqn       
leqno            
 
titlepage notitlepage     
        article   
     report  book 
onecolumn twocolumn 
     
   
twoside, oneside       
    article  report  
   book        
          twoside
 not          
 
landscape          

openright, openany        
            
article          report 
          book
      
1.7 Files You Might Encounter 11
1.6.2 Packages
           
  
        
           
     
    
     
\usepackage[options]{package}
  package        options  
          \usepackage
            
    
ε
    
          
       Local Guide     
 
  The L
A
T
E
X Companion   
           
   
ε

       
           texdoc 
  
1.6.3 Page Styles
     
  style   
\pagestyle{style}
            
              

\thispagestyle{style}
          
 The L
A
T
E
X Companion       
1.7 Files You Might Encounter
   
        
          
         
 
12 Things You Need to Know
       

doc    

  doc.dtx
a
  The L
A
T
E
X Companion 
exscale        
  ltexscale.dtx
fontenc    
 
  ltoutenc.dtx
ifthen     
  
  ifthen.dtx  The L
A
T
E
X Companion 
latexsym    
       latexsym
   latexsym.dtx   The L
A
T
E
X Companion 
makeidx         
  The L
A
T
E
X Companion 
syntonly     
inputenc          
         
       
inputenc.dtx
a
              dvi 
 latex doc.dtx            
        
      

plain              
       
headings           
            
   
empty         
1.7 Files You Might Encounter 13
             
             
.tex

     latex
.sty
     
  
\usepackage 
.dtx 
       

            
     
.ins             

        
   
        
.cls           
  \documentclass 
.fd    
  
       
   
.dvi          
          
     dvips      
 
        
.log          

.toc             
         
.lof          
.lot         
.aux           
           
  
.idx      
    
           makeindex 
          
.ind            
  
.ilg    makeindex 
14 Things You Need to Know
1.8 Big Projects
             
  
        
\include{filename}
             
 filename.tex  
     
    filename.tex
            

      \include 
\includeonly{filename,filename,}
           
\include            
\includeonly   
 \include        
       \includeonly    
           
       
\input{filename}
           


      syntonly 
 
       
           
 
           
   
\usepackage{syntonly}
\syntaxonly
            
  
Chapter 2
Typesetting Text
After reading the previous chapter, you should know about the basic stuff of
which a L
A
T
E
X 2
ε
document is made. In this chapter I will fill in the remaining
structure you will need to know in order to produce real world material.
2.1 The Structure of Text and Language
   <hanspi@schmid-werren.ch>
            
             
            
          
          
             
            
      
     
     
          
            
          \\  
             
           
           
           
            
         
       
           
     
   
            
             
16 Typesetting Text
           
          
           
      
% Example 1
\ldots when Einstein introduced his formula
\begin{equation}
e = m \cdot c^2 \; ,
\end{equation}
which is at the same time the most widely known
and the least well understood physical formula.
% Example 2
\ldots from which follows Kirchhoff's current law:
\begin{equation}
\sum_{k=1}^{n} I_k = 0 \; .
\end{equation}
Kirchhoff's voltage law can be derived \ldots
% Example 3
\ldots which has several advantages.
\begin{equation}
I_D = I_F - I_R
\end{equation}
is the core of a very different transistor model. \ldots
           
            

          
             
  
           
         
           
            
             
            
              
    
2.2 Line Breaking and Page Breaking 17
         
           
       \section{The Structure
of Text and Language}         
    
2.2 Line Breaking and Page Breaking
2.2.1 Justified Paragraphs
          

           
           
           
           
          
  
       
  
\\  \newline
      
\\*
        
\newpage
  
\linebreak[n] \nolinebreak[n] \pagebreak[n] \nopagebreak[n]
           
         n  
         n     

          
           
     
     
               
              
           
  
18 Typesetting Text
           
            
           
 
          

        

        \sloppy  
        
            
              
 \fussy 
    
2.2.2 Hyphenation
       
           
    
  
 
\hyphenation{word list}
            
  -         
           
 
         
           
          
         
  \begin{document}        
   polyglossia       
     polyglossia
          
        
            


\hyphenation{FORTRAN Hy-phen-a-tion}
  \-       
           
         

      Overfull \hbox  
                draft  
\documentclass             

2.3 Ready-Made Strings 19
  
      
  
I think this is: su\-per\-cal\-%
i\-frag\-i\-lis\-tic\-ex\-pi\-%
al\-i\-do\-cious
   

          
\mbox{text}
         
My phone number will change soon.
It will be \mbox{0116 291 2319}.
The parameter
\mbox{\emph{filename}} should
contain the name of the file.
      
   
  filename  
    
\fbox    \mbox         
   
2.3 Ready-Made Strings
             

     
  
\today     
\TeX
  
\LaTeX
    
\LaTeXe
ε
  
2.4 Special Characters and Symbols
2.4.1 Quotation Marks
  not   "        
          
           
            
 
``Please press the `x' key.''
    
20 Typesetting Text
             
            
    
2.4.2 Dashes and Hyphens
           
            
    
daughter-in-law, X-rated\\
pages 13--67\\
yes---or no? \\
$0$, $1$ and $-1$
 
 
 
0 1  1
           
  
2.4.3 Tilde ()
           
 \~{}            

http://www.rich.edu/\~{}bush \\
http://www.clever.edu/$\sim$demo


2.4.4 Slash (/)
             
read/write   
     
            
   \slash    read\slash write 
    /       
  5 MB/s
2.4.5 Degree Symbol ()
     

It's $-30\,^{\circ}\mathrm{C}$.
I will soon start to
super-conduct.
 30
      

2.4 Special Characters and Symbols 21
 textcomp         \textdegree
        \textcelsius
30 \textcelsius{} is
86 \textdegree{}F.
   
2.4.6 The Euro Currency Symbol (e)
           
        textcomp  
    
\usepackage{textcomp}
  
\texteuro
  
               
        
  eurosym       
\usepackage[official]{eurosym}
            gen
    official 
       
 \texteuro
 \euro e e e
[] \euro A AC AC
2.4.7 Ellipsis (…)
           
           
           
22 Typesetting Text
           
       
\ldots  
Not like this ... but like this:\\
New York, Tokyo, Budapest, \ldots
      
   
2.4.8 Ligatures
           
         
  
       \mbox{} 
           

\Large Not shelfful\\
but shelf\mbox{}ful
 
 
2.4.9 Accents and Special Characters
          
             
    
             
     \i  \j
H\^otel, na\"\i ve, \'el\`eve,\\
sm\o rrebr\o d, !`Se\~norita!,\\
Sch\"onbrunner Schlo\ss{}
Stra\ss e
  
 
  
2.5 International Language Support
   <A.Kielhorn@web.de>
           
 
   
2.5 International Language Support 23
     
    
 

         
          
      
          
          
            
           
 
       
  polyglossia     babel 
          
   
  fontspec    
 

      
2.5.1 Polyglossia Usage
  
       
          
           
    
           
 
            
           
     
     
\`o \'o \^o \~o
\=o \.o \"o \c c
\u o \v o \H o \c o
\d o
\b o
\t oo
\oe \OE \ae \AE
\aa \AA
\o \O \l \L
\i ȷ \j !` ?`
24 Typesetting Text

       
 

           
     csquotes     
             
   before    
\usepackage[autostyle=true]{csquotes}
\setdefaultlanguage{english}
\setotherlanguage{german}
         
English text.
\begin{german}
Deutscher \enquote{Text}.
\end{german}
More English \enquote{text}.
     
 
            \textlanguage

Did you know that
\textgerman{Gesundheit} is
actually a German word.
      
 
           
            
  
           
           
    
\usepackage{iftex}
\ifXeTeX
\usepackage{fontspec}
\else
\usepackage{luatextra}
\fi
\defaultfontfeatures{Ligatures=TeX}
\usepackage{polyglossia}
          

2.5 International Language Support 25
            
        polyglossia 
            
            
          
  
 
   
\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}

     
\setmainfont{cmun}[
Extension=.otf,UprightFont=*rm,ItalicFont=*ti,
BoldFont=*bx,BoldItalicFont=*bi,
]
\setsansfont{cmun}[
Extension=.otf,UprightFont=*ss,ItalicFont=*si,
BoldFont=*sx,BoldItalicFont=*so,
]
\setmonofont{cmun}[
Extension=.otf,UprightFont=*btl,ItalicFont=*bto,
BoldFont=*tb,BoldItalicFont=*tx,
]
        
\textrussian{Правда} is
a russian newspaper.
\textgreek{ἀλήθεια} is truth
or disclosure in philosophy
    
     
  xgreek        
    
Right to Left (RTL) languages.
            
polyglossia   bidi 
     
 bidi          hyperref
       polyglossia  bidi  
 polyglossia     
bidi    

26 Typesetting Text
  xepersian       
 
       
\section          
xepersian        
 
        
      
    
 http://www.scict.ir/Portal/Home/Default.aspx
 arabxetex       

 




 


 

     
    

 
         
 http://wiki.irmug.org/index.php/X_Series_2
           
   polyglossia      
           
     http://www.sbl-site.org/educational/
biblicalfonts.aspx        
     http://www.sil.org/computing/catalog/show_
software.asp?id=76
     
\newfontfamily\hebrewfont[Script=Hebrew]{SBL Hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL}
      
   
2.6 The Space Between Words 27
Chinese, Japanese and Korean (CJK)
  xeCJK         

2.6 The Space Between Words
      
  
             
       
  
          
            
       
         
          
 ~        
     \@      
          
Mr.~Smith was happy to see her\\
cf.~Fig.~5\\
I like BASIC\@. What about you?
      
 
    
         
\frenchspacing
 
not          
         
    \frenchspacing   \@   

2.7 Titles, Chapters, and Sections
             
      
   
              
     
28 Typesetting Text
        article 
\section{...}
\subsection{...}
\subsubsection{...}
\paragraph{...}
\subparagraph{...}
           
    
\part{...}
     report  book    
   
\chapter{...}
  article          
           
           

       
 \part        

 \appendix         
    
          
          
\tableofcontents
            
    
        
           
      
         
        *   
            
        \section{Help} 
   \section*{Help}
        
2.7 Titles, Chapters, and Sections 29
           
             
               
            
 
\chapter[Title for the table of contents]{A long
and especially boring title, shown in the text}
         
\maketitle
           
\title{...} \author{...}   \date{...}
  \maketitle     \author   
    \and 
           
   
      
ε

        book   
         
          
\frontmatter           
  \begin{document}      
         
      \chapter*{Preface} 
          
\mainmatter            
       
\appendix           
     
\backmatter          
          
     
30 Typesetting Text
2.8 Cross References
          
     
   
  
\label{marker} \ref{marker}  \pageref{marker}
 marker      
 \ref 
           
  \label    \pageref   
      \label  
  
            
    
A reference to this subsection
\label{sec:this} looks like:
``see section~\ref{sec:this} on
page~\pageref{sec:this}.''
     
     
2.9 Footnotes
  
\footnote{footnote text}
            

          
            

Footnotes\footnote{This is
a footnote.} are often used
by people using \LaTeX.

a
    

a
  
            \label   
   
        

              
            
         


        
2.10 Emphasized Words 31
2.10 Emphasized Words
         emphasized by
underlining them.
\underline{text}
          
 italic          
   
        
   
\emph{text}
          
   
\emph{If you use
emphasizing inside a piece
of emphasized text, then
\LaTeX{} uses the
\emph{normal} font for
emphasizing.}
If you use emphasizing inside a piece of
emphasized text, then L
A
T
E
X uses the 
 font for emphasizing.
              
  
2.11 Environments
\begin{environment} text \end{environment}
 environment        
            
\begin{aaa}...\begin{bbb}...\end{bbb}...\end{aaa}
        
2.11.1 Itemize, Enumerate, and Description
 itemize        enumerate 
      description   

32 Typesetting Text
\flushleft
\begin{enumerate}
\item You can nest the list
environments to your taste:
\begin{itemize}
\item But it might start to
look silly.
\item[-] With a dash.
\end{itemize}
\item Therefore remember:
\begin{description}
\item[Stupid] things will not
become smart because they are
in a list.
\item[Smart] things, though,
can be presented beautifully
in a list.
\end{description}
\end{enumerate}
      
  
     

 
  
Stupid    
    

Smart   
   
2.11.2 Flushleft, Flushright, and Center
  flushleft  flushright   
      center   
      \\    
 
  
\begin{flushleft}
This text is\\ left-aligned.
\LaTeX{} is not trying to make
each line the same length.
\end{flushleft}
  

    
    
\begin{flushright}
This text is right-\\aligned.
\LaTeX{} is not trying to make
each line the same length.
\end{flushright}
   

     
   
\begin{center}
At the centre\\of the earth
\end{center}
 
  
2.11 Environments 33
2.11.3 Quote, Quotation, and Verse
 quote         

A typographical rule of thumb
for the line length is:
\begin{quote}
On average, no line should
be longer than 66 characters.
\end{quote}
This is why \LaTeX{} pages have
such large borders by default
and also why multicolumn print
is used in newspapers.
      
 
     
   
  
   
     
     
      quotation   verse 
  quotation       
           
 verse           
       \\       
    
I know only one English poem by
heart. It is about Humpty Dumpty.
\begin{flushleft}
\begin{verse}
Humpty Dumpty sat on a wall:\\
Humpty Dumpty had a great fall.\\
All the King's horses and all
the King's men\\
Couldn't put Humpty together
again.
\end{verse}
\end{flushleft}
      
    
   

  
 
     
  
  
 
2.11.4 Abstract
            
       
  abstract
     abstract    
     
\begin{abstract}
The abstract abstract.
\end{abstract}
  
34 Typesetting Text
2.11.5 Printing Verbatim
     \begin{verbatim}  \end{verbatim} 
           
  
  
      
\verb+text+
 +           
 *   
      
 
The \verb|\ldots| command \ldots
\begin{verbatim}
10 PRINT "HELLO WORLD ";
20 GOTO 10
\end{verbatim}
 \ldots 
10 PRINT "HELLO WORLD ";
20 GOTO 10
\begin{verbatim*}
the starred version of
the verbatim
environment emphasizes
the spaces in the text
\end{verbatim*}
the␣starred␣version␣of
the␣␣␣␣␣␣verbatim
environment␣emphasizes
the␣spaces␣␣␣in␣the␣text
 \verb        
\verb*|like this :-) |
like␣␣␣this␣:-)␣
 verbatim    \verb     
    
2.11.6 Tabular
 tabular        
    
    
 
 table spec   
\begin{tabular}[pos]{table spec}
         l    
  r     c    p{width}
2.11 Environments 35
         |  

          
 
   p{width}        
       
 pos          
           t b  c
         
 tabular  &      \\ 
   \hline        
\cline{i-j}  i  j        

\begin{tabular}{|r|l|}
\hline
7C0 & hexadecimal \\
3700 & octal \\ \cline{2-2}
11111000000 & binary \\
\hline \hline
1984 & decimal \\
\hline
\end{tabular}
 
 
 
 
\begin{tabular}{|p{4.7cm}|}
\hline
Welcome to Boxy's paragraph.
We sincerely hope you'll
all enjoy the show.\\
\hline
\end{tabular}
   
    
  
       @{...}  
           
           
          
      @{}
\begin{tabular}{@{} l @{}}
\hline
no leading space\\
\hline
\end{tabular}
  
36 Typesetting Text
\begin{tabular}{l}
\hline
leading space left and right\\
\hline
\end{tabular}
    
            


         
     @{.}    \begin{tabular}
           
        
         &  
          \multicolumn

\begin{tabular}{c r @{.} l}
Pi expression &
\multicolumn{2}{c}{Value} \\
\hline
$\pi$ & 3&1416 \\
$\pi^{\pi}$ & 36&46 \\
$(\pi^{\pi})^{\pi}$ & 80662&7 \\
\end{tabular}
  
π 
π
π

(π
π
)
π

\begin{tabular}{|c|c|}
\hline
\multicolumn{2}{|c|}{Ene} \\
\hline
Mene & Muh! \\
\hline
\end{tabular}

 
         
              
longtable 
  
      
           
\arraystretch  \tabcolsep 

             dcolumn 
2.12 Including Graphics and Images 37
\begin{tabular}{|l|}
\hline
These lines\\\hline
are tight\\\hline
\end{tabular}
{\renewcommand{\arraystretch}{1.5}
\renewcommand{\tabcolsep}{0.2cm}
\begin{tabular}{|l|}
\hline
less cramped\\\hline
table layout\\\hline
\end{tabular}}
 
 
 
 
               
  

   \rule    
\begin{tabular}{|c|}
\hline
\rule{1pt}{4ex}Pitprop \ldots\\
\hline
\rule{0pt}{4ex}Strut\\
\hline
\end{tabular}


 pt  ex     
    
     
        
   booktabs       
       
2.12 Including Graphics and Images
     
    
          figure  table

           
     graphicx        
       

            

           
  

      

CTAN://pkg/graphics
38 Typesetting Text
     graphicx 
width      
height      
angle   
scale  
\includegraphics[angle=90,width=\textwidth]{test.png}
      test.png  
            
            epstopdf
           
          
             
          
      
   graphicx         
\usepackage{graphicx}
   
\includegraphics[keyvalue ]{file-name}
  file       
    keys   values  keys  
           
      
              
       test.png    first 
      then         
        1.0   
           
           
             
2.13 Floating Bodies 39
2.13 Floating Bodies
          
         
             
            
    
              
             
 
        
            
    
  
        
        
      
  
    figure  table   
         
\begin{figure}[placement specifier]  \begin{table}[]
  placement specifier      
 
         placement specifier 
    float-placing permissions   
        
\begin{table}[!hbp]
   [!hbp] 
     
h     b         p 
    
     
h here          
       
t   top  
b   bottom  
p   page   
!       

a
      
 
a
          
40 Typesetting Text
          !     
     [tbp]
          
            
       figures    tables 


     
          
              
             

           
             
   
     
            
          

           
        
     
  
             
         
             

    
           
  table  figure   
\caption{caption text}
           
    

  
\listoffigures  \listoftables
    \tableofcontents    
          
              
            
   \caption 
\caption[Short]{LLLLLoooooonnnnnggggg}

     
2.13 Floating Bodies 41
 \label  \ref        
   \label    after  \caption 
          
          
              
     
Figure~\ref{white} is an example of Pop-Art.
\begin{figure}[!hbtp]
\includegraphics[angle=90,width=\textwidth]{white-box.pdf}
\caption{White Box by Peter Markus Paulian.\label{white}}
\end{figure}
   
  really hard !     
here h

             bottom b
             
            
             
  
        
        
        
\clearpage    \cleardoublepage
  
       
      \cleardoublepage    
 

     
Chapter 3
Typesetting Mathematical
Formulae
Now you are ready! In this chapter, we will attack the main strength of T
E
X:
mathematical typesetting. But be warned, this chapter only scratches the sur-
face. While the things explained here are sufficient for many people, don’t
despair if you can’t find a solution to your mathematical typesetting needs here.
It is highly likely that your problem is addressed in A
M
S-L
A
T
E
X.
3.1 The A
M
S-L
A
T
E
X bundle
          A
M
S

 A
M
S
        
       amsmath   
    A
M
S
    American Mathemat-
ical Society        
         
           A
M
S

unlimited     
A
M
S
          


    amsmath  
   \usepackage{amsmath}
3.2 Single Equations
          text
style          
display style   within    
 $  $
       CTAN://pkg/amslatex
44 Typesetting Mathematical Formulae
Add $a$ squared and $b$ squared
to get $c$ squared. Or, using
a more mathematical approach:
$a^2 + b^2 = c^2$
 a   b    c
    
 a
2
+ b
2
= c
2
\TeX{} is pronounced as
$\tau\epsilon\chi$\\[5pt]
100~m$^{3}$ of water\\[5pt]
This comes from my $\heartsuit$
   τ χ

3
 
  
             
     display       
        \begin{equation} 
\end{equation}
   \label      
        \eqref     
      \tag  
Add $a$ squared and $b$ squared
to get $c$ squared. Or, using
a more mathematical approach
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
Einstein says
\begin{equation}
E = mc^2 \label{clever}
\end{equation}
He didn't say
\begin{equation}
1 + 1 = 3 \tag{dumb}
\end{equation}
This is a reference to
\eqref{clever}.
 a   b    c
    

a
2
+ b
2
= c
2

 
E = mc
2

  
1 + 1 = 3 
    
   
       
  equation    equation*     
  \[  \]
   amsmath            
   
  displaymath  
    amsmath  
    equation 
  
3.2 Single Equations 45
Add $a$ squared and $b$ squared
to get $c$ squared. Or, using
a more mathematical approach
\begin{equation*}
a^2 + b^2 = c^2
\end{equation*}
or you can type less for the
same effect:
\[ a^2 + b^2 = c^2 \]
 a   b    c
    

a
2
+ b
2
= c
2
        
a
2
+ b
2
= c
2
 \[           
        equation  equation*
          
 
This is text style:
$\lim_{n \to \infty}
\sum_{k=1}^n \frac{1}{k^2}
= \frac{\pi^2}{6}$.
And this is display style:
\begin{equation}
\lim_{n \to \infty}
\sum_{k=1}^n \frac{1}{k^2}
= \frac{\pi^2}{6}
\end{equation}
    
n→∞
n
k=1
1
k
2
=
π
2
6
    

n→∞
n
k=1
1
k
2
=
π
2
6

           
 \smash  
      
    
A $d_{e_{e_p}}$ mathematical
expression followed by a
$h^{i^{g^h}}$ expression. As
opposed to a smashed
\smash{$d_{e_{e_p}}$} expression
followed by a
\smash{$h^{i^{g^h}}$} expression.
d
e
e
p
  
h
i
g
h
   
 d
e
e
p
  h
i
g
h

3.2.1 Math Mode
     math mode  text mode  
 math mode
             
         
       \, \quad  \qquad
        
46 Typesetting Mathematical Formulae
          
              
           
           
   \text{...}        
$\forall x \in \mathbf{R}:
\qquad x^{2} \geq 0$
x R : x
2
0
$x^{2} \geq 0\qquad
\text{for all }x\in\mathbf{R}$
x
2
0   x R
          
            
  \mathbb    amssymb
   

$x^{2} \geq 0\qquad
\text{for all } x
\in \mathbb{R}$
x
2
0   x R
              

3.3 Building Blocks of a Mathematical Formula
           
           
amsmath           
Lowercase Greek letters    \alpha \beta \gamma 
     \Gamma \Delta
            
$\lambda,\xi,\pi,\theta,
\mu,\Phi,\Omega,\Delta$
λ, ξ, π, θ, µ, Φ, ,
Exponents, Superscripts and Subscripts     
^   _          
amssymb      A
M
S
        
        CTAN:/fonts/amsfonts/latex/ 
 
        
ε
     
   
3.3 Building Blocks of a Mathematical Formula 47
           
       {...}
           
$p^3_{ij} \qquad
m_\text{Knuth}\qquad
\sum_{k=1}^3 k \\[5pt]
a^x+y \neq a^{x+y}\qquad
e^{x^2} \neq {e^x}^2$
p
3
ij
m

3
k=1
k
a
x
+ y ̸= a
x+y
e
x
2
̸= e
x
2
 square root    \sqrt  n

   
\sqrt[n]          

       \surd
            
$\sqrt{x} \Leftrightarrow x^{1/2}
\quad \sqrt[3]{2}
\quad \sqrt{x^{2} + \sqrt{y}}
\quad \surd[x^2 + y^2]$
x x
1/2
3
2
x
2
+
y
[x
2
+y
2
]
  dot        
             
\cdot      \cdots    dots 
\ldots            \vdots
   \ddots        
 
$\Psi = v_1 \cdot v_2
\cdot \ldots \qquad
n! = 1 \cdot 2
\cdots (n-1) \cdot n$
Ψ = v
1
·v
2
·. . . n! = 1 ·2 ···(n 1) ·n
  \overline  \underline  horizontal lines
     
$0.\overline{3} =
\underline{\underline{1/3}}$
0.3 = 1/3
  \overbrace  \underbrace   horizontal
braces     
$\underbrace{\overbrace{a+b+c}^6
\cdot \overbrace{d+e+f}^7}
_\text{meaning of life} = 42$
6

a + b + c ·
7

d + e + f

  
= 42
48 Typesetting Mathematical Formulae
     small arrows  tilde  
            
         \widetilde
 \widehat     \hat  \widehat  
  \bar        '
 
$f(x) = x^2 \qquad f'(x)
= 2x \qquad f''(x) = 2\\[5pt]
\hat{XY} \quad \widehat{XY}
\quad \bar{x_0} \quad \bar{x}_0$
f(x) = x
2
f
(x) = 2x f
′′
(x) = 2
ˆ
XY
XY ¯x
0
¯x
0
Vectors           
       \vec    
\overrightarrow  \overleftarrow       
A  B
$\vec{a} \qquad
\vec{AB} \qquad
\overrightarrow{AB}$
a
AB
AB
             
   
      
   
\arccos \cos \csc \exp \ker \limsup
\arcsin \cosh \deg \gcd \lg \ln
\arctan \cot \det \hom \lim \log
\arg \coth \dim \inf \liminf \max
\sinh \sup \tan \tanh \min \Pr
\sec \sin
\begin{equation*}
\lim_{x \rightarrow 0}
\frac{\sin x}{x}=1
\end{equation*}

x0
 x
x
= 1
        \DeclareMathOperator 
           
            
     
%\DeclareMathOperator{\argh}{argh}
%\DeclareMathOperator*{\nut}{Nut}
\begin{equation*}
3\argh = 2\nut_{x=1}
\end{equation*}
3  = 2 
x=1
3.3 Building Blocks of a Mathematical Formula 49
        \bmod   
 a  b  \pmod     x a ( b)
$a\bmod b \\
x\equiv a \pmod{b}$
a  b
x a ( b)
 fraction     \frac{...}{...}  
             
    \tfrac        
   \dfrac     1/2    
       
In display style:
\begin{equation*}
3/8 \qquad \frac{3}{8}
\qquad \tfrac{3}{8}
\end{equation*}
  
3/8
3
8
3
8
In text style:
$1\frac{1}{2}$~hours \qquad
$1\dfrac{1}{2}$~hours
   1
1
2
 1
1
2

  \partial      
\begin{equation*}
\sqrt{\frac{x^2}{k+1}}\qquad
x^\frac{2}{k+1}\qquad
\frac{\partial^2f}
{\partial x^2}
\end{equation*}
x
2
k + 1
x
2
k+1
2
f
x
2
        
\binom  amsmath
Pascal's rule is
\begin{equation*}
\binom{n}{k} =\binom{n-1}{k}
+ \binom{n-1}{k-1}
\end{equation*}
  
n
k
=
n 1
k
+
n 1
k 1
           
\stackrel{#1}{#2}      #1    
#2       
\begin{equation*}
f_n(x) \stackrel{*}{\approx} 1
\end{equation*}
f
n
(x)
1
50 Typesetting Mathematical Formulae
 integral operator    \int  sum operator 
\sum   product operator  \prod     
   ^  _    
\begin{equation*}
\sum_{i=1}^n \qquad
\int_0^{\frac{\pi}{2}} \qquad
\prod_\epsilon
\end{equation*}
n
i=1
π
2
0
ϵ
          
amsmath   \substack 
\begin{equation*}
\sum^n_{\substack{0<i<n \\
j\subseteq i}}
P(i,j) = Q(i,j)
\end{equation*}
n
0<i<n
ji
P (i, j) = Q(i, j)
      bracketing   delim-
iters  [         
      \{     
     \updownarrow
\begin{equation*}
{a,b,c} \neq \{a,b,c\}
\end{equation*}
a, b, c ̸= {a, b, c}
   \left        \right  
  
      
        \left  
\right            \right.
\begin{equation*}
1 + \left(\frac{1}{1-x^{2}}
\right)^3 \qquad
\left. \ddagger \frac{~}{~}\right)
\end{equation*}
1 +
1
1 x
2
3
            
          \big \Big
\bigg  \Bigg      
$\Big((x+1)(x-1)\Big)^{2}$\\
$\big( \Big( \bigg( \Bigg( \quad
\big\} \Big\} \bigg\} \Bigg\} \quad
\big\| \Big\| \bigg\| \Bigg\| \quad
\big\Downarrow \Big\Downarrow
\bigg\Downarrow \Bigg\Downarrow$
(x + 1)(x 1)
2
3.4 Single Equations that are Too Long: multline 51
           
3.4 Single Equations that are Too Long:
multline
            
            
            
         before   
  
             

          

           
             multline

\begin{multline}
a + b + c + d + e + f
+ g + h + i
\\
= j + k + l + m + n
\end{multline}
a + b + c + d + e + f + g + h + i
= j + k + l + m + n 
    equation      
           
 \\          
  equation*    multline*    
 
  IEEEeqnarray       
    
\begin{equation}
a = b + c + d + e + f
+ g + h + i + j
+ k + l + m + n + o + p
\label{eq:equation_too_long}
\end{equation}
a = b+c+d+e+f+g+h+i+j+k+l+m+n+o+p

 multline   amsmath
52 Typesetting Mathematical Formulae
                multline
    
\begin{multline}
a = b + c + d + e + f
+ g + h + i + j \\
+ k + l + m + n + o + p
\end{multline}
a = b + c + d + e + f + g + h + i + j
+ k + l + m + n + o + p 
            
            
  k        IEEEeqnarray 
       
3.5 Multiple Equations
           
             
           
           
          
3.5.1 Problems with Traditional Commands
    align 
 
\begin{align}
a & = b + c \\
& = d + e
\end{align}
a = b + c 
= d + e 
        
\begin{align}
a & = b + c \\
& = d + e + f + g + h + i
+ j + k + l \nonumber \\
& + m + n + o \\
& = p + q + r + s
\end{align}
a = b + c 
= d + e + f + g + h + i + j + k + l
+ m + n + o 
= p + q + r + s 
 align           
       IEEEeqnarray     
{rCl+rCl}
3.5 Multiple Equations 53
 + m   d      

    \mathrel{\phantom{=}} \negmedspace {}  
      +m+n+o       
     
      eqnarray    

\begin{eqnarray}
a & = & b + c \\
& = & d + e + f + g + h + i
+ j + k + l \nonumber \\
&& +\: m + n + o \\
& = & p + q + r + s
\end{eqnarray}
a = b + c 
= d + e + f + g + h + i + j + k + l
+ m + n + o 
= p + q + r + s 
            
      not      multline 
equation 
\begin{eqnarray}
a & = & a = a
\end{eqnarray}
a = a = a 
         
       
\begin{eqnarray}
a & = & b + c
\\
& = & d + e + f + g + h^2
+ i^2 + j
\label{eq:faultyeqnarray}
\end{eqnarray}
a = b + c 
= d + e + f + g + h
2
+ i
2
+ j
     \lefteqn    
    
\begin{eqnarray}
\lefteqn{a + b + c + d
+ e + f + g + h}\nonumber\\
& = & i + j + k + l + m
\\
& = & n + o + p + q + r + s
\end{eqnarray}
a + b + c + d + e + f + g + h
= i + j + k + l + m 
= n + o + p + q + r + s 
               
 
54 Typesetting Mathematical Formulae
\begin{eqnarray}
\lefteqn{a + b + c + d
+ e + f + g + h}
\nonumber \\
& = & i + j
\end{eqnarray}
a + b + c + d + e + f + g + h
= i + j 
         
  
3.5.2 IEEEeqnarray Environment
 IEEEeqnarray        
          
     
          IEEEeqnarray 
     
IEEEtrantools     
    
\usepackage{IEEEtrantools}
   IEEEeqnarray        
columns         {rCl}
i.e.          
          C  
 c     
\begin{IEEEeqnarray}{rCl}
a & = & b + c
\\
& = & d + e + f + g + h
+ i + j + k \nonumber\\
&& \negmedspace {} + l + m + n + o
\\
& = & p + q + r + s
\end{IEEEeqnarray}
a = b + c 
= d + e + f + g + h + i + j + k
+ l + m + n + o 
= p + q + r + s 
      {c}     
     {rCll}     
      l c r LCR   
    s t u        
     .  /  ?   

            
 eqnarray 
     CTAN://macros/latex/contrib/IEEEtran/IEEEtran_
HOWTO.pdf    IEEEeqnarray     
 IEEEtrantools            

       
3.5 Multiple Equations 55
3.5.3 Common Usage
         IEEEeqnarray    
 
           
\IEEEeqnarraynumspace
            
            
          
\begin{IEEEeqnarray}{rCl}
a & = & b + c
\\
& = & d + e + f + g + h
+ i + j + k
\\
& = & l + m + n
\end{IEEEeqnarray}
a = b + c 
= d + e + f + g + h + i + j + k
= l + m + n 

\begin{IEEEeqnarray}{rCl}
a & = & b + c
\\
& = & d + e + f + g + h
+ i + j + k
\IEEEeqnarraynumspace\\
& = & l + m + n.
\end{IEEEeqnarray}
a = b + c 
= d + e + f + g + h + i + j + k 
= l + m + n. 
           \lefteqn 
 IEEEeqnarray   \IEEEeqnarraymulticol  
   
\begin{IEEEeqnarray}{rCl}
\IEEEeqnarraymulticol{3}{l}{
a + b + c + d + e + f
+ g + h
}\nonumber\\ \quad
& = & i + j
\\
& = & k + l + m
\end{IEEEeqnarray}
a + b + c + d + e + f + g + h
= i + j 
= k + l + m 
      \multicolumns    tabular
    {3}     
      {l}
56 Typesetting Mathematical Formulae
    \quad       
   

e.g.
\begin{IEEEeqnarray}{rCl}
\IEEEeqnarraymulticol{3}{l}{
a + b + c + d + e + f
+ g + h
}\nonumber\\ \qquad\qquad
& = & i + j
\\
& = & k + l + m
\end{IEEEeqnarray}
a + b + c + d + e + f + g + h
= i + j 
= k + l + m 
        
  
+             
  {}     
\begin{IEEEeqnarray}{rCl}
a & = & b + c
\\
& = & d + e + f + g + h
+ i + j + k \nonumber\\
&& + l + m + n + o
\\
& = & p + q + r + s
\end{IEEEeqnarray}
a = b + c 
= d + e + f + g + h + i + j + k
+l + m + n + o 
= p + q + r + s 
 
\begin{IEEEeqnarray}{rCl}
a & = & b + c
\\
& = & d + e + f + g + h
+ i + j + k \nonumber\\
&& \negmedspace {} + l + m + n + o
\\
& = & p + q + r + s
\end{IEEEeqnarray}
a = b + c 
= d + e + f + g + h + i + j + k
+ l + m + n + o 
= p + q + r + s 
     +  l   {} + l 
 +            
   {}  +     
\negmedspace
           
  \nonumber  \IEEEnonumber     
 \label{eq:...}           

            
3.6 Arrays and Matrices 57
           
 \\            
          
\IEEEmulticol    
         
            
\IEEEyesnumber
\begin{IEEEeqnarray*}{rCl}
a & = & b + c \\
& = & d + e \IEEEyesnumber\\
& = & f + g
\end{IEEEeqnarray*}
a = b + c
= d + e 
= f + g
      \IEEEyessubnumber
\begin{IEEEeqnarray}{rCl}
a & = & b + c
\IEEEyessubnumber\\
& = & d + e
\nonumber\\
& = & f + g
\IEEEyessubnumber
\end{IEEEeqnarray}
a = b + c 
= d + e
= f + g 
3.6 Arrays and Matrices
 arrays   array       
 tabular   \\       
\begin{equation*}
\mathbf{X} = \left(
\begin{array}{ccc}
x_1 & x_2 & \ldots \\
x_3 & x_4 & \ldots \\
\vdots & \vdots & \ddots
\end{array} \right)
\end{equation*}
X =
x
1
x
2
. . .
x
3
x
4
. . .
 array        
 .    \right 
58 Typesetting Mathematical Formulae
\begin{equation*}
|x| = \left\{
\begin{array}{rl}
-x & \text{if } x < 0,\\
0 & \text{if } x = 0,\\
x & \text{if } x > 0.
\end{array} \right.
\end{equation*}
|x| =
x  x < 0,
0  x = 0,
x  x > 0.
 cases   amsmath      
 
\begin{equation*}
|x| =
\begin{cases}
-x & \text{if } x < 0,\\
0 & \text{if } x = 0,\\
x & \text{if } x > 0.
\end{cases}
\end{equation*}
|x| =
x  x < 0,
0  x = 0,
x  x > 0.
    array  amsmath   
    matrix       
  matrix  pmatrix ( bmatrix [ Bmatrix { vmatrix
|  Vmatrix            
array             
     
\begin{equation*}
\begin{matrix}
1 & 2 \\
3 & 4
\end{matrix} \qquad
\begin{bmatrix}
p_{11} & p_{12} & \ldots
& p_{1n} \\
p_{21} & p_{22} & \ldots
& p_{2n} \\
\vdots & \vdots & \ddots
& \vdots \\
p_{m1} & p_{m2} & \ldots
& p_{mn}
\end{bmatrix}
\end{equation*}
1 2
3 4
p
11
p
12
. . . p
1n
p
21
p
22
. . . p
2n
p
m1
p
m2
. . . p
mn
3.7 Spacing in Math Mode 59
3.7 Spacing in Math Mode
      
    
      \, 
3
18
  \: 
4
18
  \; 
5
18
      \␣ 
         \quad
 \qquad       \quad 
           \!  
 
3
18
 
\begin{equation*}
\int_1^2 \ln x \mathrm{d}x
\qquad
\int_1^2 \ln x \,\mathrm{d}x
\end{equation*}
2
1
 xx
2
1
 x x
            
      \ud    
              
  \newcommand     
\newcommand{\ud}{\,\mathrm{d}}
\begin{equation*}
\int_a^b f(x)\ud x
\end{equation*}
b
a
f(x) x
           
           \!  ams-
math           \iint
\iiint \iiiint  \idotsint 
\newcommand{\ud}{\,\mathrm{d}}
\begin{IEEEeqnarray*}{c}
\int\int f(x)g(y)
\ud x \ud y \\
\int\!\!\!\int
f(x)g(y) \ud x \ud y \\
\iint f(x)g(y) \ud x \ud y
\end{IEEEeqnarray*}
f(x)g(y) x y
f(x)g(y) x y
f(x)g(y) x y
    testmath.tex   A
M
S

   The L
A
T
E
X Companion   
60 Typesetting Mathematical Formulae
3.7.1 Phantoms
     ^  _
   
    \phantom       
              
      
\begin{equation*}
{}^{14}_{6}\text{C}
\qquad \text{versus} \qquad
{}^{14}_{\phantom{1}6}\text{C}
\end{equation*}
14
6

14
6
             mhchem
          
3.8 Fiddling with the Math Fonts
          
$\Re \qquad
\mathcal{R} \qquad
\mathfrak{R} \qquad
\mathbb{R} \qquad $
R R R
    amssymb  amsfonts
    
      
       
\displaystyle 123 \textstyle 123 \scriptstyle 123 
\scriptscriptstyle 123

           

\begin{equation*}
P = \frac{\displaystyle{
\sum_{i=1}^n (x_i- x)
(y_i- y)}}
{\displaystyle{\left[
\sum_{i=1}^n(x_i-x)^2
\sum_{i=1}^n(y_i- y)^2
\right]^{1/2}}}
\end{equation*}
P =
n
i=1
(x
i
x)(y
i
y)
n
i=1
(x
i
x)
2
n
i=1
(y
i
y)
2
1/2
          

3.9 Theorems, Lemmas, 61
3.8.1 Bold Symbols
        
    
          
\mathbf          
          
      \boldmath   this can only
be used outside math mode      
$\mu, M \qquad
\mathbf{\mu}, \mathbf{M}$
\qquad \boldmath{$\mu, M$}
µ, M µ, M µ, M
  amsbsy  amsmath      bm
  tools         \boldsymbol

$\mu, M \qquad
\boldsymbol{\mu}, \boldsymbol{M}$
µ, M µ, M
3.9 Theorems, Lemmas,
         
     
\newtheorem{name}[counter]{text}[section]
 name         
  text          
     
           
         counter 
   name       
         section  
            

   \newtheorem       
         
\begin{name}[text]
    
\end{name}
 amsthm    A
M
S
   \theoremstyle{style}
             
62 Typesetting Mathematical Formulae
   definition     plain  
   remark    
        
         \newtheorem 
     
   
\theoremstyle{definition} \newtheorem{law}{Law}
\theoremstyle{plain} \newtheorem{jury}[law]{Jury}
\theoremstyle{remark} \newtheorem*{marg}{Margaret}
\begin{law} \label{law:box}
Don't hide in the witness box
\end{law}
\begin{jury}[The Twelve]
It could be you! So beware and
see law~\ref{law:box}.\end{jury}
\begin{jury}
You will disregard the last
statement.\end{jury}
\begin{marg}No, No, No\end{marg}
\begin{marg}Denis!\end{marg}
Law 1.      
Jury 2  . It could be you! So
beware and see law 1.
Jury 3. You will disregard the last state-
ment.
Margaret.   
Margaret. 
            
           
             

\newtheorem{mur}{Murphy}[section]
\begin{mur} If there are two or
more ways to do something, and
one of those ways can result in
a catastrophe, then someone
will do it.\end{mur}
Murphy .      
       
     
   
           
           
 
             nthe-
orem     
3.9.1 Proofs and End-of-Proof Symbol
 amsthm     proof 
3.9 Theorems, Lemmas, 63
\begin{proof}
Trivial, use
\begin{equation*}
E=mc^2.
\end{equation*}
\end{proof}
Proof.  
E = mc
2
.
   \qedhere        
          
\begin{proof}
Trivial, use
\begin{equation*}
E=mc^2. \qedhere
\end{equation*}
\end{proof}
Proof.  
E = mc
2
.
       IEEEeqnarray
\begin{proof}
This is a proof that ends
with an equation array:
\begin{IEEEeqnarray*}{rCl}
a & = & b + c \\
& = & d + e. \qedhere
\end{IEEEeqnarray*}
\end{proof}
Proof.       
 
a = b + c
= d + e.
         IEEEeqnarray  
            
    IEEEeqnarray     
    \qedhere    
outside           
    
        
\begin{proof}
This is a proof that ends
with an equation array:
\begin{IEEEeqnarray*}{+rCl+x*}
a & = & b + c \\
& = & d + e. & \qedhere
\end{IEEEeqnarray*}
\end{proof}
Proof.       
 
a = b + c
= d + e.
   +  {+rCl+x*}       
         
IEEEeqnarray            
64 Typesetting Mathematical Formulae
 after         x  
         \qedhere    
   *      IEEEeqnarray
    +
          
\begin{proof}
This is a proof that ends
with a numbered equation:
\begin{equation}
a = b + c.
\end{equation}
\end{proof}
Proof.        
 
a = b + c. 

\begin{proof}
This is a proof that ends
with a numbered equation:
\begin{equation}
a = b + c. \qedhere
\end{equation}
\end{proof}
Proof.        
 
a = b + c. 
         2     
     
            
    
\begin{proof}
This is a proof that ends
with an equation array:
\begin{IEEEeqnarray}{+rCl+x*}
a & = & b + c \\
& = & d + e. \\
&&& \qedhere\nonumber
\end{IEEEeqnarray}
\end{proof}
Proof.       
 
a = b + c 
= d + e. 
  
\begin{proof}
This is a proof that ends
with an equation array:
\begin{IEEEeqnarray}{rCl}
a & = & b + c \\
& = & d + e.
\end{IEEEeqnarray}
\end{proof}
Proof.       
 
a = b + c 
= d + e. 
3.10 List of Mathematical Symbols 65
3.10 List of Mathematical Symbols
         
math mode
          
amssymb       

  A
M
S 
            CTAN:pkg/
amslatex          
CTAN:info/symbols/comprehensive
    
ˆa \hat{a} ˇa \check{a} ˜a \tilde{a}
`a \grave{a} ˙a \dot{a} ¨a \ddot{a}
¯a \bar{a} a \vec{a}
AAA \widehat{AAA}
´a \acute{a} ˘a \breve{a}
AAA \widetilde{AAA}
˚a \mathring{a}
   
          \Alpha \Beta   
          
α \alpha θ \theta o o υ \upsilon
β \beta ϑ \vartheta π \pi φ \phi
γ \gamma ι \iota \varpi ϕ \varphi
δ \delta κ \kappa ρ \rho χ \chi
\epsilon λ \lambda \varrho ψ \psi
ε \varepsilon µ \mu σ \sigma ω \omega
ζ \zeta ν \nu ς \varsigma
η \eta ξ \xi τ \tau
Γ \Gamma Λ \Lambda Σ \Sigma Ψ \Psi
\Delta Ξ \Xi Υ \Upsilon \Omega
Θ \Theta Π \Pi Φ \Phi

     symbols.tex      
     
66 Typesetting Mathematical Formulae
   
         \not 

< < > > = =
\leq  \le \geq  \ge \equiv
\ll \gg
.
= \doteq
\prec \succ \sim
\preceq \succeq \simeq
\subset \supset \approx
\subseteq \supseteq
=
\cong
\sqsubset
a
\sqsupset
a
1 \Join
a
\sqsubseteq \sqsupseteq \bowtie
\in \ni \owns \propto
\vdash \dashv |= \models
| \mid \parallel \perp
\smile \frown \asymp
: : / \notin ̸= \neq  \ne
a
  latexsym     
   
+ + -
± \pm \mp \triangleleft
· \cdot ÷ \div \triangleright
× \times \ \setminus \star
\cup \cap \ast
\sqcup \sqcap \circ
\vee \lor \wedge \land \bullet
\oplus \ominus \diamond
\odot \oslash \uplus
\otimes \bigcirc ⨿ \amalg
\bigtriangleup \bigtriangledown \dagger
\lhd
a
\rhd
a
\ddagger
\unlhd
a
\unrhd
a
\wr
3.10 List of Mathematical Symbols 67
   
\sum
\bigcup
\bigvee
\prod
\bigcap
\bigwedge
\coprod
\bigsqcup
\biguplus
\int
\oint
\bigodot
\bigoplus
\bigotimes
  
\leftarrow  \gets \longleftarrow
\rightarrow  \to \longrightarrow
\leftrightarrow \longleftrightarrow
\Leftarrow = \Longleftarrow
\Rightarrow = \Longrightarrow
\Leftrightarrow \Longleftrightarrow
7→ \mapsto 7− \longmapsto
\hookleftarrow \hookrightarrow
\leftharpoonup \rightharpoonup
\leftharpoondown \rightharpoondown
\rightleftharpoons \iff  
\uparrow \downarrow
\updownarrow \Uparrow
\Downarrow \Updownarrow
\nearrow \searrow
\swarrow \nwarrow
; \leadsto
a
a
  latexsym     
    
AB \overrightarrow{AB} AB
\underrightarrow{AB}
AB \overleftarrow{AB} AB
\underleftarrow{AB}
AB \overleftrightarrow{AB} AB
\underleftrightarrow{AB}
68 Typesetting Mathematical Formulae
  
( ( ) ) \uparrow
[ [  \lbrack ] ]  \rbrack \downarrow
{ \{  \lbrace } \}  \rbrace \updownarrow
\langle \rangle \Uparrow
| |  \vert \|  \Vert \Downarrow
/ / \ \backslash \Updownarrow
\lfloor \rfloor
\rceil \lceil
   
\lgroup
\rgroup
\lmoustache
\arrowvert
\Arrowvert
\bracevert
\rmoustache
   
. . . \dots ··· \cdots
\vdots
\ddots
\hbar ı \imath \jmath \ell
\Re \Im \aleph \wp
\forall \exists \mho
a
\partial
' \prime \emptyset \infty
\nabla \triangle 2 \Box
a
3 \Diamond
a
\bot \top \angle
\surd
\diamondsuit \heartsuit \clubsuit \spadesuit
¬ \neg  \lnot \flat \natural \sharp
a
  latexsym     
   
       
\dag \S \copyright \textregistered
\ddag \P \pounds \%
3.10 List of Mathematical Symbols 69
  A
M
S 
\ulcorner \urcorner \llcorner \lrcorner
| \lvert | \rvert \lVert \rVert
  A
M
S   
\digamma κ \varkappa \beth ג \gimel \daleth
   
        
   
 \mathrm{ABCDE abcde 1234}
ABCDEabcde1234 \mathit{ABCDE abcde 1234}
ABCDEabcde \mathnormal{ABCDE abcde 1234}
ABCDE \mathcal{ABCDE abcde 1234}
A BC D E \mathscr{ABCDE abcde 1234} mathrsfs
ABCDEabcde1234 \mathfrak{ABCDE abcde 1234} amsfonts  amssymb
ABCDE \mathbb{ABCDE abcde 1234} amsfonts  amssymb
  A
M
S  
\dotplus \centerdot
\ltimes \rtimes \divideontimes
\doublecup \doublecap \smallsetminus
\veebar \barwedge \doublebarwedge
\boxplus \boxminus \circleddash
\boxtimes \boxdot \circledcirc
\intercal \circledast \rightthreetimes
\curlyvee \curlywedge \leftthreetimes
70 Typesetting Mathematical Formulae
  A
M
S  
\lessdot \gtrdot \doteqdot
\leqslant \geqslant \risingdotseq
\eqslantless \eqslantgtr \fallingdotseq
\leqq \geqq \eqcirc
\lll  \llless \ggg \circeq
\lesssim \gtrsim \triangleq
\lessapprox \gtrapprox \bumpeq
\lessgtr \gtrless \Bumpeq
\lesseqgtr \gtreqless \thicksim
\lesseqqgtr \gtreqqless \thickapprox
\preccurlyeq \succcurlyeq \approxeq
\curlyeqprec \curlyeqsucc \backsim
\precsim \succsim \backsimeq
\precapprox \succapprox \vDash
\subseteqq \supseteqq \Vdash
\shortparallel \Supset \Vvdash
\blacktriangleleft \sqsupset \backepsilon
\vartriangleright \because \varpropto
\blacktriangleright \Subset \between
\trianglerighteq \smallfrown \pitchfork
\vartriangleleft \shortmid \smallsmile
\trianglelefteq \therefore \sqsubset
3.10 List of Mathematical Symbols 71
  A
M
S 
L99 \dashleftarrow 99K \dashrightarrow
\leftleftarrows \rightrightarrows
\leftrightarrows \rightleftarrows
\Lleftarrow \Rrightarrow
\twoheadleftarrow \twoheadrightarrow
\leftarrowtail \rightarrowtail
\leftrightharpoons \rightleftharpoons
\Lsh \Rsh
\looparrowleft \looparrowright
\curvearrowleft \curvearrowright
\circlearrowleft \circlearrowright
\multimap \upuparrows
\downdownarrows \upharpoonleft
\upharpoonright \downharpoonright
\rightsquigarrow \leftrightsquigarrow
72 Typesetting Mathematical Formulae
  A
M
S     
\nless \ngtr \varsubsetneqq
\lneq \gneq \varsupsetneqq
\nleq \ngeq \nsubseteqq
\nleqslant \ngeqslant \nsupseteqq
\lneqq \gneqq \nmid
\lvertneqq \gvertneqq \nparallel
\nleqq \ngeqq \nshortmid
\lnsim \gnsim \nshortparallel
\lnapprox \gnapprox \nsim
\nprec \nsucc \ncong
\npreceq \nsucceq \nvdash
\precneqq \succneqq \nvDash
\precnsim \succnsim \nVdash
\precnapprox \succnapprox \nVDash
\subsetneq \supsetneq \ntriangleleft
\varsubsetneq \varsupsetneq \ntriangleright
\nsubseteq \nsupseteq \ntrianglelefteq
\subsetneqq \supsetneqq \ntrianglerighteq
\nleftarrow \nrightarrow \nleftrightarrow
\nLeftarrow \nRightarrow \nLeftrightarrow
  A
M
S 
\hbar \hslash k \Bbbk
\square \blacksquare \circledS
\vartriangle \blacktriangle \complement
\triangledown \blacktriangledown \Game
\lozenge \blacklozenge \bigstar
\angle \measuredangle
\diagup \diagdown \backprime
\nexists \Finv \varnothing
ð \eth \sphericalangle \mho
Chapter 4
Specialities
When putting together a large document, L
A
T
E
X will help with some special
features like index generation, bibliography management, and other things. A
much more complete description of specialities and enhancements possible with
L
A
T
E
X can be found in the L
A
T
E
X Manual and The L
A
T
E
X Companion .
4.1 Bibliography
    thebibliography   
 
\bibitem[label]{marker}
 marker            

\cite{marker}
      label       
     \begin{thebibliography} 
             
  {99}  
       
      
74 Specialities
Partl~\cite{pa} has
proposed that \ldots
\begin{thebibliography}{99}
\bibitem{pa} H.~Partl:
\emph{German \TeX},
TUGboat Volume~9, Issue~1 (1988)
\end{thebibliography}
   
Bibliography
   German T
E
X 
   
          


   
     
          
          

          
      
4.2 Indexing
         
 
  makeindex
      
         
      The L
A
T
E
X Companion 
    
  makeidx  
    
\usepackage{makeidx}
         
\makeindex
   
          
   makeidx
4.2 Indexing 75
     
Example Index Entry Comment
\index{hello}   
\index{hello!Peter}    
\index{Sam@\textsl{Sam}} Sam  
\index{Lin@\textbf{Lin}} Lin  
\index{Kaese@K\"ase} Käse   
\index{ecole@\'ecole}   
\index{Jenny|textbf}  3   
\index{Joe|textit}  5   
       
\index{keyformatted_entry}
  formatted_entry       key 
    formatted_entry        key
             
             
  
       
  \index 
          
          
  
  .idx  .idx      
makeindex 
makeindex filename
 makeindex        
        .ind   
 
            
 

\printindex

showidx
   
ε
    
             
    
   \index         

76 Specialities
My Word \index{Word}. As opposed
to Word\index{Word}. Note the
position of the full stop.
       
     
makeindex         
      @        
 
4.3 Fancy Headers
 fancyhdr 
      
            
             
\documentclass{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
% with this we ensure that the chapter and section
% headings are in lowercase.
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}}
\fancyhf{} % delete current header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % space for the rule
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line
}
   fancyhdr 
           
       
 
           
  \rightmark  \leftmark     
  CTAN://macros/latex/contrib/supported/fancyhdr
4.4 The Verbatim Package 77
         
       
    \chapter      
 \rightmark  \leftmark      
 \chaptermark \sectionmark  \subsectionmark   
   \rightmark  \leftmark
              
     \chaptermark 
       fancyhdr    
              
           
  
4.4 The Verbatim Package
         verbatim environment  
        verbatim package  verbatim
      verbatim  
         verbatim 
           verbatim
          
  verbatim   
\verbatiminput{filename}
           
     verbatim 
  verbatim           
            
    
4.5 Installing Extra Packages

        
              
      http://www.ctan.org/
   geometry hyphenat      
       .ins     
.dtx      readme.txt      
        
            
           

78 Specialities
           
     
 
  .ins     .sty 
   .sty          
     …/localtexmf/tex/latex  
            
        
  
  
 texhash 
maktexlsr 
initexmf --update-fndb    
      .dtx 
 
  .dtx     .pdf  
     
     
 
    
  .idx     
             
    
         
makeindex -s gind.ist name
 name        
 
  .dtx   
      .ps  .pdf     

     .glo     
      
makeindex -s gglo.ist -o name.gls name.glo
   
  .dtx        
4.6 L
A
T
E
X and PDF
   <Daniel.Flipo@univ-lille1.fr>
           
            
             
            
 
       \ref  \pageref 
           
     
4.6 L
A
T
E
X and PDF 79
          (HyperText Markup
Language)        
 
         
          
         
          
         
        

        
 
            
      
    
               
  
      
          
           (Portable
Document Format)         
         
     
 
          
          
 
4.6.1 Hypertext Links
 hyperref      
 
            
 
         
  \usepackage{hyperref}   last    
   
          hyperref

        
\usepackage{hyperref}
       \hypersetup{options}
            
80 Specialities
bookmarks (=true,false)       
  
unicode (=false,true)        
   
pdftoolbar (=true,false)     
pdfmenubar (=true,false)     
pdffitwindow (=false,true)       
 
pdftitle (={text})         Document
Info   
pdfauthor (={text})      
pdfnewwindow (=false,true)     
        
colorlinks (=false,true)       false
       true      
        
linkcolor (=red)       
citecolor (=green)     
filecolor (=magenta)    
urlcolor (=cyan)      
       
\usepackage{hyperref}
          =true 
 
\usepackage[bookmarks,colorlinks]{hyperref}
          
               
      
\usepackage{hyperref}
\hypersetup{colorlinks=false}
   
4.6 L
A
T
E
X and PDF 81
\usepackage{hyperref}
\hypersetup{colorlinks,%
citecolor=black,%
filecolor=black,%
linkcolor=black,%
urlcolor=black,%
pdftex}
         Document Info 
    
\usepackage[pdfauthor={Pierre Desproges},%
pdftitle={Des femmes qui tombent},%
pdftex]{hyperref}
           
    
\href{url}{text}
 
The \href{http://www.ctan.org}{CTAN} website.
            
  
              \href
    
The complete document is \href{manual.pdf}{here}
           
      manual.pdf      
    
            
    \href    \author   
    
\author{Mary Oetiker $<$\href{mailto:mary@oetiker.ch}%
{mary@oetiker.ch}$>$
              
             
\href{mailto:mary@oetiker.ch}{Mary Oetiker}
            
    
82 Specialities
4.6.2 Problems with Links
   
! pdfTeX warning (ext4): destination with the same
identifier (name{page.1}) has been already used,
duplicate ignored
          
\mainmatter   book       
               
             
     duplicate   ignored
      plainpages=false  
          
        
hypertexnames=false           
 
4.6.3 Problems with Bookmarks
            
          
   
     
    
Package hyperref Warning:
Token not allowed in a PDFDocEncoded string:
         
    
\texorpdfstring{T
E
X text}{Bookmark Text}
         
\section{\texorpdfstring{$E=mc^2$}%
{E = mc ** 2}}
  \section{$E=mc^2$}         
          unicode  
 hyperref          
            
\texorpdfstring
4.7 Working with X
Ǝ
L
A
T
E
X and PDF 83
4.7 Working with X
Ǝ
L
A
T
E
X and PDF
   <A.Kielhorn@web.de>
           
 
    http://wiki.xelatex.org/doku.php  
  


4.7.1 The Fonts
     tfm  
     
         Linux Libertine 
    
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine}
           
   \textit  \textbf        
          
            
           
     
           
           
         
            
 
\newfontfamily\LLln[Numbers=Lining]{(font)}
\newfontfamily\LLos[Numbers=OldStyle]{(font)}
\newfontfamily\LLlnm[Numbers=Lining,Numbers=Monospaced]{(font)}
\newfontfamily\LLosm[Numbers=OldStyle,Numbers=Monospaced]{(font)}
          
              
             
        
\setmainfont[Ligatures=Rare]{(font)}
\setmainfont[Ligatures=Historic]{(font)}
\setmainfont[Ligatures=Historic,Ligatures=Rare]{(font)}
           
           
             
 
84 Specialities
\setmainfont[Language=Polish]{(font)}
    
         
       
 
 
        
            
 
\setmainfont[Contextuals=NoAlternate]{(font)}
   
  fontspec 
Where do I get OpenType fonts?
   TeXLive       .../texmf-dist/
fonts/opentype         
   DejaVu     http://dejavu-fonts.org/
        once  
  
           
             fontspec
            

Entering Unicode Characters
             
         
            
           
          

             
 
          
           
            
4.7.2 Compatibility Between X
Ǝ
L
A
T
E
X and pdfL
A
T
E
X
       
 

              
         
4.8 Creating Presentations 85
 
         

    
 microtype     
  
     
          
  
4.8 Creating Presentations
   <Daniel.Flipo@univ-lille1.fr>
           
         


   beamer      
            
            
         
 beamer   graphicx color  hyperref   
  
          

           
           
            
          
 prosper        
  ppower4 
  beamer         
           
          
 
beamer      
trans  
handout    
    beamer         
   \documentclass[10pt,handout]{beamer}   
  
           
             
      beameruserguide.pdf   
  
86 Specialities
\documentclass[10pt]{beamer}
\mode<beamer>{%
\usetheme[hideothersubsections,
right,width=22mm]{Goettingen}
}
\title{Simple Presentation}
\author[D. Flipo]{Daniel Flipo}
\institute{U.S.T.L. \& GUTenberg}
\titlegraphic{\includegraphics[width=20mm]{USTL}}
\date{2005}
\begin{document}
\begin{frame}<handout:0>
\titlepage
\end{frame}
\section{An Example}
\begin{frame}
\frametitle{Things to do on a Sunday Afternoon}
\begin{block}{One could \ldots}
\begin{itemize}
\item walk the dog\dots \pause
\item read a book\pause
\item confuse a cat\pause
\end{itemize}
\end{block}
and many other things
\end{frame}
\end{document}
      beamer 
4.8 Creating Presentations 87
         
       \mode<beamer>  
 Goettingen         
               
              
hideothersubsections         
         \mode<trans> 
\mode<handout>      
  \title{} \author{} \institute{} 
\titlegraphic{}          
 \title[]{}  \author[]{}        
           Goettingen 
           \section{}
 \subsection{}     outside  frame 

             
           

            frame
         < 
>              
             
     <handout:0> 
             
        \frametitle{}   
   block        
   \section{}  \subsection{}   
    
  \pause        
           
\only \uncover \alt  \temporal        
      
           
beameruserguide.pdf           
            
  
Chapter 5
Producing Mathematical
Graphics
Most people use L
A
T
E
X for typesetting their text. And since the structure ori-
ented approach to authoring is so convenient, L
A
T
E
X also offers a, if somewhat
restricted, means for producing graphical output from textual descriptions. Fur-
thermore, quite a number of L
A
T
E
X extensions have been created in order to
overcome these restrictions. In this section, you will learn about a few of them.
5.1 Overview
   
     
  picture         
        
    L
A
T
E
X Manual   picture  
ε
    \qbezier  q    
           
         
          
 \qbezier  
   picture  
 
    
  
            
            
    
             
 beamer         pgf  
   tikz       
    
     
90 Producing Mathematical Graphics
          
            The
L
A
T
E
X Graphics Companion 
       
 META
POST          META
FONT METAPOST       
    METAFONT    METAFONT 
       
  
     A User’s Manual for META-
POST      
   

   
    T
E
X Unbound 
5.2 The picture Environment
   <osurs@bluewin.ch>
         
               
             
            
  
5.2.1 Basic Commands
picture 
       
\begin{picture}(x, y)\end{picture}

\begin{picture}(x, y)(x
0
, y
0
)\end{picture}
  x, y, x
0
, y
0
  \unitlength     
    picture     
\setlength{\unitlength}{1.2cm}
    \unitlength  1pt    (x, y)  
          
   (x
0
, y
0
)      
     
             
ε
   
5.2 The picture Environment 91
       
\put(x, y){object}

\multiput(x, y)(x, y){n}{object}
          
\qbezier(x
1
, y
1
)(x
2
, y
2
)(x
3
, y
3
)
5.2.2 Line Segments
\setlength{\unitlength}{5cm}
\begin{picture}(1,1)
\put(0,0){\line(0,1){1}}
\put(0,0){\line(1,0){1}}
\put(0,0){\line(1,1){1}}
\put(0,0){\line(1,2){.5}}
\put(0,0){\line(1,3){.3333}}
\put(0,0){\line(1,4){.25}}
\put(0,0){\line(1,5){.2}}
\put(0,0){\line(1,6){.1667}}
\put(0,0){\line(2,1){1}}
\put(0,0){\line(2,3){.6667}}
\put(0,0){\line(2,5){.4}}
\put(0,0){\line(3,1){1}}
\put(0,0){\line(3,2){1}}
\put(0,0){\line(3,4){.75}}
\put(0,0){\line(3,5){.6}}
\put(0,0){\line(4,1){1}}
\put(0,0){\line(4,3){1}}
\put(0,0){\line(4,5){.8}}
\put(0,0){\line(5,1){1}}
\put(0,0){\line(5,2){1}}
\put(0,0){\line(5,3){1}}
\put(0,0){\line(5,4){1}}
\put(0,0){\line(5,6){.8333}}
\put(0,0){\line(6,1){1}}
\put(0,0){\line(6,5){1}}
\end{picture}
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
92 Producing Mathematical Graphics
      
\put(x, y){\line(x
1
, y
1
){length}}
 \line    
  
 
          
6, 5, . . . , 5, 6,
            
            
  \unitlength       
            

5.2.3 Arrows
\setlength{\unitlength}{0.75mm}
\begin{picture}(60,40)
\put(30,20){\vector(1,0){30}}
\put(30,20){\vector(4,1){20}}
\put(30,20){\vector(3,1){25}}
\put(30,20){\vector(2,1){30}}
\put(30,20){\vector(1,2){10}}
\thicklines
\put(30,20){\vector(-4,1){30}}
\put(30,20){\vector(-1,4){5}}
\thinlines
\put(30,20){\vector(-1,-1){5}}
\put(30,20){\vector(-1,-4){5}}
\end{picture}
-
:
1
*
X
X
X
X
X
X
Xy
C
C
C
C
CO
     
\put(x, y){\vector(x
1
, y
1
){length}}
           
         
4, 3, . . . , 3, 4.
          
    \thicklines       
 
5.2 The picture Environment 93
5.2.4 Circles
\setlength{\unitlength}{1mm}
\begin{picture}(60, 40)
\put(20,30){\circle{1}}
\put(20,30){\circle{2}}
\put(20,30){\circle{4}}
\put(20,30){\circle{8}}
\put(20,30){\circle{16}}
\put(20,30){\circle{32}}
\put(40,30){\circle{1}}
\put(40,30){\circle{2}}
\put(40,30){\circle{3}}
\put(40,30){\circle{4}}
\put(40,30){\circle{5}}
\put(40,30){\circle{6}}
\put(40,30){\circle{7}}
\put(40,30){\circle{8}}
\put(40,30){\circle{9}}
\put(40,30){\circle{10}}
\put(40,30){\circle{11}}
\put(40,30){\circle{12}}
\put(40,30){\circle{13}}
\put(40,30){\circle{14}}
\put(15,10){\circle*{1}}
\put(20,10){\circle*{2}}
\put(25,10){\circle*{3}}
\put(30,10){\circle*{4}}
\put(35,10){\circle*{5}}
\end{picture}
bej


&%
'$
&%
'$
behjm












"!
#
"!
#
&%
'$
r u x z}
 
\put(x, y){\circle{diameter}}
    (x, y)     diameter 
picture         
           \circle*
    
             
   eepic  pstricks      
  The L
A
T
E
X Graphics Companion 
      picture     
          
         
  Graphics in L
A
T
E
X 2
ε
      
94 Producing Mathematical Graphics
5.2.5 Text and Formulas
\setlength{\unitlength}{0.8cm}
\begin{picture}(6,5)
\thicklines
\put(1,0.5){\line(2,1){3}}
\put(4,2){\line(-2,1){2}}
\put(2,3){\line(-2,-5){1}}
\put(0.7,0.3){$A$}
\put(4.05,1.9){$B$}
\put(1.7,2.95){$C$}
\put(3.1,2.5){$a$}
\put(1.3,1.7){$b$}
\put(2.5,1.05){$c$}
\put(0.3,4){$F=
\sqrt{s(s-a)(s-b)(s-c)}$}
\put(3.5,0.4){$\displaystyle
s:=\frac{a+b+c}{2}$}
\end{picture}
H
H
H
H
H
A
B
C
a
b
c
F =
s(s a)(s b)(s c)
s :=
a + b + c
2
          picture
   \put     
5.2.6 \multiput and \linethickness
\setlength{\unitlength}{2mm}
\begin{picture}(30,20)
\linethickness{0.075mm}
\multiput(0,0)(1,0){26}%
{\line(0,1){20}}
\multiput(0,0)(0,1){21}%
{\line(1,0){25}}
\linethickness{0.15mm}
\multiput(0,0)(5,0){6}%
{\line(0,1){20}}
\multiput(0,0)(0,5){5}%
{\line(1,0){25}}
\linethickness{0.3mm}
\multiput(5,0)(10,0){2}%
{\line(0,1){20}}
\multiput(0,5)(0,10){2}%
{\line(1,0){25}}
\end{picture}
 
\multiput(x, y)(x, y){n}{object}
           
5.2 The picture Environment 95
             
\linethickness        
            
   
5.2.7 Ovals
\setlength{\unitlength}{0.75cm}
\begin{picture}(6,4)
\linethickness{0.075mm}
\multiput(0,0)(1,0){7}%
{\line(0,1){4}}
\multiput(0,0)(0,1){5}%
{\line(1,0){6}}
\thicklines
\put(2,3){\oval(3,1.8)}
\thinlines
\put(3,2){\oval(3,1.8)}
\thicklines
\put(2,1){\oval(3,1.8)[tl]}
\put(4,1){\oval(3,1.8)[b]}
\put(4,3){\oval(3,1.8)[r]}
\put(3,1.5){\oval(1.8,0.4)}
\end{picture}
#
"
!
#
"
!
#
" !
!
 
\put(x, y){\oval(w, h)}

\put(x, y){\oval(w, h)[position]}
     (x, y)    w   h 
 position  b t l r      
      
       
\linethickness{length}     \thinlines  \thicklines
    \linethickness{length}     
      \thinlines  \thicklines
           
96 Producing Mathematical Graphics
5.2.8 Multiple Use of Predefined Picture Boxes
\setlength{\unitlength}{0.5mm}
\begin{picture}(120,168)
\newsavebox{\foldera}
\savebox{\foldera}
(40,32)[bl]{% definition
\multiput(0,0)(0,28){2}
{\line(1,0){40}}
\multiput(0,0)(40,0){2}
{\line(0,1){28}}
\put(1,28){\oval(2,2)[tl]}
\put(1,29){\line(1,0){5}}
\put(9,29){\oval(6,6)[tl]}
\put(9,32){\line(1,0){8}}
\put(17,29){\oval(6,6)[tr]}
\put(20,29){\line(1,0){19}}
\put(39,28){\oval(2,2)[tr]}
}
\newsavebox{\folderb}
\savebox{\folderb}
(40,32)[l]{% definition
\put(0,14){\line(1,0){8}}
\put(8,0){\usebox{\foldera}}
}
\put(34,26){\line(0,1){102}}
\put(14,128){\usebox{\foldera}}
\multiput(34,86)(0,-37){3}
{\usebox{\folderb}}
\end{picture}
   declared  
\newsavebox{name}
 defined
\savebox{name}(width,height)[position]{content}
    drawn 
\put(x, y){\usebox{name}}
  position        
           bl    
            
 t  r
5.2 The picture Environment 97
 name     
     
          
        \foldera  
    \folderb
 \oval       \line   
         
5.2.9 Quadratic Bézier Curves
\setlength{\unitlength}{0.8cm}
\begin{picture}(6,4)
\linethickness{0.075mm}
\multiput(0,0)(1,0){7}
{\line(0,1){4}}
\multiput(0,0)(0,1){5}
{\line(1,0){6}}
\thicklines
\put(0.5,0.5){\line(1,5){0.5}}
\put(1,3){\line(4,1){2}}
\qbezier(0.5,0.5)(1,3)(3,3.5)
\thinlines
\put(2.5,2){\line(2,-1){3}}
\put(5.5,0.5){\line(-1,5){0.5}}
\linethickness{1mm}
\qbezier(2.5,2)(5.5,0.5)(5,3)
\thinlines
\qbezier(4,2)(4,3)(3,3)
\qbezier(3,3)(2,3)(2,2)
\qbezier(2,2)(2,1)(3,1)
\qbezier(3,1)(4,1)(4,2)
\end{picture}
H
H
H
H
H
H
HD
D
D
D
D
D
         
            
   \linethickness        
 \thinlines   \thicklines     
           
     
 P
1
= (x
1
, y
1
), P
2
= (x
2
, y
2
)      m
1
, m
2
         
 S = (x, y)      
rclx =
m
2
x
2
m
1
x
1
(y
2
y
1
)
m
2
m
1
,
y = y
i
+ m
i
(x x
i
) (i = 1, 2).

 Graphics in L
A
T
E
X 2
ε
       
 \qbezier  
98 Producing Mathematical Graphics
5.2.10 Catenary
\setlength{\unitlength}{1cm}
\begin{picture}(4.3,3.6)(-2.5,-0.25)
\put(-2,0){\vector(1,0){4.4}}
\put(2.45,-.05){$x$}
\put(0,0){\vector(0,1){3.2}}
\put(0,3.35){\makebox(0,0){$y$}}
\qbezier(0.0,0.0)(1.2384,0.0)
(2.0,2.7622)
\qbezier(0.0,0.0)(-1.2384,0.0)
(-2.0,2.7622)
\linethickness{.075mm}
\multiput(-2,0)(1,0){5}
{\line(0,1){3}}
\multiput(-2,0)(0,1){4}
{\line(1,0){4}}
\linethickness{.2mm}
\put( .3,.12763){\line(1,0){.4}}
\put(.5,-.07237){\line(0,1){.4}}
\put(-.7,.12763){\line(1,0){.4}}
\put(-.5,-.07237){\line(0,1){.4}}
\put(.8,.54308){\line(1,0){.4}}
\put(1,.34308){\line(0,1){.4}}
\put(-1.2,.54308){\line(1,0){.4}}
\put(-1,.34308){\line(0,1){.4}}
\put(1.3,1.35241){\line(1,0){.4}}
\put(1.5,1.15241){\line(0,1){.4}}
\put(-1.7,1.35241){\line(1,0){.4}}
\put(-1.5,1.15241){\line(0,1){.4}}
\put(-2.5,-0.25){\circle*{0.2}}
\end{picture}
-
x
6
y
u
         y =  x 1 
           
   (2, 2.7622)       m = 3.6269 
         
   (1.2384, 0)  (1.2384, 0)     
 real           
           
\begin{picture}        
    
\begin{picture}(4.3,3.6)(-2.5,-0.25)
           
(2.5, 0.25)
5.3 The PGF and TikZ Graphics Packages 99
5.2.11 Rapidity in the Special Theory of Relativity
\setlength{\unitlength}{0.8cm}
\begin{picture}(6,4)(-3,-2)
\put(-2.5,0){\vector(1,0){5}}
\put(2.7,-0.1){$\chi$}
\put(0,-1.5){\vector(0,1){3}}
\multiput(-2.5,1)(0.4,0){13}
{\line(1,0){0.2}}
\multiput(-2.5,-1)(0.4,0){13}
{\line(1,0){0.2}}
\put(0.2,1.4)
{$\beta=v/c=\tanh\chi$}
\qbezier(0,0)(0.8853,0.8853)
(2,0.9640)
\qbezier(0,0)(-0.8853,-0.8853)
(-2,-0.9640)
\put(-3,-2){\circle*{0.2}}
\end{picture}
-
χ
6
β = v/c =  χ
t
           
       P
1
= (0, 0), m
1
= 1 
P
2
= (2,  2), m
2
= 1/ 
2
2       
          
  (3, 2)  
5.3 The PGF and TikZ Graphics Packages
 
       
         pgf   
      pgf    
             
      
 pgf         
 tikz         
       tikzpicture   
  
         pgf  
            
            
   
100 Producing Mathematical Graphics
\begin{tikzpicture}[scale=3]
\clip (-0.1,-0.2)
rectangle (1.8,1.2);
\draw[step=.25cm,gray,very thin]
(-1.4,-1.4) grid (3.4,3.4);
\draw (-1.5,0) -- (2.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\filldraw[fill=green!20!white,
draw=green!50!black]
(0,0) -- (3mm,0mm)
arc (0:30:3mm) -- cycle;
\end{tikzpicture}
   ;      
  
\begin{tikzpicture}
\node[circle,draw,
minimum size=3cm,
label=120:{economics}]
at (0,0) {};
\node[circle,draw,
minimum size=3cm,
label=60:{psychology}]
at (1,0) {};
\node (i) at (0.5,-1) {};
\node at (0.6,-2.5)
{behavioral economics}
edge[->,thick,
out=60,in=-60] (i);
\end{tikzpicture}


 
       
5.3 The PGF and TikZ Graphics Packages 101
\begin{tikzpicture}[scale=0.8]
\tikzstyle{v}=[circle, minimum size=2mm,inner sep=0pt,draw]
\foreach \i in {1,...,8}
\foreach \j in {1,...,3}
\node[v]
(G-\i-\j) at (\i,\j) {};
\foreach \i in {1,...,8}
\foreach \j/\o in {1/2,2/3}
\draw[->]
(G-\i-\j) -- (G-\i-\o);
\foreach \i/\n in
{1/2,2/3,3/4,4/5,5/6,6/7,7/8}
\foreach \j/\o in {1/2,2/3} {
\draw[->] (G-\i-\j) -- (G-\n-\o);
\draw[->] (G-\n-\j) -- (G-\i-\o);
}
\end{tikzpicture}
  \usetikzlibrary       
           
   
\usetikzlibrary{%
decorations.pathmorphing}
\begin{tikzpicture}[
decoration={bent,aspect=.3}]
\draw [decorate,fill=lightgray]
(0,0) rectangle (5.5,4);
\node[circle,draw]
(A) at (.5,.5) {A};
\node[circle,draw]
(B) at (5,3.5) {B};
\draw[->,decorate] (A) -- (B);
\draw[->,decorate] (B) -- (A);
\end{tikzpicture}
102 Producing Mathematical Graphics
\usetikzlibrary{positioning}
\begin{tikzpicture}[xscale=6,
yscale=8,>=stealth]
\tikzstyle{v}=[circle,
minimum size=1mm,draw,thick]
\node[v] (a) {$1$};
\node[v] (b) [right=of a] {$2$};
\node[v] (c) [below=of a] {$2$};
\node[v] (d) [below=of b] {$1$};
\draw[thick,->]
(a) to node {} (c);
\draw[thick,->]
(a) to node {} (d);
\draw[thick,->]
(b) to node {} (d);
\end{tikzpicture}
1 2
2 1
            
           
             
  pgf         
 
+
unsigned integer
.
digit
E
unsigned integer
-
              
         pgfplot   
            gnuplot
         
          
http://www.texample.net/tikz/       
   
 
    
               
   
Chapter 6
Customising L
A
T
E
X
Documents produced with the commands you have learned up to this point will
look acceptable to a large audience. While they are not fancy-looking, they
obey all the established rules of good typesetting, which will make them easy
to read and pleasant to look at.
However, there are situations where L
A
T
E
X does not provide a command or
environment that matches your needs, or the output produced by some existing
command may not meet your requirements.
In this chapter, I will try to give some hints on how to teach L
A
T
E
X new tricks
and how to make it produce output that looks different from what is provided
by default.
6.1 New Commands, Environments and
Packages
            
                
     
   
         
      
\begin{lscommand}
\ci{dum}
\end{lscommand}
\dum
        
lscommand          
    \ci      
            
104 Customising L
A
T
E
X
\dum              
  \dum        \dum 
           
         lscommand 
            
           
      
6.1.1 New Commands
     
\newcommand{name}[num]{definition}
        name 
        definition    
num           
            
      
           
     \tnss      
   
ε
      
             
\newcommand{\tnss}{The not
so Short Introduction to
\LaTeXe}
This is ``\tnss'' \ldots{}
``\tnss''
       
ε
    
 
ε
          
  #1         
#2       
\newcommand{\txsit}[2]
{This is the \emph{#1}
#2 Introduction to \LaTeXe}
% in the document body:
\begin{itemize}
\item \txsit{not so}{short}
\item \txsit{very}{long}
\end{itemize}
   not so  

ε
   very  

ε
          
           
  \renewcommand        \newcommand

6.1 New Commands, Environments and Packages 105
          \providecommand 
    \newcommand       
ε
   
        

     
6.1.2 New Environments
    \newcommand       
    \newenvironment    

\newenvironment{name}[num]{before}{after}
 \newenvironment       
   before         
       after   
  \end{name}   
        \newenvironment 

\newenvironment{king}
{\rule{1ex}{1ex}%
\hspace{\stretch{1}}}
{\hspace{\stretch{1}}%
\rule{1ex}{1ex}}
\begin{king}
My humble subjects \ldots
\end{king}
  
 num          \newcommand 

          
            
\renewenvironment         \newenvironment

           
\rule      \stretch       
  \hspace     
6.1.3 Extra Space
          
           
           
        \ignorespaces   
106 Customising L
A
T
E
X
            
            
         \ignorespacesafterend
   \ignorespaces      

\newenvironment{simple}%
{\noindent}%
{\par\noindent}
\begin{simple}
See the space\\to the left.
\end{simple}
Same\\here.
  
  


\newenvironment{correct}%
{\noindent\ignorespaces}%
{\par\noindent%
\ignorespacesafterend}
\begin{correct}
No space\\to the left.
\end{correct}
Same\\here.
 
  


6.1.4 Command-line L
A
T
E
X
            
          
      
 
         
\usepackage{ifthen}
\ifthenelse{\equal{\blackandwhite}{true}}{
% "black and white" mode; do something..
}{
% "color" mode; do something different..
}
 
 
latex '\newcommand{\blackandwhite}{true}\input{test.tex}'
   \blackandwhite      
       \blackandwhite     
    
6.2 Fonts and Sizes 107
6.1.5 Your Own Package
            
             

       
   \usepackage       
 
% Demo Package by Tobias Oetiker
\ProvidesPackage{demopack}
\newcommand{\tnss}{The not so Short Introduction
to \LaTeXe}
\newcommand{\txsit}[1]{The \emph{#1} Short
Introduction to \LaTeXe}
\newenvironment{king}{\begin{quote}}{\end{quote}}
   
          
         .sty  
  
\ProvidesPackage{package name}
          \ProvidesPackage 
            
           
          
6.2 Fonts and Sizes
6.2.1 Font Changing Commands
           
            
            
              
            
          
{\small The small and
\textbf{bold} Romans ruled}
{\Large all of great big
\textit{Italy}.}
   bold    
  Italy
108 Customising L
A
T
E
X
   
ε
      
           
       
 math mode     commands    math
mode             
           
 
          
      groups      

He likes {\LARGE large and
{\small small} letters}.
     

            
           
  }           
  
\textrm{...}  \textsf{...} sans serif
\texttt{...} typewriter
\textmd{...}  \textbf{...} bold face
\textup{...}  \textit{...} italic
\textsl{...} slanted \textsc{...}  
\emph{...} emphasized \textnormal{...}  
   
\tiny  
\scriptsize   
\footnotesize   
\small  
\normalsize  
\large  
\Large  
\LARGE   
\huge 
\Huge 
6.2 Fonts and Sizes 109
       
      
\tiny   
\scriptsize   
\footnotesize   
\small   
\normalsize   
\large   
\Large   
\LARGE   
\huge   
\Huge   
   
\mathrm{...}  
\mathbf{...} Boldface Font
\mathsf{...} Sans Serif Font
\mathtt{...} Typewriter Font
\mathit{...} Italic Font
\mathcal{...} CALLIGRAPHIC FONT
\mathnormal{...} Normal F ont
110 Customising L
A
T
E
X
\par      
{\Large Don't read this!
It is not true.
You can believe me!\par}
     
    
{\Large This is not true either.
But remember I am a liar.}\par
     
  
          
              
 
\begin{Large}
This is not true.
But then again, what is these
days \ldots
\end{Large}
     
    
         
6.2.2 Danger, Will Robinson, Danger
             
          
    
         
            
           
   \newcommand       
  
\newcommand{\oops}[1]{%
\textbf{#1}}
Do not \oops{enter} this room,
it's occupied by \oops{machines}
of unknown origin and purpose.
  enter     
machines     

           
            
\textbf         
   \textbf         
          
\par     
6.3 Spacing 111
     
 emphasize 
      font  \emph    
     
\textit{You can also
\emph{emphasize} text if
it is set in italics,}
\textsf{in a
\emph{sans-serif} font,}
\texttt{or in
\emph{typewriter} style.}
You can also emphasize text if it is set in
italics, in a sans-serif font, or in type-
writer style.
6.2.3 Advice
             
  
Remember! The MO RE    in document the
   beautiful it becomes
6.3 Spacing
6.3.1 Line Spacing
            
 
\linespread{factor}
        \linespread{1.3}
       \linespread{1.6}   
            
 
      \linespread     
            
112 Customising L
A
T
E
X
          
\setlength{\baselineskip}{1.5\baselineskip}
{\setlength{\baselineskip}%
{1.5\baselineskip}
This paragraph is typeset with
the baseline skip set to 1.5 of
what it was before. Note the par
command at the end of the
paragraph.\par}
This paragraph has a clear
purpose, it shows that after the
curly brace has been closed,
everything is back to normal.
      
         
        

     
       
     
6.3.2 Paragraph Formatting

         
 
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
             
          
     
 plus  minus       
   
         
          
         
             
             
            
     \tableofcontents      
           
   
          
\indent
     
      
          indentfirst   
 
6.3 Spacing 113
 \parindent     
   
\noindent
            
          
6.3.3 Horizontal Space
       
   
\hspace{length}
               
  \hspace*   \hspace  length     
            
This\hspace{1.5cm}is a space
of 1.5 cm.
     
 
\stretch{n}
          
        \hspace{\stretch{n}}  
            
   
x\hspace{\stretch{1}}
x\hspace{\stretch{3}}x
           
              
     
em

ex
{\Large{}big\hspace{1em}y}\\
{\tiny{}tin\hspace{1em}y}


114 Customising L
A
T
E
X
  

mm  1/25 
cm   
in  =  
pt  1/72 
1
3

em         
ex         
6.3.4 Vertical Space
        
 
      between two
paragraphs     
\vspace{length}
          
             
     \vspace*   \vspace
 \stretch     \pagebreak  
              

Some text \ldots
\vspace{\stretch{1}}
This goes onto the last line of the page.\pagebreak
      the same   
    
\\[length]

 \bigskip  \smallskip      
        
6.4 Page Layout
ε
         \documentclass 
          
6.4 Page Layout 115





i
-
i
?
6
i
-
-i
i

-
- i
6
?
i

i
?
6
i
6
?
i
6
?
i
6
?
1 one inch + \hoffset 2 one inch + \voffset
3 \oddsidemargin = 22pt 4 \topmargin = 22pt
or \evensidemargin
5 \headheight = 12pt 6 \headsep = 19pt
7 \textheight = 595pt 8 \textwidth = 360pt
9 \marginparsep = 7pt 10 \marginparwidth = 106pt
11 \footskip = 27pt \marginparpush = 5pt (not shown)
\hoffset = 0pt \voffset = 0pt
\paperwidth = 597pt \paperheight = 845pt
         layouts  
      
116 Customising L
A
T
E
X
           
           
    layout     
WAIT!          
           

           
          
       
    
             
           
 
            
            
               
               
   
              
             
        
        
     
          
\setlength{parameter}{length}
         
\addtolength{parameter}{length}
         \setlength 
           
            
 
\addtolength{\hoffset}{-0.5cm}
\addtolength{\textwidth}{1cm}
          calc   
         \setlength  
        
pkg/tools
       
6.5 More Fun With Lengths 117
6.5 More Fun With Lengths
       

              
      \textwidth       

          
   
\settoheight{variable}{text}
\settodepth{variable}{text}
\settowidth{variable}{text}
        
\flushleft
\newenvironment{vardesc}[1]{%
\settowidth{\parindent}{#1:\ }
\makebox[0pt][r]{#1:\ }}{}
\begin{displaymath}
a^2+b^2=c^2
\end{displaymath}
\begin{vardesc}{Where}$a$,
$b$ -- are adjacent to the right
angle of a right-angled triangle.
$c$ -- is the hypotenuse of
the triangle and feels lonely.
$d$ -- finally does not show up
here at all. Isn't that puzzling?
\end{vardesc}
a
2
+ b
2
= c
2
 a b     
   
c     
   
d      
    
6.6 Boxes
           
             
             
             

           
  
          
           
118 Customising L
A
T
E
X
       
    

          
  tabular    \includegraphics  
           
             
     
           
\parbox[pos]{width}{text}
  
\begin{minipage}[pos]{width}  \end{minipage}
  pos        c, t  b 
            
  width       
      minipage  \parbox   
       parbox  
    minipage
 \parbox         
           
          
\mbox            
  
        
       
\makebox[width][pos]{text}
width           

        \width \height \depth 
\totalheight          
   text  pos     
c l r  s      
  \framebox      \makebox  
    
           
\makebox  \framebox 
                
             

6.7 Rules 119
\makebox[\textwidth]{%
c e n t r a l}\par
\makebox[\textwidth][s]{%
s p r e a d}\par
\framebox[1.1\width]{Guess I'm
framed now!} \par
\framebox[0.8\width][r]{Bummer,
I am too wide} \par
\framebox[1cm][l]{never
mind, so am I}
Can you read this?
   
   
       
             
 
  
 
\raisebox{lift}[extend-above-baseline][extend-below-baseline]{text}
            
\width \height \depth  \totalheight     
            text 
\raisebox{0pt}[0pt][0pt]{\Large%
\textbf{Aaaa\raisebox{-0.3ex}{a}%
\raisebox{-0.7ex}{aa}%
\raisebox{-1.2ex}{r}%
\raisebox{-2.2ex}{g}%
\raisebox{-4.5ex}{h}}}
she shouted, but not even the next
one in line noticed that something
terrible had happened to her.
Aaaa
a
aa
r
g
h
   
       
     
6.7 Rules
        
\rule[lift]{width}{height}
       
\rule{3mm}{.1pt}%
\rule[-1mm]{5mm}{1cm}%
\rule{3mm}{.1pt}%
\rule[1mm]{1cm}{5mm}%
\rule{3mm}{.1pt}
              
120 Customising L
A
T
E
X
             
       \rule 
 
Appendix A
Installing L
A
T
E
X
Knuth published the source to T
E
X back in a time when nobody knew about
Open Source and/or Free Software. The License that comes with T
E
X lets you
do whatever you want with the source, but you can only call the result of your
work T
E
X if the program passes a set of tests Knuth has also provided. This has
lead to a situation where we have free T
E
X implementations for almost every
Operating System under the sun. This chapter will give some hints on what to
install on Linux, macOS and Windows, to get a working T
E
X setup.
A.1 What to Install

       
 

   
  
    
     
    
   
    
         

          
 
          
              
 
A.2 Cross Platform Editor

      

     
122 Installing L
A
T
E
X
            
          
           
   http://www.xm1math.net/texmaker   
           
http://texstudio.sourceforge.net/      
       
           

A.3 T
E
X on macOS
A.3.1 T
E
X Distribution
     
  
  
     
 
 http://www.tug.org/mactex/
A.3.2 macOS T
E
X Editor
          

      
    
    http://www.uoregon.edu/~koch/texshop 
      

   
  http://texworks.
org/       
  
            
    
A.3.3 Treat yourself to PDFView
      
   
 
       
     
http://pdfview.sourceforge.net/     
       automatically reload documents 
        
A.4 T
E
X on Windows
A.4.1 Getting T
E
X
      
 
http://www.miktex.org/         
A.5 T
E
X on Linux 123
  
       

  
      
         
           
    http://www.tug.org/texlive/
A.4.2 A L
A
T
E
X editor
          

        
   
     
 
http://www.texniccenter.org/     


   
  http://
texworks.org/         
A.4.3 Document Preview
             
           http://blog.
kowalczyk.info/software/sumatrapdf/    
             
     
A.4.4 Working with graphics
     
     
          
             
       http://www.cs.wisc.
edu/~ghost/
          
           
  http://gimp-win.sourceforge.net/
A.5 T
E
X on Linux
        
  
             
         
  


124 Installing L
A
T
E
X
        
    
   
     
      
   
    
          
     
       
 
            
   
Bibliography
   L
A
T
E
X: A Document Preparation System 
       

    The T
E
Xbook,   Computers and Type-
setting      
 
        
 The L
A
T
E
X Companion, (2nd Edition) 
    
        The L
A
T
E
X
Graphics Companion    
 
 
    L
A
T
E
X Local Guide
            
    local.tex    
            
  

   L
A
T
E
X 2
ε
for authors   
ε
  usrguide.tex

   L
A
T
E
X 2
ε
for Class and Package writers 
 
ε
  clsguide.tex

   L
A
T
E
X 2
ε
Font selection   
ε
  fntguide.tex
    Packages in the ‘graphics’ bundle   
   grfguide.tex      
  
       A New Implementation
of L
A
T
E
X’s verbatim Environments      
126 BIBLIOGRAPHY
verbatim.dtx      

 
     
   Cyrillic
languages support in L
A
T
E
X   
ε
 
cyrguide.tex
   The TeX Catalogue      


     CTAN:
//help/Catalogue/catalogue.html
    X
Y
-pic User’s Guide   

 
    A User’s Manual for METAPOST  
http://cm.bell-labs.com/who/hobby/
   T
E
X Unbound     
  
   Graphics in L
A
T
E
X 2
ε
    
        picture 
  METAPOST - A Tutorial   
http://www.ursoswald.ch
   TikZ&PGF Manual   CTAN://graphics/
pgf/base/doc/generic/pgf/pgfmanual.pdf
   Polyglossia: A Babel Replacement for X
E
L
A
T
E
X
  
   polyglossia.pdf 
texdoc polyglossia    
   An ArabT
E
X-like interface for typesetting languages
in Arabic script with X
E
L
A
T
E
X   
 
 arabxetex.pdf  texdoc arabxetex    
      The fontspec package  

   fontspec.pdf  texdoc fontspec 
  
   The xgreek package   

  xgreek.pdf  texdoc xgreek   

   The bidi package   
 
 bidi.pdf  texdoc bidi    
BIBLIOGRAPHY 127
   The XePersian package   

  xepersian-doc.pdf  texdoc xepersian  
 
   The xeCJK package   
 
  xeCJK.pdf  texdoc xecjk    
Index
Symbols
\! 
" 
$ 
\,  
 

\- 
 
 
   
 
\: 
\; 
\@ 
\[  
\\     
\\* 
\] 
~ 
A
  
  
 
abstract 
 
 
\addtolength 
 

 
align 
\Alpha 
   
amsbsy 
amsfonts  
amsmath      
amssymb   
amsthm  
\and 
 
\appendix  
 
arabxetex 
\arccos 
\arcsin 
\arctan 
\arg 
array  
\arraystretch 
  
 
\author  
B
  
babel 
\backmatter 

\bar 
   
beamer   
\begin   
\Beta 
\bibitem 
 
bidi 
\Big 
\big 
\Bigg 
\bigg 
\bigskip 
INDEX 129
  
\binom 
  
  
block 
bm 
Bmatrix 
bmatrix 
\bmod 
  
   
\boldmath 
\boldsymbol 
 
booktabs 

 
 
C
calc 
\caption  
cases 
\cdot 
\cdots 
center 
\chapter 
\chaptermark 
 
\ci 
\circle 
\circle* 
\cite 
\cleardoublepage 
\clearpage 
\cline 
color 
  
 

\! 
\,  
\- 
\: 
\; 
\@ 
\[  
\\     
\\* 
\] 
\addtolength 
\Alpha 
\and 
\appendix  
\arccos 
\arcsin 
\arctan 
\arg 
\arraystretch 
\author  
\backmatter 
\bar 
\begin   
\Beta 
\bibitem 
\Big 
\big 
\Bigg 
\bigg 
\bigskip 
\binom 
\bmod 
\boldmath 
\boldsymbol 
\caption  
\cdot 
\cdots 
\chapter 
\chaptermark 
\ci 
\circle 
\circle* 
\cite 
\cleardoublepage 
\clearpage 
\cline 
\cos 
\cosh 
130 INDEX
\cot 
\coth 
\csc 
\date 
\ddots 
\DeclareMathOperator 
\deg 
\depth  
\det 
\dfrac 
\dim 
\displaystyle 
\documentclass  
\dum  
\emph   
\end  
\eqref 
\exp 
\fbox 
\foldera 
\folderb 
\footnote 
\footskip 
\frac 
\framebox 
\frenchspacing 
\frontmatter 
\fussy 
\gcd 
\hat 
\headheight 
\headsep 
\height  
\hline 
\hom 
\href 
\hspace  
\hyphenation 
\idotsint 
\IEEEeqnarraymulticol 
\IEEEmulticol 
\IEEEnonumber 
\IEEEyesnumber 
\IEEEyessubnumber 
\ignorespaces  
\ignorespacesafterend 
\iiiint 
\iiint 
\iint 
\include 
\includegraphics  
\includeonly 
\indent 
\index 
\inf 
\input 
\int 
\item 
\ker 
\label   
\LaTeX 
\LaTeXe 
\ldots  
\left 
\lefteqn  
\leftmark  
\lg 
\lim 
\liminf 
\limsup 
\line  
\linebreak 
\linespread 
\linethickness   
\listoffigures 
\listoftables 
\ln 
\log 
\mainmatter  
\makebox 
\makeindex 
\maketitle 
\marginparpush 
\marginparsep 
\marginparwidth 
\mathbb 
\max 
\mbox   
INDEX 131
\min 
\multicolumn 
\multicolumns 
\multiput  
\negmedspace 
\newcommand   
\newenvironment 
\newline 
\newpage 
\newsavebox 
\newtheorem 
\noindent 
\nolinebreak 
\nonumber 
\nopagebreak 
\not 
\oddsidemargin 
\oval  
\overbrace 
\overleftarrow 
\overline 
\overrightarrow 
\pagebreak 
\pageref  
\pagestyle 
\paperheight 
\paperwidth 
\par 
\paragraph 
\parbox 
\parindent 
\parskip 
\part 
\partial 
\phantom 
\pmod 
\Pr 
\printindex 
\prod 
\providecommand 
\ProvidesPackage 
\put 
\qbezier   
\qedhere  
\qquad  
\quad   
\raisebox 
\ref   
\renewcommand 
\renewenvironment 
\right  
\right. 
\rightmark  
\rule    
\savebox 
\scriptscriptstyle 
\scriptstyle 
\sec 
\section 
\sectionmark 
\setlength   
\settodepth 
\settoheight 
\settowidth 
\sin 
\sinh 
\slash 
\sloppy 
\smallskip 
\smash 
\sqrt 
\stackrel 
\stretch  
\subparagraph 
\subsection 
\subsectionmark 
\substack 
\subsubsection 
\sum 
\sup 
\tabcolsep 
\tableofcontents 
\tag 
\tan 
\tanh 
\TeX 
\texorpdfstring 
\textbackslash
132 INDEX
\textcelsius 
\textdegree 
\texteuro 
\textheight 
\textstyle 
\textwidth 
\tfrac 
\theoremstyle 
\thicklines   
\thinlines  
\thispagestyle 
\title 
\tnss 
\today 
\topmargin 
\totalheight  
\ud 
\underbrace 
\underline  
\unitlength  
\usebox 
\usepackage    
\usetikzlibrary 
\vdots 
\vec 
\vector 
\verb 
\verbatiminput 
\vspace 
\widehat 
\widetilde 
\width  
comment

\cos 
\cosh 
\cot 
\coth 
 
\csc 
csquotes 
  
D
 
\date 
dcolumn 
\ddots 
  
\DeclareMathOperator 
\deg 
  
 
\depth  
description 
\det 
\dfrac 
  
\dim 
 
   
displaymath 
\displaystyle 
doc 
   
  
\documentclass  
 
  ȷ 
 
 
   
  
\dum  
E
eepic 
 
 
\emph   
empty 
 
  
\end  
enumerate 

Bmatrix 
INDEX 133
IEEEeqnarray   
Vmatrix 
abstract 
align 
array  
block 
bmatrix 
cases 
center 
comment
description 
displaymath 
enumerate 
eqnarray 
equation*   
equation    
figure  
flushleft 
flushright 
frame 
itemize 
lscommand 
matrix 
minipage 
multline* 
multline 
parbox 
picture    
pmatrix 
proof 
quotation 
quote 
table  
tabular  
thebibliography 
tikzpicture 
verbatim  
verse 
vmatrix 
eqnarray 
\eqref 
 
 
amsmath 
 
equation    
equation*   
eurosym 
  
\exp 
 
exscale 
 
.aux 
.cls 
.dtx 
.dvi 
.fd 
.idx  
.ilg 
.ind  
.ins 
.lof 
.log 
.lot 
.sty  
.tex 
.toc 
F
fancyhdr  
\fbox 
figure  
  
  
flushleft 
flushright 
\foldera 
\folderb 
 
\footnotesize 
\Huge 
\huge 
\LARGE 
\Large 
\large 
\mathbf 
\mathcal 
134 INDEX
\mathit 
\mathnormal 
\mathrm 
\mathsf 
\mathtt 
\normalsize 
\scriptsize 
\small 
\textbf 
\textit 
\textmd 
\textnormal 
\textrm 
\textsc 
\textsf 
\textsl 
\texttt 
\textup 
\tiny 
  
   
fontenc 
fontspec  
 
\footnote 
\footnotesize 
\footskip 
\frac 
 
frame 
\framebox 
\frenchspacing 
\frontmatter 
\fussy 
G
\gcd 
geometry 
 
 
 
 
graphicx  
 
 
  
 
H
\hat 
 
\headheight 
 
\headsep 
 
\height  
\hline 
\hom 

 
 
 
 
\href 
\hspace  
\Huge 
\huge 
hyperref    
 
 
hyphenat 
\hyphenation 
I
\idotsint 
IEEEeqnarray   
\IEEEeqnarraymulticol 
\IEEEmulticol 
\IEEEnonumber 
IEEEtrantools 
\IEEEyesnumber 
\IEEEyessubnumber 
ifthen 
\ignorespaces  
\ignorespacesafterend 
\iiiint 
\iiint 
\iint 
INDEX 135
\include 
\includegraphics  
\includeonly 
\indent 
indentfirst 
 
\index 
\inf 
\input 
 
inputenc 
\int 
  
 
 
\item 
itemize 
J
 
 
K
 
 
\ker 
  
 
 
L
\label   
 
 
\LARGE 
\Large 
\large 
\LaTeX 

\LaTeXe 
latexsym 
layout 
layouts 
\ldots  
\left 
  
\lefteqn  
\leftmark  
  
  
\lg 
 
\lim 
\liminf 
\limsup 

 
\line  
  
  
\linebreak 
\linespread 
\linethickness   
\listoffigures 
\listoftables 
\ln 
\log 
  
longtable 
lscommand 
M
 
\mainmatter  
\makebox 
makeidx  
  
\makeindex 
  
\maketitle 
 
\marginparpush 
\marginparsep 
\marginparwidth 
 
  
  
\mathbb 
\mathbf 
136 INDEX
\mathcal 

 
 
 
 
 
\mathit 
\mathnormal 
\mathrm 
mathrsfs 
\mathsf 
\mathtt 
 
matrix 
\max 
\mbox   
mhchem 
microtype 

 
\min 
 
minipage 
  
  
\multicolumn 
\multicolumns 
\multiput  
multline 
multline* 
N
\negmedspace 
\newcommand   
\newenvironment 
\newline 
\newpage 
\newsavebox 
\newtheorem 
\noindent 
\nolinebreak 
\nonumber 
\nopagebreak 
\normalsize 
\not 
ntheorem 
O
\oddsidemargin 
 
  

 
 
\oval  
\overbrace 
  
\overleftarrow 
\overline 
\overrightarrow 
P
  

amsbsy 
amsfonts  
amsmath      
amssymb   
amsthm  
arabxetex 
babel 
beamer   
bidi 
bm 
booktabs 
calc 
color 
csquotes 
dcolumn 
doc 
eepic 
eurosym 
exscale 
fancyhdr  
fontenc 
fontspec  
geometry 
graphicx  
INDEX 137
hyperref    
hyphenat 
IEEEtrantools 
ifthen 
indentfirst 
inputenc 
latexsym 
layout 
layouts 
longtable 
makeidx  
mathrsfs 
mhchem 
microtype 
ntheorem 
pgf   
pgfplot 
polyglossia    
ppower4 
prosper 
pstricks 
showidx 
syntonly  
textcomp 
tikz  
verbatim 
xeCJK 
xepersian 
xgreek 
  
  
empty 
headings 
plain 
\pagebreak 
\pageref  
\pagestyle 
   
\paperheight 
\paperwidth 
\par 
 
\paragraph 

\parbox 
parbox 
\parindent 
\parskip 
\part 
\partial 
  
 
  

 
 
 
 
pgf   
pgfplot 
\phantom 
picture    
  
  
plain 
pmatrix 
\pmod 
polyglossia    
    
 
ppower4 
\Pr 

 
\printindex 
 
\prod 
  
proof 
prosper 
\providecommand 
\ProvidesPackage 
pstricks 
\put 
Q
\qbezier   
\qedhere  
\qquad  
138 INDEX
\quad   
quotation 
  
quote 
R
\raisebox 
\ref   
\renewcommand 
\renewenvironment 
 
 
\right  
 
\right. 
\rightmark  
 
\rule    
S
  
\savebox 
  
\scriptscriptstyle 
\scriptsize 
\scriptstyle 
\sec 
\section 
\sectionmark 
\setlength   
\settodepth 
\settoheight 
\settowidth 
showidx 
\sin 
 
  
\sinh 
 
 
\slash 
 
\sloppy 
\small 
  
\smallskip 
\smash 


  
  
\sqrt 
 
  
\stackrel 
\stretch  

 
\subparagraph 
 
\subsection 
\subsectionmark 
\substack 
\subsubsection 
\sum 
  
\sup 
 
syntonly  
T
\tabcolsep 
 
table  
   
\tableofcontents 
tabular  
\tag 
\tan 
\tanh 
\TeX 
 
\texorpdfstring 
   
\textbackslash
\textbf 
\textcelsius 
textcomp 
INDEX 139
\textdegree 
\texteuro 
\textheight 
\textit 
\textmd 
\textnormal 
\textrm 
\textsc 
\textsf 
\textsl 
\textstyle 
\texttt 
\textup 
\textwidth 
\tfrac 


thebibliography 
\theoremstyle 
\thicklines   
\thinlines  
\thispagestyle 
tikz  
tikzpicture 
  
 ~ 
\tiny 
  
\title 
\tnss 
\today 
\topmargin 
\totalheight  
 
 
U
\ud 
 
 
\underbrace 
  
\underline  
\unitlength  
  
 
 
  
\usebox 
\usepackage    
\usetikzlibrary 
V
\vdots 
\vec 
\vector 
 
\verb 
verbatim 
verbatim  
\verbatiminput 
verse 

 
  
Vmatrix 
vmatrix 
\vspace 
W

 
    
\widehat 
\widetilde 
\width  
 

X
xeCJK 
 
xepersian 
 
xgreek 