我尝试使用caption*
:
\documentclass{beamer}
\usepackage[lined,boxed,commentsnumbered, ruled,vlined,linesnumbered, french, onelanguage]{algorithm2e}
\usepackage{caption}
\begin{document}
\begin{frame}{Frame 1}
\begin{algorithm}[H]
$test$\;
\caption{alg}
\end{algorithm}
\begin{algorithm}[H]
$test$\;
\caption*{alg}
\end{algorithm}
\end{frame}
\end{document}
答案1
使用 \NoCaptionOfAlgo
您可以在序言中或本地使用它。\RestoreCaptionOfAlgo
将恢复正确的字幕。
\documentclass{beamer}
\usepackage[lined,boxed,commentsnumbered, ruled,vlined,linesnumbered, french, onelanguage]{algorithm2e}
\NoCaptionOfAlgo % added <<<<<<<<<<<<<<<
\begin{document}
\begin{frame}{Frame 1}
\begin{algorithm}[H]
$test$\;
\caption{alg A }
\end{algorithm}
\begin{algorithm}[H]
$test$\;
\caption{alg B}
\end{algorithm}
\RestoreCaptionOfAlgo % restore the caption
\begin{algorithm}[H]
$test$\;
\caption{alg C}
\end{algorithm}
\end{frame}
\end{document}
答案2
没有包标题,在文档 Algoritm2e p.22-23 中。
\documentclass{beamer}
\usepackage[lined,boxed,commentsnumbered, ruled,vlined,linesnumbered, french, onelanguage]{algorithm2e}
\begin{document}
\begin{frame}{Frame 1}
\SetAlgorithmName{}{}{}
\begin{algorithm}[H]
%\TitleOfAlgo{alg}
$test$\;
\caption{alg}
\end{algorithm}
\SetAlgoRefName{}
\SetAlgoCaptionSeparator{}
\begin{algorithm}[H]
$test$\;
\caption{alg}
\end{algorithm}
\end{frame}
\end{document}