3

I used \SetKwProg{myproc}{Procedure}{}{} for starting my pseudo-code with Procedure keyword. But its end statement (the last end in pseudo-code) is not appear in the result pdf. So how can i bring it?

\documentclass[10pt,a4paper]{article}
\usepackage[algo2e]{algorithm2e}

\begin{document}

\IncMargin{1em}
\begin{algorithm2e}[H]
\SetKwFunction{proc}{BuildEBTM}%
\SetKwProg{myproc}{Procedure}{}{}
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\SetKwFunction{connect}{Connect}
\SetKwData{ce}{ce}
\myproc{\proc{}}{
    \Input{A Process $M$}
    \Output{A Process $EM$}
    \BlankLine
    \ForEach{FlowElement $e$ in $M$}{
        \ForEach{Converter $c$ in $Converters$}{
            \If{$c$ accepts $e$}{
                \ce $\leftarrow$ $c$ converts $e$\;
                \connect($EM$,\ce)\;
            }               
        }
    }
}
\caption{my procedure}
\label{my_procedure}
\end{algorithm2e}
\DecMargin{1em}

\end{document}

The result pdf without last end statement:

result pdf

4

According to the documentation on CTAN, the last argument of the \SetKwProg command sets the end text. So get that 'end', the builder for the \myproc command should be

\SetKwProg{myproc}{Procedure}{}{end}

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.