[pstricks] Questions about pst-node

Michael Sharpe msharpe at ucsd.edu
Fri May 7 22:10:16 CEST 2010


On May 7, 2010, at 8:12 AM, Martin Chicoine wrote:

> Hi all,
> 
> I use pst-node to draw the following diagram. I have some questions:
> 
> 1) Why is the "Wide Gray Common Box 1" not well centered on the central
> arrow?
> 
> 2) Is there a way to draw the top and bottom horizontal arrows without
> having to specify the 2cm offsets?
> 
> 3) Is there a better way to draw the gray frame?
> 

Marco's answer is good but did not address all your questions, so here's some more information.

The "Wide Gray Common Box 1" doesn't center well because the node is constructed as an \Rnode, where the center is by default .7ex above the baseline. (Settable with keyword vref.) You can change this by using mnode=r so it constructs an \rnode.

The gray frame underneath can be constructed without ad hoc coordinates using the following method, which draws the underlying frame with 10pt border around the title and the first 3 boxes. This requires drawing the psmatrix twice. (You'll need the most recent version of pst-node to get \nodexn.)

\documentclass{article}
\usepackage{pst-node}
\begin{document}

\psset{arrowscale=2}
\newcommand{\cadre}[1]{\fcolorbox{black}{cyan}{\parbox{5cm}{\centering #1}}}

\pspicture(0,0)(10,10)
\def\tmp{\psmatrix[colsep=1.5cm,rowsep=1cm,mnode=r]
 \rnode[tl]{TL}{\colorbox{lightgray}{\parbox{5cm}{\centering Title}}} & \\
 \cadre{Box 1\\ (B1)} & \\
 \cadre{Box 2\\ (B2)} & 
   \rput[b]{-90}{\colorbox{lightgray}{Wide Gray Common Box 1}} \\
 \rnode[br]{BR}{\cadre{Box 3\\ (B3)}} & \\
 \cadre{Box 4\\ (B4)}  \\
\ncline{->}{2,1}{3,1}
\ncline{->}{3,1}{4,1}
\ncline{->}{4,1}{5,1}
\ncline{<-}{3,1}{3,2}
\ncline{<-}{2,1}{2,2}
\ncline{<-}{4,1}{4,2}
\endpsmatrix}
\rput[tl](1,8){\tmp}%
\nodexn{(TL)+(-10pt,10pt)}{T}%
\nodexn{(BR)+(10pt,-10pt)}{B}%
\psframe[fillstyle=solid,fillcolor=lightgray](T)(B)%
\rput[tl](1,8){\tmp}%
\endpspicture
\end{document}


Michael


More information about the PSTricks mailing list