ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Conditional cross references to floats
@ 2011-01-16 19:58 Robert Blackstone
  2011-01-17 15:22 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Blackstone @ 2011-01-16 19:58 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Conditional cross references to floats
  2011-01-16 19:58 Conditional cross references to floats Robert Blackstone
@ 2011-01-17 15:22 ` Wolfgang Schuster
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2011-01-17 15:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Conditional cross references to floats
@ 2011-01-18 10:15 Robert Blackstone
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Blackstone @ 2011-01-18 10:15 UTC (permalink / raw)
  To: ntg-context

On  Mon, 17 Jan 2011 16:22:03 +0100  Wolfgang Schuster wrote:

> Am 16.01.2011 um 20:58 schrieb Robert Blackstone:
>
>> Hi all,
>>
>> I wonder if it is already possible to perform the following task:
>>
>>.... 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:
>
> .....
>Wolfgang

Thank you, Wolfgang.
The code you gave, while not a fool-proof tool, works quite well. I
expect I will be able to use it when figures will not be pushed away
too far from their intended place in the text. I have changed "above"
and "below" to "the previous page" and "the next page" respectively
but that is a detail. It will still require careful proofreading
anyway.

Kind regards,
Robert Blackstone
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-18 10:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-16 19:58 Conditional cross references to floats Robert Blackstone
2011-01-17 15:22 ` Wolfgang Schuster
2011-01-18 10:15 Robert Blackstone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).