ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Leave out reference to page if on the same page?
@ 2014-07-23 15:46 Gerben Wierda
  2014-07-23 18:01 ` Otared Kavian
  0 siblings, 1 reply; 22+ messages in thread
From: Gerben Wierda @ 2014-07-23 15:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 307 bytes --]

Suppose I have this fragment:

is shown in \in{figure}[foo] on \at{page}[foo].
\placefigure
	[]
	[foo]

I would like to leave the fragment “on \at{page}[foo]” out of the text if the figure ends up on the same page as the \at. Is that doable or is this a matter of manual tweaking at the end?

G


[-- Attachment #1.2: Type: text/html, Size: 1040 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-23 15:46 Leave out reference to page if on the same page? Gerben Wierda
@ 2014-07-23 18:01 ` Otared Kavian
  2014-07-24  0:34   ` Rik
  0 siblings, 1 reply; 22+ messages in thread
From: Otared Kavian @ 2014-07-23 18:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3106 bytes --]

Hi, 

In my ConTeXt archives I found the following example from a discussion on the mailing list: Wolfgang S. gave an answer which may help you:
Best regards: OK

%%%%%% begin test-ref.tex

%
%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
%%%% end test-ref.tex

On 23 Jul 2014, at 17:46, Gerben Wierda <gerben.wierda@rna.nl> wrote:

> Suppose I have this fragment:
> 
> is shown in \in{figure}[foo] on \at{page}[foo].
> \placefigure
> 	[]
> 	[foo]
> 
> I would like to leave the fragment “on \at{page}[foo]” out of the text if the figure ends up on the same page as the \at. Is that doable or is this a matter of manual tweaking at the end?
> 
> G
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 5061 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-23 18:01 ` Otared Kavian
@ 2014-07-24  0:34   ` Rik
  2014-07-24 11:20     ` Otared Kavian
  0 siblings, 1 reply; 22+ messages in thread
From: Rik @ 2014-07-24  0:34 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1693 bytes --]

On 2014-07-23 14:01, Otared Kavian wrote:
> In my ConTeXt archives I found the following example from a discussion 
> on the mailing list: Wolfgang S. gave an answer which may help you:
> Best regards: OK

...some text elided...

> one can set conditional texts but these are internal macros
> (which can change) and meant for users.
>
> Wolfgang
> %%%% end test-ref.tex
>

I suspect that Wolfgang meant to warn:

    ... internal macros (which can change) and /are not/ meant for users

because that certainly appears to be the case. More specifically, the 
example (from 2011) fails, complaining about an undefined control 
sequence with \analyzecurrentreference.

As others pointed out in related discussions, there is another serious 
shortcoming with this. References should be relative to the current page 
spread, which on doublesided layouts includes two pages, verso and 
recto. A reference to something on either of these pages is 
traditionally considered to be current, and above and below refer to 
previous and subsequent page spreads.

There is a module, smartref, by Marco Patzer, that may address the needs 
of the original poster. It has some limitations, but generally addresses 
the issue quite well. See the list message at 
http://www.mail-archive.com/ntg-context%40ntg.nl/msg71889.html for more 
on smartref.

