0%

LaTeX Commands for Figures

LaTeX codes for inserting figures

Basic

1
2
3
4
5
6
7
8
\usepackage{graphicx} % required by \includegraphics

\begin{figure}[t]
\centering
\includegraphics[width=0.8\linewidth]{exmp.pdf}
\caption{description of exmp}
\label{fig:exmp}
\end{figure}

Remarks

  • [t] is the position parameter meaning position at the top
  • Other commonly used values include h (here), b (bottom), H (precisely the location of the code)

Wrap figure

1
2
3
4
5
6
7
\usepackage{wrapfig} % required by wrapfigure env
\usepackage{graphicx} % required by \includegraphics

\begin{wrapfigure}{r}{0.25\textwidth} % at the right
\centering
\includegraphics[width=0.25\textwidth]{exmp.pdf}
\end{wrapfigure}

Remarks

  • Wrap the text around a small figure
  • {r} (resp. {l}) means put the figure on the right (resp. left)

Two-col figure

1
2
3
4
5
6
7
8
\usepackage{graphicx}

\begin{figure*}[t]
\centering
\includegraphics[width=0.8\linewidth]{exmp.pdf}
\caption{description of exmp}
\label{fig:exmp}
\end{figure*}

Multiple figures

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
\usepackage{graphicx} % required by \includegraphics
\usepackage{subcaption} % required by subfigure env

\begin{figure}[t]
\begin{subfigure}{.48\linewidth}
\centering
\includegraphics[width=\linewidth]{1_1.eps}
\caption{}
\label{Fig:1_1}
\end{subfigure}
\begin{subfigure}{.48\linewidth}
\centering
\includegraphics[width=\linewidth]{1_2.eps}
\caption{}
\label{Fig:1_2}
\end{subfigure}
\\
\begin{subfigure}{.48\linewidth}
\centering
\includegraphics[width=\linewidth]{2_1.eps}
\caption{}
\label{Fig:2_1}
\end{subfigure}
\begin{subfigure}{.48\linewidth}
\centering
\includegraphics[width=\linewidth]{2_2.eps}
\caption{}
\label{Fig:2_2}
\end{subfigure}
\\
\begin{subfigure}{.48\linewidth}
\centering
\includegraphics[width=\linewidth]{3_1.eps}
\caption{}
\label{Fig:3_1}
\end{subfigure}
\begin{subfigure}{.48\linewidth}
\centering
\includegraphics[width=\linewidth]{3_2.eps}
\caption{}
\label{Fig:3_2}
\end{subfigure}
\caption{description of all figures}
\end{figure}

Remarks

  • 6 figures in 3 rows and 2 columns
  • Each subfigure can has its own caption and label