# [OS X TeX] hyperref problem with bibliograhic links

Ross Moore ross.moore at mq.edu.au
Thu Nov 22 23:00:03 CET 2012

Hello Michael and Andreas,

On 23/11/2012, at 7:29 AM, Michael Welsh wrote:

> On 23/11/2012, at 9:21 AM, Andreas Paeffgen <oegeeks at gmail.com> wrote:
>>
>> On 2012-11-22 18:05:39 +0000, Michael Welsh said:
>>
>>> texorpdfstring{\cite{SYS}}{}.
>>
>> Unfortunately that does not work like expected. If i put it inside of the chapter, the bookmarks are still flawed. If i put it outside the \chapter{}, this works, but the position of the Link is wrong. See the attached example. (PDF and tex.)
>>
>> Any further ideas, how to get the position right?

Don't know what you mean by this.

>
> You didn't attach anything. The command I just used is:
>
> \chapter{test\texorpdfstring{\cite{SYS}}{}} (replace line 70)
>
> and it works as it's supposed to.

There is still a problem in that this creates an extra back-link
from the Bibliography entry, pointing to the Table-of-Contents.
In a sense this is correct; but personally I don't think you
want this, as the TOC links should go to the chapters & sections,
not directly to bib-entries.

The other deficiency is that you need to know the citation number
to use, if you expect this to show up in the bookmark.
This is a real pain if you are continually adding extra bib-entries.

Here's a way to fix both of these.

1.  in the preamble put these definitions:

\makeatletter
\DeclareRobustCommand{\pdfcite}[1]{%
\expandafter\reducedcite\expandafter{\csname b@#1\endcsname}}
\def\reducedcite#1{%
\expandafter\ifx\expandafter\relax#1\relax\else
\expandafter\doreducedcite#1\fi}
\def\doreducedcite#1[#2]#3#4#5{{[#5]}}
\makeatother

2. include an  \addtocontents  as follows:

\tableofcontents

3. use the new command \pdfcite  as follows:

\chapter{test\texorpdfstring{\cite{SYS}}{\pdfcite{SYS}}}

or

\chapter[another test{\pdfcite{SYS}}]{another test\cite{SYS}}

The attached PDF shows how this should look, after running
LaTeX on your (modified) source file.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.pdf
Type: application/pdf
Size: 64331 bytes
Desc: not available
URL: <http://tug.org/pipermail/macostex-archives/attachments/20121123/d935ab4b/attachment.pdf>
-------------- next part --------------

> I had to comment out some package that I didn't have - hyperendnotes

same here.

>
> Michael

Hope this helps,

Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at 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
------------------------------------------------------------------------