[pstricks] Parallelogram in trees

Herbert Voss Herbert.Voss at FU-Berlin.DE
Wed May 27 16:27:23 CEST 2009

Antoine Cailliau schrieb:

> I'm trying to build a tree with parallelograms within. I do not find
> any node matching the shape and I wonder if :
> - it is possible to use custom node in trees, if so, how?
> - there is a simple way to do it

not realy simple :-)

I don't why the code isn't in pstricks-add or pstricks itself.


\def\psset at parallelogramsep#1{\pssetlength\psparallelogramsep{#1}}
\psset at parallelogramsep{3mm}
\def\psparallelogrambox{\pst at object{psparallelogrambox}}
\def\psparallelogrambox at i{\pst at makebox\psparallelogrambox at ii}
\def\psparallelogrambox at ii{%
	\pst at useboxpar
	\pst at dima=\pslinewidth
	\advance\pst at dima by \psframesep
	\pst at dimc=\wd\pst at hbox\advance\pst at dimc by \pst at dima
	\pst at dimb=\dp\pst at hbox\advance\pst at dimb by \pst at dima
	\pst at dimd=\ht\pst at hbox\advance\pst at dimd by \pst at dima
	\setbox\pst at hbox=\hbox{%
		\ifpsboxsep\kern\pst at dima\fi
		\begin at ClosedObj
		\addto at pscode{%
			\psk at cornersize
			\pst at number\pst at dima neg
			\pst at number\pst at dimb neg
			\pst at number\pst at dimc
			\pst at number\pst at dimd
			\pst at number\psparallelogramsep
			\tx at Parallelogram}%
			\def\pst at linetype{2}%
		\end at ClosedObj
		\box\pst at hbox
		\ifpsboxsep\kern\pst at dima\fi%
	\ifpsboxsep\dp\pst at hbox=\pst at dimb\ht\pst at hbox=\pst at dimd\fi
	\leavevmode\box\pst at hbox

% From the Frame and Rect PostScript macros
\pst at def{Parallelogram}<{%
/ParallelogramA {
x1 pgs sub y1 moveto
x1 y2 lineto
x2 pgs add y2 lineto
x2 y1 lineto
x1 pgs sub y1 lineto
closepath} def
/pgs ED
CLW mul
/a ED
3 -1 roll
2 copy gt { exch } if
a sub
/y2 ED
a add
/y1 ED
2 copy gt { exch } if
a sub
/x2 ED
a add
/x1 ED
1 index 0 eq {pop pop ParallelogramA } { OvalFrame } ifelse}>



  & \pspbox[1.75cm]{Achieve [BookRequestSatiefied]}\\
\pspbox[1.75cm]{\shortstack{Achieve [Copy Borrowed\\ \textbf{if}
available]} }
 & & \pspbox[1.75cm]{\shortstack{Achieve [Copy Soon
ForCheckout\\\textbf{if not} available]}}


More information about the PSTricks mailing list