# 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

I just discovered the xparse package. It lets you define more flexible macros with more than one optional argument. I used it to make a very general partial derivative function.

\usepackage{xparse}
\DeclareDocumentCommand{\pder}{ O{} O{} m }{\frac{\partial^{#2}#1}{\partial#3^{#2}}}


Example

\pder{x} will give you

\pder[f]{x} will give you

\pder[f][3]{x} will give you

-

When using class book, I always load package emptypage.

It needs no particular skill since it doesn't introduce any new command to use, it removes headers and footers from empty pages at the end of chapters just by adding \usepackage{emptypage} in your preamble.

The default option is odd.

-

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 at 21:13

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.
-

No one mention tabulary.

Sometimes I make tables with multiline cells in several columns, where the total width must be just \textwidth. Use tabular with p{} columns here is a pain since one must take into account \tabcolsep.

For this, the sibling tabularx (cited in another answer) could make a good work ( X columns take all the available space), but often I need columns weighted according to the amount of text rather and with different alignments, but X columns of tabularx share equally that space.

Instead, tabulary allow the use L, C, R and J columns o automatic variable width. Not always a column layouts as LLCRL produce the desired result but since it is possible mix L,C,R columns with basic types (l,r,c,p{}, m{}...) find the best fit (i.e., some like Lcp{5em}RL) is a child play.

-

I usually use relsize package. It's easy to use it. It changes the font size of part of your text. Just type \relsize{x} where x is the number of steps you want to move through the hierarchy of font sizes.

-
\usepackage{mciteplus}


Allows you to combine multiple references: \cite{refa, *refc, *refc, refd} will produce one references with refa, refb, and refc combined (if they are not used independently elsewhere).

-
BTW: natbib supports this feature too. See p.19 in the documentation mirrors.ctan.org/macros/latex/contrib/natbib/natbib.pdf –  amorua May 2 '12 at 1:24

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 at 19: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

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.

-
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 only texts for which I don't use microtype are those set raggedright. It seems to maximally stretch practically all lines. In any case, ragged2e then becomes the must include package. –  Christian Jun 27 '13 at 16:41

I always end up loading the same packages, some of which were suggested by some answers to this question, such as hyperref, amsmath, nag, etoolbox, xparse, and others.

I created a style file latexdev.sty that I use in almost all my notes and publications, which loads all these standard packages:

https://github.com/olivierverdier/latexdev

-

I include: \usepackage{outlines} in my preamble. outlines is a quick and easy way to generate hierarchically embedded lists. Especially useful when I'm drafting up a paper (I like to outline it) or if I'm quickly typing up notes, e.g., at a conference.

-
\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

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

I'm not just feigning surprise when I say I'm shocked that such an incredibly useful package set as xparse/expl3 (the latter is loaded by the former) hasn't been mentioned yet. I invariably find myself typing:

\documentclass{article}
\usepackage{xparse}


to begin a document.

-
So, what does it do? –  fifaltra Dec 24 '13 at 0:32
with xparse, one can define commands and environments with multiple optional arguments before, between, and after mandatory arguments. Several new type of arguments can be defined, starred commands, and much more. –  Michael P May 7 '14 at 10:17

As long as this list is, minted is missing. For code syntax highlighting it works really well and includes the long list of languages of pygments. The pieces of code end up looking like this:

\begin{minted}{language}
code
\end{minted}


In Beamer it requires frames to be marked as [fragile], and it takes some skill to set it up on Windows. But the results are well worth the effort.

-
@Christian: the main difference is that you can tap directly into pygments, which is a (very) well maintained source for syntax colouring for many languages and is used in many places other than LaTeX. There is a full discussion on the differences between lstlisting and minted here: tex.stackexchange.com/questions/102596/…, –  FvD Jun 28 '13 at 13:17

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

This has been mentioned in some of the “big answers”, but thought it deserved special attention. Probably most documents should include:

\usepackage[T1]{fontenc}


This is to resolve some deficiencies and inconsistencies of the default OT1 font encoding; while improving the support of special characters (e.g. the ability to copy&paste from the generated pdf document).

-

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

pageslts: for being able to refer to the last page of a document

-
\usepackage{fancyvrb}


I use it for highly customisable verbatim. The abstract of the package documentation reads:

This package provides very sophisticated facilities for reading and writing verbatim TeX code. Users can perform common tasks like changing font family and size, numbering lines, framing code examples, colouring text and conditionally processing text.

Here's an example using the SaveVerbatim environment in combination with the \fcolorbox command:

-

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).

-

I also find package lipsum fun to use. It lets you generate several versions of lorem ipsum placeholder text to see what your document would look like.

-

For the natural scientists among us, the package mhchem makes it very easy to typeset chemical symbols and chemical equations.

-

I always load the package xy to produce diagrams.

Also tikz to draw figures.

-
I use tikz-cd to get commutative diagrams drawn with tikz with a syntax highly reminiscent of the xy syntax. –  Charles Staats Dec 6 '12 at 3:22

Very often a requirement for the documents I write is that the font should be Times (or Times New Roman), so the package I use to set the main roman font to Times and acceptable math is mathptmx.

Recently, I have experimented with newtxtext and newtxmath but, personally, I do not like the design of some symbols and there are a few cases where the spacing between characters is too tight.

For personal use I set the font to New Century Schoolbook and Fourier (for math) with the fouriernc package.

-

I always use

\usepackage[retainorgcmds]{IEEEtrantools} % sophisticated equation arrays


It offers a sophisticated environment for formatting equation arrays,IEEEeqnarray and also offers a few other constructions. I don't use the traditional eqnarrays any more. I usually set the option [retainorgcmds] because it prevents the package from overwriting the itemize, enumerate and description definitions.

Check out How to Typeset Equations in LaTeX. The author gives some good examples of how and why to use this package instead of the traditional ones. The Not So Short Introduction to LaTeX 2ε also mentions the package in section 3.5.2. This section actually seems to be a copy of the first link ;)

-

The following command before the \documentclass command permits Computer Modern fonts at arbitrary sizes: \RequirePackage{fix-cm}.

-

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

Edited by doncherry: Removed packages mentioned in separate answers.

I use TeX for a variety of documents: research papers, lectures/tutorials, presentations, miscellaneous documents (some in Japanese). Each of these different uses, requires different packages.

Depending on my mood, I like to use different fonts. A particular nice combination for mathematics papers is

\usepackage[T1]{fontenc} % better treatment of accented words
\usepackage{eulervm}   % Zapf's Euler fonts
\usepackage{tgpagella} % TeXGyre Pagella fonts


For references,...

\usepackage[notref,notcite]{showkeys} % useful when writing the paper
\usepackage[noadjust]{cite} % [1,2,3,4,5] --> [1-5]  useful in hep-th!


For lecture notes (again mathematical) I often like to section the document into "lectures" instead of sections and to add some colours to the titles,.... To do this it's useful to use

\usepackage{fancyhdr} % fancy headers
\usepackage{titlesec} % to change how sections are displayed
\usepackage{color}    % to be able to do this in colour


and I also like to decorate using some silly glyphs, for which these fonts are useful:

\usepackage{wasysym,marvosym,pifont}


and also box equations and other things

\usepackage{fancybox,shadow}


\usepackage[rflt]{floatflt}
\usepackage{graphicx,subfigure,epic,eepic}


You may want to hide the answers to tutorial exercises, problems,... and this can be achieved with

\usepackage{version,ifthen} % ifthen allows controlling exclusions


I use XeLaTeX for documents containing Japanese, which works better with

\usepackage{fontspec} % makes it very easy to select fonts in XeLaTeX
\usepackage{xunicode} % accents

-
As the question suggested, could you write an answer per package/topic and explain what these packages do or why do you need them? –  Juan A. Navarro Jul 29 '10 at 10:51
can you please add comments like \ usepackage{foo} % to get following features within your code? –  Dima Jul 29 '10 at 11:06
To avoid breaking them up all the way, you could try grouping them a little (say, if there's one package that you wouldn't consider using without another one then put them together). –  Loop Space Jul 29 '10 at 13:04