# [texhax] [OS X TeX] Error with apacite in figure caption bug?

Alan Litchfield alan at alphabyte.co.nz
Wed Mar 26 19:41:28 CET 2008

Thanks Erik, Ross and Stefan,

\protect certainly did the trick. Something I should have remembered, but in
the heat of the moment of frustration :)

As Erik pointed out, \cite is fragile and while natbib has resolved the issue
apacite has yet to.

Cheers
Alan

Ross Moore wrote:
> Hello Alan,
>
> On 26/03/2008, at 4:29 PM, Alan Litchfield wrote:
>
>> Hi,
>>
>> Sorry for the cross postings but I am having a frustrating time
>> with a persistent error with citations in captions in figure and
>> table environments.
>>
>> The input is more or less the same in each case:...
>>
>>  \caption{Work System Lifecycle: \emph{Source, adapted from~
>> \citeauthor{Alter2002a}, \citeyearNP[p.~95]{Alter2002a}}.} \label
>> {fig:WorkSystemLifecycle}
>
> I'd try
> either (a) getting rid of the ~s
>    or   (b) putting \protect~
> and (c) putting \protect\cite....
>
> e.g.,
>   \caption{Work System Lifecycle: \emph{Source, adapted from\protect~
> \protect\citeauthor{Alter2002a}, \protect\citeyearNP[p.\protect~95]
> {Alter2002a}}.} \label{fig:WorkSystemLifecycle}
>
>>
>> ... and each returns an error as below:
>>
>> ! Illegal parameter number in definition of \reserved at a.
>>                    }
>> l.101 ... \emph{Source~\cite[p.~93]{Alter2002a}}.}
>>                                                    \label
>> {fig:WorkSystemFram...
>>
>> Any clues as to what I may be doing wrong or is this a bug?
>
> \caption  needs to write its contents into a file.
> You need to control how much is expanded.
> The \emph  macro should be robust, but I doubt that ~ is,
> and probably also not the \cite... macros.
>
>
>>
>> I am using TeXLive 2007 so if there is a newer version of apacite...
>
>    I'd doubt that a newer version would help much.
>
>

--
Alan Litchfield MBus (Hons), MNZCS
AlphaByte
PO Box 1941, Auckland
http://www.alphabyte.co.nz