-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Position tracking is broken in XeTeX #353
Comments
Migrated from SourceForge For convenience, I attach the code here: The following code does not work when compiled with XeLaTeX but produces the expected result when compiled with PDFLaTeX:
|
Migrated from SourceForge Hi Stefan
Maybe you can contact him for further elaborations? |
Migrated from SourceForge Hi, I checked the Tex.SX post but did not find anything. I can contact him directly. Thanks for the hint! Best Stefan |
Migrated from SourceForge The example given does not demonstrate the problem. Here's an example which uses
The problem appears to lie in the backend driver provided by PGF. The following code corrects the problem (from Jipí's answer at http://tex.stackexchange.com/a/339975/).
Examining the definition of this macro before it is redefined, it seems that the problem lies with its definition in
I don't understand this code at all, but according to comments on TeX SE, I gather that this is preventing positions within a node from being saved -- the position is always saved as |
Migrated from SourceForge
|
Dear all, |
Hi, there has been another report today, it still seems broken... https://tex.stackexchange.com/questions/690413/using-subnode-in-a-tikzpicture-with-xelatex |
The previous fix d0f6660 was reverted in 943a0a0 due to regression I tried the Note I don't understand the two Output comparison and full example
% !TeX TS-program = xelatex
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\makeatletter
\ifdefined\XeTeXrevision
% pgfsys-dvipdfm.def
\def\pgfsys@hboxsynced#1{%
{%
\pgfsys@begin@idscope%
\pgfsys@beginscope%
\setbox\pgf@hbox=\hbox{%
\hskip\pgf@pt@x%
\raise\pgf@pt@y\hbox{%
\pgf@pt@x=0pt%
\pgf@pt@y=0pt%
\special{pdf: content q}%
\pgflowlevelsynccm%
\pgfsys@invoke{q -1 0 0 -1 0 0 cm}%
\special{pdf: content -1 0 0 -1 0 0 cm q}% translate to original coordinate system
\pgfsys@invoke{0 J [] 0 d}% reset line cap and dash
\wd#1=0pt%
\ht#1=0pt%
\dp#1=0pt%
\box#1%
\pgfsys@invoke{n Q Q Q}%
}%
\hss%
}%
\wd\pgf@hbox=0pt%
\ht\pgf@hbox=0pt%
\dp\pgf@hbox=0pt%
\pgfsys@hbox\pgf@hbox%
\pgfsys@endscope%
\pgfsys@end@idscope%
}%
}
\fi
\makeatother
\begin{document}
% https://tex.stackexchange.com/q/690413
\begin{tikzpicture}[remember picture]
\node[draw] {A node with a \subnode{sn}{subnode}};
\end{tikzpicture}
\begin{tikzpicture}[remember picture, overlay]
\draw [red,<-] (pic cs:sn) -- ++(0pt,25pt);
\end{tikzpicture}
% https://tex.stackexchange.com/q/229500
x\pgfmark{tA}some text \pgfmark{tB} some text
\begin{tikzpicture}[remember picture]
\draw (0,0)node (A){A} rectangle (1,1)node (B){B};
\end{tikzpicture}
\begin{tikzpicture}[remember picture]
\draw (0,0)node {\pgfmark{nA}} rectangle (1,1)node {\pgfmark{nB}};
\end{tikzpicture}
\vspace{3cm}\centering
\begin{tikzpicture}[overlay,remember picture]
\draw[red,->] (0,0)--(pic cs:tA) (0,0)--(pic cs:tB);
\draw[blue,->](0,0)--(pic cs:nA) (0,0)--(pic cs:nB); %nB faulty
\draw[green,->](0,0)--(A) (0,0)--(B);
\end{tikzpicture}
% https://github.com/pgf-tikz/pgf/issues/708
\newsavebox\mybox
\sbox\mybox{\includegraphics[scale=0.5]{example-image.pdf}}
\fbox{\usebox\mybox}
%
\begin{tikzpicture}
\node{\fbox{\usebox\mybox}};
\end{tikzpicture}
\end{document} |
dvips and XeTeX use a backend that is separate from the TeX engine, so when we move the point using PDF literals, the point where the engine inserts boxes is not moved. Some hacking with regards to transformations is also required. See how l3backend does it: I'd really like to have another go at this, but currently I'm still blocked by the testsuite. |
@hmenke What you linked is the l3backend implementation for dvips backend. For dvipdfmx and xetex backend, it's simpler \cs_new_protected:Npn \__draw_backend_box_use:Nnnnn #1#2#3#4#5
{
\__kernel_backend_scope_begin:
\__kernel_backend_literal:n
{ pdf:btrans~matrix~ #2 ~ #3 ~ #4 ~ #5 ~ 0 ~ 0 }
\hbox_overlap_right:n { \box_use:N #1 }
\__kernel_backend_literal:n { pdf:etrans }
\__kernel_backend_scope_end:
} See relevant lines in From how l3draw and l3backend does it, it seems the PS:
|
Migrated from SourceForge
Author: st-mue
Timestamp: 2015-02-25 09:38:35.377000
I run into a problem with tikzmark and the professional help on the xetex mail list and on stackexchange (Ulrike Fischer) identified it as a pgf problem. Please find some description and minimal examples here:
http://tex.stackexchange.com/questions/229500/tikzmark-and-xelatex
The text was updated successfully, but these errors were encountered: