LaTeX
en.wikibooks.org
June 18, 2016
On the 28th of April 2012 the contents of the English as well as German Wikibooks and Wikipedia
projects were licensed under Creative Commons Attribution-ShareAlike 3.0 Unported license. A
URI to this license is given in the list of figures on page 717. If this document is a derived work
from the contents of one of these projects and the content was still licensed by the project under
this license at the time of derivation this document has to be licensed under the same, a similar or a
compatible license, as stated in section 4b of the license. The list of contributors is included in chapter
Contributors on page 685. The licenses GPL, LGPL and GFDL are included in chapter Licenses on
page 731, since this book and/or parts of it may or may not be licensed under one or more of these
licenses, and thus require inclusion of these licenses. The licenses of the figures are given in the list of
figures on page 717. This PDF was generated by the L
A
T
E
X typesetting software. The L
A
T
E
X source
code is included as an attachment (source.7z.txt) in this PDF file. To extract the source from
the PDF file, you can use the pdfdetach tool including in the poppler suite, or the http://www.
pdflabs.com/tools/pdftk-the-pdf-toolkit/ utility. Some PDF viewers may also let you save
the attachment to a file. After extracting it from the PDF file you have to rename it to source.7z.
To uncompress the resulting archive we recommend the use of http://www.7-zip.org/. The L
A
T
E
X
source itself was generated by a program written by Dirk Hünniger, which is freely available under
an open source license from http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/wb2pdf.
Contents
I. Getting Started 3
1. Introduction 5
1.1. What is TeX? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2. What is LaTeX? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3. Philosophy of use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4. Terms regarding TeX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5. What next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2. Installation 11
2.1. Distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2. Custom installation with TeX Live . . . . . . . . . . . . . . . . . . . . . . 13
2.3. Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4. Bibliography management . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.5. Viewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.6. Tables and graphics tools . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.7. References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3. Installing Extra Packages 29
3.1. Automatic installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2. Manual installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.3. Checking package status . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.4. Package documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.5. External resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.6. See Also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4. Basics 37
4.1. The LaTeX syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.2. Our first document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.3. Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.4. Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.5. And what now? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
II. Common Elements 49
5. Document Structure 51
5.1. Global structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.2. Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
III
Contents
5.3. The document environment . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.4. Book structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.5. Special pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.6. Notes and references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
6. Text Formatting 63
6.1. Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.2. Hyphenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.3. Quote-marks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.4. Diacritics and accents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.5. Margin misalignment and interword spacing . . . . . . . . . . . . . . . . . 69
6.6. Ligatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.7. Slash marks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.8. Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.9. Formatting macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.10. Text mode superscript and subscript . . . . . . . . . . . . . . . . . . . . . 71
6.11. Text figures (”old style”numerals) . . . . . . . . . . . . . . . . . . . . . . . 72
6.12. Dashes and hyphens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.13. Ellipsis (…) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.14. Ready-made strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.15. Notes and References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7. Paragraph Formatting 77
7.1. Paragraph alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.2. Paragraph indent and break . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.3. \paragraph line break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
7.4. Line spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
7.5. Manual breaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
7.6. Special paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.7. Notes and References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
8. Colors 87
8.1. Adding the color package . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
8.2. Entering colored text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
8.3. Entering colored background for the text . . . . . . . . . . . . . . . . . . . 88
8.4. Predefined colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
8.5. Defining new colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
8.6. Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
9. Fonts 93
9.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
9.2. Font families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
9.3. Available LaTeX Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
9.4. Emphasizing text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
9.5. Font encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
9.6. Font styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
9.7. Local font selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
9.8. Arbitrary font size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
IV
Contents
9.9. Finding fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
9.10. Using arbitrary system fonts . . . . . . . . . . . . . . . . . . . . . . . . . . 103
9.11. PDF fonts and properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
9.12. Useful websites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
9.13. References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
10. List Structures 107
10.1. List structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
10.2. Some special lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
10.3. Customizing lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
10.4. Easylist package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
11. Special Characters 119
11.1. Input encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11.2. Escaped codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
11.3. Less than < and greater than > . . . . . . . . . . . . . . . . . . . . . . . . 123
11.4. Euro € currency symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
11.5. Degree symbol for temperature and math . . . . . . . . . . . . . . . . . . 124
11.6. Other symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
11.7. In special environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
11.8. Unicode keyboard input . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
11.9. External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
11.10. Notes and References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
12. Internationalization 131
12.1. Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
12.2. Babel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
12.3. Multilingual versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
12.4. Specific languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
12.5. References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
13. Rotations 149
13.1. The rotating package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
13.2. The rotfloat package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
14. Tables 151
14.1. The tabular environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
14.2. Row specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
14.3. Spanning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
14.4. Controlling table size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
14.5. Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
14.6. Width and stretching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
14.7. Table across several pages . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
14.8. Partial vertical lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
14.9. Vertically centered images . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
14.10. Footnotes in tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
14.11. Professional tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
14.12. Sideways tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
V