10

I need to put a multi-line quote in a figure caption. I've put code together that does this correctly if I override several errors, but I'd like the document to compile without errors.

The code:

\begin{figure}
  \begin{center}
     \includegraphics[width = 6in]{myfigure.png} 
  \end{center}
   \caption[Reproduced from foo.]{text. 
     \begin{quote}
       Quoted text from reproduction
     \end{quote}
     No really this is important.}\label{mylabel}
\end{figure}

The error I get is:

./chap1.tex:166: LaTeX Error: Something's wrong--perhaps a missing \item.

Thanks for the help.

1 Answer 1

14

Please always post complete documents showing the class used.

In the standard classes the caption is set twice once as a single line to see if it fits, and then as a paragraph if not, the single line trial generates the error if you use a display environment.

You can turn this off with the caption package:

\documentclass{article}
\usepackage{caption}
\captionsetup{singlelinecheck=false}
\begin{document}
\begin{figure}
  \begin{center}
     XXXX%\includegraphics[width = 6in]{myfigure.png} 
  \end{center}
   \caption[Reproduced from foo.]{text. 
     \begin{quote}
       Quoted text from reproduction
     \end{quote}
     No really this is important.}\label{mylabel}
\end{figure}

\end{document}
3
  • 1
    I'd also use \centering instead of \begin{center} ... \end{center}.
    – lockstep
    Mar 1, 2013 at 16:12
  • yes @Sevenless, center introduces additional vertical space which you often don't want in this context. Mar 1, 2013 at 16:16
  • Thank you so much, also for the \centering advice.
    – Sevenless
    Mar 1, 2013 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .