I want the pages of my document to be labeled like 001,002, ... ,099,100, instead of 1,2, ... ,99,100. How do I get such a triple-digit pattern? I've already tried \ifnum\value{mycounter}<10 0\fi\arabic{mycounter} which doesn't yield what I seek.

  • Welcome! Do you also want that \pageref{<label>} yields a three digit number? – egreg Apr 13 at 14:07
  • Yes, that would be great – LaH Apr 13 at 14:25

Define a suitable counter representation that expands to three digits: add a 0 if the number is less than 100 and a further one if the number is less than 10.

\usepackage[a6paper,bottom=2cm]{geometry} % for small pictures

\newcommand{\arabicthree}[1]{\expandafter\@arabicthree\csname c@#1\endcsname}
\newcommand{\@arabicthree}[1]{\ifnum #1<100 0\fi\ifnum #1<10 0\fi\number#1}



text \pageref{first} and \pageref{second}








enter image description here

| improve this answer | |
  • @Mico Done the edit. – egreg Apr 13 at 19:15

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.