算法和 amsart

算法和 amsart

基本上,我已经从答案中复制了代码这个问题,因为我必须翻译一些单词。我只将documentclass改为。articleamsart

\documentclass[11pt]{amsart}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algorithmic}% http://ctan.org/pkg/algorithms
\makeatletter
\renewcommand{\ALG@name}{AlGoRiThM}
\renewcommand{\listalgorithmname}{List of \ALG@name s}
\makeatother
\begin{document}
\listofalgorithms
\begin{algorithm}
\caption{Funkcija ACO}
\label{alg:aco}  
\begin{algorithmic} 
  \STATE{do something}  
\end{algorithmic}  
\end{algorithm} 
\end{document}

现在,我收到一堆错误:

error line 5: Missing } inserted \listofalgorithms
error line 5: Extra }, or forgotten \endgroup \listofalgorithms
error line 1: Undefined control sequence ...berline {1}{\ignorespaces Funkcija ACO}}{1}
error line 1: Missing number, treated as zero ...berline {1}{\ignorespaces Funkcija ACO}}{1}
error line 1: Undefined control sequence ...berline {1}{\ignorespaces Funkcija ACO}}{1}
error line 1: Missing number, treated as zero ...berline {1}{\ignorespaces Funkcija ACO}}{1}
warning line 0:  Label(s) may have changed. Rerun to get cross-references right.

如果省略\listofalgorithms该行,则一切都可以正常工作(但是,当然,我将没有算法列表)。

答案1

您必须对具有 AMS 类的算法列表做出额外规定:

\documentclass[11pt]{amsart}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algorithmic}% http://ctan.org/pkg/algorithms

\makeatletter
\def\listofalgorithms{\@starttoc{loa}\listalgorithmname}
\def\l@algorithm{\@tocline{0}{3pt plus2pt}{0pt}{1.9em}{}}
\renewcommand{\ALG@name}{AlGoRiThM}
\renewcommand{\listalgorithmname}{List of \ALG@name s}
\makeatother

\begin{document}
\listofalgorithms
\begin{algorithm}
\caption{Funkcija ACO}
\label{alg:aco}  
\begin{algorithmic} 
  \STATE{do something}  
\end{algorithmic}  
\end{algorithm} 
\end{document}

结果:

在此处输入图片描述

相关内容