0

I'm trying to put a block quote in a caption like so,

Correctly formatted

My MCVE creates the correct formatting, but raises an error on line 23

LaTeX Error: Something's wrong--perhaps a missing \item.

Here's my MCVE

\documentclass{article}
%Packages for example image and text
\usepackage{lipsum}
\usepackage{mwe}

\usepackage{subfig} \usepackage{caption}

\begin{document} \begin{figure} \centering \subfloat[Image A]{ \includegraphics[width=0.4\textwidth]{example-image-a} } \subfloat[Image B]{ \includegraphics[width=0.4\textwidth]{example-image-b} } \caption{ A quote follows this text: \begin{quote} \lipsum[3] \end{quote} Insightful and important stuff about the figure.} \label{mylabel} \end{figure}

\end{document}

I tried the solution from this question: Block quote in figure caption but the subfloat captions become aligned left.

Captions are aligned left instead of centered

I need to use subfig or subfigure because my journal template is not compatible with subcaption

How can I keep the subfloat captions centered?

2cents
  • 225
  • Did you check whether it is compatible with the  floatrow package, ans its subfloatrow environment? – Bernard Jun 10 '21 at 21:50

1 Answers1

1

You can build your own quote style without any other package. The only trick is to be able to put multiple lines into the caption environment (See the caption manual, end of page #13}.

b

\documentclass{article}
%Packages for example image and text
\usepackage{lipsum}
\usepackage{mwe}

\usepackage{subfig} \usepackage{caption}

\newcommand{\quoteincaption}[1]{% build your own style!! {\medskip\hfill\parbox{0.7\linewidth}{\emph{\textquotedblleft#1\textquotedblright}}\hfill\medskip}
}

\begin{document}

\begin{figure}
    \centering
    \subfloat[Image A]{%
        \includegraphics[width=0.4\textwidth]{example-image-a}
    }
    \subfloat[Image B]{%
        \includegraphics[width=0.4\textwidth]{example-image-b}
    }
    %%  https://tex.stackexchange.com/a/101599/161015
        \caption[]{A quote follows this text:   

            \quoteincaption{\lipsum[3]}

        Insightful and important stuff about the figure.
                }
    \label{mylabel}
\end{figure}

\end{document}

Simon Dispa
  • 39,141