(The primary limitation in my use is that it assumes that a following 
argument, as in \smartref{preceding}{following}[label], should follow 
the /at page number/ text, thus disabling the use of the following text 
to provide a subfigure label. Thus, one ends up with "see figure 6.4 at 
page 73a" instead of "see figure 6.4a at page 73".)

-- 
Rik Kabel






[-- Attachment #1.2: Type: text/html, Size: 2924 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-24  0:34   ` Rik
@ 2014-07-24 11:20     ` Otared Kavian
  2014-07-24 11:26       ` luigi scarso
                         ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Otared Kavian @ 2014-07-24 11:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2758 bytes --]

Hi Rik,

As a matter of fact the example given by Wolfgang works despite mkiv complaining about
	\analyzecurrentreference
being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting.
I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.

Maybe Marco has a solution for his module?

Best regards: OK


On 24 Jul 2014, at 02:34, Rik <rik@panix.com> wrote:

> On 2014-07-23 14:01, Otared Kavian wrote:
>> In my ConTeXt archives I found the following example from a discussion on the mailing list: Wolfgang S. gave an answer which may help you:
>> Best regards: OK
> 
> ...some text elided...
> 
>> one can set conditional texts but these are internal macros
>> (which can change) and meant for users.
>> 
>> Wolfgang
>> %%%% end test-ref.tex
>> 
> 
> I suspect that Wolfgang meant to warn:
> ... internal macros (which can change) and are not meant for users
> because that certainly appears to be the case. More specifically, the example (from 2011) fails, complaining about an undefined control sequence with \analyzecurrentreference.
> 
> As others pointed out in related discussions, there is another serious shortcoming with this. References should be relative to the current page spread, which on doublesided layouts includes two pages, verso and recto. A reference to something on either of these pages is traditionally considered to be current, and above and below refer to previous and subsequent page spreads.
> 
> There is a module, smartref, by Marco Patzer, that may address the needs of the original poster. It has some limitations, but generally addresses the issue quite well. See the list message at http://www.mail-archive.com/ntg-context%40ntg.nl/msg71889.html for more on smartref.
> 
> (The primary limitation in my use is that it assumes that a following argument, as in \smartref{preceding}{following}[label], should follow the at page number text, thus disabling the use of the following text to provide a subfigure label. Thus, one ends up with "see figure 6.4 at page 73a" instead of "see figure 6.4a at page 73".)
> 
> -- 
> Rik Kabel
> 
> 
> 
> 
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 4761 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-24 11:20     ` Otared Kavian
@ 2014-07-24 11:26       ` luigi scarso
  2014-07-24 11:38         ` Wolfgang Schuster
  2014-07-24 11:34       ` Wolfgang Schuster
  2014-07-24 13:36       ` Rik Kabel
  2 siblings, 1 reply; 22+ messages in thread
From: luigi scarso @ 2014-07-24 11:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1007 bytes --]

On Thu, Jul 24, 2014 at 1:20 PM, Otared Kavian <otared@gmail.com> wrote:

> Hi Rik,
>
> As a matter of fact the example given by Wolfgang works despite mkiv
> complaining about
> \analyzecurrentreference
> being unknown… Whent the typesetting stops because of this command, saying
> « run » or rather « r » continues the typesetting.
> I didn’t send the example module of Marco Patzer since it doesn’t seem to
> work anymore with recent versions of mkiv.
>
> Maybe Marco has a solution for his module?
>


also this one should work
\starttext
is shown in \in{figure}[FOO]%
\doifreferencefoundelse{FOO}{\ifnum\realfolio=\currentreferencepage\else\at{page}[FOO]\fi}{}%
\placefigure[none][FOO]{FOO}{\externalfigure[cow.pdf][width=1cm]}

\page

is shown in \in{figure}[FOO1]%
\doifreferencefoundelse{FOO1}{\ifnum\realfolio=\currentreferencepage\else\at{page}[FOO1]\fi}{}\page%
\placefigure[none][FOO1]{FOO1}{\externalfigure[cow.pdf][width=1cm]}

\stoptext


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 1969 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-24 11:20     ` Otared Kavian
  2014-07-24 11:26       ` luigi scarso
@ 2014-07-24 11:34       ` Wolfgang Schuster
  2014-07-24 12:03         ` Otared Kavian
  2014-07-24 13:36       ` Rik Kabel
  2 siblings, 1 reply; 22+ messages in thread
From: Wolfgang Schuster @ 2014-07-24 11:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 24.07.2014 um 13:20 schrieb Otared Kavian <otared@gmail.com>:

> Hi Rik,
> 
> As a matter of fact the example given by Wolfgang works despite mkiv complaining about
> 	\analyzecurrentreference
> being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting.

Better remove the \analyzecurrentreference command.

> I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.

Do you have a example because I run the example at the end of the module and had no problems.

What could be improved in the module is the check for left/right pages because the current check
can fail when the reference appears at the begin of a page.

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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-24 11:26       ` luigi scarso
@ 2014-07-24 11:38         ` Wolfgang Schuster
  2014-07-24 15:43           ` luigi scarso
  0 siblings, 1 reply; 22+ messages in thread
From: Wolfgang Schuster @ 2014-07-24 11:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1334 bytes --]


Am 24.07.2014 um 13:26 schrieb luigi scarso <luigi.scarso@gmail.com>:

> 
> 
> 
> On Thu, Jul 24, 2014 at 1:20 PM, Otared Kavian <otared@gmail.com> wrote:
> Hi Rik,
> 
> As a matter of fact the example given by Wolfgang works despite mkiv complaining about
> 	\analyzecurrentreference
> being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting.
> I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.
> 
> Maybe Marco has a solution for his module?
> 
> 
> also this one should work
> \starttext
> is shown in \in{figure}[FOO]%
> \doifreferencefoundelse{FOO}{\ifnum\realfolio=\currentreferencepage\else\at{page}[FOO]\fi}{}% 
> \placefigure[none][FOO]{FOO}{\externalfigure[cow.pdf][width=1cm]}
> 
> \page
> 
> is shown in \in{figure}[FOO1]%
> \doifreferencefoundelse{FOO1}{\ifnum\realfolio=\currentreferencepage\else\at{page}[FOO1]\fi}{}\page%
> \placefigure[none][FOO1]{FOO1}{\externalfigure[cow.pdf][width=1cm]}
> 
> \stoptext

I won’t trust this pagenumber check because when a reference appears at the begin of a page
it can sometimes use the pagenumber of the previous page (hard to notice when you use \page
in your examples to force a page break).

Wolfgang


[-- Attachment #1.2: Type: text/html, Size: 2683 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-24 11:34       ` Wolfgang Schuster
@ 2014-07-24 12:03         ` Otared Kavian
  2014-07-24 12:10           ` Wolfgang Schuster
  2014-07-25 11:06           ` Hans Hagen
  0 siblings, 2 replies; 22+ messages in thread
From: Otared Kavian @ 2014-07-24 12:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1835 bytes --]

Hi,

Thanks for your attention, Wolfgang: indeed removing 
	\analyzecurrentreference
from your example allows mkiv to typeset correctly and obtain the expected result.

Regarding Marco Patzer’s smartref command, I can typest the following example if I \input directly 

	\input conditionalfloatreferences.mkvi

but invoking

	\usemodule[conditionalfloatreferences]

does not work. (By the way I didn’t check whether the module is included in the minimals: so I am sending the file with this mail).
Best regards: OK

%%% begin test-smartref.tex
%\usemodule[conditionalfloatreferences]
\input conditionalfloatreferences.mkvi

\useMPlibrary[dum]

\starttext
{\bf Test 1:}

See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].

See \smartref{equation}[eq:Fermat].
\page 

{\bf Test 2:}

See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].

See \smartref{equation}[eq:Fermat].

\startplacefigure [reference=fig:alpha] \externalfigure \stopplacefigure
\startplacefigure [reference=fig:beta]  \externalfigure \stopplacefigure

\input knuth.tex
\placeformula[eq:Fermat]
\startformula
a,b,c \in {\Bbb N}^*, \quad n \geq 3, \quad a^n + b^n = c^n \imply abc = 0.
\stopformula

\page 
{\bf Test 3:}

See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].

See \smartref{equation}[eq:Fermat].

\startplacefigure [reference=fig:gamma] \externalfigure \stopplacefigure
\startplacefigure [reference=fig:delta] \externalfigure \stopplacefigure

\page 

{\bf Test 4:}

See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].

See \smartref{equation}[eq:Fermat].
\page 

{\bf Test 5:}

See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].

See \smartref{equation}[eq:Fermat].

\stoptext
%%% end test-smartref.tex


[-- Attachment #2: conditionalfloatreferences.mkvi --]
[-- Type: application/octet-stream, Size: 3635 bytes --]

\unprotect

\unexpanded\def\strc_references_smart
  {\strc_references_start_goto
   \let\currentreferencecontent\currentreferencedefault
   \strc_references_pickup_smart_goto}

\def\strc_references_pickup_smart_goto
  {\dodoublegroupempty\strc_references_pickup_goto_smart_indeed}

\starttexdefinition strc_references_pickup_goto_smart_indeed #left#right#dummy[#label]
  \leftreferencetoks
  \iffirstargument
    {#left}
  \else
    \defaultleftreferencetoks
    \let\leftofreferencecontent\empty
  \fi
  \rightreferencetoks
  \ifsecondargument
    {#right}
  \else
    \defaultrightreferencetoks
    \let\rightofreferencecontent\empty
  \fi
  \doifreferencefoundelse{#label}
    {\goto{\referencesequence}[#label]
     \strc_references_check_visibility
     \ifreferenceisvisible\else
       \space\strc_references_smart_string
     \fi}
     {\let\currentreferencecontent\dummyreference
      \goto{\referencesequence}[#label]}
  \strc_references_stop_goto
\stoptexdefinition

\newif\ifreferenceisvisible \referenceisvisiblefalse

\starttexdefinition strc_references_check_visibility
  \def\strc_references_smart_string{\labeltext\v!atpage\currentreferencepage}
  \referenceisvisiblefalse

  \ifnum\referencepagestate=\plusone %% 1 = reference on current page
    \referenceisvisibletrue
  \else
    \ifsinglesided
      \strc_references_do_relative_else\plusone
        {\def\strc_references_smart_string{\labeltext\v!nextpage}}
        {\strc_references_do_relative_else\minusone
         {\def\strc_references_smart_string{\labeltext\v!previouspage}}{}}
    \else
      \ifodd\realpageno
        \strc_references_do_relative_else\minusone
          {\def\strc_references_smart_string{\labeltext\v!previouspage}
           \referenceisvisibletrue}
          {\strc_references_do_relative_else\plusone
           {\def\strc_references_smart_string{\labeltext\v!nextpage}}{}}
      \else
        \strc_references_do_relative_else\minusone
          {\def\strc_references_smart_string{\labeltext\v!previouspage}}
          {\strc_references_do_relative_else\plusone
           \referenceisvisibletrue{}}
      \fi
    \fi
  \fi
\stoptexdefinition

\starttexdefinition strc_references_do_relative_else #relativepagenumber
  \ifnum\currentreferencerealpage=\numexpr\realpageno+#relativepagenumber\relax
    \expandafter\firstoftwoarguments
  \else
    \expandafter\secondoftwoarguments
  \fi
\stoptexdefinition

\let\smartref\strc_references_smart

\startinterface all
  \setinterfacevariable {previouspage} {previouspage}
  \setinterfacevariable {nextpage}     {nextpage}
\stopinterface

\setuplabeltext
  [\s!en]
  [\v!atpage=on page\nobreakspace, %% “at page” sounds weird
   \v!previouspage=on the previous page,
   \v!nextpage=on the next page]

\protect \endinput

\useMPlibrary [dum]
\setuppagenumbering [alternative=doublesided]

\starttext

      See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].
\page See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].

\startplacefigure [reference=fig:alpha] \externalfigure \stopplacefigure
\startplacefigure [reference=fig:beta]  \externalfigure \stopplacefigure

\page See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].

\startplacefigure [reference=fig:gamma] \externalfigure \stopplacefigure
\startplacefigure [reference=fig:delta] \externalfigure \stopplacefigure

\page See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].
\page See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].

\stoptext

[-- Attachment #3: Type: text/plain, Size: 1416 bytes --]



On 24 Jul 2014, at 13:34, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:

> 
> Am 24.07.2014 um 13:20 schrieb Otared Kavian <otared@gmail.com>:
> 
>> Hi Rik,
>> 
>> As a matter of fact the example given by Wolfgang works despite mkiv complaining about
>> 	\analyzecurrentreference
>> being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting.
> 
> Better remove the \analyzecurrentreference command.
> 
>> I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.
> 
> Do you have a example because I run the example at the end of the module and had no problems.
> 
> What could be improved in the module is the check for left/right pages because the current check
> can fail when the reference appears at the begin of a page.
> 
> 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
> ___________________________________________________________________________________


[-- Attachment #4: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-24 12:03         ` Otared Kavian
@ 2014-07-24 12:10           ` Wolfgang Schuster
  2014-07-25 11:06           ` Hans Hagen
  1 sibling, 0 replies; 22+ messages in thread
From: Wolfgang Schuster @ 2014-07-24 12:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 24.07.2014 um 14:03 schrieb Otared Kavian <otared@gmail.com>:

> Hi,
> 
> Thanks for your attention, Wolfgang: indeed removing 
> 	\analyzecurrentreference
> from your example allows mkiv to typeset correctly and obtain the expected result.
> 
> Regarding Marco Patzer’s smartref command, I can typest the following example if I \input directly 
> 
> 	\input conditionalfloatreferences.mkvi
> 
> but invoking
> 
> 	\usemodule[conditionalfloatreferences]
> 
> does not work. (By the way I didn’t check whether the module is included in the minimals: so I am sending the file with this mail).

I think it’s better to use the version from github [1] which can be loaded with \usemodule[smartref].

[1] https://github.com/mpfusion/context-smartref

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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-24 11:20     ` Otared Kavian
  2014-07-24 11:26       ` luigi scarso
  2014-07-24 11:34       ` Wolfgang Schuster
@ 2014-07-24 13:36       ` Rik Kabel
  2 siblings, 0 replies; 22+ messages in thread
From: Rik Kabel @ 2014-07-24 13:36 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 926 bytes --]

