[pstricks] pstroicks and xelatex

Herbert Voss Herbert.Voss at fu-berlin.de
Fri Dec 21 16:16:45 CET 2018


Am 21.12.18 um 13:54 schrieb Patrice MEGRET:

> I have a small problem with pstricks and xelatex.
> 
> If I compile the example below with latex, everything works as expected.
> 
> If I use xelatex, $\Delta y$ of the \ncput inside the \rput(0,1){…} is 
> misplaced. Indeed it is shifted by 1 cm above the \ncput as the \rput 
> was doing twice its job.

Patrice,

the xdvipdfmx program is not complete compatible to dvips.
This is the case for placing objects relativ to nodes.
\pcline defines its coordinates first as internal nodes
@@A and @@B. We can use this for a new macro. Maybe that I
will write a pstricks-xetex.tex which wioll collect all such
stuff.

\documentclass{minimal}
\usepackage{pst-node}
\makeatletter
\def\NCput{\pst at object{NCput}}
\def\NCput at i#1{%
   \begingroup
   \use at par
   \pst at getcoor{@@A}\pst at tempA
   \pst at getcoor{@@B}\pst at tempB
   \if at star\def\next{\rput*}\else\def\next{\rput}\fi
   \next(!
   	  \pst at tempA /yA ED /xA ED
   	  \pst at tempB /yB ED /xB ED
   	  xA xB add 2 div
   	  yA yB add 2 div \tx at UserCoor){#1}
   \endgroup
   \ignorespaces
}
\makeatother
\begin{document}

\begin{pspicture}[showgrid](10,5)
   \pcline{<->}(1,1)(7,1)\ncput{$\Delta y$}%
   \pnode(0,1){A}
   \rput(0,1){\pcline{<->}(1,1)(7,1)\NCput*{$\Delta y$}}
\end{pspicture}

\end{document}


Herbert



More information about the PSTricks mailing list