Difference between revisions of "Titles"

From Wiki
Jump to navigation Jump to search
(forgot to login and a piece of code...)
(Added formatted page numbering notes)
Line 79: Line 79:
  
 
To have some parts of your title texts ''not'' appear in the table of contents, use <cmd>nolist</cmd> and have a look at http://www.pragma-ade.com/general/magazines/mag-0001.pdf.
 
To have some parts of your title texts ''not'' appear in the table of contents, use <cmd>nolist</cmd> and have a look at http://www.pragma-ade.com/general/magazines/mag-0001.pdf.
 +
 +
==Page numbering in tables of contents==
 +
 +
If you have a special page numbering style it won't automatically be reflected in the table of contents. You need to set the parameters of the table of contents separately. For example,
 +
 +
<texcode>
 +
\starttext
 +
\startfrontmatter
 +
\placecombinedlist[MyContentsList]
 +
\stopfrontmatter
 +
\startbodymatter
 +
\setuppagenumbering[way=bychapterleft=A,chapternumber=yes,numberseparator=/]
 +
...
 +
\stopbodymatter
 +
</texcode>
 +
 +
will give you pagenumbering such as A1/1, A1/2 etc. on the pages in the bodymatter. In the table of contents, however, these will show up as 1-1, 1-2 etc. The ToC needs to be formatted separately.
 +
 +
To get a prefix to the page numbering (like "A"), use
 +
 +
<texcode>
 +
\def\ChapterPrefix#1{A#1}
 +
\setuplist[chapter][pagecommand=\ChapterPrefix]
 +
</texcode>
 +
 +
To get the numberseparator working, you need to know that the ToC will use the separator that is active ''at the time the ToC is output''. So you need to set it immediately before you call the ToC command, e.g.
 +
 +
<texcode>
 +
\setuppagenumbering[numberseparator=/]
 +
\placecombinedlist[MyContentsList]
 +
</texcode>

Revision as of 08:37, 2 August 2005

< Structurals | Visuals >

Default

numberedunnumbered
\part--
\chapter\title
\section\subject
\subsection\subsubject
\subsubsection\subsubsubject
......

Every heading command can take an optional parameter as reference:

\title[hasselt-by-night]{Hasselt by night}

The bracket pair is optional and used for internal References. If you want to refer to this header you type for example

\at{page}[hasselt-by-night].

(see \at)

Of course you can switch off numbering even for a "numbered" title, see \setuphead.

Your own title styles

Sometimes the possibilities of \setuphead aren't enough. Just define your own styling command like this:

\def\MyChapterCommand#1#2{\framed[frame=off, bottomframe=on, topframe=on]{\headtext{chapter} \vbox{#1\blank#2}}}
% #1 is number, #2 is text
% \vbox is needed for \blank to work
\setuphead[chapter][command=\MyChapterCommand, style={\ss\bfa}]
\setupheadtext[chapter=Chapter]

so \chapter{My First Chapter} looks like:

Your own titling levels

Of course you can define your own titling commands and probably must adapt the default settings.

\definehead[myheader][section]

\setuphead[myheader]
[numberstyle=bold,
textstyle=cap,
before=\hairline\blank,
after=\nowhitespace\hairline]

\myheader[hasselt-ref]{Hasselt makes headlines}

A new header \myheader is defined and it inherits the properties of section (title, subject, whatever). You can "define" several headers at once!


Table(s) of Contents

Default:

\completecontent % with title
\placecontent % without title

Define your own tables of somewhat with \definelist and \setuplist!

To have some parts of your title texts not appear in the table of contents, use \nolist and have a look at http://www.pragma-ade.com/general/magazines/mag-0001.pdf.

Page numbering in tables of contents

If you have a special page numbering style it won't automatically be reflected in the table of contents. You need to set the parameters of the table of contents separately. For example,

\starttext
\startfrontmatter
\placecombinedlist[MyContentsList]
\stopfrontmatter
\startbodymatter
\setuppagenumbering[way=bychapterleft=A,chapternumber=yes,numberseparator=/]
...
\stopbodymatter

will give you pagenumbering such as A1/1, A1/2 etc. on the pages in the bodymatter. In the table of contents, however, these will show up as 1-1, 1-2 etc. The ToC needs to be formatted separately.

To get a prefix to the page numbering (like "A"), use

\def\ChapterPrefix#1{A#1}
\setuplist[chapter][pagecommand=\ChapterPrefix]

To get the numberseparator working, you need to know that the ToC will use the separator that is active at the time the ToC is output. So you need to set it immediately before you call the ToC command, e.g.

\setuppagenumbering[numberseparator=/]
\placecombinedlist[MyContentsList]