LaTeX packages
95 packages: what each one is for, its main commands and a complete example.
abstract- Changes the layout of the
abstractenvironment (heading font, text font, indents) and providesonecolabstractfor a full-width abstract in a two-column document. acronym- Manages acronyms without an external program:
\acrodefines them in theacronymenvironment, and\acprints the long form at the first use and the short form afterwards. algorithm2e- Typesets pseudocode in a numbered
algorithmfloat, with commands such as\KwIn,\For,\While,\Ifand\Return. algpseudocode- Typesets pseudocode in the
algorithmicenvironment with commands such as\State,\If ... \EndIf,\For ... \EndForand\Function. amsmath- Adds the display environments
align,gatherandcases, the matrix environments, and commands such as\text,\dfracand\DeclareMathOperator. amssymb- Adds about 200 math symbols and the alphabets
\mathbband\mathfrak, for example\mathbb{R},\leqslant,\nmidand\therefore. amsthm- Defines theorem environments in three styles with
\theoremstyleand\newtheorem, and adds theproofenvironment with an end-of-proof mark. appendix- Provides the
appendicesenvironment and options that add the word "Appendix" to headings and an "Appendices" entry to the table of contents. array- Extends the column argument of
tabularandarray:m{...}andb{...}columns,>{...}and<{...}for code around every cell, and\newcolumntype. babel- Adapts a document to its language: hyphenation, generated words such as "Contents" and "Figure", and the date format.
\selectlanguageand\foreignlanguageswitch between languages. biblatex- Creates citations and the bibliography from a
.bibfile with the program Biber:\addbibresource,\parencite,\textciteand\printbibliography. blindtext- Inserts dummy text in the language of the document with
\blindtext, and a complete test document with headings and lists with\blinddocument. bm- Provides
\bm, which sets any math symbol in bold and keeps its shape, including Greek letters and operators. bookmark- Replaces the bookmark code of
hyperref: the PDF outline is correct after one run, and\bookmarksetupsets its style, numbering and open levels. booktabs- Draws the horizontal rules of a table with correct thickness and spacing:
\toprule,\midruleand\bottomrule. calc- Allows arithmetic in
\setlength,\setcounterand the length arguments of boxes:\setlength{\x}{\textwidth - 2cm}, plus\widthof{text}for the width of a text. cancel- Strikes through parts of a formula with a diagonal line:
\cancel,\bcancel,\xcanceland\cancelto. caption- Changes the look of figure and table captions with
\captionsetupand adds\caption*and\captionof. chemfig- Draws structural formulas of molecules with
\chemfig: atoms, single, double and triple bonds at chosen angles, rings and reaction schemes. circuitikz- Draws electrical circuits: components such as
R,C,LandVare placed on a path withto[...]inside acircuitikzenvironment. cleveref- Writes the kind of object in front of a reference:
\cref{fig:setup}prints "fig. 1" and handles several labels at once. colortbl- Colours table rows, columns, single cells and rules:
\rowcolor,\columncolor,\cellcolorand\arrayrulecolor. csquotes- Sets the quotation marks of the document language with
\enquoteand formats longer quotations with\blockquoteanddisplayquote. dcolumn- Provides the column type
D, which aligns the numbers of a table column at the decimal marker. draftwatermark- Prints a text watermark such as "DRAFT" behind the content of every page; text, size, angle and colour are set with
\DraftwatermarkOptions. enumitem- Sets labels, spacing and indents of
itemize,enumerateanddescriptionthrough options such aslabel,noitemsep,leftmarginandresume. etoolbox- Programming tools for the preamble: flags with
\newtoggleand\iftoggle, tests such as\ifstrequaland\ifdef, hooks such as\AtBeginEnvironment, and\patchcmdfor changing existing commands. eurosym- Prints the euro sign with
\euroand amounts with\EUR{...}, from a font of its own with the official shape of the sign. fancyhdr- Defines the header and footer of a page in three parts each (left, centre, right) with
\fancyheadand\fancyfoot. fancyvrb- Provides the
Verbatimenvironment with options for line numbers, frames, font size and line ranges, and\VerbatimInputfor files. float- Adds the placement
[H], which sets a figure or table exactly where it stands in the source, and defines new float types with\newfloat. fontawesome5- Provides the icons of Font Awesome 5 as text characters:
\faIcon{name}, or one command per icon such as\faGithuband\faEnvelope. fontenc- Selects the font encoding for pdfLaTeX.
\usepackage[T1]{fontenc}switches to fonts that contain accented letters as single characters. fontspec- Loads OpenType and TrueType fonts by name in LuaLaTeX and XeLaTeX:
\setmainfont,\setsansfont,\setmonofontand\newfontfamily. footmisc- Changes numbering and layout of footnotes through package options such as
perpage,bottom,hang,symbolandmultiple. forest- Draws trees from bracket notation:
[parent [child] [child]]inside aforestenvironment. geometry- Sets the paper size and the page margins with options such as
margin=2.5cm,left,topanda4paper. glossaries- Manages a glossary and a list of acronyms: terms are defined once with
\newglossaryentryor\newacronym, used with\glsand listed with\printglossaries. graphicx- Includes image files with
\includegraphicsand sets their size, rotation and cropping through options such aswidth,angleandtrim. hyperref- Turns cross-references, citations, the table of contents and URLs into clickable links and writes bookmarks and metadata into the PDF;
\href,\urland\hypersetupare its main commands. ifthen- Provides the conditional
\ifthenelse{test}{true}{false}with tests for numbers, strings, lengths and flags, and the loop\whiledo. imakeidx- Creates an index from
\indexentries with\makeindexand\printindex, runs MakeIndex during the compilation and supports several indexes in one document. inputenc- Tells pdfLaTeX in which encoding the source file is saved.
\usepackage[utf8]{inputenc}has been the default since 2018 and is no longer needed. lineno- Prints line numbers in the margin of the text with
\linenumbers, as journals ask for in manuscripts under review. lipsum- Inserts paragraphs of the dummy text "Lorem ipsum" with
\lipsum, for testing a layout before the real text exists. listings- Typesets source code with syntax highlighting, line numbers and captions, without an external program: the
lstlistingenvironment,\lstinlineand\lstinputlisting, configured with\lstset. lmodern- Switches the document to Latin Modern, the vector version of the Computer Modern fonts with the full
T1character set. longtable- Provides the
longtableenvironment for tables that continue over several pages, with a head and foot that repeat on every page. makecell- Provides
\makecellfor line breaks inside a table cell and\theadfor column headings with their own font. marginnote- Places notes in the page margin with
\marginnote, also in places where\marginparfails: inside figures, footnotes and boxes. mathtools- Extends
amsmathwith\DeclarePairedDelimiter, thedcasesenvironment,\coloneqq, matrix columns with a chosen alignment and an option that numbers only the equations you reference. mdframed- Draws a frame with an optional background around text that may run over several pages: the
mdframedenvironment and\newmdenv. mhchem- Typesets chemical formulas and reaction equations from plain input with
\ce, for example\ce{2H2 + O2 -> 2H2O}. microtype- Evens out justified text with character protrusion and font expansion; loading the package without options switches both on.
minted- Highlights source code with the Python library Pygments: the
mintedenvironment,\mintinlineand\inputminted. It needs a compile run with shell escape. multicol- Sets part of a page in two to ten columns with the
multicolsenvironment and balances the columns at its end. multirow- Provides
\multirow, a table cell that spans several rows, with its text centred vertically across them. natbib- Adds author-year citations to the BibTeX workflow: with the option
round,\citetprints Knuth (1984) and\citepprints (Knuth, 1984). nicefrac- Provides
\nicefrac{1}{2}for small diagonal fractions such as ½ in running text and in formulas. nomencl- Builds a list of symbols:
\nomenclature{symbol}{description}records an entry where the symbol is introduced, and\printnomenclatureprints the sorted list. parskip- Separates paragraphs by vertical space instead of a first-line indent; the options
skipandindentset both values. pdflscape- Provides the
landscapeenvironment: its content is set on landscape pages, and a PDF viewer shows these pages turned. pdfpages- Inserts whole pages of another PDF file into the document with
\includepdf, one or several per sheet. pgfgantt- Draws Gantt charts for project plans:
\ganttbar,\ganttgroupand\ganttmilestoneinside aganttchartenvironment. pgfplots- Draws function plots, data plots and bar charts with axes, ticks and a legend:
\addplotinside anaxisenvironment. physics- Shortens physics notation: derivatives with
\dvand\pdv, Dirac notation with\braand\ket, brackets that size themselves with\qty, and vector operators such as\grad. pifont- Prints the symbols of the Zapf Dingbats font by number with
\ding, for example check marks, crosses, arrows and circled digits. placeins- Provides
\FloatBarrier, a point that no figure or table can float past, and an option that puts such a barrier before every\section. ragged2e- Sets ragged text that still hyphenates words (
\RaggedRight,\Centering,\RaggedLeft) and returns to justified text with\justifying. rotating- Turns a figure or table with its caption by 90° on a page of its own (
sidewaysfigure,sidewaystable) and rotates text by any angle. scrlayer-scrpage- Defines headers and footers for KOMA-Script and standard classes with
\ihead,\chead,\ohead,\ifoot,\cfootand\ofoot. setspace- Sets the line spacing of the text with
\onehalfspacing,\doublespacingand\setstretch. siunitx- Typesets numbers and physical quantities with consistent spacing and units:
\qty,\num,\unit, and the table columnSthat aligns numbers at the decimal marker. soul- Underlines, strikes out, highlights and letterspaces text that still breaks across lines:
\ul,\st,\hl,\soand\caps. subcaption- Places several images or tables in one float, each with its own caption (a), (b), through the environments
subfigureandsubtable. subfiles- Splits a document into files that compile on their own with the preamble of the main file:
\subfilein the main file and the classsubfilesin each part. svg- Includes SVG files with
\includesvgby calling Inkscape during the LaTeX run to convert them to PDF. tabularx- Sets a table to a width you choose, for example
\textwidth: the column typeXtakes the space that is left and wraps its text. tabulary- Sets a table to a target width and gives each
L,C,RorJcolumn a width in proportion to the amount of text in it. tcolorbox- Draws coloured boxes with a frame, a background and an optional title: the
tcolorboxenvironment and\newtcolorboxfor box types of your own. textcomp- Provides text symbols such as
\texteuro,\textdegree,\textmuand\textcopyright. Since the LaTeX release of February 2020 these commands work without the package. threeparttable- Sets footnotes directly below a table and limits them and the caption to the width of the table: the environments
threeparttableandtablenotesand the command\tnote. tikz- Draws vector graphics from commands in the document: lines and shapes with
\draw, labelled boxes with\node, inside atikzpictureenvironment. tikz-cd- Draws commutative diagrams: objects in a grid inside
tikzcd, connected with\arrowand labelled in quotes. titlesec- Changes font, numbering layout and spacing of
\chapter,\sectionand the lower headings with\titleformatand\titlespacing. tocloft- Controls fonts, indents, dot leaders and spacing in the table of contents, list of figures and list of tables through lengths and commands named
\cft.... todonotes- Marks open tasks in a draft:
\todoputs a coloured note in the margin,\listoftodoscollects all notes,\missingfigureholds the place of a figure. ulem- Underlines and strikes out text in several styles that break across lines:
\uline,\uuline,\uwave,\sout,\xout,\dashulineand\dotuline. unicode-math- Sets formulas in an OpenType math font chosen with
\setmathfontand accepts Unicode characters such as α, ∑ and ≤ in the source. Needs LuaLaTeX or XeLaTeX. url- Typesets web addresses, e-mail addresses and file paths with
\urland\path: special characters are typed as they are, and long addresses break across lines. verbatim- Reimplements the
verbatimenvironment and adds\verbatiminputfor whole files and thecommentenvironment for text that LaTeX should skip. wrapfig- Lets text flow around a narrow figure or table at the edge of the page: the environments
wrapfigureandwraptable. xcolor- Provides colour for text, backgrounds and boxes:
\textcolor,\colorbox,\definecolor, and mixtures written asblue!30. xfrac- Provides
\sfrac{1}{2}for diagonal fractions such as ½, with sizes and spacing set per font family. xparse- Defines commands with stars, several optional arguments and default values through
\NewDocumentCommand. Since the LaTeX release of October 2020 these commands work without the package.