0

I'm working on my thesis right now and have a small issue I'm not absolutely sure how to solve. Make lots of cross-references and as the thesis won't be 4 pages long I find it helps to add page-references when referencing something on another page. Previously, I've manually written something like

see Equation \ref{regression} on page \pageref{regression}

whenever I want to do this. However, as 95% of my cross-references are to different pages I have written a macro:

\newcommand{\exactref}[1]{\ref{#1} on page \pageref{#1}}

However, there are edge cases. For instance, with some floats, the referent might be on the same page at one time, but with a small, seemingly unrelated edit, it might end up at a different page. It would be awesome if my macro could handle this by checking whether reference and referent are on the same page or not and only adding the pageref if not.

Meanwhile, I'm no LaTeX macro ninja and am not sure whether this behavior would even be possible without digging down deep into TeX itself. Has anyone got any pointers for me on how to go about this?

0
2

And in just a few more minutes I find the varioref package and its vref macro. Sorry for disturbing y'all. I'll keep this here for public shaming of my weak google-fu and in case anyone else has the same issue.

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.