Tags:

A Cheatsheet for Figure/Table Placement in LaTeX

  • LaTeX

Various LaTeX code templates for creating and placing figures and tables.


A Single Entity

FigureTable
%============= Figure =============
\begin{figure}[t] % options: htbp
    \centering
    \includegraphics[width=1\textwidth]{example.pdf}
    %\vspace{-1\baselineskip}
    \caption{Figure Caption.}
    \label{fig:example}
\end{figure}
%========== End of Figure ==========
%============= Table =============
\begin{table}[t] % options: htbp
%\small%\footnotesize 
    \centering
    \caption{Table Caption.}
    \label{tab:example}
    %\vspace{-1\baselineskip}
    \begin{tabular}{|c|c|} % options: lcr
        \hline
        % \multicolumn{2}{|c|}{example of a merged column} 	\\ \hline
        title1 & title2 \\ \hline
        col1 & col2 \\ \hline
    \end{tabular}
\end{table}
%========== End of Table ==========

Multiple Entities in Parallel

Figure (2 Subfigures)Figure (2 Figures)
%============= Figure =============
\begin{figure}[t] % options: htbp
    \centering
    \begin{subfigure}[t]{0.49\columnwidth}
        \centering
        \includegraphics[width=1\columnwidth]{FigureLeft.pdf}
        %\vspace{-1\baselineskip}
        \caption{Left Caption.}
    \end{subfigure}  
    %\hfill
    \begin{subfigure}[t]{0.49\columnwidth}
        \centering
        \includegraphics[width=1\columnwidth]{FigureRight.pdf}
        %\vspace{-1\baselineskip}
        \caption{Right Caption.}
    \end{subfigure}
    %\vspace{-1\baselineskip}
    \caption{Main Caption.}
    \label{fig:example}
\end{figure}
%========== End of Figure ==========
%============= Figure =============
\begin{figure}[t] % options: htbp
    \centering
    \begin{minipage}{0.49\textwidth}
        \centering
        \includegraphics[width=1\columnwidth]{LeftFigure.pdf}
        %\vspace{-1\baselineskip}
        \caption{Left Caption.}
        \label{fig:left}
    \end{minipage}
    %\hfill
    \begin{minipage}{0.49\textwidth}
        \centering
        \includegraphics[width=1\columnwidth]{RightFigure.pdf}
        %\vspace{-1\baselineskip}
        \caption{Right Caption.}
        \label{fig:right}
    \end{minipage}
\end{figure}
%========== End of Figure ==========

Was this post helpful?

Leave a Reply

Your email address will not be published.