# [NTG-context] Conditional cross references to floats

Robert Blackstone blackstone.robert at gmail.com
Sun Jan 16 20:58:27 CET 2011

Hi all,

I wonder if it is already possible to perform the following task:

I have to typeset documents that contain many pictures of various
sizes. Due to lack of space, some may pictures may not appear on the
page on which they are discussed. And also in the course of revising
the document, adding text may push them to another page.  Therefore I
always refer to every picture with \in and \at. On the other hand,
changing or deleting text may unexpectedly land them on the correct
page.

So sometimes it may happen that the reader, for instance on page 23,
will be referred to a figure on page 23, which looks rather silly.

Is there a trick to let ConTeXt automatically omit the reference when
the picture happens to appear on the correct page (or change the
reference to « on this page »). In other words, can one make a sort of
conditional reference that only mentions the page if it is not the
present page?

Would this perhaps be something that can be coded in Lua?

(I saw a similar question on this list in june 2010, and the
provisional solution that was suggested, but apparently did not work.)

Incidentally, the address for the archive seems not to be correct (and
untrusted).  (Message: The requested URL