LaTeX Snippets

Colours

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

source

enumitem

\usepackage[shortlabels]{enumitem}
% ...
\begin{enumerate}[(a)]
\begin{enumerate}[label=(\textbf{\alph*})]

also available: \Alph, \roman, \Roman

quick reference

Miscellaneous

Symbols: