Command/setuphead
\setuphead
Syntax
Description
- style: See manual "Context: an excursion" section 31.3 Style and size switch in commands, e.g. for large, bold, sans serif section headers use 'style=\tfa\bf\ss'.
- page
- yes: The section header must be on the top of a new page
- left: The section header must be on the top of an even page
- right: The section header must be on the top of an odd page
- number
- yes: Include number before chapter/section title
- no: Do not include number before chapter/section title
- continue
- yes: If the section immediately follows a chapter it will be on the same page even though page=yes.
- no: If the section immediately follows a chapter it will start on a new page.
- header/footer: Set a particular header style, see \setupheader.
- sectionsegments: which level(s) should be included, e. g. when head is numbered. Note, ":" specifies a range (e. g. "chapter:subsubsection")
- aligntitle
- yes: use the current local hsize; flush side float first
- no: use the current global hsize
- float: use the current local hsize; do not flush side floats
Example
\setuppapersize[A5] \setuplabeltext[chapter=CHAPTER~] \setuphead[chapter][ header=empty, alternative=middle, style=bold, numbercommand=\groupedcommand{}{\blank[2cm]}, after={\blank[3cm]}, ] \starttext \chapter{Title of chapter} The first paragraph begins 3 cm below the title. In this chapter, we will discuss... \stoptext
produces
More examples
A big space before a smaller space behind the heading:
\setuphead [subject] [before={\blank[2*big]}, after={\blank[big]}, style=bold] \starttext \subject{Headline 1} text text text text text text text text text text text text text text text vtext text text text text text text text text text text text text\par \subject{Headline 2} text text text text text text text text text text text text text text text vtext text text text text text text text text text text text text\par \stoptext
produces
Setting label of a new section head
\definehead[mychapter][chapter][bodypartlabel=mychapter] \setuplabeltext[en][mychapter=My Chapter~] \starttext \mychapter{Animals} \stoptext
produces
Setting label of a part
In MkIV, if you want parts to be labeled as "Part 1" etc., the following isn't sufficient (but works in MkII):
\setuphead[part][placehead=yes] \starttext \part{A part} \stoptext
because it produces
For MkIV, add bodypartlabel=part
to the setuphead
:
\setuphead[part][placehead=yes, bodypartlabel=part] \starttext \part{A part} \stoptext
(Thanks to Wolfgang Schuster on the mailing list for this information.)
\setupheadnumber[section] [8] \setupheadnumber[subsection] [3] \setupheadnumber[subsubsection][5] \setuphead[section,subsection][placehead=hidden] \setuphead[subsubsection] [placehead=yes] \starttext \section{} % hidden 8th section \subsection{} % hidden 3rd section \subsubsection{This is complete numbering of subsubsection} % view 9.4.6 subsubsection \stoptext
produces
Modifying the page before a chapter
Here is an example which shows how you can change the background color of an empty page before the chapter title.
\setuppagenumbering [alternative=doublesided] \startsetups [chapter:before] \doifoddpageelse {} {\pushbackground[page] \setupbackgrounds[page][background=color,backgroundcolor=black] \page[empty,right] \popbackground} \stopsetups \setuphead [chapter] [page=yes, before=\directsetup{chapter:before}] \starttext \startchapter[title={Knuth}] \dorecurse{10}{\samplefile{knuth}} \stopchapter \startchapter[title={Zapf}] \dorecurse{10}{\samplefile{zapf}} \stopchapter \startchapter[title={Ward}] \dorecurse{10}{\samplefile{ward}} \stopchapter \stoptext
produces
Sadly the output does not show the effect here. Copy the code into a file to see the background change.
The command \pushbackground stores the values of the background which is modified. After the execution of \page[empty,right] the old values of background are restored by \popbackground.
See also
Help from ConTeXt-Mailinglist/Forum
All issues with: