Is it possible to transform the outcome of a reference (e.g., a line number) to a regular number that I can use in a calculation?
I have this (and works fine):
\FPeval{\result}{clip(5+6)} $\result$
Now I want to do a calculation involving \lineref{myline}. However,
\FPeval{\result}{clip(5+\lineref{myline})} $\result$
doesn't work because \lineref{myline}
is not recognized as a number, I guess.
Any ideas?
Best Answer
You easiest is to use the
refcount
package which allows for expandable versions of functions to retrieve counter numbers. Here's a small example where line number is extracted from an algorithm:\getrefnumber{<label>}
retrieves the counter associated with<label>
. For calculation of page references, an analogous\getpagerefnumber
is provided.