How does one set the value of a counter to the value obtained from a \ref{} command?

I am using the xr package to access labels from another document; I want to add the value of a \ref{} to a counter in my current document.

I tried \setcounter{newcount}{\value{\ref{oldlabel}}} but that doesn't work.


This is a job for the \setcounterref command from the refcount package:




The value of \texttt{newcount} is \thenewcount


enter image description here

| improve this answer | |
  • That's perfect. I had forgotten about that package. Thanks. – GregH Jun 20 '13 at 14:11

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.