
Algorithm2e 允許您定義函數,然後您可以使用eg (這將以正確的字體輸出所有漂亮的排版)\SetKwFunction{Fn}{Function}
在文件中的任何位置(而不僅僅是在環境中)引用。但是,這在字幕內不起作用。例如,以下文件:algorithm
\Fn
Function
\documentclass{article}
\usepackage{algorithm2e}
\SetKwFunction{Fn}{Function}
\begin{document}
\begin{algorithm}
\caption{\Fn, my function}
\KwRet{0}\;
\end{algorithm}
\end{document}
死於
Argument of \@caption has an extra }.
<inserted text>
\par
l.6 \caption{\Fn, my function}
有人知道發生了什麼事以及如何解決它嗎?