[OS X TeX] \cite within \href

Alan Munn amunn at msu.edu
Fri Jan 27 18:35:55 EST 2006


At 10:56 AM +1100 1/26/06, Ross Moore wrote:
>Hi Alan,
>
>On 26/01/2006, at 10:42 AM, Alan Munn wrote:
>
>>Hi,
>>
>>I would like to include external hyperlinks to documents on a 
>>reading list generated by BiBTeX.
>>
>>I thought that the logical thing to do would be the following:
>>
>>\href{link-to-paper}{\cite{cite-key-of-paper}}
>
>Nice try ...
>
>>
>>But this doesn't seem to work.  I get a link, but it is just to the 
>>place where the bibliography is.  So hyperref seems to be ignoring 
>>the first part of the href.
>
>  ... but you actually get 2 links, at exactly the same place.
>
>Due to the order of the internal expansions and processing,
>the \href link button (technically called an 'annotation')
>is placed first. The \cite link button comes afterwards.
>But since the anchor-text is exactly the same in both cases,
>the active rectangle of the 2nd totally obscures the first.
>
>Thus you get what you described.
>It is quite correct behaviour.

Thanks for a very clear explanation of the problem. (Thanks also to 
Claus for his suggestions in a separate message.)

>
>You need to find a better way to organise your LaTeX source;
>e.g.
>
>  ... read about it in \href{link-to-paper}{Watson \cite{cite-key-of-paper}}.
>

I guess since I use the Author/Date style of referencing, natbib 
automatically inserts the author, so this exact solution won't work 
unless  I use \citeyear instead of \cite and hard code the author 
name.  But this modification will achieve the desired effect.

>(where the paper is by someone named Watson).
>
>Now the 'Watson' will be active for the external URL,
>while the citation number will take you to the Bibliography.
>
>
>Alternatively, suppose the \cite command was producing:  Watson [1]
>
>Then define the \bibitem entry so that it produces instead:
>
>      \href{link-to-paper}{Watson} [1]
>
>Now you simply use  \cite{cite-key-of-paper}  as usual in you LaTeX document,
>and you should get both links.
>Now the \href will obscure only part of the active rectangle for the \cite .

I'm not sure I understand this solution entirely, since my 
bibliographies are always automatically produced by BiBTeX and an 
appropriate .bst file that I created using custombib.  Can custom bib 
create such a style, or would I have to hack my own .bst file (not 
for the faint of heart or short of time...)

Alan
-- 
Alan Munn                                                   amunn at msu.edu
Department of Linguistics                                   amunn at acm.org
and Germanic, Slavic, Asian and African Languages   Fax.  +1-517-432-2736
Michigan State University, East Lansing MI 48824    Tel.  +1-517-355-7491
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list