# How do you put multiple paragraphs in a caption?

I have a really long caption for a figure in a LaTeX document. I would like to break the caption into a few paragraphs. How do I do that?

As per the request below, I removed everything I could while still getting the errors I mentioned in my comment. The resulting file is this:

\documentclass{article}

\usepackage[pdftex]{graphicx}
\usepackage{hyperref}

\graphicspath{{./Figures/}}

\begin{document}

\begin{figure}
\includegraphics{NodesEdgesExample2.pdf}
\caption{
Paragraph 1.

Paragraph 2.

Paragraph 3.
}
\end{figure}

\end{document}


We're building it in TeXnicCenter, and I verified that another person in my research lab also gets the same errors on his computer with the above code.

-
There's no restriction that I know of. – egreg Mar 16 '12 at 22:49
@egreg I didn't think there was either... But, my friend's document compiles with no errors when there aren't blank lines in his caption. When we put blank lines in to separate paragraphs, it's giving errors like Paragraph ended before \NR@gettitle was complete, Paragraph ended before \addcontentsline was complete and Extra }, or forgotten \endgroup. Any thoughts? – Brandon Mar 16 '12 at 22:57
Please, try preparing a minimal example. – egreg Mar 16 '12 at 23:02
NR@gettitle appears to be from nameref package. Presumably \def\NR@gettitle#1{% should be \long\def\NR@gettitle#1{% to allow paragraphs. – David Carlisle Mar 16 '12 at 23:31
I was wrong; however, if you say \endgraf instead of leaving a blank line, everything works. It's better, though, to follow lockstep's advice of providing a "short caption". – egreg Mar 16 '12 at 23:36

The following quote from the manual of the caption package (p. 12) is also true for the LaTeX standard definition of \caption:

If your caption contains more than one paragraph, you have to specify an alternative caption for the list-of-figures using the optional argument of \caption or \captionof, otherwise you will get an error message.

EDIT: To clarify: A multi-paragraph figure caption without a single-paragraph optional variant will produce an error even if you don't use \listoffigures in your document.

\documentclass{article}

\begin{document}

\listoffigures

\section{foo}

\begin{figure}[!ht]
\centering
\rule{1cm}{1cm}
\caption[LoF entry]{The first paragraph of a figure's caption.

And the second.}
\end{figure}

\end{document}

-
Adding [LoF entry] seems to have done the trick. Thanks! – Brandon Mar 16 '12 at 23:35

You can use caption package.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{lipsum}
\begin{document}
\captionsetup{margin={15pt},parskip=10pt,format=hang,indention=-.8cm}
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{myfigure}
\caption[my caption]{\lipsum[1-2]}
\end{figure}
This is regular text. \lipsum[1]
\end{document}


Note: If your caption contains at least two paragraphs, then you should add a short title [my caption] in \caption[my caption]{\lipsum[1-2]}for LOF. Otherwise it will give an error.

-