2

I have two types of Theorems (Theorem A and Theorem B) and some enumeration lists below the Theorems. If would like to reference to the items as follows:

A1.1 to 1.3 and B1.1

However, using the usual command \cref{en:A1,en:A2,en:A3,en:B1} only yields

A 1.1 to 1.3 and B 1.1

Is there a way to remove the space between A and 1.1 as well as between B and 1.1?

Remark: I want to avoid an 'ugly' solution like \crefname{A}{A\hspace{-2pt}}{A\hspace{-2pt}}, since this yields different spacings in a justified text.

Here is an 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 Answer 1

2

With the help of \crefformat and \crefrangeformat you can suppress the spaces between name and number:

enter image description here

\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}
2
  • 1
    Great, your solution works perfectly fine for my MWE! I just realized that I also have to define \crefmultiformat in a similar way if I, for example, only reference to a list of two: \cref{en:A1,en:A2} (Of course, this was not in my MWE)
    – Jack
    Commented Dec 15, 2019 at 15:01
  • Shouldn't \crefformat use the ref name? Why does it need to be repeated?
    – khatchad
    Commented Feb 9, 2021 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .