为了与当前文档中对定理的引用保持一致,我希望插入 cleveref 定理格式,而不是theorem
在引用中进行硬编码,例如\cite[theorem xyz]{reference}
。我想这需要检索 的(可能是默认值)\crefname
。这可能吗?
答案1
看起来名称存储在\cref@<type>@name
etc中。
\documentclass{article}
\usepackage{cleveref}
\makeatletter
\newcommand{\theoname}{\cref@theorem@name}
\newcommand{\Theoname}{\Cref@theorem@name}
\newcommand{\theonames}{\cref@theorem@name@plural}
\newcommand{\Theonames}{\Cref@theorem@name@plural}
\makeatother
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{knuth,
author = {Knuth, Donald E.},
title = {The {\TeX} book},
date = 1984,
maintitle = {Computers \& Typesetting},
volume = {A},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
langid = {english},
langidopts = {variant=american},
sortyear = {1984-1},
sorttitle = {Computers & Typesetting A},
indexsorttitle= {The TeXbook},
indextitle = {\protect\TeX book, The},
shorttitle = {\TeX book}
}
\end{filecontents*}
\begin{document}
\makeatletter
\cref@theorem@name
\Cref@theorem@name
\cref@theorem@name@plural
\Cref@theorem@name@plural
\makeatother
\cite[\theoname{} xyz]{knuth}
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}