Conditional cross references to floats
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 https://foundry.supelec.fr/projects/contextrev/ was not found on this server.) If it is no longer in use wouldn't it perhaps be better not to mention it anymore at the bottom of each ntg-context Digest? Thanks in advance. Robert Blackstone
Am 16.01.2011 um 20:58 schrieb Robert Blackstone:
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?
ConTeXt has a \atpage and a \somewhere command but none of them can be used to omit the reference when the float and the reference are on the same page but it’s not impossible. As you can see from this example: \starttext 1. \doifreferencefoundelse{test}{\analyzecurrentreference\ifcase\referencepagestate\relax\or this page\or above\or below\fi}{} \page 2. \doifreferencefoundelse{test}{\analyzecurrentreference\ifcase\referencepagestate\relax\or this page\or above\or below\fi}{} \placefigure[force][test]{First}{\framed{One}} 3. \doifreferencefoundelse{test}{\analyzecurrentreference\ifcase\referencepagestate\relax\or this page\or above\or below\fi}{} \page 4. \doifreferencefoundelse{test}{\analyzecurrentreference\ifcase\referencepagestate\relax\or this page\or above\or below\fi}{} \stoptext one can set conditional texts but these are internal macros (which can change) and meant for users. Wolfgang
participants (2)
-
Robert Blackstone
-
Wolfgang Schuster