9

When typesetting the following sample using xelatex, the various clickable link-boxes produced using \ref, \cite, \footnote, \href, etc. are small and ugly, and sometimes make it hard to read the enclosed number or text. How can we make the link-boxes bigger, as they appear when running the same code through pdflatex?

% hyperref-xelatex.tex

\documentclass{article}
\usepackage{hyperref}

\begin{document}

\section{First section}
\label{one}

Link to section \ref{one}

This text has a footnote.\footnote{Some explanation here}

We are quoting from a book \cite{book}.

Now we want to \href{www.example.com}{link somewhere} or like this \url{www.example.com}.

\begin{thebibliography}{99}
\bibitem{book}
This book needs no title

\end{thebibliography}

\end{document}
  • Did you compared the output in different PDF viewers? – buhtz Oct 3 '16 at 7:45
3

the xdvipdfmx driver has a -g option to control the padding added to these links and other annotations, you can pass that option through from xetex by using

xelatex --output-driver='xdvipdfmx -g 1pt '

to add an extra 1pt of space.

The image shows an unchanged copy of your test file set with pdflatex, xelatex, or xelatex using the above option.

enter image description here

  • 1
    Upvoted for the font choice :-) – Phelype Oleinik Apr 30 at 21:19
  • @PhelypeOleinik a little present for egreg when he comes past. – David Carlisle Apr 30 at 21:23
  • Imho \hypersetup{pdflinkmargin=4pt} should work too (in a current tex system). – Ulrike Fischer Apr 30 at 21:37
  • @UlrikeFischer ooh obviously the current maintainers of hyperref would know such a thing... (or at least one of them:-) – David Carlisle Apr 30 at 21:39
  • Nonzero -g option breaks the nice animation controls of the animate package. Not only modifies it the size of links, but also of any PDF annotation in the document. – AlexG Apr 30 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.