Difference between revisions of "Titles"

From Wiki
Jump to navigation Jump to search
(added some text; changed order of items, because "own styles" got too big)
(→‎Titling Style: How to change section numbers to characters)
Line 39: Line 39:
see <cmd>setupsection</cmd> on modifying how the number appears.
To make the section numbers appear as characters, do
The <code>section-3</code> corresponds to <code>section</code>. Similarly,
<code>section-1</code> corresponds to <code>part</code>, <code>section-2</code> corresponds to <code>chapter</code> and so on.
==Your Own Titling Levels==
==Your Own Titling Levels==

Revision as of 18:39, 5 February 2006

< Structurals | Visuals >


Titles define the structure of your document. Decide yourself, how deep you want to nest them:


The "unnumbered" versions don't appear in a table of contents! But you can switch off the numbering of the "numbered" versions with \setuphead to get unnumbered titles and a toc (confusing?).

Referencing Titles

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


(see \at)

Titling Style

see \setuphead and some enhanced samples below.

A FAQ is how to get a line under the title:


see \setupsection on modifying how the number appears. To make the section numbers appear as characters, do


The section-3 corresponds to section. Similarly, section-1 corresponds to part, section-2 corresponds to chapter and so on.

Your Own Titling Levels

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



\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


\completecontent % with title
\placecontent % without title

Define your own "table of somewhat" with \definelist and \setuplist! You can "collect" several section levels in one list using \definecombinedlist, that's even explained in "ConTeXt, an excursion" (see Official_ConTeXt_Documentation).

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,

\setuppagenumbering[way=bychapter, left=A, chapternumber=yes, numberseparator=/]

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


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.


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]{\vbox{\headtext{chapter} #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] % used by \headtext

so \chapter{My First Chapter} looks like:

A complex graphical element under the chapter title

    numeric w, h, repeats;
    path p[];
    w := OverlayWidth ; h := OverlayHeight ;
    repeats := abs(TextWidth/BodyFontSize);
    p[1] := unitsquare xscaled w yscaled h ;
    draw p[1] withcolor white;
    p[2] := fullcircle scaled BodyFontSize;
    p[3] := fullcircle scaled .25BodyFontSize;
    draw p[2] shifted (.5BodyFontSize,0);
    for i = 1 upto repeats:
        if odd i :
            filldraw p[3] shifted (i*BodyFontSize+.5BodyFontSize,0);
        else :
            draw p[2] shifted (i*BodyFontSize+.5BodyFontSize,0);


        [width= \overlaywidth,
            \headtext{chapter} #1

   \chapter{Here we go!}

It looks like: