2

I want to cross reference multiple equations at a single place and I found that cleveref package is what I need. But I find that cleveref can not work properly: it only print the first equation ref correctly.

The MWE is as follows:

\documentclass{article}
\usepackage{cleveref}

\begin{document}

 \begin{equation}\label{eq1}
   a = b+c
 \end{equation}
 \begin{equation}\label{eq2}
   e = mc^2
 \end{equation}

 \begin{equation}\label{eq3}
    r = d +e
 \end{equation}

 \begin{equation}\label{eq4}
   f = j + m
 \end{equation}

 \begin{equation}\label{eq5}
    s = p +b
 \end{equation}

   See~\cref{eq1, eq2, eq3, eq4, eq5} for more information.
 \end{document} 

The above code produces something like this: enter image description here

Only one equaiton reference is printed correctly. What is problem?

2

Cleveref is sensitive to the space in the label and as a result, you cannot have spaces after the comma. It is trying to find the reference ' eq2' as opposed to 'eq2' (the ' are there to make the space salient).

Here's the fixed version:

\documentclass{article}
\usepackage{cleveref}

\begin{document}
\begin{equation}\label{eq1}
  a = b+c
\end{equation}
\begin{equation}\label{eq2}
  e = mc^2
\end{equation}
\begin{equation}\label{eq3}
  r = d +e
\end{equation}
\begin{equation}\label{eq4}
  f = j + m
\end{equation}
\begin{equation}\label{eq5}
  s = p +b
\end{equation}

See \cref{eq1,eq2,eq3,eq4,eq5} for more information.
\end{document}

output

  • Yes, the space after the comma is the problem. But it just makes no sense why space after comma is not allowed. – jdhao Nov 10 '16 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.