Command/setuphead

From ConTeXt wiki

\setuphead

Syntax

\setuphead[...,...,...][...,...=...,...]
[...,...,...] IDENTIFIER
default SECTION
section SECTION
coupling SECTION
sectionnumber yes no
textstyle normal bold slanted boldslanted type cap small... COMMAND
textcolor IDENTIFIER
numberstyle normal bold slanted boldslanted type cap small... COMMAND
numbercolor IDENTIFIER
style normal bold slanted boldslanted type cap small... COMMAND
color IDENTIFIER
beforesection COMMAND
aftersection COMMAND
prefix IDENTIFIER + -
incrementnumber yes no list file
placehead yes no empty hidden
alternative normal paragraph inmargin margin middle top bottom IDENTIFIER TEXT
expansion yes no xml COMMAND
xmlsetup IDENTIFIER
catcodes IDENTIFIER
sectionresetset IDENTIFIER
sectionseparatorset IDENTIFIER
sectionconversionset IDENTIFIER
conversion A conversion; see \convertnumber
sectionstarter TEXT
sectionstopper TEXT
sectionset IDENTIFIER
sectionsegments NUMBER NUMBER:NUMBER SECTION SECTION:SECTION
distance DIMENSION Space between number and title text
textdistance DIMENSION Space between title and the following text
before COMMAND
inbetween COMMAND
after COMMAND
page inherits from \page
marking page reset
number yes no
continue yes no
aligntitle yes no float
interlinespace inherits from \setupinterlinespace
ownnumber yes no
commandbefore COMMAND
commandafter COMMAND
deeptextcommand \...#1
numbercommand \...#1
deepnumbercommand \...#1
command \...#1#2
interaction list reference
internalgrid normal standard yes strict tolerant top bottom both broad fit first last high low line strut max min IDENTIFIER
align inherits from \setupalign left right middle normal
tolerance inherits from \setuptolerance
strut yes no
hang none lines broad fit NUMBER line
grid normal standard yes strict tolerant top bottom both broad fit first last high low line strut max min IDENTIFIER
indentnext yes no auto
width DIMENSION
numberwidth DIMENSION
textwidth DIMENSION
margintext yes no
margin DIMENSION
frontpartlabel IDENTIFIER
bodypartlabel IDENTIFIER
appendixlabel IDENTIFIER
backpartlabel IDENTIFIER
header none empty high nomarking
text none empty high nomarking
footer none empty high nomarking
textcommand \...#1
resetnumber yes no
file IDENTIFIER
[...,...=...,...] inherits from \setupheads

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 immeadiately follows a chapter it will be on the same page even though page=yes.
    • no: If the section immeadiately 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")


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

Example of hidden sections

\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

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: