LaTeX Snippets
Colours
- List of latex colour definition snippets: latexcolor.com
- Predefined colors: black, blue, brown, cyan, darkgray, gray, green, lightgray, lime, magenta, olive, orange, pink, purple, red, teal, violet, white, yellow (src)
{\color{blue} scoped blue} text
Simple counter
% one of these packages
\usepackage{enumerate}
\usepackage{array}
\usepackage{addlines}
\newcounter{ri}
\setcounter{ri}{0}
\newcommand{\st}{\stepcounter{ri}\theri}
Sample Usage (e.g. for tables):
\begin{tabular}{c|cc}
& a & b \\
\hline
\st & 1 & 1 \\
\st & 0 & 1
\end{tabular}
Insert PDF, graphics
\usepackage{graphicx}
\graphicspath{ {./} }
\includegraphics[width=5in]{basename}
\includegraphics[width=5cm]{file.png}
\usepackage{pdfpages}
% one page
\includegraphics{file.pdf}
\includepdf{file.pdf}
% specify pages
\includepdf[pages=-]{file.pdf}
Crop Images
\usepackage{graphicx}
\includegraphics[trim={5cm 0 0 0},clip]{image.png}
or
\usepackage[export]{adjustbox}
\adjincludegraphics[trim={0 0 {.5\width} 0},clip]{image.png}
trim from edge order: left bottom right top
enumitem
\usepackage[shortlabels]{enumitem}
% ...
\begin{enumerate}[(a)]
\begin{enumerate}[label=(\textbf{\alph*})]
also available: \Alph
, \roman
, \Roman
Miscellaneous
\pagestyle{empty}
remove page numbers\newcommand*{\bqed}{$\blacksquare$}
Symbols:
- some arrows
\mathcal{E}
ε\bigcup
union set operator\langle
,\rangle
⟨⟩