This is minimal (not) working example that comes from much bigger document:

\documentclass{article}
\usepackage{hyperref}

\begin{document}

\newcommand\hreftt[2]{%
\href{#1}{\texttt{#2}}%
}
\begin{table}
\begin{tabular}{l|l|l|l|l}
Something            & aaaaaaaaaaaaaaaaa & bbbbbbbbbbbbb           & ccccccccccccc                 & dddddddddddddddddddd
\end{tabular}
\caption{This is test}
\end{table}

\end{document}


When I compile it with the command latexmk -pdf it produces correct PDF:

But when I compile with XeLaTeX, like that: latexmk -pdf -pdflatex=xelatex it produces:

Unfortunately I need to use XeLaTeX and the above example needs to produce correct PDF. How can I fix misplaced hyperlinks?

• I think this has come up before (scaling pdf links is tricky) but scaling tables should only be a last resort, is there really no alternative? – David Carlisle May 5 '17 at 20:37
• I have 5-columns table with comparison of some software. Unfortunately this table is (a little bit) too wide to fit \textwidth. On the one hand too wide table looks ugly, but on the other hand, as @Ulrike Fischer mentioned, scaling a tabular is bad typesetting. – patryk.beza May 6 '17 at 8:24
• yes but you would not justify a paragraph of text by applying arbitrary scale so having inconsistent fonts and spacing, so why do it to the text if it is in a tabular ? It should always be possible to use \small or reduce \tabcolsep or some other way of adjusting the table. – David Carlisle May 6 '17 at 8:44
• I've changed table's font to \footnotesize and it looks much better now. Thank you! – patryk.beza May 6 '17 at 8:53

Scaling a tabular is bad typesetting. It leads to uneven font sizes.

Your problem is due to a change in xetex.def which broke skaling of link areas. This problem affects a current texlive 2016, texlive 2017 pretest and a current miktex.

As a workaround until the problem is resolved you can try to revert to the older definition by adding to your document.

\makeatletter
\def\Gscale@start{%
\special{x:gsave}\special{x:scale \Gscale@x\space\Gscale@y}}
\makeatletter


You can also use tikz instead as it scales links area when xelatex is used correctly (it doesn't with pdflatex)

\documentclass{article}