
パッケージ内で両方のオプション (完全な参照名と参照名の省略形) を使用できるかどうか疑問に思っていますcleveref
。
手元のケースは、テキスト モード内の参照と数式モードの記号の上の参照の両方を含むドキュメントです(以下の例を参照)。理想的には、テキスト モードでは完全な参照名 (Theorem 0.1) を使用し、記号の上に参照を印刷するために必要なスペースなどの理由で、=
省略バージョン (Thm. 0.1 など) を使用したいと思います。$\stackrel{\text{\Cref{th:theorem1}}}{=}$
=
これを実現する方法を誰か知っていますか?
以下は最小限の動作例です。
\documentclass[a4paper,english]{scrbook}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage[nameinlink, noabbrev]{cleveref}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem*{theorem*}{Theorem}
\begin{document}
\begin{theorem}\label{th:theorem1}
If $A$ is closed, then $A$ is closed.
\end{theorem}
\begin{proof}
Left to the reader.
\end{proof}
In \Cref{th:theorem1} we have seen that ...
\begin{equation}
a + b \stackrel{\text{\Cref{th:theorem1}}}{=} 0\,.
\end{equation}
\end{document}
答え1
ヒントを提供してくれたleandriisに感謝します:cleveref -- 省略形と完全形の両方の参照を使用していますか?
この修正されたソリューションは、省略形と非省略形の両方で機能し\Cref
ます\cref
。
\usepackage[nameinlink, noabbrev]{cleveref}
\DeclareRobustCommand{\abbrevcrefs}{%
\Crefname{theorem}{Thm.}{Thms.}%
\Crefname{example}{Ex.}{Exs.}%
\crefname{equation}{eqn.}{eqns.}%
}
\DeclareRobustCommand{\Cshref}[1]{{\abbrevcrefs\Cref{#1}}}
\DeclareRobustCommand{\cshref}[1]{{\abbrevcrefs\cref{#1}}}
参考になれば幸いです。