# What packages do people load by default in LaTeX?

I'm getting the impression from reading the answers written by some of the real experts here that there are quite a few little packages that just tweak LaTeX2e's default behaviour a little to make it more sensible here and there.

Rather than try to pick these up one by one as I read answers to questions (and thus risk missing them), I thought I'd ask up front what LaTeX2e packages people load by default in (almost) every document.

As this is a "big list" question, I'm making it CW. I don't know if there are standard rules across all SE/SO sites for such questions, but on MathOverflow the rule is generally: one thing (in this case, package) per answer. I guess that if a couple of packages really do go together then it would be fine to group them.

This is perhaps a little subjective and a little close to the line, so I'll not be offended if it gets closed or voted down! (But please explain why in the comments.)

Also see our community poll question: “I have used the following packages / classes”

-
Personally, I'd find a single list, separated by headings (Ex. Format, Math, Bib,Images, Other for this question), with a list of everyone's packages and how they're different from other packages in the section much more readable and useful. That amsmath is the highest voted just says that the MO community is here in full force. The less-known, but equally relevant formatting packages linked by Vivi, Joseph, and András are invisible without a lot of scrolling and reading. – Kevin Vermeer Jul 29 '10 at 22:37
I think the list of one package per answer is a good idea, as we can vote on individual packages... – Amir Rachum Jul 30 '10 at 11:30
It can be good to have a single answer that is just an index of all the other answers, and accept that, so that it floats to the top. – naught101 Aug 30 '12 at 3:44

I almost always load microtype. It plays with ever-so-slightly shrinking and stretching of the fonts and with the extent to which text protrudes into the margins in a way that yields results that look better, that have fewer instances of hyphenation, and fewer overfull hboxes. It doesn't work with latex, you have to use pdflatex instead. It also works with lualatex and (protrusion only) with xelatex.

-
I use \usepackage[expansion=false]{microtype} almost always. Microtype with expansion is a bit too much for me. – Jukka Suomela Jul 29 '10 at 18:57
You may want to use \usepackage[stretch=10]{microtype}, which allows font expansion up to 1% (default is 2%). – lockstep Aug 6 '10 at 12:03
Can we have an example of with versus without? – levesque Nov 15 '10 at 18:28
there's a nice example in the documentation for microtype mirror.ctan.org/macros/latex/contrib/microtype/microtype.pdf, though it requires adobe acrobat for the inline examples – Noah Aug 12 '11 at 22:37
Here is another example. – Juri Robl Oct 11 '12 at 11:13

The family of AMS math packages. At least amsmath and amssymb. Also amsthm if I need theorems and the class I'm using doesn't already define them.

Particularly for writing equations, the AMS packages define a rich set of environments to group and align formulas in many different and useful ways. I also like that it encourages the use of semantic commands (e.g. the cases environment) over syntactic commands (e.g. a \left\{ followed by an array).

Its documentation can be found running texdoc amsldoc on a command line.

-
In particular, amsthm provides an easy way to set up different theorem styles, amsmath provides the \text command, and amssymb contains several often-used symbols. – András Salamon Jul 29 '10 at 12:40
+1 for the (oblique) reference to texdoc. I only discovered that recently and I wonder how I ever lived without it! – Loop Space Jul 29 '10 at 18:08
I believe amssymb loads amsfonts. There's rarely any need to load it yourself. – TH. Sep 11 '10 at 9:13
Note that the ams math packages are loaded automatically if you use one of their document classes, such as amsart. – Erik P. Jan 18 '12 at 19:08
Instead of loading amsmath I usually load mathtools. It is based on amsmath and loads it automatically. Moreover it fixes some deficiencies of the amsmath package and provides additional useful commands such as \coloneqq. – Stan Aug 24 '14 at 9:53

I use hyperref for setting PDF metadata and to create links, both within the document and for clickable URLs. Even Elsevier has used urlbst to update their bibliography style to support URLs and DOIs; hyperref does the actual work of rendering url = and doi = BibTeX fields into clickable PDF links.

-

The todonotes package is a must have in all my documents.

\usepackage{todonotes}

The package enables you to insert small notes in the text marking things to do in the document. Something like

At any location in the document a list of the inserted notes can be generated with the

\listoftodos

command.

-
For multiuser comment support, and configurability with regard to the kinds of notes/themes available, the fixme package is quite nice (I use it quite regularly). – Mark Mar 25 '11 at 22:29
Personally I use an editor which automatically highlights and groups in the "structure" window any comment that begins with %TODO: Works better for me because you don't have anything in your compiled document giving away the fact that it still has TODOs around. – Dom Jun 12 '13 at 10:53
Has anyone done a comparison between easy-todo, fixme, fixmetodonotes, todo, and todonotes? – Ari Brodsky Nov 20 '13 at 1:12

For citations and bibliographies, biblatex is the package of my choice. Key points:

• biblatex includes a wide variety of built-in citation/bibliography styles (numeric, alphabetic, author-year, author-title, verbose [full in-text-citations], with numerous variants for each one). A number of custom styles have been published.

• Modifications of the built-in or custom styles can be accomplished using LaTeX macros instead of having to resort to the BibTeX programming language.

• biblatex offers well-nigh every feature of other bibliography-related LaTeX packages (e.g. multiple/subdivided bibliographies, sorted/compressed citations, entry sets, ibidem functionality, back references). If a feature is not included, chances are high it is on the package authors' to-do list.

• The babel package is supported, and biblatex comes with localization files for about a dozen languages (with the list still growing).

• Although the current version of biblatex (2.8a) still allows to use BibTeX as a database backend, by default it cooperates with Biber which supports bibliographies using Unicode. Biber (currently at version 1.8) is included in TeX Live and MiKTeX. Many features introduced since biblatex 1.1 (e.g., advanced name disambiguation, smart crossref data inheritance, configurable sorting schemes, dynamic datasource modification) are "Biber only".

-
Nevertheless one should append about the usage of biblatex that some papers do not accept its usage. See: Biblatex: submitting to a journal – strpeter Jan 16 '14 at 9:25

One package that’s really general purpose is nag: It doesn’t do anything, per se, it just warns when you accidentally use deprecated LaTeX constructs from l2tabu (English / French / German / Italian / Spanish documentation).

From the documentation:

Old habits die hard. All the same, there are commands, classes and packages which are outdated and superseded. nag provides routines to warn the user about the use of those. As an example, we provide an extension that detects many of the “sins” described in l2tabu.

Therefore, I now always have the following in my header (before the \documentclass, thanks qbi):

\RequirePackage[l2tabu, orthodox]{nag}

It’s a bit like having use strict; in Perl: a useful best practice.

-
Somewhat better is \RequirePackage[l2tabu,orthodox]{nag} before \documentclass. The package docu also recommends this. – qbi Jul 29 '10 at 18:40
This package sounds useful. However, when I tested it with a large project, I started to get the message "Label(s) may have changed. Rerun to get cross-references right." no matter how many times I re-run Latex. – Jukka Suomela Jul 31 '10 at 9:36
Congrats on getting yet one more "great" answer! – Mico Jan 18 '15 at 19:12

I nearly always use the tikz package. Once you learn how to draw with it, you can do almost any vector graphic you need.

-
You can produce almost any diagram with Tikz. Check the tikz examples page. texample.net/tikz/examples However, it is fairly complicated to get the hang on large diagrams since you have to type everything and nearly always you can't see what you are doing. But if you are using a Debian/KDE combination, you can use Ktikz/Qtikz which is really helpful since it compiles tikz code in real time. – fabikw Nov 16 '10 at 0:42
TikZ is awesome with a capital A. But load it by default? It takes up a lot of time and space. I would say only load it if you need it. – Matthew Leingang Nov 22 '10 at 12:53
@levesque: Tikz has a fairly steep learning curve, but it is beautifully documented and provides rich libraries. I find the vector graphics that I produce in tikz to be superior to those I produced in inkscape. It seems easier on my brain to stay in keyboard mode as well. – philosodad Dec 29 '10 at 4:56

I'm surprised that no one has mentioned

\usepackage[margin=1in]{geometry} % set page margins automatically

This is in every document I write (with varying margins, of course.)

-
This is generally poor style. The design of the page is pretty involved and lots of thought has went into (La)TeX's default designs. If you're interested in just saving paper, consider the packages savetrees or fullpage. – Quadrescence Apr 16 '11 at 23:15
Both savetrees and fullpage change other things too; Anyway, the point of of the answer is that geometry is a must use package, no matter what margins you choose for it. The appropriateness of 1in margins also depends on the kind of documents you produce. – Alan Munn Apr 16 '11 at 23:38
It is not a must if you use a class from the KOMAscript bundle or memoir. – Sveinung Jan 13 '14 at 16:01

Since my files nowadays has UTF-8 character encoding, I use this

\usepackage[utf8]{inputenc}
-
XeLaTeX or LuaLaTeX would be my choice for this – Joseph Wright Aug 15 '10 at 13:05
Isn't it \usepackage[utf8x]{inputenc}? – Olivier Jul 19 '11 at 8:17
I've experienced several cases where utf8x had a symbol that utf8 hadn't – Mog Nov 24 '12 at 11:47
@Olivier: utf8 is LaTeX base, while utf8x comes from the ucs package. So utf8 is portable. – Martin Schröder Jun 27 '13 at 14:39
I always use \usepackage[utf8]{inputenx} instead. – Sveinung Jan 13 '14 at 16:03

Another essential package combination is

\usepackage{booktabs}
\usepackage{array}

The booktabs package creates much nicer looking tables than the standard latex tables; the array package's ability to create custom columns is invaluable for formatting tabular material on a per-column basis.

-
I just discovered booktabs -- it is great! – Ben Jan 12 '11 at 22:37
@Ben Yes, it's a great package. If you visit my profile web link you can find my own list of essential packages. – Alan Munn Jan 12 '11 at 22:47
\usepackage{siunitx}

siunitx, for typesetting units and especially for the "S" column type, which allows numbers in tables to be easily aligned, e.g. on the decimal marker.

-
\usepackage[allowlitunits]{siunitx} is my normal incantation, it allows you to use things like 20\milli\meter directly in math mode. – Alex Hirzel May 1 '12 at 20:18

The 'rich' document classes such as memoir and KOMA-Script include a lot of functionality that is not available from the LaTeX kernel. So the packages you load when using the article class might be rather different from those when using memoir. A lot of packages that get used by many people with the base classes (things like float, caption, tocbibind and titlesec) are covered by the richer document classes.

-
\begin{gripe} My problems with these richer document classes are that it makes it very difficult to pick and choose, and that it is a major pain when Big Shot Journal says "please rewrite your document to use our class file" (there's even a journal that won't let you send an accompanying style file). \end{gripe} – Loop Space Jul 29 '10 at 13:19
I tend to stick to article + packages, myself, so I can sympathise. All the more reason for me to get on and get LaTeX3 finished, so we can have a good set of abilities out of the box! – Joseph Wright Jul 29 '10 at 14:33
\begin{joke} Then stop wasting time here and get on with it! \end{joke} – Loop Space Jul 29 '10 at 18:11
If only it were that easy :-) If you want to see that things are happening, there is an RSS feed for SVN checkins: latex-project.org/latex3svn.rss – Joseph Wright Jul 29 '10 at 21:36
That gripe seems a gripe with the journals, rather than with the rich document classes. Also, if you're writing a journal article, memoir doesn't seem like an obvious way to go, if you are going to end up having to conform to some journal's style eventually. Again, that's not an issue with rich document classes, that's just a matter of picking the right tool for the job. And for journal submissions, minimal package requirements and basic document classes seems a good modus operandi – Seamus Aug 1 '10 at 10:41
\usepackage{lmodern}  % better i18n Postscript version of Knuth's cm fonts
-
\usepackage{graphicx}

