ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Leave out reference to page if on the same page?
Date: Sat, 26 Jul 2014 10:43:33 +0200	[thread overview]
Message-ID: <53D36A35.3070901@wxs.nl> (raw)
In-Reply-To: <B2887272-9855-400D-8B85-D0CE736A94EF@rna.nl>

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
___________________________________________________________________________________


  reply	other threads:[~2014-07-26  8:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 15:46 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53D36A35.3070901@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).