ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* compare locations of two pagereferences
@ 2011-03-02 17:05 Daniel Schopper
  2011-03-02 17:32 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Schopper @ 2011-03-02 17:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear all,
how can one compare the locations of two pagereferences for conditional 
processing? I tried it with this (mkiv, 2011.01.10):

\starttext

\pagereference[page:a]bla \pagereference[page:b]bla
\at[page:a] % 1
\at[page:b] % also 1
\doifsamestringelse{\at[page:a]}{\at[page:b]}{same page}{different page} 
% yet, the else-branch gets executed

\stoptext

Of course this is clumsy, but although I tried to peek into strc-ref I 
couldn't quite sort out how to directly access the results of \at.
Thanks
Daniel
___________________________________________________________________________________
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] 2+ messages in thread

* Re: compare locations of two pagereferences
  2011-03-02 17:05 compare locations of two pagereferences Daniel Schopper
@ 2011-03-02 17:32 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2011-03-02 17:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 02.03.2011 um 18:05 schrieb Daniel Schopper:

> Dear all,
> how can one compare the locations of two pagereferences for conditional processing? I tried it with this (mkiv, 2011.01.10):

There is nothing predefined in the core but it’s not so hard to write your own command:

\def\doifelsesamepagereference#1#2%
  {\doifelse
     {\doifreferencefoundelse{#1}{\currentreferencepage}{-}}
     {\doifreferencefoundelse{#2}{\currentreferencepage}{+}}}

\starttext

A\pagereference[page:a]\par
B\pagereference[page:b]

\page[yes]

C\pagereference[page:c]

A+B: \doifelsesamepagereference{page:a}{page:b}{YES}{NO}

B+C: \doifelsesamepagereference{page:b}{page:c}{YES}{NO}

\stoptext

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

end of thread, other threads:[~2011-03-02 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-02 17:05 compare locations of two pagereferences Daniel Schopper
2011-03-02 17:32 ` Wolfgang Schuster

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