ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Reset counters by sectionblock
@ 2012-03-12 17:44 Wolfgang Schuster
  2012-03-13 11:38 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2012-03-12 17:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans,

can add “way=block” to counter which reset the number at the start of each sectionblock,
for now it works in the same way as “way=text”.

\definestructureconversionset[frontpart:pagenumber][][romannumerals]
\definestructureconversionset [bodypart:pagenumber][][numbers]
\definestructureconversionset [appendix:pagenumber][][Characters]

\setuppagenumber[numberconverionset=pagenumber,way=block]

\startsectionblockenvironment[bodypart]
%\resetpagenumber
\stopsectionblockenvironment

\startsectionblockenvironment[appendix]
%\resetpagenumber
\stopsectionblockenvironment

\setupheadertexts[Page \userpagenumber\ of \lastuserpagenumber]

\starttext

\startfrontmatter

\chapter{Fontpart}

\dorecurse{20}{\input knuth\par}

\stopfrontmatter

\startbodymatter

\chapter{Bodypart}

\dorecurse{20}{\input tufte\par}

\stopbodymatter

\startappendices

\chapter{Appendix}

\dorecurse{20}{\input zapf\par}

\stopappendices

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

* Re: Reset counters by sectionblock
  2012-03-12 17:44 Reset counters by sectionblock Wolfgang Schuster
@ 2012-03-13 11:38 ` Hans Hagen
  2012-03-13 14:48   ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2012-03-13 11:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 12-3-2012 18:44, Wolfgang Schuster wrote:
> Hi Hans,
>
> can add “way=block” to counter which reset the number at the start of each sectionblock,
> for now it works in the same way as “way=text”.

Actually block is already implemented but not resolved right (due to 
inheritance resolving). This should do the trick:

\def\thenamedstructurecounterlevel#1%
   {\xthenamedheadlevel{\structurecounterway{#1}}}

\def\xthenamedheadlevel#1%
   {\xsectionlevel{#1}{\sectionheadsection{\sectionheadcoupling{#1}}}}

\def\xsectionlevel#1#2% direct indirect
   {\csname\??headlevel
      \ifcsname\??headlevel#1\endcsname
        #1%
      \else\ifcsname\??headlevel#2\endcsname
        #2%
      \else
        \v!none
      \fi\fi
    \endcsname}


> \definestructureconversionset[frontpart:pagenumber][][romannumerals]
> \definestructureconversionset [bodypart:pagenumber][][numbers]
> \definestructureconversionset [appendix:pagenumber][][Characters]
>
> \setuppagenumber[numberconverionset=pagenumber,way=block]
>
> \startsectionblockenvironment[bodypart]
> %\resetpagenumber
> \stopsectionblockenvironment
>
> \startsectionblockenvironment[appendix]
> %\resetpagenumber
> \stopsectionblockenvironment
>
> \setupheadertexts[Page \userpagenumber\ of \lastuserpagenumber]
>
> \starttext
>
> \startfrontmatter
>
> \chapter{Fontpart}
>
> \dorecurse{20}{\input knuth\par}
>
> \stopfrontmatter
>
> \startbodymatter
>
> \chapter{Bodypart}
>
> \dorecurse{20}{\input tufte\par}
>
> \stopbodymatter
>
> \startappendices
>
> \chapter{Appendix}
>
> \dorecurse{20}{\input zapf\par}
>
> \stopappendices
>
> \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
> ___________________________________________________________________________________


-- 

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

* Re: Reset counters by sectionblock
  2012-03-13 11:38 ` Hans Hagen
@ 2012-03-13 14:48   ` Wolfgang Schuster
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2012-03-13 14:48 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users


Am 13.03.2012 um 12:38 schrieb Hans Hagen:

> On 12-3-2012 18:44, Wolfgang Schuster wrote:
>> Hi Hans,
>> 
>> can add “way=block” to counter which reset the number at the start of each sectionblock,
>> for now it works in the same way as “way=text”.
> 
> Actually block is already implemented but not resolved right (due to inheritance resolving). This should do the trick:
> 
> \def\thenamedstructurecounterlevel#1%
>  {\xthenamedheadlevel{\structurecounterway{#1}}}
> 
> \def\xthenamedheadlevel#1%
>  {\xsectionlevel{#1}{\sectionheadsection{\sectionheadcoupling{#1}}}}
> 
> \def\xsectionlevel#1#2% direct indirect
>  {\csname\??headlevel
>     \ifcsname\??headlevel#1\endcsname
>       #1%
>     \else\ifcsname\??headlevel#2\endcsname
>       #2%
>     \else
>       \v!none
>     \fi\fi
>   \endcsname}

Yes, it works.

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

end of thread, other threads:[~2012-03-13 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-12 17:44 Reset counters by sectionblock Wolfgang Schuster
2012-03-13 11:38 ` Hans Hagen
2012-03-13 14:48   ` 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).