loopspace / tikzmark

The dread tikzmark arrives on github
14 stars 3 forks source link

subnode does not work well with xelatex #14

Open jiaopjie opened 2 years ago

jiaopjie commented 2 years ago

When use the command \subnode to label some texts, some problem appears. The following is the codes.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{tikzpicture}[remember picture,>=stealth]
\node{Assume \subnode{f}{$f'(x)$} exists};
\draw[->] (0,1) to (f);
\end{tikzpicture}
\end{document}

The target of f defined by \subnode will be wrong if compile with xelatex. The result looks like the picture. 20220429201249

But, when compile using pdflatex or lualatex, the problem disappears. 20220429201500

I don't know whether the problem is due to tikzmark or xelatex itself.

loopspace commented 2 years ago

My understanding of this is that it is actually an issue with the xetex driver for pgf. There is an open issue on the pgf repository for this at https://github.com/pgf-tikz/pgf/issues/353 and it was raised on TeX-SX some time ago at https://tex.stackexchange.com/q/229500/86.

Looking at the commits on the pgf repository, a fix was implemented but then reverted, so I imagine that the proposed fix had some issues elsewhere. Nevertheless, the suggestion there (which, I think, came from the TeX-SX thread) may work in specific cases so you could try it.