Re: [NTG-context] Getting ToC to match page numbering
I have three issues where page number formatting in the table of contents is wrong compared to the pages themselves: 1. The separator character in the actual pagenumbers is "/". In the ToC it displays as a "-". 2. I used "left=A" on the pagenumbering command in the appendices because appendices are numbered A1, A2 etc. This gives the required output for the actual pagenumbers, but there is no 'A' prefix in the ToC. 3. Similarly in the backmatter I have added a 'I/' prefix to the pagenumber ("left={I/}"), which works on the pages but is not reflected in the ToC. The overall question is how to get each of these page numbering features repeated in the table of contents? Thanks. Minimal file follows. Duncan ---- %% Tested on live.contextgarden \setupoutput[pdftex] %% change appendix numbering from Character to numbers \setupsection[section-2][appendixconversion=numbers] %% define new chapter-like heads for different sections \definehead[Frontchapter][chapter] \definehead[Appchapter][chapter] \definehead[Backchapter][chapter] %% set up individual content lists and labels \setuplist[Frontchapter][pagenumber=yes] \setuplabeltext[en][chapter={Module }] \setuplist[chapter][pagenumber=yes,chapternumber=yes,label=yes] \setuplabeltext[en][Appchapter={Appendix }] \setuplist[Appchapter][pagenumber=yes,chapternumber=yes,label=yes] \setuplist[Backchapter][pagenumber=yes] %% set up the combined list \definecombinedlist[Xontents] [part,Frontchapter,chapter,Appchapter,Backchapter,section] [level=section,criterium=local] \setupcombinedlist[Xontents][alternative=b,aligntitle=yes,distance=4em] %% page numbering is output using the explicit \completepagenumber %% command in the footer because the final output has rather %% complicated footers which incorporate the page number. \setupfootertexts[text] [][{\inframed{\kern.3em\completepagenumber\kern.3em}}] [][{\inframed{\kern.3em\completepagenumber\kern.3em}\hfill}] \starttext \startfrontmatter %% page numbering is set up for each section \setuppagenumbering[state=start,alternative={singlesided,doublesided}, location=,chapternumber=no,partnumber=no,conversion=romannumerals] \title{Contents} \placecombinedlist[Xontents] \Frontchapter{Test Intro} \dorecurse{3}{\input tufte\par} \stopfrontmatter \startbodymatter %% for the body and appendices we prefix the chapternumber and a '/' \setuppagenumbering[state=start,alternative={singlesided,doublesided},location=, way=bychapter,partnumber=no,chapternumber=yes,numberseparator={/}] \chapter{Test Chapter} \dorecurse{3}{\input tufte\par} \chapter{Another Test Chapter} \dorecurse{3}{\input tufte\par} \stopbodymatter \startappendices \setuppagenumbering[state=start,alternative={singlesided,doublesided},location=, way=bychapter,partnumber=no,left=A,chapternumber=yes,numberseparator={/}] \Appchapter{Test Appendix} \dorecurse{3}{\input tufte\par} \stopappendices \startbackmatter %% for the backmatter we just prefix I/ (it's going to be the index) \setuppagenumbering[state=start,alternative={singlesided,doublesided}, location=,way=bychapter,left={I/}] \setuppagenumber[number=1] \Backchapter{Index} \dorecurse{3}{\input tufte\par} \stopbackmatter \stoptext ----
Duncan Hothersall wrote:
I have three issues where page number formatting in the table of contents is wrong compared to the pages themselves:
i admit that this is a bit tricky; has to do with how numbers are used for selective purposed; maybe i'll rewrite that part some day (no need to be efficient nowadays)
1. The separator character in the actual pagenumbers is "/". In the ToC it displays as a "-".
\start \setuppagenumbering[numberseparator=/] \placecombinedlist[Xontents] \stop
2. I used "left=A" on the pagenumbering command in the appendices because appendices are numbered A1, A2 etc. This gives the required output for the actual pagenumbers, but there is no 'A' prefix in the ToC.
indeed, since left/right is cosmetics an dit's easier to add that than to remov eit when you dont wan it, so: \setuplist[Appchapter][pagecommand=A] % or cleaner: pagecommand=\AppPrefix and \def\AppPrefix#1{A\enspace#1}
3. Similarly in the backmatter I have added a 'I/' prefix to the pagenumber ("left={I/}"), which works on the pages but is not reflected in the ToC.
now you know how to do that wikiable:
%% Tested on live.contextgarden \setupoutput[pdftex] %% change appendix numbering from Character to numbers \setupsection[section-2][appendixconversion=numbers] %% define new chapter-like heads for different sections \definehead[Frontchapter][chapter] \definehead[Appchapter][chapter] \definehead[Backchapter][chapter] %% set up individual content lists and labels \setuplist[Frontchapter][pagenumber=yes] \setuplabeltext[en][chapter={Module }] \setuplist[chapter][pagenumber=yes,chapternumber=yes,label=yes] \setuplabeltext[en][Appchapter={Appendix }] \setuplist[Appchapter][pagenumber=yes,chapternumber=yes,label=yes] \setuplist[Backchapter][pagenumber=yes] %% set up the combined list \definecombinedlist[Xontents] [part,Frontchapter,chapter,Appchapter,Backchapter,section] [level=section,criterium=local] \setupcombinedlist[Xontents][alternative=b,aligntitle=yes,distance=4em] %% page numbering is output using the explicit \completepagenumber %% command in the footer because the final output has rather %% complicated footers which incorporate the page number. \setupfootertexts[text] [][{\inframed{\kern.3em\completepagenumber\kern.3em}}] [][{\inframed{\kern.3em\completepagenumber\kern.3em}\hfill}] \starttext \startfrontmatter %% page numbering is set up for each section \setuppagenumbering[state=start,alternative={singlesided,doublesided}, location=,chapternumber=no,partnumber=no,conversion=romannumerals] \title{Contents} \placecombinedlist[Xontents] \Frontchapter{Test Intro} \dorecurse{3}{\input tufte\par} \stopfrontmatter \startbodymatter %% for the body and appendices we prefix the chapternumber and a '/' \setuppagenumbering[state=start,alternative={singlesided,doublesided},location=, way=bychapter,partnumber=no,chapternumber=yes,numberseparator={/}] \chapter{Test Chapter} \dorecurse{3}{\input tufte\par} \chapter{Another Test Chapter} \dorecurse{3}{\input tufte\par} \stopbodymatter \startappendices \setuppagenumbering[state=start,alternative={singlesided,doublesided},location=, way=bychapter,partnumber=no,left=A,chapternumber=yes,numberseparator={/}] \Appchapter{Test Appendix} \dorecurse{3}{\input tufte\par} \stopappendices \startbackmatter %% for the backmatter we just prefix I/ (it's going to be the index) \setuppagenumbering[state=start,alternative={singlesided,doublesided}, location=,way=bychapter,left={I/}] \setuppagenumber[number=1] \Backchapter{Index} \dorecurse{3}{\input tufte\par} \stopbackmatter \stoptext
----------------------------------------------------------------- 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 -----------------------------------------------------------------
participants (2)
-
Duncan Hothersall
-
Hans Hagen