
我正在用 Algorithm2e 編寫一個演算法。
我想做一個內聯 if 並\lIf
在同一行添加註釋\Comment*
。
\documentclass{article}
\usepackage[vlined,boxed,linesnumbered]{algorithm2e}
\DontPrintSemicolon
\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{}
\SetKwComment{Comment}{}{}
\begin{document}
\begin{algorithm}[ht]
\lIf{true}{%
foo \Comment*{bar}
}
\caption{Test}
\end{algorithm}
\end{document}
如何去除它?