2

My LaTeX code is as follows:

\documentclass[fontsize=12pt,english]{scrbook} 
\usepackage[pict2e]{struktex} 
\usepackage{babel} 

\begin{document} 

\begin{figure}[htb] 
  \centering 
  \begin{struktogramm}(160,92) 
    \descriptionwidth=80pt 
    \assign {Algorithm: description etc.} 
    \assign 
    { 
      \begin{declaration}[Parameters:] 
        \description{\pVar{some paras}} {\pKey{character}-parameter} 
      \end{declaration} 
    } 
    \assign 
    { init:\\ 
      some initialization
    } 

    \ifthenelse[15]{3}{1}{if a something b}{\sTrue}{\sFalse} 

    \case{6}{4}{a\texttt{:=value}}{$a\cdot 1e+03$} 
    \assign[17]{\texttt{korpar} = zero} 
    \switch{$a\cdot 1e+02$} 
    \assign[17]{\texttt{korpar} = one} 
    \switch{$a\cdot 1e+01$} 
    \assign[17]{\texttt{korpar} = two} 
    \switch{$a$} 
    \assign[17]{\texttt{korpar} =three} 
    \caseend 

    \assign[14]{I need here one if statement more !!!!!}

    \change 
    \assign{stop} 
    \ifend 

  \end{struktogramm} 
  \caption{some text} 
\end{figure} 

\end{document}

In the left block I need one more IF-statement. How can I manage this problem?

It should look something like that:

goal

  • What should this elusive if statement contain/express? – Mico Feb 14 '17 at 15:44
  • @Mico something like that: [link] (ibb.co/dqwZ6F) – ingenium Feb 14 '17 at 15:52
4

Just add it with

\ifthenelse{1}{1}{If condition}{\sTrue}{\sFalse}
\assign{True assignment}
\change
\assign{False assignment}
\endif

and remember to increase the overall size of the figure in the \begin{struktogramm} so that it does not overlap the caption.

Sample

\documentclass[fontsize=12pt,english]{scrbook}

\usepackage[pict2e]{struktex}

\usepackage{babel}

\begin{document}

\begin{figure}[htb]
  \centering
  \begin{struktogramm}(160,100)
    \descriptionwidth=80pt
    \assign {Algorithm: description etc.}
    \assign
    {
    \begin{declaration}[Parameters:]
      \description{\pVar{some paras}} {\pKey{character}-parameter}
    \end{declaration}
    }
    \assign
    { init:\\
    some initialization
    }

    \ifthenelse[15]{3}{1}{if a something b}{\sTrue}{\sFalse}

    \case{6}{4}{a\texttt{:=value}}{$a\cdot 1e+03$}
    \assign[17]{\texttt{korpar} = zero}
    \switch{$a\cdot 1e+02$}
    \assign[17]{\texttt{korpar} = one}
    \switch{$a\cdot 1e+01$}
    \assign[17]{\texttt{korpar} = two}
    \switch{$a$}
    \assign[17]{\texttt{korpar} =three}

    \caseend

    \ifthenelse[14]{1}{1}{if par 1 \( > \) par 2}{\sTrue}{\sFalse}
    \assign{par 1 * \texttt{korpar}}
    \change
    \assign{par 2 * \texttt{korpar}}
    \ifend

    \change
    \assign{stop}
    \ifend
  \end{struktogramm}
  \caption{some text}
\end{figure}

\end{document}

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.