-1
\documentclass{article}
\usepackage{hyperref}
\begin{document}
link\hyperlink{a}{\textsuperscript{1}}
\hypertarget{a}{target}
\end{document}

enter image description here

As you can see the clickable area is extremely small. I have tried adding blank spaces, phantoms, and \makebox to no avail.

5
  • What version of TeX are you using? I don't get your box with TeXlive 2022: imgur.com/a/EDSmQWg. Add \listfiles after hyperref and before \begin{document} and then copy and paste your log into the question please, the answer (if there is one that isn't upgrade) is likely dependent upon your package and TeX versions
    – JamesT
    Mar 10, 2023 at 16:54
  • @JamesT Overleaf with XeTeX. But I checked in my usual set up of MikTex with XeTeX that I am getting the same as your output. But that's besides the point, I would still like the box to be considerably larger in width, for touchscreen viewing. Mar 10, 2023 at 17:00
  • 2
    You should have mentioned xetex in the question, it is a xetex-specific issue see \XeTeXLinkBox in the hyprref manual Mar 10, 2023 at 17:27
  • @DavidCarlisle Yes, thank you that solves the issue. Mar 10, 2023 at 17:40
  • (updated the title to make it clearer that it is about XeTeX ) Mar 10, 2023 at 19:24

2 Answers 2

3

Link boxes tend to be smaller in XeLaTeX* you can use \XeTeXLinkBox to force the box wider.

You can use

\setlength{\XeTeXLinkMargin}{...}

to specify how much padding the command adds.


  • It shouldn't be that small: apparently an issue with the pdf viewer used, but xetex linkboxes are tricky, and this command can often help.
6
  • 1
    Can you reproduce the output in the question? I get a larger box with xetex and imho it would be quite odd if it doesn't encompass the 1 by default. Mar 10, 2023 at 17:46
  • @UlrikeFischer no, I expect the image in the question is misleading (why I worded the answer as I did) Mar 10, 2023 at 17:50
  • @UlrikeFischer I was able to reproduce, see imgur.com/5zoMTfS. Mar 10, 2023 at 19:30
  • 1
    @Dr.ManuelKuehner looks like a problem of the pdf viewer of overleaf. Mar 10, 2023 at 19:31
  • @UlrikeFischer That was fast :) Mar 10, 2023 at 19:32
2

As Ulrike pointed out in a comment, it seems to be a issue with the Overleaf PDF viewer.

% XeTeX
\documentclass{article}

\usepackage[linkbordercolor={0 0 1}]{hyperref}

\begin{document}

\begin{itemize}
    \item link\hyperlink{a}{\textsuperscript{1}}
    \item link\textsuperscript{\hyperlink{a}{1}} % This structure / order is more logical to me.
\end{itemize}

\end{document}

Adobe PDF Viewer

enter image description here

Overleaf PDF Viewer

enter image description here

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .