假设我有以下代码:
\usepackage[ruled,vlined]{algorithm2e}
\begin{dcocument}
\begin{algorithm}[H]
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
\end{dcocument}
结果:
文字在哪儿end
?
答案1
该vlined
选项禁止打印“end”。只需删除该选项,只保留ruled
:
\documentclass{article}
\usepackage[ruled]{algorithm2e}
\begin{document}
\begin{algorithm}[H]
\caption{How to write algorithms}
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\end{algorithm}
\end{document}