XeTeXlinks after \paragraph{...} cause heading to be a link

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
Post Reply
doonyakka
Posts: 9
Joined: Fri May 28, 2010 2:50 pm

links after \paragraph{...} cause heading to be a link

Post by doonyakka »

Hi,

I've recently converted a long document from LaTeX to XeLaTeX and nearly everything's working, but I've found that if I have citation (or anything else that hyperref turns into a link) immediately after a \paragraph{...} heading, the heading itself will be part of the link. An example will illustrate this better than I can explain it, so here it is:

Code: Select all

Code, edit and compile here:
\RequirePackage{filecontents}
\begin{filecontents}{test.bib}
@book{citation,
author = {Smith, John},
title = {{Yet Another Fake Citation}},
year = {2011},
publisher = {(nonexistent)}
}
\end{filecontents}
\documentclass{article}
\usepackage[english]{babel}
\usepackage[xetex]{hyperref}
\usepackage{url}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Linux Libertine O}%
\usepackage[round]{natbib}
\begin{document}
\label{thispage}
\paragraph{This is a link} \pageref{thispage}st page
\paragraph{This is also a link} \citet{citation}.
\paragraph{This is not a link} because this is plain text.
\bibliographystyle{plainnat}
\bibliography{test}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This doesn't happen in LaTeX. Am I doing something wrong? Any idea what's causing it, and how to fix it?

Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

links after \paragraph{...} cause heading to be a link

Post by localghost »

A very interesting phenomenon which seems to be related to some hyperref internals. I suggest to post this on comp.text.tex (ctt) since there are the experts. Feel free to report the result after you got an answer there.


Thorsten
doonyakka
Posts: 9
Joined: Fri May 28, 2010 2:50 pm

links after \paragraph{...} cause heading to be a link

Post by doonyakka »

Hi Thorsten,

I posted my question on comp.text.tex and the hyperref package Maintainer, Heiko Oberdiek, got back to me very quickly. As you suggest, it's due to a bug in hyperref. It'll be fixed in the next release but, in the meantime, Heiko suggests the following:
Workaround: Add \leavevmode (or \mbox{}) before
\pageref and \citet.

Fixed in hyperref 2011/04/17 v6.82g. Upload is on its way.
GL replied to Heiko with the following comment, which may be of help:
I would have proposed \ \unskip
because \null don't seem to have any effect. But \mbox{} is simpler !
Cheers,
Antonio
Post Reply