[pstricks] bug pstricks x positions of nodes set before and after fnode, not center of fnode
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Mon Nov 3 11:27:55 CET 2008
jean-pierre moreau schrieb:
> See below latex source for this intricate bug. I think it is a bug, but I am
> somewhat confused, I find it difficult to explain. I include below latex file
> to explain it, by trying to confine this (supposed) bug of pstricks node.
>
> The pdf output is same as the ps output (as seen by gv, of
> ghostscript, which I think
> does the ps2pdf too). It is from:
> $ latex bug-pstricks-node-positions.tex
> $ dvips -o bug-pstricks-node-positions.ps bug-pstricks-node-positions.dvi
> $ ps2pdf bug-pstricks-node-positions.ps bug-pstricks-node-positions.pdf
> on my GNU/Linux Slackware-12.1 system, with an old pstricks and a much
> recent one
yes, that looks like a bug. But I have no idea why the maxro
uses a \hbox, which causes the problem. Here is an example
which should work in the expected way:
\documentclass[12pt]{article}
\usepackage{pst-node}
\makeatletter
\def\fnode at ii(#1)#2{%
\begin at ClosedObj%
\ifnodealign%
\kern\psk at framewidth\p@%
\vrule width\z@ height \psk at frameheight\p@ depth \psk at frameheight\p@%
\def\pst at coor{0 0 }%
\else\pst@@getcoor{#1}\fi
\pst at newnode{#2}{14}{}{
\pst at coor
/Y ED /X ED
/d \psk at dimen .5 sub CLW mul neg def
/r \psk at framewidth d add def
/l r neg def
/u \psk at frameheight d add def
/d u neg def
/NodePos { \tx at GetRnodePos } def}%
\addto at pscode{
/x2 \psk at framewidth CLW \psk at dimen mul sub def
/y2 \psk at frameheight CLW \psk at dimen mul sub def
\pst at coor 2 copy
y2 sub /y1 ED x2 sub /x1 ED
y2 add /y2 ED x2 add /x2 ED
\psk at cornersize
1 index 0 eq { pop pop \tx at Rect } { \tx at OvalFrame } ifelse}%
\def\pst at linetype{2}%
\end at ClosedObj%
\ifnodealign\pst at dimb=\psk at framewidth\p@%
\kern0.5\pst at dimb\fi
\ignorespaces}
\makeatother
\begin{document}
foo
z \quad
\pnode{testL1}
\fnode[linecolor=lightgray,framesize=6pt 50pt](0,.5ex){eqL}
\pnode(0,2ex){testL2}
\quad
=
\quad%
\pnode{testR1}
\fnode[linecolor=lightgray,framesize=6pt 50pt](0,.5ex){eqR}
\pnode(0,2ex){testR2}
\quad
z
\ncline[linecolor=red]{testL1}{testR1}
\ncline[linecolor=blue]{testL2}{testR2}
bar
\bigskip now with an aligned node
\psset{nodealign=true}
foo
z \quad
\pnode{testL1}
\fnode[linecolor=lightgray,framesize=6pt 50pt](0,.5ex){eqL}
\pnode(0,2ex){testL2}
\quad
=
\quad%
\pnode{testR1}
\fnode[linecolor=lightgray,framesize=6pt 50pt](0,.5ex){eqR}
\pnode(0,2ex){testR2}
\quad
z
\ncline[linecolor=red]{testL1}{testR1}
\ncline[linecolor=blue]{testL2}{testR2}
bar
\end{document}
Herbert
More information about the PSTricks
mailing list