用于引用算法行号的 autoref 命令是什么?我尝试定义stepautorefname
、linenoautorefname
和alglinenoautorefname
命令,如下所示,但它们不像algorithmautorefname
命令那样工作。
\documentclass{article}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage[hidelinks,
colorlinks = true,
linkcolor = blue,
urlcolor = blue,
citecolor = blue,
anchorcolor = blue]{hyperref}
\newcommand{\algorithmautorefname}{Algorithm}
\newcommand{\stepautorefname}{Step}
\newcommand{\linenoautorefname}{Line}
\newcommand{\alglinenoautorefname}{ALine}
\begin{document}
\begin{algorithm}
\caption{Algorithm} \label{alg:A}
\begin{algorithmic}
\REQUIRE $Input$
\STATE A
\STATE B
\STATE C
\STATE D \label{step:A4}
\end{algorithmic}
\end{algorithm}
In \autoref{step:A4} of \autoref{alg:A}
\end{document}