I want to define a macro for referencing equations in an article. I want the equation to be referenced as: " Eq. (3) " So I defined a command "\eref{}" as:


But I also have instances where I want to refer to multiple equations like: "Eq. (3,4,5)" and when I try to use:


I simply find " Eq. ?? " in the pdf.

Can anyone kindly help me declare a macro which can take as input a list and simply call another function with that list (like how \ref{} command of latex does). I tried to replace "#1" in the definition by "##", it didn't work.

I wish to have similar macros for referring to Lemmas, Theorems, etc, which too have similar problems.

  • 5
    I suggest you to look at the cleveref package.
    – egreg
    Oct 3, 2013 at 15:51
  • 2
    I think you might look into the cleveref package, which does all of this already
    – cmhughes
    Oct 3, 2013 at 15:51
  • Aside: I suppose you are using LaTeX - then don't use \def; use \newcommand et.al. Oct 4, 2013 at 11:14

1 Answer 1


If you have three consecutive equations labeled, say, eq:1, eq:2, and eq:3 and need to cross-reference them jointly, you could do so with the help of the cleveref package and its \cref command:


cleveref is clever enough (pun intended) to sort and, if necessary, compress the numbers associated with the equations, generating the typeset output "eqs. (1) to (3)". If you don't want to see the word "equations" abbreviated to "eqs.", load the cleveref package with the noabbrev option.

The only real restriction if using the cleveref package is that you mustn't use a comma (,) as part of a label's name since -- as you can tell from the example above -- commas are used to separate labels from one another.

For much more on the topic of cross-referencing, including various aspects of the cleveref package, see the posting Cross-reference packages: which to use, which conflict? and the associated answers.

  • Does cleveref package have any conflicts with hyperref, because i used \cref{label1,lebel2} and it simply gives: " ???? " in the pdf. Oct 4, 2013 at 7:02
  • 1
    @PavithranIyer - The cleveref package must be loaded after hyperref. Also, be sure to compile the document twice to let LaTeX update and resolve all cross-references.
    – Mico
    Oct 4, 2013 at 7:33
  • Thanks. The \cref command for referencing one equation fits with the format I needed. However for multiple labels, it seems to place a "and" in between the references. Moreover, when I try to extend \cref to Lemma and Theorem environments as: \crefformat{lemma}{Lemma.~(#2{}#1{}#3)}. I loose the parenthesis around the equation number in the reference (pdf) when I call \cref with multiple labels. Oct 4, 2013 at 8:34
  • @PavithranIyer - The connector "and" will be used if there are two items of a type being cross-referenced. Please consider posting a new question and providing an explicit MWE (minimum working example) to ask for advice on how to format cref-type cross-references to additional objects (such as theorems and lemmas).
    – Mico
    Oct 4, 2013 at 9:52

You must log in to answer this question.

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