This question already has an answer here:

I would like to perform integer operations on a cross reference.



hello \label{here}

\ifnumequal{\pageref{here}}{1}{You are on the 1st page}{...}


I get Missing number, treated as zero, even on a second pass (when the reference is not ?? anymore).

NB: In this MWE, one could obviously use \thepage. But this is not an option in the real document.

marked as duplicate by egreg, Werner, mafp, Heiko Oberdiek, lockstep Jun 14 '13 at 15:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    Do \usepackage{refcount} and use \getpagerefnumber instead of \pageref. – egreg Jun 14 '13 at 13:58
  • egreg, a thousand thanks! I had tried without success many things, not knowing about the refcount package... (I wish I could accept your answer). – BertS Jun 14 '13 at 14:14
  • It's better to close the question as duplicate, if you agree. – egreg Jun 14 '13 at 14:19
  • Please, do so! The questions are close indeed. – BertS Jun 14 '13 at 14:26