我有两类定理(定理 A 和定理 B),以及定理下方的一些枚举列表。如果想引用以下项目:
A1.1 至 1.3 和 B1.1
然而,使用通常的命令\cref{en:A1,en:A2,en:A3,en:B1}
只会产生
A 1.1 至 1.3 和 B 1.1
有没有办法删除 A 和 1.1 之间以及 B 和 1.1 之间的空格?
备注:我想避免像这样的“丑陋”的解决方案\crefname{A}{A\hspace{-2pt}}{A\hspace{-2pt}}
,因为这会在对齐的文本中产生不同的间距。
以下是 MWE:
\documentclass[12pt]{article}
\usepackage{enumitem}
\usepackage{cleveref}
\usepackage{amsthm}
\parindent0pt
\newtheoremstyle{Theorem}{3pt}{3pt}{\itshape}{}{\bfseries}{}{.5em}{\thmname{#1}\thmnumber{#2}}
\theoremstyle{Theorem}
\newtheorem{TheoremA}{Theorem A}
\newtheorem{TheoremB}{Theorem B}
\setlist[1]{leftmargin=*, labelsep=10pt, itemsep=1pt, label=\theTheoremA.\arabic*, align=parleft}
\crefname{A}{A}{A}
\crefname{B}{B}{B}
\begin{document}
\begin{TheoremA}
This is the first Theorem A.
\end{TheoremA}
\begin{enumerate}
\item \label[A]{en:A1} This is item 1.1 of Theorem A
\item \label[A]{en:A2} This is item 1.2 of Theorem A
\item \label[A]{en:A3} This is item 1.3 of Theorem A
\end{enumerate}
\setlist[1]{leftmargin=*, labelsep=10pt, itemsep=1pt, label=\theTheoremB.\arabic*, align=parleft}
\begin{TheoremB}
This is the first Theorem B.
\end{TheoremB}
\begin{enumerate}
\item \label[B]{en:B1} This is item 1.1 of Theorem B
\item \label[B]{en:B2} This is item 1.2 of Theorem B
\item \label[B]{en:B3} This is item 1.3 of Theorem B
\end{enumerate}
Here are references to \cref{en:A1,en:A2,en:A3,en:B1}.
\end{document}
答案1
借助\crefformat
和,\crefrangeformat
您可以抑制姓名和号码之间的空格:
\documentclass[12pt]{article}
\usepackage{enumitem}
\usepackage{cleveref}
\usepackage{amsthm}
\parindent0pt
\newtheoremstyle{Theorem}{3pt}{3pt}{\itshape}{}{\bfseries}{}{.5em}{\thmname{#1}\thmnumber{#2}}
\theoremstyle{Theorem}
\newtheorem{TheoremA}{Theorem A}
\newtheorem{TheoremB}{Theorem B}
\setlist[1]{leftmargin=*, labelsep=10pt, itemsep=1pt, label=\theTheoremA.\arabic*, align=parleft}
\crefname{A}{A}{A}
\crefname{B}{B}{B}
\crefformat{A}{A#2#1#3}
\crefformat{B}{B#2#1#3}
\crefrangeformat{A}{A#3#1#4 to~#5#2#6}
\crefrangeformat{B}{B#3#1#4 to~#5#2#6}
\begin{document}
\begin{TheoremA}
This is the first Theorem A.
\end{TheoremA}
\begin{enumerate}
\item \label[A]{en:A1} This is item 1.1 of Theorem A
\item \label[A]{en:A2} This is item 1.2 of Theorem A
\item \label[A]{en:A3} This is item 1.3 of Theorem A
\end{enumerate}
\setlist[1]{leftmargin=*, labelsep=10pt, itemsep=1pt, label=\theTheoremB.\arabic*, align=parleft}
\begin{TheoremB}
This is the first Theorem B.
\end{TheoremB}
\begin{enumerate}
\item \label[B]{en:B1} This is item 1.1 of Theorem B
\item \label[B]{en:B2} This is item 1.2 of Theorem B
\item \label[B]{en:B3} This is item 1.3 of Theorem B
\end{enumerate}
Here are references to \cref{en:A1,en:A2,en:A3,en:B1}.
\end{document}