Add caption on the side of a figure in LaTeX
Generally, in LaTeX you can place a caption on top or bottom of a figure. But we may need to place the caption on the side of the figure or table. In this case, you have to use an additional package called sidecap
.
The sidecap
package gives you access to place the caption on the side of a figure. But in this case, you have to create tables with the SCtable
environment, and for figures use SCfigure
environment other than figure
or table
environment.
Caption on the left side of a figure or table
To place the caption on the left side of a figure or table you have to use the leftcaption
option with the sidecap
package. Use this on the preamble.
\usepackage[leftcaption]{sidecap}
\documentclass{article} \usepackage[leftcaption]{sidecap} \usepackage{graphicx} % For \includegraphics \begin{document} \begin{SCfigure} \centering \includegraphics[width=0.5\textwidth]{example-image} \caption{Caption for this Figure} \end{SCfigure} \begin{SCtable} \centering \begin{tabular}{| c | c | c |} \hline \textbf{Heading-1} & \textbf{Heading-2} & \textbf{Heading-3} \\ \hline A & B & C \\ \hline D & E & F \\ \hline G & H & I \\ \hline \end{tabular} \caption{Caption for this Table} \end{SCtable} \end{document}
Output:
Caption on the right side of a figure or table
In order to place the caption on the right side use this in the preamble of the document.
\usepackage[rightcaption]{sidecap}
\documentclass{article} \usepackage[rightcaption]{sidecap} \usepackage{graphicx} % For \includegraphics \begin{document} \begin{SCfigure} \centering \includegraphics[width=0.5\textwidth]{example-image} \caption{Caption for this Figure} \end{SCfigure} \begin{SCtable} \centering \begin{tabular}{| c | c | c |} \hline \textbf{Heading-1} & \textbf{Heading-2} & \textbf{Heading-3} \\ \hline A & B & C \\ \hline D & E & F \\ \hline G & H & I \\ \hline \end{tabular} \caption{Caption for this Table} \end{SCtable} \end{document}
Output:
Set the vertical position of the caption
To set the vertical position of the caption you have these options to use:
For figures,
\sidecaptionvpos{figure}{c}
for center\sidecaptionvpos{figure}{b}
for bottom\sidecaptionvpos{figure}{t}
for top
For tables,
\sidecaptionvpos{table}{c}
for center\sidecaptionvpos{table}{c}
for bottom\sidecaptionvpos{table}{c}
for top
You can use these options as you need in the preamble of your document.
\documentclass{article} \usepackage[rightcaption]{sidecap} \sidecaptionvpos{figure}{c} % To center vertically (figure) \sidecaptionvpos{table}{c} % To center vertically (table) \usepackage{graphicx} % For \includegraphics \begin{document} \begin{SCfigure} \centering \includegraphics[width=0.5\textwidth]{example-image} \caption{Caption for this Figure} \end{SCfigure} \begin{SCtable} \centering \begin{tabular}{| c | c | c |} \hline \textbf{Heading-1} & \textbf{Heading-2} & \textbf{Heading-3} \\ \hline A & B & C \\ \hline D & E & F \\ \hline G & H & I \\ \hline \end{tabular} \caption{Caption for this Table} \end{SCtable} \end{document}
Output:
Leave a Reply