For including figures, rotating or scaling text. I also use the \graphicspath command to specify a subfolder to help organize my figures and so I can easily change between, for example, a set of figures for internal used (with extra info) and final versions for distribution.

-

In addition to many packages already listed here, I always include mathtools. It provides implementations of \mathclap (and similar commands) as well as nice extensible arrow.

-
\mathclap is great. I use it to great effect for things like \sum_{\mathclap{big long thing}}. (It's also amusingly named with at least one off-color meaning.) – TH. Aug 27 '10 at 9:36
\shortintertext is also provided by the \mathtools package and provids tighter vertical spacing compared to \intertext from the amsmath package. – Peter Grill May 2 '12 at 0:47

I can't live without listings --- pretty-printing (colours, formatting and all) algorithms and code is indispensable --- in pretty much any programming languages and dialects under the sun. Plus, I can import a source file directly from the repository, and the latest version will be automatically rendered.

-

First line of the document should be

\RequirePackage{fixltx2e}
\documentclass{...}

, which fixes a few things in the LaTeX2e kernel.

Due to LaTeX's stability policy, these corrections have not been incorporated into the LaTeX2e kernel, but this package does things most people would agree are bugfixes. So to load this package is always recommended for newly created documents. The corrections have no commonalities, but the package's description has a nice summary:

• ensure one-column floats don't get ahead of two-column floats;
• correct page headers in twocolumn documents;
• stop spaces disappearing in moving arguments;
• allowing \fnsymbol to use text symbols;
• allow the first word after a float to hyphenate;
• \emph can produce caps/small caps text;
• bugs in \setlength and flushbottom.

## EDIT 27.01.2016:

This package is obsolete for LaTeX releases after 2015. See latexrelease.pdf.

-
really should be an argument to documentclass. – ivo Welch Jan 2 at 16:58

The package xspace lets you define commands that don't eat up whitespace after them. So you can define an abbreviation like

\newcommand{\sA}{\mathcal{A}\xspace}

and then you can type objects of \sA are called widgets instead of objects of \sA\ are called widgets.

-
That's one I use so much that I forget it's not part of the main code! – Loop Space Aug 5 '10 at 7:10
The main advantage of \sa/ is that an error message will occur if you happen to forget the closing slash. On the contrary, if you happen to forget the closing backslash of \sA\ , you'll end with gobbled space without noticing it. – lockstep Aug 11 '10 at 20:50
I used xspace one time in a paper with other authors. It was a huge pain since some macros didn't behave like others. It led to all sort of confusion, especially when thinks like \foo bar no long work as you expect because \foo's definition ends with \xspace. I've never tried \foo/. The main advantage I see with that is if your macro is \m/... – TH. Aug 27 '10 at 9:32
I don't especially like the look of \sA/ but I can't think of a better delimiter to use. Perhaps a semicolon would be fine (after HTML): \sA;. My personal belief is that non-delimited macros without arguments (i.e., the ones that gobble spaces) are just plain wrong for document commands because of the spacing problems. Even experienced LaTeX authors trip up with them. – Will Robertson Sep 2 '10 at 9:28

For papers on the arXiv (maths, physics and computer science mostly) there's a list of packages sorted by frequency of use.

The top twenty packages are:

1. article
2. graphicx
3. amssymb
4. amsmath
5. revtex
6. revtex4
7. epsfig
8. amsfonts
9. bm
10. latexsym
11. amsart
12. dcolumn
13. amsthm
14. graphics
15. aastex
16. amscd
17. epsf
18. color
19. aa
20. times
-
That list is literally pain to my eyes. Loading bm?! Use proper bold math characters instead, please, and not poorman's bold. times? Outdated since ages, use mathptmx or XITS Math instead. I'll stop here... – Ingo Jan 30 '14 at 11:46

I use url to typeset urls.

-

For quickly setting multicolumn text in a single column document, the multicol package is another package that I use all the time.

\usepackage{multicol}
-
\usepackage[parfill]{parskip}

I much prefer no indentation and space between paragraphs, so the parskip package is a must for me!

-
Have a look at the KOMA-Script-classes - they include a parskip option that is more powerful than the package of the same name. – lockstep Aug 8 '10 at 17:39

Nothing surprising here: I use natbib, hyperref and hypernat together.

Natbib for referencing.

Hyperref adds bookmarks for sections and lists and turns references and urls into links.

Hypernat allows natbib and hyperref to work together. -- Note (added 2015/02/11): natbib and hyperref have been working together just fine for at least ten years. hypernat is no longer needed for any TeX distribution with a vintage more recent than ca 2002.

-
I'm pretty sure that hypernat is superfluous these days. With only loading natbib and hyperref I get references as [1-5] with both 1 and 5 being hyperlinks. – Lev Bishop Aug 8 '10 at 14:51
And? Was it superfluous in 2010? Is it now? ;) – K.-Michael Aye Nov 23 '12 at 5:18
@K.-MichaelAye - hypernat was superfluous (and potentially troublesome) back in 2010 and in 2012, and it continues to be superfluous as of 2015. – Mico Feb 11 '15 at 21:13

