## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Citing pages in a subfloat

Information and discussion about graphics, figures & tables in LaTeX documents.
peterdbr
Posts: 1
Joined: Wed Jul 02, 2014 4:38 pm

### Citing pages in a subfloat

Hi all,

I want to create a figure with 3 subfigures in which the caption of each of these subfigures includes a citation with a page reference. If I try to do this via the code below, I get an error.

Apparently, the problem is caused by the citing of the pages because a reference without pages (e.g., \citet{author1}) does not return an error.

Can anyone help me how to solve this?

Thanks!

Peter

\begin{figure}\subfloat[Caption subfig1 \citet[p.~100]{author1}]{ \includegraphics{img1.pdf} \label{fig:1} } \hfill \centering \subfloat[Caption subfig2 \citet[p.~200]{author2}]{ \includegraphics{img2.pdf} \label{fig:2} } \hfill \centering \subfloat[Caption subfig3 \citet[p.~300]{author3}]{ \includegraphics{img3.pdf} \label{fig:3} } \centering \caption{General caption \label{fig}}\end{figure}

Tags:

Johannes_B
Site Moderator
Posts: 4109
Joined: Thu Nov 01, 2012 4:08 pm
Not really a solutinon for the problem at hand, but:

Instead of using package subfig, you could use package subcaption. It is actively maintained and works well with the caption package (it's the same author).

BTW: In the following example i just biblatex in conjunction with biber to handle the bibliography. You should check it out.

\documentclass{article}\usepackage{subcaption}\usepackage[style=authoryear]{biblatex}\addbibresource{biblatex-examples.bib}\begin{document}\cite[p.~200]{knuth:ct:a}\par\cite[p.~100]{westfahl:space}\par\citetitle{knuth:ct:a}\par\citeauthor{knuth:ct:a}\par\begin{figure}	\begin{subfigure}{0.3\linewidth}		\rule{3cm}{2cm}		\caption{Caption subfig1 \cite[p.~100]{westfahl:space}}		\label{fig:1}	\end{subfigure}\hfill	\begin{subfigure}{.3\linewidth}		\rule{3cm}{2cm}		\caption{Caption subfig2 \cite[p.~200]{knuth:ct:a}}		\label{fig:2}	\end{subfigure}	\caption{General caption \label{fig}}\end{figure}\end{document}

Please always post a minimal working example with your question. This is immediately compilable to supporters, meaning they can start testing and finding a solution.
I had to look up which packages to use which needs some time.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.