ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* late reset of counter with way=bypage
@ 2016-02-18 17:15 massifr
  2016-02-22 10:38 ` massifr
  0 siblings, 1 reply; 2+ messages in thread
From: massifr @ 2016-02-18 17:15 UTC (permalink / raw)
  To: ntg-context


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

Hello list,
this is an example of footnotes with two different markers (and counters): numbers for editor's footnotes, stars for author's footnotes.
The footnotes are typeset together, in the order they appear in the text, so number and star markers are interspersed.
The two counters are reset every page (way=bypage).
-----
\setupnotation[footnote][way=bypage]

\definecounter[authornote][way=bypage]

% taken and adapted from https://www.mail-archive.com/ntg-context@ntg.nl/msg56637.html
\define[1]\authorNote{\bgroup%
   \savecounter[footnote]%
   \setcounter[footnote][{\rawcountervalue[authornote]}]%
   \setupnotation[footnote][numberconversion=set 1]%
   \footnote{#1}%
   \restorecounter[footnote]%
   \incrementcounter[authornote]%
   \egroup}

\starttext

First footnote\footnote{First footnote}.
First author's footnote\authorNote{First author's footnote}.
Second footnote\footnote{Second footnote}.
Second author's footnote\authorNote{Second author's footnote}.

\page

First footnote\footnote{First footnote}.
First author's footnote\authorNote{First author's footnote}.
Second footnote\footnote{Second footnote}.
Second author's footnote\authorNote{Second author's footnote}.

\stoptext
-----

The problem: the first authorNote of the second page has its counter set to 3 instead of 1 (you see 3 stars as marker).
The second authorNote has the right value of 2 (2 stars as marker).
This means that "way=bypage" works for the authornote counter too, but one step late.
What am I missing? Some \iftrialtypesetting?

Greetings,
Massi


[-- Attachment #1.2: Type: text/html, Size: 8222 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] 2+ messages in thread

* Re: late reset of counter with way=bypage
  2016-02-18 17:15 late reset of counter with way=bypage massifr
@ 2016-02-22 10:38 ` massifr
  0 siblings, 0 replies; 2+ messages in thread
From: massifr @ 2016-02-22 10:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Solved with a workaround
> -----
> \setupnotation[footnote][way=bypage]
> 
> \definecounter[authornote][way=bypage]
> 
> % taken and adapted from https://www.mail-archive.com/ntg-context@ntg.nl/msg56637.html
> \define[1]\authorNote{\bgroup%
>    \savecounter[footnote]%
   \incrementcounter[authornote]\decrementcounter[authornote]%  <-- authornote is incremented and decremented to force the reset by page
>    \setcounter[footnote][{\rawcountervalue[authornote]}]%
>    \setupnotation[footnote][numberconversion=set 1]%
>    \footnote{#1}%
>    \restorecounter[footnote]%
>    \incrementcounter[authornote]%
>    \egroup}
> 
> \starttext
> 
> First footnote\footnote{First footnote}.
> First author's footnote\authorNote{First author's footnote}.
> Second footnote\footnote{Second footnote}.
> Second author's footnote\authorNote{Second author's footnote}.
> 
> \page
> 
> First footnote\footnote{First footnote}.
> First author's footnote\authorNote{First author's footnote}.
> Second footnote\footnote{Second footnote}.
> Second author's footnote\authorNote{Second author's footnote}.
> 
> \stoptext
> -----

Wolfgang Schuster already answered me on this (see https://www.mail-archive.com/ntg-context%40ntg.nl/msg78847.html):
> It’s a bug and hopefully fixed in a new beta but the counter is only reset
> when you increment the value.

If you need the value of a counter with "way=bypage" without modifying its value, the workaround is:
- increment the counter to force its reset by page
- decrement it to get the correct current value

Greetings,
Massi
___________________________________________________________________________________
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:[~2016-02-22 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-18 17:15 late reset of counter with way=bypage massifr
2016-02-22 10:38 ` massifr

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