# [NTG-context] References to floats

Mon May 7 22:25:37 CEST 2012

Am 07.05.2012 um 15:03 schrieb Robert Blackstone:

> On Mon, May 7, 2012 at 12:00 PM,   Hans Hagen <pragma at wxs.nl>
> wrote
>>
>> On 6-5-2012 23:18, Robert Blackstone wrote:
>
>>> Sometimes however the example is placed at the same page as the text discussing it.
>>> Is there any trick to adapt the reference to this situation, so that, instead of saying, for instance, "ex. 3.4 on page 12", it just says "ex. 3.4", or "ex. 3.4 below" or even "ex. 3.4 on this page"?
>>>
>
>>
>> you can try \atpage[ref]
>>
>
> Thank you, Hans, for your quick reply. Unfortunately it does not help me.
> The result is basically the same as when I write "on \at{page}[ref]",
> except that, instead of "on page 20", I get "at page 20", (with the
> float sitting on page 20).
> Frankly, I'm rather surprised that this wish of mine seems not to have
> come up before.

The mechanism to check if float and reference are on the same page is available
as Hans has shown with \atpage but there are to many ways to format the output.

The best way is to define your own command for this.

\starttext

<\somewhere{above}{below}[fig:test]>

\page

<\somewhere{above}{below}[fig:test]>

\placefigure[][fig:test]{Test}{\framed{test}}

\page

<\somewhere{above}{below}[fig:test]>

\stoptext

Wolfgang