我的 LaTeX 代码如下:
\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}
在左侧块中我需要一个 IF 语句。我该如何解决这个问题?
它看起来应该是这样的:
答案1
只需添加
\ifthenelse{1}{1}{If condition}{\sTrue}{\sFalse}
\assign{True assignment}
\change
\assign{False assignment}
\endif
并记住增加图形的整体尺寸,以便\begin{struktogramm}
它不与标题重叠。
\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}