使用算法删除“end if”行

使用算法删除“end if”行

我是 Latex 的新手,目前正在使用算法编写伪代码。我想从代码中删除所有“end if”行。我试过使用,\usepackage[noend]{algpseudocode}但没有用(见图)。请帮忙。谢谢!

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\algnewcommand\algorithmicinput{\textbf{Input:}}
\algnewcommand\algorithmicoutput{\textbf{Output:}}
\algnewcommand\Input{\item[\algorithmicinput]}%
\algnewcommand\Output{\item[\algorithmicoutput]}%
\algnewcommand{\Donnees}{\Statex \textbf{$x$}}

\begin{document}





\begin{algorithm}
\caption{The recommendation }
\begin{algorithmic}[1]
\Donnees: a scenario

\Input{$Stakeholder_x, Solutions_x, Architectures_x$}
\Output{$Issues_x, Measures_x, Attributes_x$}
\FORALL{$Solution$ in $Solutions_x$}
    \IF{$Solution$ in $Solutions_{Stakeholder_x}$}
        \IF{$Solution_{Components}$ not in $Components_x$}
            \STATE add $Solution_{Components}$ to $Components_x$
        \ENDIF
        \IF{$Issues_{Solution}$ not in $Issues_x$}
            \STATE add $Issues_{Solution}$ to $Issues_x$
        \ENDIF
        \FORALL{$Architecture$ in $Architectures_x$}
            \IF{$Architecture$ in $Solution_{Architectures}$}
                \IF{$Component_{Architecture}$ not in $Components_x$}
                    \STATE add $Component_{Architecture}$ to $Components_x$
                \IF{$Issues_{Architecture}$ not in $Issues_x$}
                    \STATE add $Issues_{Architecture}$ to $Issues_x$
                \ENDIF
                \ENDIF
            \ENDIF
        \ENDFOR
    \ENDIF
\ENDFOR

\end{algorithmic}
\end{algorithm}

在此处输入图片描述

相关内容