3

I'm currently using struktex for generating structograms (Nassi–Shneiderman diagram).

My source code looks as follows:

\begin{struktogramm}(150,45)
\assign{Do something}
\ifthenelse{5}{5} {Make a decision?}{Yes}{No}
    \ifthenelse{3}{3} {Make a decision?}{Yes}{No}
        \assign{Do something}
        \change
        \assign{Do something}
    \ifend
    \change
    \assign{Do something}
\ifend
\end{struktogramm}

which results in this simple diagram:

enter image description here

Actually I'm missing two things:

  1. Is it possible to center the contents (i.e. "Do something") within each cell?
  2. How can I avoid the empty set symbol by spanning the cell "Do something" over two rows?
2

Originally, I took Harish's answer a step further to solve #2: Add a \rule. Manual tweaking is required to guess the height of the rule. But in my edit, I realized I could also achieve the centering with symmetric \hfills about the entry.

\documentclass{article}
\usepackage{struktex}
%\usepackage{etoolbox}
%\patchcmd{\sub}{}{}{}{}
\begin{document}
  \begin{struktogramm}(150,45)
\assign{\mbox{}\hfil Do something}
\ifthenelse{5}{5} {Make a decision?}{Yes}{No}
    \ifthenelse{3}{3} {Make a decision?}{Yes}{No}
        \assign{\hfill Do something\hfill}
        \change
        \assign{\hfill Do something\hfill}
    \ifend
    \change
    \assign{\hfill Do something\rule[-4.7ex]{0ex}{10.3ex}\hfill}
\ifend
\end{struktogramm}
\end{document}

enter image description here

2

Easiest (may be ugliest) is to use

\mbox{}\hfil Do something

You can also use \null instead of \mbox{}.

\documentclass{article}
\usepackage{struktex}
%\usepackage{etoolbox}
%\patchcmd{\sub}{}{}{}{}
\begin{document}
  \begin{struktogramm}(150,45)
\assign{\mbox{}\hfil Do something}
\ifthenelse{5}{5} {Make a decision?}{Yes}{No}
    \ifthenelse{3}{3} {Make a decision?}{Yes}{No}
        \assign{\mbox{}\hfil Do something}
        \change
        \assign{\mbox{}\hfil Do something}
    \ifend
    \change
    \assign{\mbox{}\hfil Do something}
\ifend
\end{struktogramm}
\end{document}

enter image description here

  • I have no idea about 2. – user11232 Feb 7 '14 at 10:40
  • Big thanks for your solution @Harish Kumar. I've decided to mark Stevens answer as correct because of his lower reputation. My mistake to ask two questions at once :-) – Daniel Feb 7 '14 at 12:00
  • @Daniel Oh Noooo...! ;) – user11232 Feb 7 '14 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.