On 2014-07-24 07:20, Otared Kavian wrote:
> Hi Rik,
>
> As a matter of fact the example given by Wolfgang works despite mkiv 
> complaining about
> \analyzecurrentreference
> being unknown… Whent the typesetting stops because of this command, 
> saying « run » or rather « r » continues the typesetting.

How do you know it works? You only show that it runs to completion at 
that point. But without knowing what \analyzecurrentreference should do, 
not knowing if, for instance, it adjusts for certain edge cases, you do 
not have a reliable result.

> I didn’t send the example module of Marco Patzer since it doesn’t seem 
> to work anymore with recent versions of mkiv.
>
> Maybe Marco has a solution for his module?
>
> Best regards: OK

As Wolfgang wrote, the version on Github, which is referenced in the 
link I provided, works just fine, aside from the issue I described earlier.

-- 
Rik


[-- Attachment #1.2: Type: text/html, Size: 1846 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-24 11:38         ` Wolfgang Schuster
@ 2014-07-24 15:43           ` luigi scarso
  0 siblings, 0 replies; 22+ messages in thread
From: luigi scarso @ 2014-07-24 15:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1756 bytes --]

On Thu, Jul 24, 2014 at 1:38 PM, Wolfgang Schuster <
schuster.wolfgang@gmail.com> wrote:

>
>
> I won’t trust this pagenumber check because when a reference appears at
> the begin of a page
> it can sometimes use the pagenumber of the previous page (hard to notice
> when you use \page
> in your examples to force a page break).
>
> ah yes, when the pagetotal is greater  than the pagegoal of the MVL and
the pagebox is not splitted the realfolio counter is still the old one.

\placefigure[none][FOOa]{FOOa}{\externalfigure[cow.pdf][width=1cm]}
\vskip20cm
is shown in \in{figure}[FOOa]%
\doifreferencefoundelse{FOOa}{\ifnum\realfolio=\the\numexpr\currentreferencepage+0\relax\else\at{page}[FOOa]\fi}{}%




%%%

\newcount\mypagenr


\def\MyAtPage[#1]%
{\doifreferencefoundelse{#1}{%
%(\the\pagetotal,\the\pagegoal)
\mypagenr=\the\realpageno%
\ifdim\pagegoal<\maxdimen%
\ifdim\pagetotal>\pagegoal\advance\mypagenr by1\fi%
\edef\tmp{\currentreferencepage}%
\ifnum\mypagenr=\the\numexpr\tmp+0\relax\else\at{page}[#1]\fi\fi}{}%
}



\starttext



\placefigure[][FOO]{FOO}{\externalfigure[cow.pdf][width=1cm]}
%\vskip12cm
FOO is shown in \in{figure}[FOO] \MyAtPage[FOO]%

\placefigure[][FOOa]{FOOa}{\externalfigure[cow.pdf][width=1cm]}
\vskip20cm


\placefigure[][FOOb]{FOOb}{\externalfigure[cow.pdf][width=1cm]}
FOOb is shown in \in{figure}[FOOb] \MyAtPage[FOOb]

FOOa is shown in \in{figure}[FOOa] \MyAtPage[FOOa]


FOOc is shown in \in{figure}[FOOc] \MyAtPage[FOOc]
\placefigure[][FOOc]{FOOc}{\externalfigure[cow.pdf][width=1cm]}


FOOd is shown in \in{figure}[FOOd] \MyAtPage[FOOd]
\vskip20cm
\placefigure[][FOOd]{FOOd}{\externalfigure[cow.pdf][width=1cm]}



\stoptext


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 2966 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-24 12:03         ` Otared Kavian
  2014-07-24 12:10           ` Wolfgang Schuster
@ 2014-07-25 11:06           ` Hans Hagen
  2014-07-25 14:31             ` Gerben Wierda
  2014-07-25 14:34             ` Rik Kabel
  1 sibling, 2 replies; 22+ messages in thread
From: Hans Hagen @ 2014-07-25 11:06 UTC (permalink / raw)
  To: ntg-context

On 7/24/2014 2:03 PM, Otared Kavian wrote:
> Hi,
>
> Thanks for your attention, Wolfgang: indeed removing
> 	\analyzecurrentreference
> from your example allows mkiv to typeset correctly and obtain the expected result.

 > ....

yet another sparsely documented feature ... in beta:

% tests/mkiv/pagestate-001.tex

\useMPlibrary[dum]

\setuppagenumbering
   [alternative=doublesided]

% new: \setupreferencing[doublesided=no]

% old: \somewhere{backward}{foreward}[label]
% new: \someplace{preceding}{backward}{current}{foreward}{following}[label]
% old: \atpage[#label]
% new: 
\doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}

\starttext

\dorecurse {20} {
     \placefigure
       [here]
       [fig:#1]
       {}
       {\externalfigure[dummy]}
     \dorecurse {20} {
         ##1: \atpage[fig:##1] /
         \doifcheckedpagestate{fig:##1}
          {preceding}
          {backward}
          {current}
          {foreward}
          {following}
          {otherwise}
     }
}

\stoptext

if okay, then it's something to wikify ... should 
\setupreferencing[doublesided=no] be default? (currently yes i.e. spread 
aware)

keep in mind that this kind of functionality once it kicks in (is used) 
can result in a few more runs to get thing right and that there's always 
the danger of oscillation as the text injected is dependent on the 
situation

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-25 11:06           ` Hans Hagen
@ 2014-07-25 14:31             ` Gerben Wierda
  2014-07-26  8:43               ` Hans Hagen
  2014-07-25 14:34             ` Rik Kabel
  1 sibling, 1 reply; 22+ messages in thread
From: Gerben Wierda @ 2014-07-25 14:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thanks all for the discussion. As a simple user, I think I must pass. All this complexity in my document text and setup is too much trouble and it seems risky (wjhat am I going to break?). Far less work to do a small check at the end.

What I was looking for was something simple that made for instance \at{page][foo] conditional, e.g.

\conditionalat[when]{page}[foo]

with ‘when’ is something like
	always
	onpage
	offpage
	onspread
	offspread
	never

Typing \conditionalat instead of \at is what I as a simpleton user can handle…

G

On 25 Jul 2014, at 13:06, Hans Hagen <pragma@wxs.nl> wrote:

> On 7/24/2014 2:03 PM, Otared Kavian wrote:
>> Hi,
>> 
>> Thanks for your attention, Wolfgang: indeed removing
>> 	\analyzecurrentreference
>> from your example allows mkiv to typeset correctly and obtain the expected result.
> 
> > ....
> 
> yet another sparsely documented feature ... in beta:
> 
> % tests/mkiv/pagestate-001.tex
> 
> \useMPlibrary[dum]
> 
> \setuppagenumbering
>  [alternative=doublesided]
> 
> % new: \setupreferencing[doublesided=no]
> 
> % old: \somewhere{backward}{foreward}[label]
> % new: \someplace{preceding}{backward}{current}{foreward}{following}[label]
> % old: \atpage[#label]
> % new: \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
> 
> \starttext
> 
> \dorecurse {20} {
>    \placefigure
>      [here]
>      [fig:#1]
>      {}
>      {\externalfigure[dummy]}
>    \dorecurse {20} {
>        ##1: \atpage[fig:##1] /
>        \doifcheckedpagestate{fig:##1}
>         {preceding}
>         {backward}
>         {current}
>         {foreward}
>         {following}
>         {otherwise}
>    }
> }
> 
> \stoptext
> 
> if okay, then it's something to wikify ... should \setupreferencing[doublesided=no] be default? (currently yes i.e. spread aware)
> 
> keep in mind that this kind of functionality once it kicks in (is used) can result in a few more runs to get thing right and that there's always the danger of oscillation as the text injected is dependent on the situation
> 
> Hans
> 
> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
>                                             | www.pragma-pod.nl
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-25 11:06           ` Hans Hagen
  2014-07-25 14:31             ` Gerben Wierda
@ 2014-07-25 14:34             ` Rik Kabel
  2014-07-25 15:44               ` Hans Hagen
  1 sibling, 1 reply; 22+ messages in thread
From: Rik Kabel @ 2014-07-25 14:34 UTC (permalink / raw)
  To: ntg-context

On 2014-07-25 07:06, Hans Hagen wrote:
> On 7/24/2014 2:03 PM, Otared Kavian wrote:
>> Hi,
>>
>> Thanks for your attention, Wolfgang: indeed removing
>>     \analyzecurrentreference
>> from your example allows mkiv to typeset correctly and obtain the 
>> expected result.
>
> > ....
>
> yet another sparsely documented feature ... in beta:
>
> % tests/mkiv/pagestate-001.tex
>
> \useMPlibrary[dum]
>
> \setuppagenumbering
>   [alternative=doublesided]
>
> % new: \setupreferencing[doublesided=no]
>
> % old: \somewhere{backward}{foreward}[label]
> % new: 
> \someplace{preceding}{backward}{current}{foreward}{following}[label]
> % old: \atpage[#label]
> % new: 
> \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
>
> \starttext
>
> \dorecurse {20} {
>     \placefigure
>       [here]
>       [fig:#1]
>       {}
>       {\externalfigure[dummy]}
>     \dorecurse {20} {
>         ##1: \atpage[fig:##1] /
>         \doifcheckedpagestate{fig:##1}
>          {preceding}
>          {backward}
>          {current}
>          {foreward}
>          {following}
>          {otherwise}
>     }
> }
>
> \stoptext
>
> if okay, then it's something to wikify ... should 
> \setupreferencing[doublesided=no] be default? (currently yes i.e. 
> spread aware)
>
> keep in mind that this kind of functionality once it kicks in (is 
> used) can result in a few more runs to get thing right and that 
> there's always the danger of oscillation as the text injected is 
> dependent on the situation
>
> Hans

This looks very promising. When I test it with today's beta, I see that 
"current" is set in some iterations, but never shows up in the final 
version of the page, so references on the same page always come out as 
"backward" or "forward".

I would think that the default should match the default for 
\setuppagenumbering[alternative=], and perhaps be tied to that.

-- 
Rik Kabel

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-25 14:34             ` Rik Kabel
@ 2014-07-25 15:44               ` Hans Hagen
  0 siblings, 0 replies; 22+ messages in thread
From: Hans Hagen @ 2014-07-25 15:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 7/25/2014 4:34 PM, Rik Kabel wrote:
> On 2014-07-25 07:06, Hans Hagen wrote:
>> On 7/24/2014 2:03 PM, Otared Kavian wrote:
>>> Hi,
>>>
>>> Thanks for your attention, Wolfgang: indeed removing
>>>     \analyzecurrentreference
>>> from your example allows mkiv to typeset correctly and obtain the
>>> expected result.
>>
>> > ....
>>
>> yet another sparsely documented feature ... in beta:
>>
>> % tests/mkiv/pagestate-001.tex
>>
>> \useMPlibrary[dum]
>>
>> \setuppagenumbering
>>   [alternative=doublesided]
>>
>> % new: \setupreferencing[doublesided=no]
>>
>> % old: \somewhere{backward}{foreward}[label]
>> % new:
>> \someplace{preceding}{backward}{current}{foreward}{following}[label]
>> % old: \atpage[#label]
>> % new:
>> \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
>>
>>
>> \starttext
>>
>> \dorecurse {20} {
>>     \placefigure
>>       [here]
>>       [fig:#1]
>>       {}
>>       {\externalfigure[dummy]}
>>     \dorecurse {20} {
>>         ##1: \atpage[fig:##1] /
>>         \doifcheckedpagestate{fig:##1}
>>          {preceding}
>>          {backward}
>>          {current}
>>          {foreward}
>>          {following}
>>          {otherwise}
>>     }
>> }
>>
>> \stoptext
>>
>> if okay, then it's something to wikify ... should
>> \setupreferencing[doublesided=no] be default? (currently yes i.e.
>> spread aware)
>>
>> keep in mind that this kind of functionality once it kicks in (is
>> used) can result in a few more runs to get thing right and that
>> there's always the danger of oscillation as the text injected is
>> dependent on the situation
>>
>> Hans
>
> This looks very promising. When I test it with today's beta, I see that
> "current" is set in some iterations, but never shows up in the final
> version of the page, so references on the same page always come out as
> "backward" or "forward".

well, in the case of 5 alternatives current will only happen when the 
reference is at the *exact* spot as the thing referred to; so, in the 
case of

   text [target] text [reference] text

the target is before the reference on the same page contrary to

   text \hbox to 0pt{[target]}\hbox to 0pt{[reference]} text

of course 'current' seldom happens but it's part of the solution set anyway

> I would think that the default should match the default for
> \setuppagenumbering[alternative=], and perhaps be tied to that.


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-25 14:31             ` Gerben Wierda
@ 2014-07-26  8:43               ` Hans Hagen
  2014-08-01 11:30                 ` Gerben Wierda
  0 siblings, 1 reply; 22+ messages in thread
From: Hans Hagen @ 2014-07-26  8:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 7/25/2014 4:31 PM, Gerben Wierda wrote:
> Thanks all for the discussion. As a simple user, I think I must pass. All this complexity in my document text and setup is too much trouble and it seems risky (wjhat am I going to break?). Far less work to do a small check at the end.

Well, that kind of decisions demand injecting a node so there could be 
potential interference (as with more mechanisms that carry status info 
around for a second pass).

Anyway, maybe someone else benefits from the extension.

> What I was looking for was something simple that made for instance \at{page][foo] conditional, e.g.
>
> \conditionalat[when]{page}[foo]
>
> with ‘when’ is something like
> 	always
> 	onpage
> 	offpage
> 	onspread
> 	offspread
> 	never
>
> Typing \conditionalat instead of \at is what I as a simpleton user can handle…

\unprotect

\unexpanded\def\strc_references_conditional#1#2[#3]#4[#5]% 
{text}[condition][reference]
   {\doifcheckedpagestate{#5}%
      {\doifelse{#3}\v!precedingpage{#1{#2}[#5]}\ignorespaces}%
      {\doifelse{#3}\v!hencefore    {#1{#2}[#5]}\ignorespaces}%
      {\doifelse{#3}\v!current      {#1{#2}[#5]}\ignorespaces}%
      {\doifelse{#3}\v!hereafter    {#1{#2}[#5]}\ignorespaces}%
      {\doifelse{#3}\v!followingpage{#1{#2}[#5]}\ignorespaces}%
      {}}

\unexpanded\def\conditionalat   {\strc_references_conditional\at}
\unexpanded\def\conditionalin   {\strc_references_conditional\in}
\unexpanded\def\conditionalabout{\strc_references_conditional\about}

\protect

But I'll not enable it to the code as it's not used anyway (maybe 
sometime a module).

> G
>
> On 25 Jul 2014, at 13:06, Hans Hagen <pragma@wxs.nl> wrote:
>
>> On 7/24/2014 2:03 PM, Otared Kavian wrote:
>>> Hi,
>>>
>>> Thanks for your attention, Wolfgang: indeed removing
>>> 	\analyzecurrentreference
>>> from your example allows mkiv to typeset correctly and obtain the expected result.
>>
>>> ....
>>
>> yet another sparsely documented feature ... in beta:
>>
>> % tests/mkiv/pagestate-001.tex
>>
>> \useMPlibrary[dum]
>>
>> \setuppagenumbering
>>   [alternative=doublesided]
>>
>> % new: \setupreferencing[doublesided=no]
>>
>> % old: \somewhere{backward}{foreward}[label]
>> % new: \someplace{preceding}{backward}{current}{foreward}{following}[label]
>> % old: \atpage[#label]
>> % new: \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
>>
>> \starttext
>>
>> \dorecurse {20} {
>>     \placefigure
>>       [here]
>>       [fig:#1]
>>       {}
>>       {\externalfigure[dummy]}
>>     \dorecurse {20} {
>>         ##1: \atpage[fig:##1] /
>>         \doifcheckedpagestate{fig:##1}
>>          {preceding}
>>          {backward}
>>          {current}
>>          {foreward}
>>          {following}
>>          {otherwise}
>>     }
>> }
>>
>> \stoptext
>>
>> if okay, then it's something to wikify ... should \setupreferencing[doublesided=no] be default? (currently yes i.e. spread aware)
>>
>> keep in mind that this kind of functionality once it kicks in (is used) can result in a few more runs to get thing right and that there's always the danger of oscillation as the text injected is dependent on the situation
>>
>> Hans
>>
>>
>> -----------------------------------------------------------------
>>                                           Hans Hagen | PRAGMA ADE
>>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
>>                                              | www.pragma-pod.nl
>> -----------------------------------------------------------------
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-07-26  8:43               ` Hans Hagen
@ 2014-08-01 11:30                 ` Gerben Wierda
  2014-08-01 14:13                   ` Otared Kavian
  0 siblings, 1 reply; 22+ messages in thread
From: Gerben Wierda @ 2014-08-01 11:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 6272 bytes --]

On 26 Jul 2014, at 10:43, Hans Hagen <pragma@wxs.nl> wrote:

> On 7/25/2014 4:31 PM, Gerben Wierda wrote:
>> Thanks all for the discussion. As a simple user, I think I must pass. All this complexity in my document text and setup is too much trouble and it seems risky (wjhat am I going to break?). Far less work to do a small check at the end.
> 
> Well, that kind of decisions demand injecting a node so there could be potential interference (as with more mechanisms that carry status info around for a second pass).
> 
> Anyway, maybe someone else benefits from the extension.
> 
>> What I was looking for was something simple that made for instance \at{page][foo] conditional, e.g.
>> 
>> \conditionalat[when]{page}[foo]
>> 
>> with ‘when’ is something like
>> 	always
>> 	onpage
>> 	offpage
>> 	onspread
>> 	offspread
>> 	never
>> 
>> Typing \conditionalat instead of \at is what I as a simpleton user can handle…
> 
> \unprotect
> 
> \unexpanded\def\strc_references_conditional#1#2[#3]#4[#5]% {text}[condition][reference]
>  {\doifcheckedpagestate{#5}%
>     {\doifelse{#3}\v!precedingpage{#1{#2}[#5]}\ignorespaces}%
>     {\doifelse{#3}\v!hencefore    {#1{#2}[#5]}\ignorespaces}%
>     {\doifelse{#3}\v!current      {#1{#2}[#5]}\ignorespaces}%
>     {\doifelse{#3}\v!hereafter    {#1{#2}[#5]}\ignorespaces}%
>     {\doifelse{#3}\v!followingpage{#1{#2}[#5]}\ignorespaces}%
>     {}}
> 
> \unexpanded\def\conditionalat   {\strc_references_conditional\at}
> \unexpanded\def\conditionalin   {\strc_references_conditional\in}
> \unexpanded\def\conditionalabout{\strc_references_conditional\about}
> 
> \protect
> 
> But I'll not enable it to the code as it's not used anyway (maybe sometime a module).

I’ve tried to add this to my environment and product file, but even without using it, it ends in an error:

(/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-tpd.mkii
specials        : loading definition file fdf
(/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-fdf.mkii))
! Undefined control sequence.
l.5  {\doifcheckedpagestate
                           {#5}%
?

G

> 
>> G
>> 
>> On 25 Jul 2014, at 13:06, Hans Hagen <pragma@wxs.nl> wrote:
>> 
>>> On 7/24/2014 2:03 PM, Otared Kavian wrote:
>>>> Hi,
>>>> 
>>>> Thanks for your attention, Wolfgang: indeed removing
>>>> 	\analyzecurrentreference
>>>> from your example allows mkiv to typeset correctly and obtain the expected result.
>>> 
>>>> ....
>>> 
>>> yet another sparsely documented feature ... in beta:
>>> 
>>> % tests/mkiv/pagestate-001.tex
>>> 
>>> \useMPlibrary[dum]
>>> 
>>> \setuppagenumbering
>>>  [alternative=doublesided]
>>> 
>>> % new: \setupreferencing[doublesided=no]
>>> 
>>> % old: \somewhere{backward}{foreward}[label]
>>> % new: \someplace{preceding}{backward}{current}{foreward}{following}[label]
>>> % old: \atpage[#label]
>>> % new: \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
>>> 
>>> \starttext
>>> 
>>> \dorecurse {20} {
>>>    \placefigure
>>>      [here]
>>>      [fig:#1]
>>>      {}
>>>      {\externalfigure[dummy]}
>>>    \dorecurse {20} {
>>>        ##1: \atpage[fig:##1] /
>>>        \doifcheckedpagestate{fig:##1}
>>>         {preceding}
>>>         {backward}
>>>         {current}
>>>         {foreward}
>>>         {following}
>>>         {otherwise}
>>>    }
>>> }
>>> 
>>> \stoptext
>>> 
>>> if okay, then it's something to wikify ... should \setupreferencing[doublesided=no] be default? (currently yes i.e. spread aware)
>>> 
>>> keep in mind that this kind of functionality once it kicks in (is used) can result in a few more runs to get thing right and that there's always the danger of oscillation as the text injected is dependent on the situation
>>> 
>>> Hans
>>> 
>>> 
>>> -----------------------------------------------------------------
>>>                                          Hans Hagen | PRAGMA ADE
>>>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>>    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
>>>                                             | www.pragma-pod.nl
>>> -----------------------------------------------------------------
>>> ___________________________________________________________________________________
>>> 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
>>> ___________________________________________________________________________________
>> 
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
>> 
> 
> 
> -- 
> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
>                                             | www.pragma-pod.nl
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 11882 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-08-01 11:30                 ` Gerben Wierda
@ 2014-08-01 14:13                   ` Otared Kavian
  2014-08-02 13:12                     ` Gerben Wierda
  0 siblings, 1 reply; 22+ messages in thread
From: Otared Kavian @ 2014-08-01 14:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 661 bytes --]


On 01 Aug 2014, at 13:30, Gerben Wierda <gerben.wierda@rna.nl> wrote:
> […]
> I’ve tried to add this to my environment and product file, but even without using it, it ends in an error:
> 
> (/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-tpd.mkii
> specials        : loading definition file fdf
> (/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-fdf.mkii))
> ! Undefined control sequence.
> l.5  {\doifcheckedpagestate
>                            {#5}%
> ?
> 
> G

Hi Gerben,

I think you are using mkii, while the code sent by Hans and containing
	\doifcheckedpagestate
is intended for use with mkiv.

Best regards: OK

[-- Attachment #1.2: Type: text/html, Size: 2247 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-08-01 14:13                   ` Otared Kavian
@ 2014-08-02 13:12                     ` Gerben Wierda
  2014-08-02 13:24                       ` Gerben Wierda
  0 siblings, 1 reply; 22+ messages in thread
From: Gerben Wierda @ 2014-08-02 13:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 975 bytes --]

On 01 Aug 2014, at 16:13, Otared Kavian <otared@gmail.com> wrote:

>> […]
>> I’ve tried to add this to my environment and product file, but even without using it, it ends in an error:
>> 
>> (/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-tpd.mkii
>> specials        : loading definition file fdf
>> (/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-fdf.mkii))
>> ! Undefined control sequence.
>> l.5  {\doifcheckedpagestate
>>                            {#5}%
>> ?
>> 
>> G
> 
> Hi Gerben,
> 
> I think you are using mkii, while the code sent by Hans and containing
> 	\doifcheckedpagestate
> is intended for use with mkiv.

I suspected as such. I’m afraid to move to mkiv at this stage of my project. Is mkiv downwards compatible with mkii? What must I do to see if my project compiles with mkiv? I’m running currently commands like

texexec --pdf —standalone —once prd_book.tex

(all than not with —standalone and —once)

G


[-- Attachment #1.2: Type: text/html, Size: 3413 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-08-02 13:12                     ` Gerben Wierda
@ 2014-08-02 13:24                       ` Gerben Wierda
  2014-08-02 16:58                         ` Otared Kavian
  0 siblings, 1 reply; 22+ messages in thread
From: Gerben Wierda @ 2014-08-02 13:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 661 bytes --]

On 02 Aug 2014, at 15:12, Gerben Wierda <gerben.wierda@rna.nl> wrote:

> I suspected as such. I’m afraid to move to mkiv at this stage of my project. Is mkiv downwards compatible with mkii? What must I do to see if my project compiles with mkiv? I’m running currently commands like

Later for me. I read:

Mark IV needs your input to be in UTF-8. Legacy documents using 8bit encodings have to be converted to utf-8 before they are usable.

that enough is a show stopper for me at this point. All my input is in ascii code edited with a simple emacs-like editor. Moving to UTF8 at this stage is out of the question unless I get my editor to do that.

G

[-- Attachment #1.2: Type: text/html, Size: 1574 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-08-02 13:24                       ` Gerben Wierda
@ 2014-08-02 16:58                         ` Otared Kavian
  2014-08-02 19:01                           ` Gerben Wierda
  0 siblings, 1 reply; 22+ messages in thread
From: Otared Kavian @ 2014-08-02 16:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1934 bytes --]

Hi Gerben,

Regarding the text encodings understood by mkii and mkiv, one can always use UTF-8 in both.
Unless you have some very uncommon characters in your ascii file, the migration from ascii to utf-8 is quite easy, at least on a Mac (I don’t know what OS you are using): for instance you can open the file in an application such as Smultron or Fraise
	http://www.macupdate.com/app/mac/33751/fraise
and then in the « Text » menu choose « Text encoding » and then « UTF-8 ». After that you save your file: now it is in UTF-8 encoding and can be typeset in mkiv, as far as the commands you use in your TeX file is compatible with mkiv.

Best regards: OK

On 02 Aug 2014, at 15:24, Gerben Wierda <gerben.wierda@rna.nl> wrote:

> On 02 Aug 2014, at 15:12, Gerben Wierda <gerben.wierda@rna.nl> wrote:
> 
>> I suspected as such. I’m afraid to move to mkiv at this stage of my project. Is mkiv downwards compatible with mkii? What must I do to see if my project compiles with mkiv? I’m running currently commands like
> 
> Later for me. I read:
> 
> Mark IV needs your input to be in UTF-8. Legacy documents using 8bit encodings have to be converted to utf-8 before they are usable.
> 
> that enough is a show stopper for me at this point. All my input is in ascii code edited with a simple emacs-like editor. Moving to UTF8 at this stage is out of the question unless I get my editor to do that.
> 
> G
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 3661 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

* Re: Leave out reference to page if on the same page?
  2014-08-02 16:58                         ` Otared Kavian
@ 2014-08-02 19:01                           ` Gerben Wierda
  0 siblings, 0 replies; 22+ messages in thread
From: Gerben Wierda @ 2014-08-02 19:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 780 bytes --]

On 02 Aug 2014, at 18:58, Otared Kavian <otared@gmail.com> wrote:

> Regarding the text encodings understood by mkii and mkiv, one can always use UTF-8 in both.
> Unless you have some very uncommon characters in your ascii file, the migration from ascii to utf-8 is quite easy, at least on a Mac (I don’t know what OS you are using): for instance you can open the file in an application such as Smultron or Fraise
> 	http://www.macupdate.com/app/mac/33751/fraise
> and then in the « Text » menu choose « Text encoding » and then « UTF-8 ». After that you save your file: now it is in UTF-8 encoding and can be typeset in mkiv, as far as the commands you use in your TeX file is compatible with mkiv.

The problem is not so much the Mac, but the old editor I use there.

G

[-- Attachment #1.2: Type: text/html, Size: 2624 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 22+ messages in thread

end of thread, other threads:[~2014-08-02 19:01 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23 15:46 Leave out reference to page if on the same page? Gerben Wierda
2014-07-23 18:01 ` Otared Kavian
2014-07-24  0:34   ` Rik
2014-07-24 11:20     ` Otared Kavian
2014-07-24 11:26       ` luigi scarso
2014-07-24 11:38         ` Wolfgang Schuster
2014-07-24 15:43           ` luigi scarso
2014-07-24 11:34       ` Wolfgang Schuster
2014-07-24 12:03         ` Otared Kavian
2014-07-24 12:10           ` Wolfgang Schuster
2014-07-25 11:06           ` Hans Hagen
2014-07-25 14:31             ` Gerben Wierda
2014-07-26  8:43               ` Hans Hagen
2014-08-01 11:30                 ` Gerben Wierda
2014-08-01 14:13                   ` Otared Kavian
2014-08-02 13:12                     ` Gerben Wierda
2014-08-02 13:24                       ` Gerben Wierda
2014-08-02 16:58                         ` Otared Kavian
2014-08-02 19:01                           ` Gerben Wierda
2014-07-25 14:34             ` Rik Kabel
2014-07-25 15:44               ` Hans Hagen
2014-07-24 13:36       ` Rik Kabel

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).