GeneralConverting a reference to integer

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Converting a reference to integer

Post by gmedina »

Hi,

I remember that this question (or a very similar one) was posed here some time ago, but I haven't been able to find the thread. I am using \pageref to retrieve the number of certain pages of a document and then I need to perform integer operations using those values. How can I convert the value given by \pageref to a (La)TeX integer?

The following code obviously doesn't work:

Code: Select all

\documentclass{article}
\usepackage{intcalc}

\setcounter{page}{40}

\begin{document}

\section{Test}
\label{sec:test}

\intcalcMod{\pageref{sec:test}}{3}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Converting a reference to integer

Post by nlct »

I think the refcount package has some commands that will do that.

Regards
Nicola Talbot
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: Converting a reference to integer

Post by gmedina »

Yes, it has the command that I needed. Thank you very much!
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply