* labels and new structure code
@ 2009-06-04 14:46 Thomas A. Schmitz
2009-06-07 12:12 ` Hans Hagen
0 siblings, 1 reply; 5+ messages in thread
From: Thomas A. Schmitz @ 2009-06-04 14:46 UTC (permalink / raw)
To: mailing ConTeXt users list for
Hi all, Hans,
here is a bug that remains with the new structure code after Hans
fixed many things two weeks ago. I want a counter that is reset at
every odd chapter. This works as expected in mkii (and used to work in
mkiv), but complains about a "Missing number, treated as zero" and
fails to compile in current beta:
\setupcolors[state=start]
\setuphead
[section]
[command={{\determineheadnumber[section]}\ifodd\currentheadnumber
\resetSlideNumber\incrementSlideNumber \else\incrementSlideNumber \fi},
expansion=yes]
\definelabel[SlideNumber][headstyle=normal,way=bytext]
\define\SLN{\color[red]{ [\nextSlideNumber]}}
\starttext
\section{One}
should be 2: \SLN
\section{Two}
should be 4: \SLN
\section{Three}
should be 2 again: \SLN
\section{Four}
should be 4 again: \SLN
\stoptext
Even if you comment out the command=... line, you'll see that labels
in mkiv still don't quite do what they should.
All best
Thomas
___________________________________________________________________________________
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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: labels and new structure code
2009-06-04 14:46 labels and new structure code Thomas A. Schmitz
@ 2009-06-07 12:12 ` Hans Hagen
2009-06-07 12:51 ` Thomas A. Schmitz
0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2009-06-07 12:12 UTC (permalink / raw)
To: mailing list for ConTeXt users
Thomas A. Schmitz wrote:
> Hi all, Hans,
>
> here is a bug that remains with the new structure code after Hans fixed
> many things two weeks ago. I want a counter that is reset at every odd
> chapter. This works as expected in mkii (and used to work in mkiv), but
> complains about a "Missing number, treated as zero" and fails to compile
> in current beta:
ok, fixed in the beta
the problem is that the old code was somewhat crippled as it uses this
two step method (determine and usage) due to expansion issues
in the current beta mkiv code we can do:
\setuphead
[section]
[after=\setups{section:after},
expansion=yes]
\startsetups section:after
\ifodd\namedheadnumber{section}\relax
\resetSlideNumber\incrementSlideNumber
\else
\incrementSlideNumber
\fi
\blank
\stopsetups
btw, you misuse 'command' which in turn has side effects; use after instead
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: labels and new structure code
2009-06-07 12:12 ` Hans Hagen
@ 2009-06-07 12:51 ` Thomas A. Schmitz
2009-06-07 13:04 ` Hans Hagen
0 siblings, 1 reply; 5+ messages in thread
From: Thomas A. Schmitz @ 2009-06-07 12:51 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Jun 7, 2009, at 2:12 PM, Hans Hagen wrote:
> ok, fixed in the beta
>
> the problem is that the old code was somewhat crippled as it uses
> this two step method (determine and usage) due to expansion issues
>
> in the current beta mkiv code we can do:
>
> \setuphead
> [section]
> [after=\setups{section:after},
> expansion=yes]
>
> \startsetups section:after
> \ifodd\namedheadnumber{section}\relax
> \resetSlideNumber\incrementSlideNumber
> \else
> \incrementSlideNumber
> \fi
> \blank
> \stopsetups
>
> btw, you misuse 'command' which in turn has side effects; use after
> instead
OK, thanks a lot Hans! Have replaced "command" with "after"; now my
test document compiles cleanly. Two questions though: \nextSlideNumber
used to simply expand to "2" "3" etc. Now I get "SlideNumber 1.2"
"SlideNumber 1.3." How can I get the old behavior back? And: I'm doing
this in xml documents, and here, the counter is not reset. I assume
you want a new example document :-)
All best
Thomas
___________________________________________________________________________________
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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: labels and new structure code
2009-06-07 12:51 ` Thomas A. Schmitz
@ 2009-06-07 13:04 ` Hans Hagen
2009-06-07 20:08 ` Thomas A. Schmitz
0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2009-06-07 13:04 UTC (permalink / raw)
To: mailing list for ConTeXt users
Thomas A. Schmitz wrote:
>
> On Jun 7, 2009, at 2:12 PM, Hans Hagen wrote:
>
>> ok, fixed in the beta
>>
>> the problem is that the old code was somewhat crippled as it uses this
>> two step method (determine and usage) due to expansion issues
>>
>> in the current beta mkiv code we can do:
>>
>> \setuphead
>> [section]
>> [after=\setups{section:after},
>> expansion=yes]
>>
>> \startsetups section:after
>> \ifodd\namedheadnumber{section}\relax
>> \resetSlideNumber\incrementSlideNumber
>> \else
>> \incrementSlideNumber
>> \fi
>> \blank
>> \stopsetups
>>
>> btw, you misuse 'command' which in turn has side effects; use after
>> instead
>
> OK, thanks a lot Hans! Have replaced "command" with "after"; now my test
> document compiles cleanly. Two questions though: \nextSlideNumber used
> to simply expand to "2" "3" etc. Now I get "SlideNumber 1.2"
> "SlideNumber 1.3." How can I get the old behavior back? And: I'm doing
> this in xml documents, and here, the counter is not reset. I assume you
> want a new example document :-)
yeah
you need to reset the prefix, like prefix=no ; depends a bit on your
definition
(i need to figure out a proper default scheme for a whole doc which is
kind of tricky since we have more control now)
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: labels and new structure code
2009-06-07 13:04 ` Hans Hagen
@ 2009-06-07 20:08 ` Thomas A. Schmitz
0 siblings, 0 replies; 5+ messages in thread
From: Thomas A. Schmitz @ 2009-06-07 20:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Jun 7, 2009, at 3:04 PM, Hans Hagen wrote:
> yeah
>
> you need to reset the prefix, like prefix=no ; depends a bit on your
> definition
>
> (i need to figure out a proper default scheme for a whole doc which
> is kind of tricky since we have more control now)
Oops, I am sorry, resetting the counter works in my xml files as well;
I had a second after= assignment which confused ConteXt. It's almost
perfect, but there's a spurious space creeping in somewhere. Reusing
my old example:
\startsetups section:after
\ifodd\namedheadnumber{section}\relax
\resetSlideNumber\incrementSlideNumber
\else
\incrementSlideNumber
\fi
\blank[0*line]
\stopsetups
\setuphead
[section]
[after=\setups{section:after},
page=yes,
expansion=yes,
before={\blank[0*big]}]
\definelabel[SlideNumber][headstyle=normal,way=bytext,prefix=no,text=]
\define\SLN{\color[red]{[\nextSlideNumber]}}
\starttext
\section{One}
should be 2: \SLN
\section{Two}
should be 4: \SLN
\section{Three}
should be 2 again: \SLN
\section{Four}
should be 4 again: \SLN
\stoptext
Thanks for your help, and best wishes!
Thomas
___________________________________________________________________________________
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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-07 20:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-04 14:46 labels and new structure code Thomas A. Schmitz
2009-06-07 12:12 ` Hans Hagen
2009-06-07 12:51 ` Thomas A. Schmitz
2009-06-07 13:04 ` Hans Hagen
2009-06-07 20:08 ` Thomas A. Schmitz
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).