![如何在演算法 2e 標題中使用演算法 2e 函數巨集?](https://rvso.com/image/327806/%E5%A6%82%E4%BD%95%E5%9C%A8%E6%BC%94%E7%AE%97%E6%B3%95%202e%20%E6%A8%99%E9%A1%8C%E4%B8%AD%E4%BD%BF%E7%94%A8%E6%BC%94%E7%AE%97%E6%B3%95%202e%20%E5%87%BD%E6%95%B8%E5%B7%A8%E9%9B%86%EF%BC%9F.png)
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}
有人知道發生了什麼事以及如何解決它嗎?