LaTeX forum ⇒ Graphics, Figures & TablesCiting pages in a subfloat

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

Citing pages in a subfloat

Postby peterdbr » Wed Jul 02, 2014 4:50 pm

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?



\subfloat[Caption subfig1 \citet[p.~100]{author1}]{
} \hfill
\subfloat[Caption subfig2 \citet[p.~200]{author2}]{
} \hfill
\subfloat[Caption subfig3 \citet[p.~300]{author3}]{
\caption{General caption \label{fig}}


User avatar
Site Moderator
Posts: 4168
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Jul 03, 2014 9:48 am

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.

  1. \documentclass{article}
  2. \usepackage{subcaption}
  3. \usepackage[style=authoryear]{biblatex}
  4. \addbibresource{biblatex-examples.bib}
  5. \begin{document}
  6. \cite[p.~200]{knuth:ct:a}\par
  7. \cite[p.~100]{westfahl:space}\par
  8. \citetitle{knuth:ct:a}\par
  9. \citeauthor{knuth:ct:a}\par
  10. \begin{figure}
  11. \begin{subfigure}{0.3\linewidth}
  12. \rule{3cm}{2cm}
  13. \caption{Caption subfig1 \cite[p.~100]{westfahl:space}}
  14. \label{fig:1}
  15. \end{subfigure}\hfill
  16. \begin{subfigure}{.3\linewidth}
  17. \rule{3cm}{2cm}
  18. \caption{Caption subfig2 \cite[p.~200]{knuth:ct:a}}
  19. \label{fig:2}
  20. \end{subfigure}
  21. \caption{General caption \label{fig}}
  22. \end{figure}
  23. \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.

Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 4 guests