Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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”

share|improve this question
2  
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
4  
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
show 4 more comments

52 Answers

1 2

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.

share|improve this answer

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
share|improve this answer

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

share|improve this answer

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.

share|improve this answer
show 4 more comments

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

share|improve this answer
\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: enter image description here

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

I always load the package xy to produce diagrams.

Also tikz to draw figures.

share|improve this answer
2  
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.

share|improve this answer

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 (in German) (in English).

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.

share|improve this answer
9  
Somewhat better is \RequirePackage[l2tabu,orthodox]{nag} before \documentclass. The package docu also recommends this. – qbi Jul 29 '10 at 18:40
show 1 more comment

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

share|improve this answer

\usepackage{fixltx2e} fixes a few things in the LaTeX2e kernel.

Due to LaTeX's stability policy, these corrections have not (yet?) been incorporated into the LaTeX 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 \fnysmbol 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.
share|improve this answer

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

share|improve this answer

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$
share|improve this answer
22  
"one thing (in this case, package) per answer" – Jukka Suomela Jul 29 '10 at 19:02
3  
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
1  
It is usually recommended to load hyperref last. – Alex Hirzel May 1 '12 at 20:20
show 1 more comment

I almost always load microtype. It plays with spacing and the extent to which text protrudes into the right hand margin 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. Be sure to load it after you load any fonts; it needs to know what fonts are in use at the time that it is loaded.

share|improve this answer
9  
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
29  
Can we have an example of with versus without? – levesque Nov 15 '10 at 18:28
4  
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
3  
Here is another example. – Juri Robl Oct 11 '12 at 11:13
show 1 more comment

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!
\usepackage{hyperref} % hyperlinks, metadata,...

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}

I like adding pictures, whence

\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
share|improve this answer
7  
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
1  
can you please add comments like \ usepackage{foo} % to get following features within your code? – Dima Jul 29 '10 at 11:06
1  
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). – Andrew Stacey Jul 29 '10 at 13:04
show 2 more comments

When I'm writing package documentation using ltxdoc it likes using three columns for the index. I'd prefer two. I fix it with the idxlayout package:

\usepackage[columns=2]{idxlayout}
share|improve this answer

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.

share|improve this answer
show 1 more comment

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.

share|improve this answer
14  
On comp.text.tex there's a series of messages "xspace and italic correction" about spacing inconsistencies created by xspace. There, Will Robertson suggested "delimited macros" as an alternative to xspace. Using \newcommand* only to ensure that no existing command is overriden, the above example would look like this: \newcommand*{\sA}{}\def\sA/{\mathcal{A}} To quote Will Robertson: "In the source you must always type "\foo/" [here: "\sA/"] (or TeX will throw an error), and spaces after it won't be gobbled." – lockstep Aug 6 '10 at 15:04
3  
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
2  
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
6  
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
show 3 more comments
\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.

share|improve this answer
5  
\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

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.

share|improve this answer
1  
I just discovered booktabs -- it is great! – Ben Jan 12 '11 at 22:37
1  
@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{docmute}

I use this in my syllabus preparation as I can make each of the subordinate documents fully standalone, yet do a complete compile of everything at once to verify I have all the corrections made.

It does require that all of the preambles are identical.

This then allows me to work only on one course syllabus or schedule or homework assignments with very fast compiles. Also during the semester I can do corrections on individual documents.

My main document preamble is

\documentclass[10pt,letterpaper]{article}
\input{commonpreamble}
\usepackage{docmute}
\begin{document}

And the subordinate documents have this preamble

\documentclass[10pt,letterpaper]{article}
\input{commonpreamble}
\begin{document}

Notice: Only one master document and the \usepackage{docmute} is only in that file.

Also all subordinate document must be only loaded with \input or \include from the main document. Only one level down is allowed.

I keep one copy of the preamble as commonpreamble. And all files are kept in one folder. This system works very well with Texmaker or TexStudio as the structure of the document is always displayed regardless of choosing a "Master Document".

share|improve this answer
\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.

share|improve this answer
\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).

share|improve this answer
1  
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

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

\usepackage[sc]{mathpazo}

Note that the old palatino package is deprecated.

share|improve this answer
8  
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
show 3 more comments

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

\usepackage{multicol}
share|improve this answer
1 2

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.