[Tex/LaTex] Drawing parallelogram in a flowchart with the psmatrix enviroment

pstricks

I'm trying to draw flowcharts and I looked at a few packages. As I'm more familiar with pstricks I chose it, and as I checked the examples I'm trying to draw it with the psmatrix environment.

Our teacher has told us that the "Initializations" should be written in a parallelogram, and when I tried to draw that in my flowchart I had no idea of what syntax should I use for a parallelogram!

Is there any specific command for that?

Should I use \psdiabox with a particular angle in order to get the parallelgram? If yes, how should I define the angle?

Here is an example of what I'm trying to draw where I want to have the red box – "Initialization" – as a parallelogram instead of a rectangle.

enter image description here

‎\documentclass{article}‎
‎\usepackage{pstricks}‎
‎\usepackage{pst-node}‎
‎\usepackage{pst-blur}‎
‎\definecolor{Pink}{rgb}{1.,0.75,0.8}‎
‎\pagestyle{empty}‎
‎\begin{document}‎


‎\vspace{0.5cm}‎
‎\small‎‎‎
  ‎\psset{shadowcolor=black!70,blur=true}‎
  ‎\begin{psmatrix}[rowsep=0.4,colsep=0.5]‎
    ‎\psovalbox{Begin} \\‎
    ‎\psframebox[‎,fillstyle=solid,fillcolor=red‎]{Initialisations} \\‎
    ‎\psdiabox{Special} &‎
       ‎\psframebox[shadow=true]{Call to SP1} & \psframebox[shadow=true]{Call to SP2} \\‎
    ‎\psframebox{Action 1} \\‎
    ~‎\\‎
    ‎\psframebox{Action 2} \\‎
    ‎\psovalbox{End}‎
    % ‎Links‎
    ‎\ncline{->}{1,1}{2,1}‎
    ‎\ncline{->}{2,1}{3,1}‎
    ‎\ncline{->}{3,1}{4,1}<{\textcolor{red}{No}}‎
    ‎\ncline{->}{4,1}{6,1}‎
    ‎\ncline{->}{6,1}{7,1}‎
    ‎\ncline{->}{3,1}{3,2}^{\textcolor{red}{Yes}}‎
    ‎\ncline{->}{3,2}{3,3}‎
    ‎\ncbar[angleA=-90,armB=0,nodesepB=0.25]{->}{3,3}{4,1}‎
  \end{document}

Best Answer

\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-node,pst-3d}
\usepackage{pst-blur}
\definecolor{Pink}{rgb}{1.,0.75,0.8}

\makeatletter
\newsavebox\TBox
\newcommand\psParaBox[2][]{{
  \psset{framesep=5pt,gangle=60,#1}%
  \sbox\TBox{\psTilt{\psk@gangle}{\psframebox{\phantom{ #2}}}}%
  \usebox\TBox%  
  \rput(-0.5\wd\TBox,\dimexpr 0.5\ht\TBox-0.5ex\relax){ #2}}}
\makeatother

\pagestyle{empty}
\begin{document}

  \psset{shadowcolor=black!70,blur}
  \begin{psmatrix}[rowsep=0.4,colsep=0.5]
    \psovalbox{Begin} \\
    \psParaBox[fillstyle=solid,fillcolor=red!40]{Initialisations} \\
    \psdiabox{Special} &
       \psframebox[shadow=true]{Call to SP1} & \psframebox[shadow=true]{Call to SP2} \\
    \psframebox{Action 1} \\
    ~\\
    \psframebox{Action 2} \\
    \psovalbox{End}
    % Links
    \ncline{->}{1,1}{2,1}
    \ncline{->}{2,1}{3,1}
    \ncline{->}{3,1}{4,1}<{\textcolor{red}{No}}
    \ncline{->}{4,1}{6,1}
    \ncline{->}{6,1}{7,1}
    \ncline{->}{3,1}{3,2}^{\textcolor{red}{Yes}}
    \ncline{->}{3,2}{3,3}
    \ncbar[angleA=-90,armB=0,nodesepB=0.25]{->}{3,3}{4,1}
  \end{psmatrix}
\end{document}

enter image description here

Related Question