梅威瑟:
\documentclass[12pt]{article}
\usepackage{algpseudocode}
\usepackage[capitalize]{cleveref}
\begin{document}
\begin{algorithmic}[1]
\State\label{line} Hello World
\end{algorithmic}
This is a reference to \cref{line}.
\end{document}
最后一行是:This is a reference to Line 1
,但我希望它是This is a reference to line 1
。当然,我可以通过删除选项来实现这capitalize
一点,但我希望将定理和算法等内容大写。
答案1
告诉cleveref
“line”应该是小写的。
\documentclass[12pt]{article}
\usepackage{algpseudocode}
\usepackage[capitalize]{cleveref}
\crefname{line}{line}{lines}
\begin{document}
\section{Title}\label{sec}
\begin{algorithmic}[1]
\State\label{line} Hello World
\end{algorithmic}
This is a reference to \cref{line}.
We're in~\cref{sec}.
\Cref{line}
\end{document}
答案2
不要使用该capitalize
选项或采用以下解决方法:
\documentclass[12pt]{article}
\usepackage{algpseudocode}
\usepackage[capitalize]{cleveref}
\begin{document}
\begin{algorithmic}[1]
\State\label{line} Hello World
\end{algorithmic}
This is a reference to \lcnamecref{line}~\ref{line}.
\end{document}