I'm trying to make a flowchart such as below in psmatrix environment using the pstricks package. but the problem is that I don't know how to make the node between the {3-1}(num<=100) and {5-1}(num <- num + 2). I want to have my node as below: enter image description here

But I have no idea how to make the above connection with pst-nodes or any other package! I checked out several documentations about pst-nodes but couldn't find anything. The code is:

 \usepackage{amsmath,amssymb}‎ ‎
    % ================================
    % Source: http://tug.org/pipermail/pstricks/2009/006766.html

        \advance\pst@dima by \psframesep
        \pst@dimc=\wd\pst@hbox\advance\pst@dimc by \pst@dima
        \pst@dimb=\dp\pst@hbox\advance\pst@dimb by \pst@dima
        \pst@dimd=\ht\pst@hbox\advance\pst@dimd by \pst@dima
                \pst@number\pst@dima neg
                \pst@number\pst@dimb neg
                \pst@number\pst@dimd .5

    % From the Frame and Rect PostScript macros
    /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}>


    % ================================

      \begin{psmatrix}[rowsep=0.5,colsep=0.7]% defines the distance between two frames 
        ‎\psovalbox[fillstyle=solid, fillcolor=‎yellow!30‎]‎{Start} \\
        \psframebox[shadow=true]{‎$‎Sum ‎\Leftarrow 0 ‎,‎‎ Num ‎\‎leftarrow ‎10‎‎‎$}  ‎\\‎
        \psdiabox[fillstyle=solid, fillcolor=magenta!20]{‎‎$‎Num ‎\leqslant ‎100‎ ‎‎$‎} &
        ‎‎‎\psparallelogrambox[fillstyle=solid,fillcolor=‎blue!20‎]{‎Print Sum‎} ‎\\‎‎ 
       ‎ \psframebox{‎‎‎$‎Sum ‎\l‎eftarrow ‎Num + Sum ‎‎‎$‎} ‎&‎‎‎‎‎‎‎‎‎
      ‎  \psovalbox[fillstyle=solid, fillcolor=yellow!30]{‎End}‎\\‎
         ‎\psframebox{‎‎‎$‎Num ‎\l‎eftarrow ‎Num + 2‎‎‎$‎}‎‎\\‎
      % Links
        \ncline{->}{3,2}{4,2} ‎‎
        % I‎ ‎used ‎these ‎two ‎but ‎none ‎of ‎the‎m were helpful 
         \ncdiag[angleA=-90,angleB=‎18‎0, armA=1cm,armB=1cm,‎lineAngle=-‎3‎0]{->}{5,1}{‎3,1}‎‎
        ‎%‎ \nccurve[ angleA=-90,angleB=180]{->}{5,1}{3,1}    ‎‎
 \end{psmatrix} ‎‎‎‎


But the shape which I get is: enter image description here

So which command should I use in order to get the right nodes for this flowchart?

1 Answer 1


You can use the connection ncangles In the example below I removed the defintion of \psparallelogrambom and use instead \psframebox to simplify the example.

For more information to this command have look at the documentation of pst-node.

  \begin{psmatrix}[rowsep=0.5,colsep=0.7]% defines the distance between two frames 
    \psovalbox[fillcolor=yellow!30]{Start} \\
    \psframebox[shadow=true]{$Sum \Leftarrow 0 , Num \leftarrow 10$}\\
    \psframebox[fillcolor=blue!20]{Print Sum} \\
    \psframebox{$Sum \leftarrow Num +Sum$} &
   \psframebox{$Num \leftarrow Num +2$}  \\





You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .