Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In my table of contents, part is defined like this:

\setuplist[part][pagenumber=no]

I would like to center align the title of the part, so it appears like this in the table of contents:

 __________
| Contents |
|          |
|  Part 1  |
| Ch. 1..1 |
| Ch. 2..5 |
| Ch. 3.10 |
|__________|

I have consulted the article about setuplist at the ConTeXt wiki, but I can see no options for horizontally aligning the entries.

  • How can I center align the part entries in the table of contents?
share|improve this question
1  
Does \setuplist [part] [ pagenumber=no, alternative=a, align=middle, ] achieve what you want? –  phg May 12 '12 at 1:18
    
This almost centers the entries, but it is to the right of center. –  Village May 12 '12 at 14:04
add comment

1 Answer

up vote 1 down vote accepted

Defining a dedicated list alternative may be the wisest choice:

\unprotect

%%% We’ll wrap the header title into a frame for convenience.
\defineframed [centered_list_frame] [
  frame=off,
  width=broad,
  align=middle,
]

%%% A new list alternative employing the frame. The three args are:
%%% #1 -> Item number.
%%% #2 -> Item title.
%%% #3 -> Page number (ignored in this example).
\definelistplacement [centered_list_placement]#1#2#3{%
  \centered_list_frame{\words\sc Part #1:\hskip\emwidth#2}%
}

%%% Here instruct the part list to use the new list alternative.
\setuplist [part] [alternative=centered_list_placement,]

\protect

\starttext

\placelist [part,chapter]

\dorecurse{3} {\part{foo} \dorecurse{5}{\chapter{bar}}}

\stoptext

This way you have complete control over the three items that constitute the TOC entry and can center align them at will.

centered part list header

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.