I have the same problem as the link use \cref within enumerate and theorem. However, after applying the provided method in the answer box, I found there are two extra spaces before and after my item referred. Help appreciated!

\setcounter{secnumdepth}{3} %The secnumdepth value determines up to what level the sectioning titles are numbered
\setcounter{tocdepth}{1} %the tocdepth value determines to which level the sectioning commands are printed in the ToC





\begin{enumerate}[label = (\alph*)]
    \item\label{thm3.10a} If $\overline{E}$ is the closure of a set $E$ in a metric space $X$, then
        \operatorname{diam} \overline{E} = \operatorname{diam} E
    \item \label{thm3.10b}If $K_{n}$ is a sequence of compact sets in $X$ such that $K_{n} \supset K_{n+1}$ and if 
        \lim_{n\to \infty} \operatorname{diam}K_{n} = 0
    then $\bigcap_{n=1}^{\infty}K_{n}$ consists of exactly one point.

From \Crefdefpart{thm3.10}{thm3.10a}, we see two extra spaces before and after the theorem.


enter image description here

  • 1
    Welcome to TeX.SE.
    – Mico
    Nov 6, 2022 at 3:21

1 Answer 1


The culprit is the following construct:


TeX changes invisible end-of-line characters to whitespace. Because the construct contains two line breaks not terminated by a comment character, you get extra whitespace both before and after the output of the instruction.

The remedy? Insert comment characters, i.e., %, at the ends of both lines:

  • 1
    +1, but you’re stealing my job! 😎
    – egreg
    Nov 6, 2022 at 9:20

You must log in to answer this question.

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