# LaTeX/FAQ

* LaTeX
* Getting Started
* Introduction
* Installation
* Installing Extra Packages
* Basics
* How to get help
* Common Elements
* Document Structure
* Text Formatting
* Paragraph Formatting
* Colors
* Fonts
* List Structures
* Special Characters
* Internationalization
* Rotations
* Tables
* Title creation
* Page Layout
* Customizing Page Headers and Footers‎
* Importing Graphics
* Floats, Figures and Captions
* Footnotes and Margin Notes
* Hyperlinks
* Labels and Cross-referencing
* Initials
* Mechanics
* Errors and Warnings
* Lengths
* Counters
* Boxes
* Rules and Struts
* Technical Text
* Mathematics
* Advanced Mathematics
* Theorems
* Chemical Graphics
* Algorithms
* Source Code Listings
* Linguistics
* Special Pages
* Indexing
* Glossary
* Bibliography Management
* More Bibliographies
* Special Documents
* Scientific Reports (Bachelor Report, Master Thesis, Dissertation)
* Letters
* Presentations
* Teacher's Corner
* Curriculum Vitae
* Academic Journals (MLA, APA, etc.)
* Creating Graphics
* Introducing Procedural Graphics
* MetaPost
* Picture
* PGF/TikZ
* PSTricks
* Xy-pic
* Creating 3D graphics
* Programming
* Macros
* Plain TeX
* Creating Packages
* Creating Package Documentation
* Themes
* Miscellaneous
* Modular Documents
* Collaborative Writing of LaTeX Documents
* Export To Other Formats
* Help and Recommendations
* FAQ
* Tips and Tricks
* Appendices
* Authors
* Links
* Package Reference
* Sample LaTeX documents
* Index
* Command Glossary

## Margins are too wide

LaTeX's default margins may seem too large. In most cases, this is a preferred default and improves readability.
If you still disagree, you can easily change them with
* \usepackage{geometry}
* % or
* \usepackage[margin=1.5in]{geometry}
See Page Layout.

## Avoid excessive double line breaks in source code

Too many paragraphs of one line or two do not look very good.
Remember the TeX rule:
* If two or more consecutive line breaks are found, TeX starts a new paragraph.
* If only one linebreak is found, TeX inserts a space if there is no space directly before or after it.
You might be tempted to put blank lines all the time to improve the readability of your source code, but this will have an impact on formatting. The solution is simple: put a comment at the very beginning of the blank lines. This will prevent TeX from seeing another line break—all characters up to and including the next line break after a comment are ignored.
Example:
* We are in the first paragraph here.
* We are still in the first paragraph.
* This time, this is another paragraph.

## Simplified special character input

So long as your computing environment supports UTF-8, you can enter special characters directly rather than entering the TeX commands for diacritics and other extended characters. E.g.,
* R\'esum\'e can also be written résumé.
This requires that:
* your text editor supports and is set to save your file in UTF-8;
* you add the \usepackage[utf8]{inputenc} line in the preamble.
Avoid using latin1. See Special Characters.

## Writing the euro symbol directly

Add the following lines in your preamble:
* \usepackage[utf8]{inputenc}
* \usepackage{marvosym}
* \DeclareUnicodeCharacter{20AC}{\EUR}

## LaTeX paragraph headings have title and content on the same line

Some people do not like the way \paragraph{...} writes the title on the same line as the content. This is actually fairly common in a lot of documents and not as weird as it may seem at first.
There are ways to get around the default behavior, however; see \paragraph line break for more information.

## Fonts are ugly/jagged/bitmaps or PDF search fails or Copy/paste from PDF is messy

You must be using diacritics (e.g. accents) with OT1 encoding (the default). Switch to T1 encoding:
* \usepackage[T1]{fontenc}
If you have ugly jagged fonts after the font encoding change, then you have no Type1 compatible fonts available. Install Computer Modern Super or Latin Modern (package name may be lm). To use Latin Modern you need to include the package:
* \usepackage{lmodern}
See Fonts for an explanation.

