Error when using \cite with page number in short caption of table

when using the \cite command with a page number in the short caption of a table or figure along with the command \listoftables, I keep getting the following set of error messages:

./Test_Bibtex.lot:3: Argument of \blx@citeargs@i has an extra }.
<inserted text>
\par
l.3 ...{\ignorespaces Short caption (\cite [5}}{1}

Runaway argument?
5
./Test_Bibtex.lot:3: Paragraph ended before \blx@citeargs@i was complete.
<to be read again>
\par
l.3 ...{\ignorespaces Short caption (\cite [5}}{1}


Quite obviously, there seems to be problem that has to do with the parsing of the page number in the .lot file.

Here you can see a MWE where the first \caption command creates the error as it contains a page number, while the second (commented) one works alright:

\documentclass{article}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{Geertz:1973,
Address = {New York},
Author = {Geertz, Clifford},
Date-Added = {2013-08-09 17:17:10 +0000},
Date-Modified = {2013-08-09 17:18:06 +0000},
Publisher = {Basic Books},
Title = {The Interpretation of Cultures. Selected essays},
Year = {1973}}
\end{filecontents}

\usepackage[style=authoryear, useprefix=true, language=english]{biblatex}
\bibliography{\jobname}

\begin{document}
\listoftables

\begin{table}[hbtp]
\centering
\begin{tabular}{ll}
\hline
w&x\\
\hline
y&z\\
\hline\\
\end{tabular}
\caption[Short caption (\cite[5]{Geertz:1973})]{A longish caption of the table, inspired by \textcite[5]{Geertz:1973}} % creates the problem, due to the page number
%\caption[Short caption (\cite{Geertz:1973})]{A longish caption of the table, inspired by \textcite{Geertz:1973}} % works, as there is no page number
\end{table}

\end{document}


Any suggestions on how to get this to work?

Thank you in advance!

Thomas

• There is no need to protect \cite commands with biblatex: The command is robust. But you must hide the ] from the optional argument of \cite so that latex doesn't think that it ends the optional argument of \caption. Use braces around the \cite for this: {\cite[5]{Geertz:1973}} Jan 4 '15 at 13:20
• Thanks for that – \protect works, but I'll use your strategy from now on. There are lots of tables left... Jan 4 '15 at 13:27
• @UlrikeFischer -- unless this is a duplicate, an answer would be good. Jan 4 '15 at 13:35
• @UlrikeFischer - I've deleted my comment; you should write up yours as an answer. :-)
– Mico
Jan 4 '15 at 13:36
• \protect alone can't work (and does nothing). But if you used argument braces (because of Mico's "to encase") then this braces naturally will do what I suggested. Jan 4 '15 at 13:36

1 Answer

When using a command with optional arguments in the optional argument of another command one must protect the inner ] by putting {...} around the inner command so that TeX doesn't think it ends the outer argument (TeX doesn't check the nesting of such [..] braces as it would do for {..})

  \caption[Short caption ({\cite[5]{Geertz:1973}})]{A longish caption ...}


There are lots of similar questions around:

Optional argument within another optional argument in biblatex \cite

Macro with optional arguments into arguments of another macro