PSTricks: what do you think about using [mnode=anArbitraryCommandName]?

Denis Girou Denis.Girou at
Tue Jul 29 21:07:16 CEST 1997

This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.

>>>>> "Christophe.Broult" == Christophe Broult <broult at> writes:

    Christophe.Broult> I have some trouble to draw lines between nodes using my own node
    Christophe.Broult> formats. 

    Christophe.Broult> If I draw some lines between the nodes using a command like the one
    Christophe.Broult> I've inserted in the example above, the lines ends are inside the
    Christophe.Broult> box and not outside the enclosing box. I think it's due to the fact
    Christophe.Broult> the \psshadowbox command is enclosing the \rnodes commands and not the
    Christophe.Broult> reversed.

  Yes, in this case the content of the nodes are only the text so their width
and height is compute ignoring the special box which will be put around later.
So, node connections are not compute correctly.

  A simple solution is to change globally the nodesep parameter before the
psmatrix environment. You must compute it value adding the linewidth (0.8pt by 
default) and the framesep width (3pt by default). It's easy and work well for
simple cases, but is not very satisfaying: you must compute the value by hand,
effect is not perfect (for instance, if you use a shadowed box, there is no
more complete equality between left and right side), you can't use both two
personal node types, etc.



\newcommand{\mnode at MyNodeType}{%
\psshadowbox[linecolor=red]{\rnode at iii\Rnode at ii{\psm at thenode}}}


  [name=A] AAAA & [name=B] BBBB

  [name=A] AAAA & [name=B] BBBB

\renewcommand{\mnode at MyNodeType}{%
\psshadowbox[linecolor=cyan,framesep=1]{\rnode at iii\Rnode at ii{\psm at thenode}}}

  [name=A] AAAA & [name=B] BBBB


    Christophe.Broult> I've tried to replace
    Christophe.Broult>    \psshadowbox[linecolor=red]{\rnode at iii\Rnode at ii{\psm at thenode}}}

    Christophe.Broult> with

    Christophe.Broult>    \rnode at iii\Rnode at ii{\psshadowbox[linecolor=red]{\psm at thenode}}}

    Christophe.Broult> but without success.

  Yes, it cannot work this way. I think a generic solution can't be very
simple. I cannot guarantee that there is not an easier one, but here is what
I can propose:





% To define personal nodes for the psmatrix environment
% Denis Girou <Denis.Girou at> - Jul. 29, 1997
% #1=type of node name, #2=macro to apply to the node contents
% Ex: \MatrixNodeDefinition{MyNodeType}{\psframebox[linecolor=red]}
\expandafter\def\csname mnode@#1\endcsname{%
\rnode{NodeTemp}{#2{\rnode at iii\Rnode at ii{\psm at thenode}}}
% Redefinition of temporary name to the "official" ones
% Implicit name node (like for {1,2} which is M-1-1-2)
\SameNode{\psm at thenode}{NodeTemp}%
% Explicit name node (given by the name= parameter)
\ifx\pst at NodeName\relax\else\SameNode{\pst at NodeName}{NodeTemp}\fi}}

% Modification of \psset at name to keep the name of the node in a macro
\let\pst at NodeName\relax
\def\psset at name#1{\edef\pst at NodeName{#1}\pst at getnode{#1}\psk at name}

% To give an alias name to a previous defined one
% Denis Girou <Denis.Girou at> - May 15, 1997
% \SameNode{B}{A} define a node B equivalent to the predefined node A
% Useful to special connections for trees and special node types for psmatrix
\pst at getnode{#1}\pst at tempa
\pst at getnode@{#2}\pst at tempb
\pst at Verb{\pst at nodedict \pst at tempa \pst at tempb def end}}
% From \pst at getnode, but to return the name of node without the first /
% Definition is different for psmatrix environments and for trees
\def\pst at getnode@#1#2{%
\pst at expandafter\pst@@getnode@{#1},,\@nil#2}
\edef#4{N@\pst at zapspace#1 \@empty\space}%
\pst at cntg=#1\relax
\pst at cnth=#2\relax
% Node definition for trees
%\edef#4{N at M-\ifnum\psmatrixcnt=\z@ 1\else\the\psmatrixcnt\fi
%-\the\pst at cntg-\the\pst at cnth\space}%
% Node definition for psmatrix environments from \psmatrix at ii
\edef#4{N at M-\the\psmatrixcnt-\the\psrow-\the\pscol}%




  [name=A] \psshadowbox[framesep=0.5,linecolor=red,shadowcolor=Pink]{AAAA} &
    [name=B] \psshadowbox[framesep=0.5,linecolor=red,shadowcolor=Pink]{BBBBBBBB}


  [name=A] AAAA & [name=B] BBBBBBBB



  [name=A] A & [name=B] B                   & [name=C,mnode=MyNodeTypeB] C \\
             & [name=D,mnode=MyNodeTypeB] D & [name=E] E



To [un]subscribe to this list, send mail to pstricks-request at
Leave the subject line blank and in the body put the line
[un]subscribe <email-address>
For help, put the word "help" in the message body.
To obtain current archive, put the words "get current" in the message body.

More information about the PSTricks mailing list