TransWikia.com

Can I make ref{} to say where the referenced thing is (page X, just above, just below)?

TeX - LaTeX Asked on May 25, 2021

I have a text with few figures, equations and text. Sometimes I reference these figures/equations with ref{label}. I would like to help my readers know where the referenced figure/equation is in the text, so when I mention them, I use ref{label} on page pageref{label}. Is there a way to issue a command, which behaves something like the examples I give below?

If referenced object is earlier or later, on a different page:

  • mynewcommand{label} output: Figure X on page Y

If rerenced object is shown earlier, on the same page:

  • mynewcommand{label} output: Figure X, just above

If rerenced object is later earlier, on the same page:

  • mynewcommand{label} output: Figure X, just below

How could I achieve this? (Ideally, the solution wouldn’t require me to know in advance where the referenced object is going to be placed.)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP