Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?
share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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

share|improve this answer
add comment

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

share|improve this answer
    
I have no idea about 2. –  Harish Kumar Feb 7 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 at 12:00
    
@Daniel Oh Noooo...! ;) –  Harish Kumar Feb 7 at 13:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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