TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider the following:



  \cs_new_eq:NN \calculate \fp_eval:n


  \rput(!#1 4 div \figurnummer mul #2 4 div \figurnummer mul){\small{$#3$}}

\def\figurnummer{#1 }
\caption{Figure number~$\figurnummer$ with area~$A_{\figurnummer} = \areal$.}






See the figures on \autopageref{appendix}--[the value of $\texttt{\textbackslash pageref\{appendix\}} + \texttt{\textbackslash sider} - 1$].

% Figurerne.


How do I create a counter with the value of

\pageref{appendix} + \sider - 1

? The point is that this value is equal to the page number on the last page.

share|improve this question
have you seen How can I add "page # of ##" on my document? – cmhughes Sep 27 '13 at 17:19
up vote 4 down vote accepted

You can use the lastpage package to get the value of the counter for the last page. There is also the pageslts package, which the documentation for lastpage encourages you to use.

With lastpage, you can refer to the value of the last page using the command

share|improve this answer
I guess it should be \getpagerefnumber{LastPage} (requires \usepackage{refcount}) if it's needed inside \calculate; otherwise a run when the reference is not set will produce loads of errors. – egreg Sep 27 '13 at 13:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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