在定义 a newcounter
(我将其命名为“cases”)crefname
、、crefformat
和 之后crefrangeformat
,我用 增加计数器refstepcounter
并用 标记它label
。我可以用 引用单个案例,用和引用cref
多个案例;但是,当用 引用多个案例时,类型不会像其他方法那样显示。我遗漏了什么?labelcref
crefrange
cref
以下是 MWE:
\documentclass{article}
\usepackage[capitalise]{cleveref}
\begin{document}
\section{My New Section}
\newcounter{cases}
\crefname{cases}{Case Study}{Case Studies}
\crefformat{cases}{Case Study~#2#1#3}
\crefrangeformat{cases}{Case Studies~#3#1#4 through~#5#2#6}
\Cref{case:a} comes first.
Next is \cref{case:b}.
Altogether, we have \cref{case:b,case:a}. %This shows ?? instead of "Case Studies" and "and". How do I fix this?
Trying again, we have Case Studies \labelcref{case:b,case:a}.
With a range, we have \crefrange{case:a}{case:b}.
\refstepcounter{cases} \label{case:a}
\textbf{Case Study \thecases:}
Blah.
\refstepcounter{cases} \label{case:b}
\textbf{Case Study \thecases:}
Blah.
\end{document}
补充说明:我对这些案例研究使用计数器而不是定理环境,因为与典型的定理相比,这些案例相对较长,而且我不想要定理环境附带的特殊格式。
答案1
\crefname
并应进行类似的指示前 \begin{document}
理应如此\newcounter
。
\documentclass{article}
\usepackage[capitalise]{cleveref}
\newcounter{cases}
\crefname{cases}{Case Study}{Case Studies}
\crefformat{cases}{Case Study~#2#1#3}
\crefrangeformat{cases}{Case Studies~#3#1#4 through~#5#2#6}
\begin{document}
\section{My New Section}
\Cref{case:a} comes first.
Next is \cref{case:b}.
Altogether, we have \cref{case:b,case:a}.
Trying again, we have Case Studies \labelcref{case:b,case:a}.
With a range, we have \crefrange{case:a}{case:b}.
\refstepcounter{cases} \label{case:a}
\textbf{Case Study \thecases:}
Blah.
\refstepcounter{cases} \label{case:b}
\textbf{Case Study \thecases:}
Blah.
\end{document}