To use the palatino font (it's just a nice looking font)

\usepackage[sc]{mathpazo}

Note that the old palatino package is deprecated.

-
You should probably also load mathpazo with the [sc] option to get real small caps and better kerning. – Will Robertson Sep 2 '10 at 9:24
Depending on taste, you may want to use [osf] instead of [sc] to get old style numerals as well as the real small caps and better kerning. I for one find old style numerals prettier and classier than lining figures in text mode (using [osf] will keep lining figures in math mode). – spet May 29 '13 at 8:52
According to this the LaTeX font catalogue, one should increase the leading when using mathpazo. tug.dk/FontCatalogue/urwpalladio – Ubiquitous Nov 21 '14 at 9:04

I almost always find myself using a tabularx environment as opposed to the regular tabular environment, as it allows for greater dynamism in column widths.

-

To make sure you have ISO formated dates (YYYY-MM-DD).

\usepackage[english]{isodate}

or

\usepackage{datetime}
\renewcommand{\dateseparator}{-}
\newcommand{\todayiso}{\the\year \dateseparator \twodigit\month \dateseparator \twodigit\day}
-

Edited by doncherry: Removed packages mentioned in separate answers.

The complete header Part of my header for most of my documents looks as follows:

\documentclass[ngerman,draft,parskip=half*,twoside]{scrreprt}
\usepackage{ifthen}

For some things I need if-then-constructs. This package provides an easy way to realise it.

\usepackage{index}

For generating an index.

\usepackage{xcolor}

xcolor is needed by several packages. For some historical reason I load it manually.

\usepackage{babel}
\usepackage{nicefrac}

nicefrac allows typesetting fractions like 1/2. It is sometimes more readable than \frac.

\usepackage[T1]{fontenc}
\usepackage[intlimits,leqno]{amsmath}
\usepackage[all,warning]{onlyamsmath}

This package warns if non-amsmath-environments are used.

\usepackage{amssymb}
\usepackage{fixmath}

Provides ISO conform greek letters.

\usepackage[euro]{isonums}

Defines comma as decimal delimiter.

\usepackage[amsmath,thmmarks,hyperref]{ntheorem}

for Theorems, definitions and stuff.

\usepackage{paralist}

Improves enumerate and itemize. Also provides some compact environments.

\usepackage{svn}

I work with VCS and svn displays some informations (keywords) from SVN.

\usepackage{ellipsis}

corrects \dots

\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

These are the definitions for absolute value and norm.

\SVN $LastChangedRevision$
\SVN $LastChangedDate$
-
"one thing (in this case, package) per answer" – Jukka Suomela Jul 29 '10 at 19:02
Could you break this up into multiple answers please, so they can be voted on? Having a dozen answers is ok! – ShreevatsaR Jul 30 '10 at 14:41
It is usually recommended to load hyperref last. – Alex Hirzel May 1 '12 at 20:20

For mathematical texts I instead use amsmath & Co. One very useful package is onlyamsmath. I load it as

\usepackage[all,warning]{onlyamsmath}

So it looks for $$..$$, eqnarray and produces a warning if some of them are used. If you left out warning, it will result in an error and compile will stop. This package is normally very useful if you edit a text with many authors.

-

Another package I use is float. It allows for the placement H for floats, which is somewhat equivalent to h!, but a bit stronger, making sure the figure or table goes exactly where I want it to be.

-
Actually not equivalent to h! at all. h! floats still "float"- they can be moved around by LaTeX in an attempt to optimize the document layout. Figures using the H specifier are not floats at all, they are treated like one big character and are put exactly where they appear in the text. – Sharpie Aug 1 '10 at 3:59

I almost always use the enumitem package, which makes it much easier to make modifications to lists (especially enumerate lists). Most notably, changing the labels to something like (i), (ii), (iii) [no period] with this package is as easy as

\begin{enumerate}[label=(\roman*)]
\item The first item
\item The second item
\end{enumerate}

Furthermore, the code above will automatically get nesting right. Before I started using this package, my preamble always included the awkward macro (necessary to change the references and eliminate the extra period in the list itself)

\newcommand{\setenumroman}{%
\renewcommand{\theenumi}{(\roman{enumi})}%
\renewcommand{\labelenumi}{\theenumi}%
}

which would break if I ever used it for a nested list (all the enumis would have to be changed to enumiis, if I understand correctly).

The enumitem package is quite flexible; another option I sometimes use is [wide], which makes a list look like part of the body of the text (with numbers/labels at the beginning of relevant paragraphs).

-