[OS X TeX] hyperref and apacite

Ross Moore ross at ics.mq.edu.au
Mon Apr 7 20:55:42 EDT 2008

Hi Salvatore,

On 07/04/2008, at 11:50 PM, Salvatore Enrico Indiogine wrote:
> Hi Ross!
> On 06/04/2008, Ross Moore <ross at ics.mq.edu.au> wrote:
>> Hi Salvatore, David, and Heiko.
>>  My suspicions seem to be correct.
>>  The simplest way to fix the problem is to put a single
>>  instance of  \protect  into  hyperref.sty ; viz.
>>  Turn this:
>>   \def\bibcite#1#2{%
>>     \@newl at bel{b}{#1\@extra at binfo}{%
>>       \hyper@@link[cite]{}{cite.#1\@extra at b@citeb}{#2}%
>>  into this:
>>   \def\bibcite#1#2{%
>>     \@newl at bel{b}{#1\@extra at binfo}{%
>>       \protect\hyper@@link[cite]{}{cite.#1\@extra at b@citeb}{#2}%
>>  This occurs at
>>    line  3972  in  hyperref.sty [2007/02/07 v6.75r
>>  and at
>>    line 4939  in  hyperref.sty [2008/04/05 v6.77l
>>    (line 8328 of the corresponding  hyperref.dtx ).
> The good news:
> 1. I have the following version of hyperref:   2008/01/09 v6.77i
> 2. The text string you wrote is only at line 4938

OK. No big deal in that.

> 3. Now the tex documents compiles without any error.  I have run
> several times latex and bibtex without any error messages.
> Now the bad news:
> 4. The references do not have the &
> 5. The citations in the text do not have the year: empty  () or  
> <author> ().
> We are getting close.

OK. We have find the correct place to edit.
However, it is quite a bit more complicated than at first sight.

It seems that the  apa.cls  class has significantly changed what
the  \bibcite  command does, without changing its syntax.


 > \bibcite=macro:
#1#2->\global \expandafter \def \csname b@#1\APAC at extra@binfo  
\endcsname {#2}\global \expandafter \def \csname Y@#1 
\APAC at extra@binfo \endcsname {\@year@ #2}.

l.7 \show\bibcite

Thus it simply stores the information into its
own global containers.

Whereas, after  hyperref  loads, the expansion of \bibcite
has changed to:

 > \bibcite=macro:
#1#2->\@newl at bel {b}{#1\@extra at binfo }{\protect \hyper@@link [cite]{} 
{cite.#1\@extra at b@citeb }{#2}}.

l.27 \show\bibcite

  ... which saves the information in a different way.

Thus later coding, which is specific to APA and expects to use the
saved global info, cannot show those bits.

It's really just a matter of executing APA's version of \bibcite
before doing the extra stuff that  hyperref  needs to create the
hyper-linking (which seems to work just fine).

For example, the following coding seems to work OK.

\let\APAbibcite\bibcite   %%%%  add this line

   pdfauthor={Salvatore Enrico Indiogine},
   pdfsubject={TAMU EDCI},
   pdfcreator={LaTeX with hyperref package},
   pdfproducer={dvips + ps2pdf},

%%%%  add the following 2 lines

This is a (relatively) simple workaround to do, but it is really
up to Heiko to provide a clean way to recover from this difficulty,
in a way that doesn't conflict with non-APA usage.

Please try this with a full document, using different
kinds of citations (\cite , \citep,  \citeauthor, etc.)
as well as  \citeauthoryear , to see that they all work

Also, you should try testing using back-references.

> Thanks,
> Enrico
> -- 
> Enrico Indiogine
> Mathematics Education
> Texas A&M University
> hindiogine at gmail.com

Hope this helps.


Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the MacOSX-TeX mailing list