latex list
Written by Daniel Herber on January 7, 2015 (last updated on March 17, 2017).
Throughout my usage of the $\LaTeX$ language, I have found a number of packages and commands essential to creating superb documents. Here I provide a list of my most commonly used $\LaTeX$ packages and commands. I use this page as a starting point for my documents; whatever is necessary for the particular document is copied into the preamble from the webpage.
---
### My Packages
Packages are grouped into 2 categories: simple and document modifying. Simple packages typically provide commands that can be used if warranted in your document while document modifying packages permanently change some aspect of the document when included. For example, the hyperref package cross-referencing with hyperlinks and by default the hyperlinks are created.
```tex
% simple packages
\usepackage[export]{adjustbox} % for image frames
\usepackage{algorithm2e} % environment for writing algorithms
\usepackage{amsmath} % AMS mathematical facilities
\usepackage{amssymb} % extended symbol collection and fonts
\usepackage{amsthm} % theorem-like structures
\usepackage[american]{babel} % cul-tur-ally de-ter-mined ty-po-graph-i-cal rules
\usepackage{blindtext} % produces text for testing
\usepackage{bm} % advanced bold symbols
\usepackage{calc} % perform arithmetic on the arguments of commands
\usepackage{caption} % makes captions ragged right
\usepackage[strict]{changepage} % change the page layout in the middle of a document
\usepackage{enumitem} % controls enumerate, itemize, and description
\usepackage{epstopdf} % 'include' eps files
\usepackage{fancyhdr} % construct headers and footers
\usepackage[T1]{fontenc} % select font encodings
\usepackage{framed} % framed or shaded regions
\usepackage{geometry} % customize page layout
\usepackage{graphicx} % improves \includegraphics
\usepackage[utf8]{inputenc} % accept different input encodings
\usepackage{lastpage} % reference to the last page
\usepackage{lineno} % include line numbers
\usepackage{lmodern} % enhanced Computer Modern fonts
\usepackage{lscape} % useful for wide tables or figures
\usepackage{ltxcmds} % some utility macros from the latex kernel
\usepackage{mathtools} % enhancing mathematics appearance
\usepackage{nicefrac} % typeset inline fractions
\usepackage{pifont} % Pi fonts (Dingbats, Symbol, etc)
\usepackage{setspace} % set the spacing between lines
\usepackage{subcaption} % writing captions for subfigures
\usepackage{tikz} % drawings
\usepackage{titlesec} % alternative section titles
\usepackage{varwidth} % specifying max widths
\usepackage{verbatim} % displays verbatim text
\usepackage{xcolor} % defines colors
\usepackage{xstring} % provides macros for manipulating strings
% document modifying packages
\usepackage[noadjust]{cite} % grouped citations
\usepackage{draftwatermark} % watermarks
\usepackage{hyperref} % cross-referencing with hyperlinks
```
#### My Package Options
Next are the package options. Some are more general such as setting the page layout with the geometry package while others are specific such as formating the watermark in the draftwatermark package. Similar to the packages, the package options are grouped by simple and document modifying.
```tex
% simple package options
% --- mathtools ---------------------------------
\DeclarePairedDelimiter\abs{\lvert}{\rvert} % absolute value delimiter
\DeclarePairedDelimiter\norm{\lVert}{\rVert} % norm delimiter
% --- tikz ---------------------------------
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
% --- xcolor ---------------------------------
\definecolor{shadecolor}{rgb}{0.9,0.9,0.9} % define a grey color
% document modifying package options
% --- caption ---------------------------------
\captionsetup{justification=raggedright,format=hang,labelsep=space,indention=0cm,labelfont=bf,width=\textwidth}
% --- geometry ---------------------------------
\geometry{top=1.25in, bottom=1.25in, left=1.75in, right=1.75in, paperheight=11in, paperwidth=8.5in}
% --- fancyhdr ---------------------------------
\lhead{} % left header
\chead{} % center header
\rhead{} % right header
\lfoot{} % left footer
\cfoot{\thepage} % center footer
\rfoot{} % right footer
\renewcommand{\headrulewidth}{0pt} % remove the header line
\pagestyle{fancy} % activates, remove on a page with \thispagestyle{plain} or {empty}
% --- lineno ---------------------------------
\linenumbers % include line numbers
% --- setspace ---------------------------------
\doublespacing % double spacing
% --- titlesec ---------------------------------
\titleformat*{\subsubsection}{\normalsize} % change subsubsection to normalsize
% --- draftwatermark ---------------------------------
\SetWatermarkText{DRAFT}
\SetWatermarkLightness{0.5}
\SetWatermarkScale{1}
% --- hyperref ---------------------------------
\hypersetup{
bookmarks=true, % show bookmarks bar?
bookmarksnumbered = true,
unicode=false, % non-Latin characters in Acrobat’s bookmarks
pdftoolbar=true, % show Acrobat’s toolbar?
pdfmenubar=true, % show Acrobat’s menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={FitV}, % fits the width of the page to the window
pdftitle={}, % title
pdfauthor={}, % author
pdfsubject={}, % subject of the document
pdfkeywords = {}, % list of keywords
pdfnewwindow=true % links in new window
}
\hypersetup{colorlinks=false,
linkbordercolor=orange,
citebordercolor=blue,
urlbordercolor=red,
pdfborderstyle={/S/U/W 1}
}
```
---
### My Commands
Finally here are some custom commands. Required packages are noted.
```tex
% commands
\newcommand{\overbar}[1]{\mkern 1.5mu\overline{\mkern-1.5mu#1\mkern-1.5mu}\mkern 1.5mu} % alternative to \bar{} command
\newcommand{\la}{\left\langle} % shorthand dot product
\newcommand{\ra}{\right\rangle} % shorthand dot product
\newcommand{\myline}{\begin{center}\line(1,0){200}\end{center}} % centered horizontal line
\newcommand{\progr}[1]{\textsc{#1}\texorpdfstring{$^\circledR$}{}} % better registered trademark, requires amsmath, amssymb, and hyperref packages
\newcommand{\cmark}{\ding{51}} % check mark, requires pifont package
\newcommand{\xmark}{\ding{55}} % x-like mark, requires pifont package
\newcommand{\doi}[1]{\mbox{doi: \href{http://doi.org/#1}{#1}}} % digital object identifier hyperlink, requires hyperref package
```