Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

LaTeX

aka Tex, MathJax

Ctrl+F to search. pdflatex file.tex to compile

Symbol lookup:

Front Matters

% metadata
\documentclass{article}
\title{Test}
\author{Me}
\date{\today}
% displayed
\begin{document}
\maketitle
\end{document}

Basic Math

\begin{cases}
    1 & \text{if} a=b \\
    0 & \text{if} a\not=b
\end{cases}

Resources

Tables

\begin{center}
\begin{tabular}{ c c c }
 cell1 & cell2 & cell3 \\ 
 cell4 & cell5 & cell6 \\  
 cell7 & cell8 & cell9    
\end{tabular}
\end{center}

Code

\def\code#1{\texttt{#1}} % then use \code{...}
% see https://tex.stackexchange.com/questions/36030/how-to-make-a-single-word-look-as-some-code

Algorithms

Algorithms

\usepackage{algpseudocode}
\begin{algorithmic}[1] % the [1] (or [n]) numbers every nth line
\Function{\textsc{MyFunction}}{}
\State $i \gets 10$
\If{$i\geq 5$} \Comment{Compare $i$ and $5$} 
    \State $i \gets i-1$
\Elsif{$i > 8$}
    \If{$i\leq 3$}
        \State $i \gets i+2$
    \EndIf
\EndIf
\EndFunction
\end{algorithmic}

Images

PNG

\begin{figure}[hp]
    \centering
    \includegraphics[width=0.5\linewidth]{figure.png}
    \caption{Caption}
    \label{fig:figurename}
\end{figure}

SVG

https://tex.stackexchange.com/questions/2099/how-to-include-svg-diagrams-in-latex

\usepackage{svg}
\begin{document}
\includesvg{some_svg_file}
\end{document}

Tikz

\usepackage{tikz}
\begin{figure}[htbp]
    \centering
    \resizebox{0.65\textwidth}{!}{
        \input{myimage} % omit .tex
    }
    \caption{my figure name}
    \label{f:figurename}
\end{figure}