我有以下 MWE
\documentclass[runningheads]{llncs}
\usepackage{algorithm}
\usepackage{algorithmic}
\begin{document}
\begin{algorithm}[H]
\caption{BLAH}
\begin{algorithmic}[1]
\REQUIRE $Input$
\ENSURE $A$.
\STATE Set $A$
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[H]
\renewcommand{\thealgorithm}{}
\floatname{algorithm}{Not an algorithm but want the layout}
\caption{BLEH}
\begin{algorithmic}[1]
\REQUIRE $Input$
\STATE Compute $B$
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[H]
\caption{BLAH}
\begin{algorithmic}[1]
\REQUIRE $Input$
\STATE Compute $B$
\end{algorithmic}
\end{algorithm}
\end{document}
从而产生了这个第三个实体的标题是算法 3,但我希望它被命名为算法 2。我该如何实现这一点?
编辑我不想使用任何其他算法环境。
答案1
走下柜台:
\documentclass{article}
\usepackage{algorithm}
\usepackage{algorithmic}
\newcommand{\altcaption}[1]{%
\addtocounter{algorithm}{-1}%
\renewcommand\thealgorithm{\unskip}%
\floatname{algorithm}{#1}%
\caption
}
\begin{document}
\begin{algorithm}[H]
\caption{BLAH}
\begin{algorithmic}[1]
\REQUIRE $Input$
\ENSURE $A$.
\STATE Set $A$
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[H]
\altcaption{Not an algorithm but want the layout}{BLEH}
\begin{algorithmic}[1]
\REQUIRE $Input$
\STATE Compute $B$
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[H]
\caption{BLAH}
\begin{algorithmic}[1]
\REQUIRE $Input$
\STATE Compute $B$
\end{algorithmic}
\end{algorithm}
\end{document}