## Manual formatting: use of line breaks and page breaks

You should really avoid breaking lines and pages manually. The TeX engine is in charge of that. The big problem with manual formatting is that it is not dynamic. Even if it looks right the first time, the content is likely to render really badly if you change anything before the point you manually formatted.
The only place where page breaks are recommended is at the upper level of sectioning in your documents, e.g. parts or chapters (although when you start a new part or chapter, LaTeX will ordinarily do this for you). When you do manually insert a page break, you should use \clearpage or \cleardoublepage which print currently floating figures before starting a new page.
If you absolutely have to insert line or page breaks manually, you should do it after you are sure you have completed your document otherwise, so that you don't later have to come back and update it.

## Always finish commands with

TeX has an unintuitive rule that if a control sequence (a command) is not followed by a pair of braces (with a parameter in between or not), then the following space character(s) are ignored. LaTeX will not print any space, and the command (say, the TeX or LaTeX logos) are run together with the following word.
To fix this, use a pair of braces after the command, even if there are no parameters. Example:
* \LaTeX is great. % BAD !
* \LaTeX is great. % GOOD !
(Technical explanation: a control sequence name can only be composed of characters with catcode 11, that is A-Z and a-z by default. TeX knows where the control sequence name start thanks to the backslash, and it knows where it ends when it encounters the first token which is not of catcode 11. This character is then skipped. Since consecutive spaces have been concatenated into one single space, no space is taken into account.)
It is possible to define macros that will insert a space dynamically by using the xspace package.
* If there is no brace and a space following the command, an extra space will be appended.
* If there are braces, no extra space will be printed.
Example:
* \usepackage{xspace}
* \let\latexold\LaTeX
* \renewcommand{\LaTeX}{\textrm{\latexold}\xspace}
* \LaTeX is followed by a space.
* \LaTeX is followed by a space.
* \LaTeXis not followed by a space.

## Avoid bold and underline

Typographically speaking, it is usually poor practice to use bold or underline formats in the middle of a paragraph. This has become a common habit for users of traditional word processors because these two functions are very easily accessible (along with italics).
However, bold and underline tend to overweight the text and distract the reader. When you start reading a paragraph with a bold word in the middle, you often read the emphasized part first, thus spoiling the content and breaking the order of the ideas. Italics are less obvious and do not have more weight than normal characters, so they are usually a better choice for emphasizing small amounts of text.
The original and more appropriate use of bold and underline is for special parts, such as headers, the index, glossaries, and so on. (Actually, underlining is rarely used in professional environments.)
LaTeX has a macro \emph{...} for emphasizing text using italics. It should be preferred to \textit{...} because \emph{...} will correctly print emphasized text inside other italic text in the regular font.

## The proper way to use figures

Users used to WYSIWYG document processors like Microsoft Word or LibreOffice often get frustrated with figures. The answer is simple: a figure is not a picture!
If you use \includegraphics without enclosing it in a figure environment, it will behave just as in a word processor, placing the picture right at the spot where it was placed in the source.
Figures are a type of float, which is a virtual object that LaTeX can put in places other than the exact location it was created, which helps to prevent cluttering your text with pictures and tables.
See Importing Graphics and Floats, Figures and Captions for more details.

## Text stops justifying

Most likely you have used \raggedleft, \raggedright or \centering at some point and forgotten to switch it off. These commands are switches—they remain active until the end of the scope, or until the end of the document if there is no scope. See Paragraph Alignment for more information.

## Rules of punctuation and spacing

LaTeX does some work for you, but not everything. Especially regarding punctuation, you are pretty free to do what you want. Punctuation rules are different for each language. In English there is no space before a punctuation mark and one space after it.
There are a lot of rules, but you can have a quick look at Wikipedia.

## Compilation fails after a Babel language change

