Reset counters by sectionblock
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
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 -----------------------------------------------------------------
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
participants (2)
-
Hans Hagen
-
Wolfgang Schuster