ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Getting ToC to match page numbering
       [not found] <20050801163617.8E7D7127C9@ronja.ntg.nl>
@ 2005-08-02 11:22 ` Duncan Hothersall
  0 siblings, 0 replies; 7+ messages in thread
From: Duncan Hothersall @ 2005-08-02 11:22 UTC (permalink / raw)


Hans said:

>>wikiable:

And I said:

> Will do; would be great to fix (or at least understand) the alignment
> before I do though, for completeness. :-)

I've added this to the wiki now, since having tested it out I don't
think my alignment problems were anything to do with the issue at hand.

To fix the alignment, I have now defined:
\def\GenPagecommand#1{\hfill\llap{#1}}
and said:
pagecommand=\GenPagecommand
for every setuplist except those which require prefixes. This allows me
to have very large page numbers and long prefixes without seeing the
page number alignment go all squiggly.

The appendices now have:
\def\AppPrefix#1{\GenPagecommand{A#1}}
and:
pagecommand=\AppPrefix
in the setuplist, and the backmatter is done similarly.

Possibly this leaves me exposed if a very long title runs over into the
llap, but I'm hoping not to run into that. Is this the only solution here?

Thanks again.

Duncan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting ToC to match page numbering
@ 2005-08-01 16:36 Duncan Hothersall
  0 siblings, 0 replies; 7+ messages in thread
From: Duncan Hothersall @ 2005-08-01 16:36 UTC (permalink / raw)


> \start
> \setuppagenumbering[numberseparator=/]
> \placecombinedlist[Xontents]
> \stop

Ah, I see, \placecombinedlist uses the value of numberseparator active
at the time it is called! Thanks.

> 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}

I had experimented with that, and it certainly works (I chose the second
option, but dropped the \enspace), BUT... the page numbers column in the
table of contents is now mis-aligned. I've pasted my revised minimal
test file below, and if you run that you can see that things have gone
squiggly. The frontmatter and appendices are aligned further to the
right than the chapters and backmatter. Weird.

I looked at the source and as far as I can tell the default pagecommand
is just \strut#1, so I don't understand how alignment has been changed
by redefining it, but it certainly seems to have.

> wikiable:

Will do; would be great to fix (or at least understand) the alignment
before I do though, for completeness. :-)

Thanks,

Duncan


Minimal test, now mostly working thanks to Hans:
----

%% 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 }]
\def\AppPrefix#1{A#1}
\setuplist[Appchapter][pagenumber=yes,chapternumber=yes,label=yes,pagecommand=\AppPrefix]
\def\BackPrefix#1{I/#1}
\setuplist[Backchapter][pagenumber=yes,pagecommand=\BackPrefix]
%% 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}
\setuppagenumbering[numberseparator=/]
\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

----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting ToC to match page numbering
  2005-08-01 13:39 ` Duncan Hothersall
@ 2005-08-01 14:46   ` Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2005-08-01 14:46 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting ToC to match page numbering
       [not found] <20050801100004.BCAD8127BF@ronja.ntg.nl>
@ 2005-08-01 13:39 ` Duncan Hothersall
  2005-08-01 14:46   ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Duncan Hothersall @ 2005-08-01 13:39 UTC (permalink / raw)


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

----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting ToC to match page numbering
       [not found] <20050731204706.7E63E127A8@ronja.ntg.nl>
@ 2005-08-01 10:09 ` Duncan Hothersall
  0 siblings, 0 replies; 7+ messages in thread
From: Duncan Hothersall @ 2005-08-01 10:09 UTC (permalink / raw)


> My guess would be (untested):
> 
>    \setuplist [part]                [separator={/}]
>    \setuplist [chapter]             [separator={/}]
>    \setuplist [section]             [separator={/}]
>    \setuplist [subsection]          [separator={/}]
>    \setuplist [subsubsection]       [separator={/}]
>    \setuplist [subsubsubsection]    [separator={/}]
>    \setuplist [subsubsubsubsection] [separator={/}]
> 
> Taco

Has no effect - tried this early on. Thanks for the suggestion. Seems
like this *should* be the answer though...

My current test file is a bit large, because I'm developing a whole
style, but I'll work on a small one to demonstrate.

Any other thoughts?

Duncan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting ToC to match page numbering
  2005-08-01  9:38 Duncan Hothersall
@ 2005-08-01  9:59 ` Taco Hoekwater
  0 siblings, 0 replies; 7+ messages in thread
From: Taco Hoekwater @ 2005-08-01  9:59 UTC (permalink / raw)



Duncan Hothersall wrote:
> Hello all.
> 
> I have set up page numbering for the bodymatter and appendices of my
> document with:
> \setuppagenumbering[way=bychapter,chapternumber=yes,numberseparator={/}]
> 
> so that \completepagenumber in my footer lines shows, e.g. 1/3 for
> chapter 1 page 3. This works well for the actual page numbering, but in
> the table of contents the separator is shown as the default '-' rather
> than '/', and I can't seem to change it using separator={/},
> numberseparator={/} or anything I can think of.

My guess would be (untested):

   \setuplist [part]                [separator={/}]
   \setuplist [chapter]             [separator={/}]
   \setuplist [section]             [separator={/}]
   \setuplist [subsection]          [separator={/}]
   \setuplist [subsubsection]       [separator={/}]
   \setuplist [subsubsubsection]    [separator={/}]
   \setuplist [subsubsubsubsection] [separator={/}]

Taco

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Getting ToC to match page numbering
@ 2005-08-01  9:38 Duncan Hothersall
  2005-08-01  9:59 ` Taco Hoekwater
  0 siblings, 1 reply; 7+ messages in thread
From: Duncan Hothersall @ 2005-08-01  9:38 UTC (permalink / raw)


Hello all.

I have set up page numbering for the bodymatter and appendices of my
document with:
\setuppagenumbering[way=bychapter,chapternumber=yes,numberseparator={/}]

so that \completepagenumber in my footer lines shows, e.g. 1/3 for
chapter 1 page 3. This works well for the actual page numbering, but in
the table of contents the separator is shown as the default '-' rather
than '/', and I can't seem to change it using separator={/},
numberseparator={/} or anything I can think of.

Can anyone tell me how to get the table of contents to match the pages?

Thanks!

Duncan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-08-02 11:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20050801163617.8E7D7127C9@ronja.ntg.nl>
2005-08-02 11:22 ` Getting ToC to match page numbering Duncan Hothersall
2005-08-01 16:36 Duncan Hothersall
     [not found] <20050801100004.BCAD8127BF@ronja.ntg.nl>
2005-08-01 13:39 ` Duncan Hothersall
2005-08-01 14:46   ` Hans Hagen
     [not found] <20050731204706.7E63E127A8@ronja.ntg.nl>
2005-08-01 10:09 ` Duncan Hothersall
  -- strict thread matches above, loose matches on Subject: below --
2005-08-01  9:38 Duncan Hothersall
2005-08-01  9:59 ` Taco Hoekwater

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