Difference between revisions of "Command/startsection"

From ConTeXt wiki
(Improved readability of description)
(Removed label key from \startsection command)
Line 14: Line 14:
 
   <tr valign="top" class="first">
 
   <tr valign="top" class="first">
 
     <td class="cmd">[[Command/keyword:bookmark|bookmark]]</td>
 
     <td class="cmd">[[Command/keyword:bookmark|bookmark]]</td>
    <td>[[Command/value:text|text]]</td>
 
  </tr>
 
  <tr valign="top" class="first">
 
    <td class="cmd">[[Command/keyword:label|label]]</td>
 
 
     <td>[[Command/value:text|text]]</td>
 
     <td>[[Command/value:text|text]]</td>
 
   </tr>
 
   </tr>

Revision as of 20:14, 25 January 2016

\startsection

Syntax

\startsection[...,...=...,...][...,...=...,...]
bookmark text
list text
marking text
reference ref
title text
[...,...=...,...] user variable assignments

Description

This family of commands are only available in ConTeXt MkIV. They supersede the sectioning commands \part, \chapter, \section, \subsection, \subsubsection, \title, \subject, \subsubject, and \subsubsubject.

The new commands, collectively documented here, are \startpart, \startchapter, \startsection, \startsubsection, \startsubsubsection, \starttitle, \startsubject, \startsubsubject, and \startsubsubsubject. These more verbose commands apply an environment (\start- and \stop-) approach to sectioning, which is more friendly to tagged-PDF, ePUB and XML output.

Sectioning is hierarchical. Numbered parts are divided into numbered chapters, themselves divided into numbered sections, subsections, and subsubsections etc. Chapters and sections etc. have unnumbered counterparts called titles, subjects, subsubjects, and subsubsubjects etc., respectively. (There are actually a couple more sub-levels than listed here.) Chapters start a new page (by default—this is easily configurable). Parts are unusual in two respects: firstly, there is no unnumbered counterpart to parts; and secondly, the title of a part is not typeset automatically, as it will generally require special attention and design.

Additional section types can be defined (based on one of the existing sections) with the \definehead command. A user-defined section type will have its own \start- and \stopsection commands, in addition to a traditional \section command. These new commands will behave as documented here

The typesetting of section types (both built-in and user-defined) can be controlled with the \setupheads and \setuphead commands.

Arguments

The first argument defines the visible and cross-referencing properties of the section. title is the title that will be used to create the section heading. Alternative versions of the title may also be specified: list is used in combined-lists (i.e. the table of contents), and bookmark is used in PDF bookmarks if enabled (see \setupinteraction and \placebookmarks). The main title is used if these are not specified.

reference specifies the reference-key for use with cross-referencing commands (see \at and \in).

The second, optional, argument allows section-local user-variables to be assigned. The values of these variables can be recalled with the \structureuservariable command.

Examples

% mode=mkiv
\setuppapersize[A5]
\starttext

\startsection[
    reference=sec:One,
    title={Section One},
]

For a subsection, see \in{subsection}[sec:Two:Sec].

\stopsection

\startsection[
    reference=sec:Two,
    title={Section Two},
]
[a_variable={some value}]

a_variable=\quote{\structureuservariable{a_variable}}.

\startsubsection[
    reference=sec:Two:Sec,
    title={Here’s a subsection},
]

In this subsection there’s some text\ldots

\stopsubsection
\stopsection
\stoptext

produces

% mode=mkiv
\setuppapersize[A5]
\setuphead[chapter][page=no]
\starttext

\startpart[title={Part}]
\startchapter[title={Chapter}]
\startsection[title={Section}]
\startsubsection[title={Subsection}]
\startsubsubsection[title={Subsubsection}]
\startsubsubsubsection[title={Subsubsubsection}]
\startsubsubsubsubsection[title={Subsubsubsubsection}]

\stopsubsubsubsubsection
\stopsubsubsubsection
\stopsubsubsection
\stopsubsection
\stopsection
\stopchapter
\stoppart
\stoptext

produces

See also

Superseded:

Help from ConTeXt-Mailinglist/Forum

All issues with: