Figures, Graphics & Diagrams
Detailed guide on floating figures, graphicx inclusion options (width, scale, angle, clip), subcaption side-by-side figures, and TikZ vector diagrams.
Choose between standard centered floats, side-by-side subfigures with (a) & (b) labels, framed border boxes, text-wrapped inline illustrations, or side-by-side figure+table pairs.
Advanced Figures & Subfigures
Comprehensive syntax, arguments, options, and copyable snippets for advanced figures & subfigures.
\begin{subfigure}{width}...\end{subfigure}
Places one panel of a multi-part figure (subcaption package)
\begin{subfigure}{0.45\textwidth}
\includegraphics{a.png}
\caption{Sample A}
\end{subfigure}
\subcaption{text}
Caption for an individual subfigure panel (subcaption package)
\subcaption{Left panel}
\begin{wrapfigure}{pos}{width}...\end{wrapfigure}
Wraps body text around a figure (wrapfig package)
Text-Wrapped Inline Graphic: pos specifies alignment (r: right, l: left). width sets reserved horizontal box width.
\begin{wrapfigure}{r}{0.4\textwidth}
\includegraphics[width=\linewidth]{fig.png}
\end{wrapfigure}
\begin{longtable}{cols}...\end{longtable}
Multi-page table that can break across pages (longtable package)
\begin{longtable}{cc}
A & B \\
\hline
\endhead
1 & 2 \\
\end{longtable}
\endhead
Marks the header row(s) to repeat on every page of a longtable
\endhead
\endfirsthead
Marks the header shown only on the first page of a longtable
\endfirsthead
\endfoot
Marks the footer row(s) to repeat on every page of a longtable
\endfoot
\sidewaystable
Rotates a table 90 degrees on its own page (rotating package)
\begin{sidewaystable}
\caption{Wide data}
\end{sidewaystable}
Colors & Image Inclusion
Comprehensive syntax, arguments, options, and copyable snippets for colors & image inclusion.
\textcolor{color}{text}
Colors text (xcolor)
\textcolor{red}{Warning!}
\colorbox{color}{text}
Colored background box (xcolor)
\colorbox{yellow}{Highlighted}
\fcolorbox{border}{bg}{text}
Framed and colored box (xcolor)
\fcolorbox{black}{yellow}{Boxed text}
\pagecolor{color}
Sets page background color (xcolor)
\pagecolor{lightgray}
\definecolor{name}{model}{spec}
Defines a custom color (xcolor)
\definecolor{myblue}{RGB}{0,102,204}
\rotatebox{angle}{text}
Rotates content (graphicx)
\rotatebox{45}{Tilted text}
\scalebox{factor}{text}
Scales content (graphicx)
\scalebox{2}{Big text}
\resizebox{width}{height}{text}
Resizes content to given dimensions (graphicx)
\resizebox{3cm}{1cm}{Stretched text}
TikZ Vector Graphics
Comprehensive syntax, arguments, options, and copyable snippets for tikz vector graphics.
\begin{tikzpicture}...\end{tikzpicture}
Container for a TikZ vector drawing (tikz package)
\begin{tikzpicture}
\draw (0,0) circle (1cm);
\end{tikzpicture}
\draw
Draws a path, line, or shape in TikZ
\draw (0,0) -- (2,2);
\node
Places a labeled node/point in TikZ
\node at (1,1) {$P$};
\coordinate
Defines a named coordinate point in TikZ
\coordinate (A) at (0,0);
\fill
Draws and fills a closed shape in TikZ
\fill[blue] (0,0) rectangle (1,1);
\filldraw
Fills and outlines a shape in one command (TikZ)
\filldraw[fill=yellow, draw=black] (0,0) circle (0.5);
\begin{axis}...\end{axis}
Plots data/functions on labeled axes (pgfplots package)
\begin{axis}
\addplot {x^2};
\end{axis}
\addplot
Adds a data series or function plot inside an axis environment (pgfplots)
\addplot table {data.dat};
\usetikzlibrary{name}
Loads a TikZ library for extra shapes/features
\usetikzlibrary{arrows.meta}