![帶有內嵌 if 和註解的額外行](https://rvso.com/image/472726/%E5%B8%B6%E6%9C%89%E5%85%A7%E5%B5%8C%20if%20%E5%92%8C%E8%A8%BB%E8%A7%A3%E7%9A%84%E9%A1%8D%E5%A4%96%E8%A1%8C.png)
我正在用 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}
如何去除它?