# How to limit the figure caption width?

Figure captions seem to wrap at the page width. How could I make them wrap at the figure width instead? Currently, they can easily be mistaken for normal text.

\begin{figure}[!htb]
\begin{center
\begin{tikzpicture} ... \end{tikzpicture}
\caption{Caption goes here.}
\end{center}
\end{figure}


The caption package provides many enhancements: for example

\usepackage[margin=1cm]{caption}


Reducing the caption to the figure width seems not a good idea in general, particularly if a couple of figures are on the same page or on facing pages. On the other hand reducing the width and maybe the font size can be a good typographical device to isolate them better from the context.

• The OP seems to want to adapt caption widths to the widths of individual figures, not to reduce the caption width by a fixed amount. Sep 20, 2011 at 17:49
• Yes, you're right. I'll edit the answer. Sep 20, 2011 at 17:51
• @egreg: You convinced me that decreasing the caption width with a constant amount would be better. Thanks! Sep 20, 2011 at 18:00
• @Nomi Hmm, what top and bottom margins? Aug 25, 2016 at 21:38
• @Nomi That's the job of abovecaptionskip and belowcaptionskip Aug 26, 2016 at 16:15

in caption package guide:

Only fixed widths are supported here; if you are looking for a way to limit the width of the caption to the width of the figure or table, please take a look at the floatrow[8] or threeparttable[22] package.

\documentclass{article}
\usepackage{floatrow}
\begin{document}

\begin{figure}
\ffigbox[\FBwidth]
{\caption{caption text caption text caption text caption text
caption text caption text caption text caption text
caption text caption text caption text caption text }\label{...}}
{\rule{50mm}{20mm}}
\end{figure}

\end{document}

• Hadi Safi aghdam - that works, but it doesn't respect 'width' options of includegraphics. That is, the caption is much wider than the figure with something like this: \begin{figure} \ffigbox[\FBwidth] {\caption{caption text caption text caption text caption text caption text caption text caption text caption text }\label{...}} {\includegraphics[width=.4\linewidth]{dummy}} \end{figure} Feb 3, 2014 at 17:09

I also encountered the problem. Sometimes I use therefore two minipages to put two figures beside each other, so not much vertical space is lost.

\documentclass{article}
\usepackage{caption}
\begin{document}
\begin{figure}
\begin{minipage}[b]{0.6\textwidth}
\centering
\rule{0.4\textwidth}{3cm}
\captionof{figure}{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
}
\label{fig:a}
\end{minipage}\hfill
\begin{minipage}[b]{0.3\textwidth}
\centering
\rule{0.8\textwidth}{3cm}
\captionof{figure}{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
}
\label{fig:b}
\end{minipage}
\end{figure}
\end{document}


Additionally to @egreg's answer, it's worth noting that caption also has a localised parameter that can be set:

\captionsetup{margin=3cm}


Otherwise globally using the package option \usepackage[margin=1cm]{caption} as suggested.

You can get the documentation here.

An example:

\begin{figure}
\centering
\captionsetup{margin=3cm}
\includegraphics[width=\textwidth]{filename}
\caption{long ... amounts  .... of ... text}
\end{figure}

• \setlength{\captionmargin}{3cm} is the same as \captionsetup{margin=3cm} but the latter should be used now.
– user2574
Jun 5, 2018 at 16:31
• @AxelSommerfeldt thanks, updated to newer syntax
– Mr G
Jun 5, 2018 at 23:07
• The caption can be extended beyond the width of the text by using negative numbers, e.g. \captionsetup{margin=-1cm}. Sep 3, 2021 at 10:43

You can use the wrapfigure environment also like so:

\begin{wrapfigure}{r}{0.5\textwidth}
\includegraphics[] {MyFigure}
\centering
\caption{My nifty caption}
\label{fig_something_to_reference_with}
\end{wrapfigure}


This will create a smaller environment containing your figure and the caption and then wrap the surrounding text around it.

Additional information can be found at https://www.sharelatex.com/learn/Inserting_Images

• Welcome to TeX.SX! This does not only limit the caption width, but also changes the figure's position. Sep 30, 2017 at 6:17