我正在使用 algorithm2e 排版算法。我喜欢下面的外观,但我无法关闭end
`
开始
`. 有什么办法吗?
\documentclass{article}
\usepackage[longend,ruled,vlined]{algorithm2e}
\begin{document}
\begin{algorithm}
\caption{PHORIZONTAL Algorithm}\label{alg:phorizontal}
\KwIn{$R$: relation; $Pr$: set of simple predicates}
\KwOut{$F_{R}$: set of horizontal fragments of $R$}
\Begin{
$Pr' \leftarrow $COM\_MIN($R, Pr$) \;
determine the set $M$ of minterm predicates \;
determine the set $I$ of implications among $p_i \in Pr'$ \;
\ForEach{$m_{i} \in M$}{
\If{ $m_{i}$ is contradictory according to $I$}{$M \leftarrow M - m_{i}$}
}
$F_{R} = \{R_{i} | \sigma_{m_{i}} R, m_{i} \in M\}, \forall m_{i} \in M$ \;
}
\end{algorithm}
\end{document}
答案1
参考@egreg 的回答结束词隐藏在算法块中,该vlined
选项会抑制“end”的打印。只需删除该选项:
\documentclass{article}
\usepackage[longend,ruled]{algorithm2e}
\begin{document}
\begin{algorithm}
\caption{PHORIZONTAL Algorithm}\label{alg:phorizontal}
\KwIn{$R$: relation; $Pr$: set of simple predicates}
\KwOut{$F_{R}$: set of horizontal fragments of $R$}
\Begin{
$Pr' \leftarrow $COM\_MIN($R, Pr$) \;
determine the set $M$ of minterm predicates \;
determine the set $I$ of implications among $p_i \in Pr'$ \;
\ForEach{$m_{i} \in M$}{
\If{ $m_{i}$ is contradictory according to $I$}{$M \leftarrow M - m_{i}$}
}
$F_{R} = \{R_{i} | \sigma_{m_{i}} R, m_{i} \in M\}, \forall m_{i} \in M$ \;
}
\end{algorithm}
\end{document}