This is a limitation of Babel. Delete the .aux file (or clean the project), then try compiling again.

## Learning LaTeX quickly or correctly

Nowadays it is very common to “learn” on the web by using a search engine and copying and pasting things here and there. As with every programming language, this is generally a poor method which will lead to lack of control, unexpected results, and a lot of frustration. Really learning LaTeX is not that difficult and does not take that long. Most chapters in this book are dedicated to a specific usage, so the basics are actually covered very quickly.
If you are getting frustrated with a specific package, make sure you read its official documentation, which is usually the best source of information. Content found on the web, even in this book, is rarely as accurate as the official documentation. Inaccurate information might result in causing mistakes without you understanding why.
The time you spend learning is worth it, and it quickly makes up for the time you would lose if you don't learn things properly and end up stuck all the time.

## Non-breaking spaces

This useful feature is unknown to most newcomers, although it is available on most WYSIWYG document processors. A non-breaking space between two tokens (e.g. words, punctuation marks) prevents processors from inserting a line break between them. It is very important for consistent reading. LaTeX uses the '~' symbol as a non-breaking space.
You usually use non-breaking spaces for punctuation marks in some languages, for units and currencies, for initials, etc.
For example, in French typography, you put a non-breaking space before all two-parts punctuation marks. Example:
* Il répondit~: «~Ce pain coûte-t-il 2~€~?~»
Note that writing French like this might get really painful. Thankfully, Babel with the frenchb option will take care of the non-breaking spaces for all punctuation marks. In the above example, only the non-breaking space for the euro symbol must remain.

## Smart mathematics

All virtual objects designated by letters, variables or others should use a dedicated formatting. For math and a lot of other fields, the LaTeX math formatting is perfect. For instance, if you want to refer to an object A, write
* Speaking of $A$, let's say...
If you want to refer to several objects in a sentence, it is the same.
* Speaking of $A$, $B$ and $C$...
If you refer to a set of objects, you can still use the math notation.
* The family $(A, B, C)$ is...
Note that this is different from usual text parentheses.
* A sentence. ($A$, $B$, and $C$ are not concerned, but we do not mean the $(A, B, C)$ family.)

## Use vector graphics rather than raster images

Raster (bitmap) graphics scale poorly and often create jagged or low-quality results which clash with the document quality, particularly when printed.
Using vector (line-oriented) graphics instead, either through LaTeX's native diagramming tools or by exporting vector formats from your drawing or diagramming tools, will produce much higher quality results. When possible, you should prefer PDF, EPS, or SVG graphics over PNG or JPG.

## Stretching tables

Trying to stretch tables with the default tabular environment will often lead to unexpected results. The nice tabu package will do what you want and even much more. Alternatively if you cannot use the tabu package you may try tabularx or tabulary packages See Tables.

## Tables are easier than you think

Even though the Tables chapter is quite long, it is worth reading. In the end, you only need to know a few things about the environment of your choice.
Some LaTeX editors feature table assistants. Also, many spreadsheet applications have a LaTeX export feature (or plugin). Again, see Tables for more details.

## Relieving cumbersome code (lists and long command names)

LaTeX is sometimes cumbersome to write, especially if you are not using an adequate editor. See Editors for some interesting choices.
You can define aliases to shorten some commands:
* \usepackage{xspace}
* \newcommand{\tss}[1]{\textsuperscript{#1}}
* \newcommand{\tbs}[1]{\textbackslash\xspace}
Here the xspace package comes in handy to avoid swallowed spaces.
For lists you may want to try the easylist package. Now writing a list is as simple as
* \usepackage[ampersand]{easylist}
* \begin{easylist}
* & Item 1
* & Item 2
* && Subitem 1
* &&& Subsubitem 1
* & Item 3
* && Subitem 1
* \end{easylist}

## Reducing the size of your LaTeX installation

The Installation article explains in detail how to manually install a fully functional TeX environment, including LaTeX and other features, in under 100 MB.