Changes

Jump to navigation Jump to search
6,128 bytes added ,  12:54, 8 June 2020
m
no edit summary
< [[Structurals]] | [[Visuals]] >
 
==Default==
|}
The unnumbered versions don't appear in a table of contents! To change that, see the section on[[#Unnumbered_titles_in_table_of_contents|Unnumbered titles in the table of contents]].
Also note that in the front matter of the document, all titles are unnumbered by default. The titles from the 'numbered' category still show up in the table of contents, though, and the titles from the 'unnumbered' category still don't.
<texcode>
\at{page}[hasselt-by-night].
</texcode>
(see See {{cmd|at}})</texcode>.
Note that reference labels are limited to ASCII characters in traditional TeX.
This limitation has been removed in ConTeXt mkiv.
 
==New MkIV Sectioning==
 
ConTeXt MkIV adds several new commands which supersede the older {{cmd|chapter}}, {{cmd|section}} etc. The new commands are more verbose, but also more flexible, and allow better support for tagged-PDF, XML and ePUB output.
 
{| class=wikitable
! Traditional !! New
|-
| {{cmd|part}} || {{cmd|startpart}}
|-
| {{cmd|chapter}} || {{cmd|startchapter}}
|-
| {{cmd|section}} || {{cmd|startsection}}
|-
| {{cmd|subsection}} || {{cmd|startsubsection}}
|-
| {{cmd|subsubsection}} || {{cmd|startsubsubsection}}
|-
| {{cmd|title}} || {{cmd|starttitle}}
|-
| {{cmd|subject}} || {{cmd|startsubject}}
|-
| ... || ...
|}
 
Each of these start-commands has a corresponding stop-command which should be used at the end of the section. For example:
 
<context mode=mkiv source=yes text=produces>
% mode=mkiv
\setuppapersize[A5]
 
\section[sec:old]{Old Section}
 
This is an old-style \ConTeXt\ section.
 
\startsection
[
title={New Section},
reference=sec:new,
]
 
This is a new-style section.
\stopsection
</context>
 
The following keys are available for the start-commands:
 
{| class=wikitable
! Key !! Description
|-
| reference= || The reference key for cross-referencing (with {{cmd|at}}, {{cmd|in}} etc.)
|-
| title= || The title of the section
|-
| list= || The title to show in the table of contents, if different
|-
| bookmark= || The title to show in the PDF bookmarks, if different
|-
| marking= || The title to use in the section marking, if different
|-
| label= || ?
|}
 
It is also possible to set per-section variables, and retrieve them with the {{cmd|structureuservariable}} command:
 
<context mode=mkiv source=yes text=produces>
% mode=mkiv
\setuppapersize[A5]
 
\startchapter[title={Foo Bar}][foo=bar]
 
foo is \quote{\structureuservariable{foo}}
 
\stopchapter
 
</context>
==Titling Style==
Using {{cmd|setuppagenumbering|2=[alternative=doublesided]}} makes the chapters start
on the right page. However, the blank page is not truely truly empty, it contains headers andfooters. To get truely truly empty pages, use the following
<texcode>
% Redefine the toc list to include titles
\definecombinedlist[content][title, section]
</texcode>
 
== Complete Section Numbering ==
 
You might have documents in which your sections don’t follow the structure, such as in:
 
<texcode>
\section{A}
%\subsection{B}
\subsubsection{C}
</texcode>
 
In that case, you would get <code>1 A</code> <code>1 C</code>. To enable complete section numbering, you would need in this case (using a beta after 2017.08.07 11:30):
 
<texcode>
\setuphead[subsection][criterium=all]
</texcode>
<context source=yes>
\setuppapersize[A5]
\defdefine[2]\MyChapterCommand#1#2%
{\framed[frame=off,bottomframe=on,topframe=on]
{\vbox{\headtext{chapter} #1\blank#2}}}
\defineoverlay[HeaderDeco][\uniqueMPgraphic{HeaderDeco}]
\defdefine[2]\Myheader#1#2{%
\framedtext
[width= \overlaywidth,
\chapter{Here we go!}
\stoptext
</context>
 
===Title page with special background===
 
If you want the title page of every chapter to have a special background (different from the background of normal pages), here's a very effective trick that Hans has provided on the mailing list. In addition, this will give every chapter its own color scheme (Mkiv only, hence won't compile on contextgarden):
 
<context source=yes>
\startMPinclusions
numeric MyTitlePageDone[] ;
\stopMPinclusions
 
\startuseMPgraphic{background:normal}
StartPage ;
fill (topboundary Page -- cycle) enlarged(0,5mm)
shifted (0,-5mm) withcolor blue ;
StopPage ;
\stopuseMPgraphic
 
\defineoverlay
[background:normal]
[\useMPgraphic{background:normal}]
 
\startuseMPgraphic{background:title}
if unknown MyTitlePageDone.\namedstructureuservariable{chapter}{mycolor} :
StartPage ;
fill ((topboundary Page --cycle) enlarged(0,5mm)) shifted (0,-20mm)
withcolor \MPcolor{color:title:\namedstructureuservariable{chapter}{mycolor}} ;
StopPage ;
MyTitlePageDone.\namedstructureuservariable{chapter}{mycolor} := 1 ;
fi ;
\stopuseMPgraphic
 
\defineoverlay
[background:title]
[\useMPgraphic{background:title}]
 
\setupbackgrounds
[page]
[background={background:normal,background:title}]
 
\definecolor [color:title:one] [red]
\definecolor [color:title:two] [blue]
 
\starttext
 
\startchapter[title=One][mycolor=one] \input tufte \page \input knuth \stopchapter
\startchapter[title=Two][mycolor=two] \input tufte \page \input knuth \stopchapter
 
\stoptext
 
</context>
[alternative=text,distance=0pt,command=\MyHead,style=\sc]
\defdefine[2]\MyHead#1#2{\inmargin{#1 #2}}
\starttext
[command=]
\defdefine[2]\MySectionCommand#1#2%
{\externalfigure[section-\currentheadnumber]}
</texcode>
===Section head without chapter number ===
 
If you only want the section number (in mark IV) in the section title you add
 
 
 
<texcode>
\setuphead[section][sectionsegments=section]
\starttext
\chapter{Eric}
\section{Foo 1}
\subsection{Bar one}
\section{Foo 2}
\stoptext
</texcode>
 
But as once you changed one you have to change the lower ones.
So you have to add the definition of sectionsegments in subsection, subsubsection, ...
 
<texcode>
\setuphead[section][sectionsegments=section]
\setuphead[subsection][sectionsegments=section:subsection]
\setuphead[subsubsection][sectionsegments=section:subsubsection]
 
\starttext
\chapter{Eric}
\section{Foo 1}
\subsection{Bar one}
\subsubsection{Barbar one }
\subsubsection{Barbar two}
\subsection{Bar two}
\subsubsection{Barbar one}
\subsubsection{Barbar two}
\section{Foo 2}
\subsection{Bar one}
\subsubsection{Barbar one}
\subsubsection{Barbar two}
\stoptext
</texcode>
 
It's not written here but you can also change the conversion of the numbering with
 
<texcode>
\definestructureconversionset[mySet][A,R,n,n,a,r][n]
\setuphead[chapter,section,subsection,subsubsection,subsubsubsection][sectionconversionset=mySet]
</texcode>
 
The parameters in definestructureconversionset are
 
the set name
 
the codes for conversion (one for each level)
 
the default conversion for the missing level
 
You can find the conversions codes at [http://wiki.contextgarden.net/Conversions]
 
===Editing Bold Math in Section Titles===
 
When a section title is formatted in boldface text, this doesn't automatically typeset embedded math in bold. This is probably a good thing, as many math fonts do not include all characters in boldface, and often authors use boldface to distinguish between different meanings (for instance, scalar and vector variables). However, in some cases, it <i>is</i> desirable to format the math in the section titles in boldface.
 
Here a very simple example:
<texcode>
\definetypeface[boldmath][mm][boldmath][latin-modern][default]
\setuphead[section][style=\boldmath\rm\bfa]
\starttext
\section{Bold $a^2+b^2=c^2$ {\em bla}}
text: not bold $a^2+b^2=c^2$ {\em bla}
\stoptext
</texcode>
 
<context>
\definetypeface[boldmath][mm][boldmath][latin-modern][default]
\setuphead[section][style=\boldmath\rm\bfa]
\starttext
\section{Bold $a^2+b^2=c^2$ {\em bla}}
text: not bold $a^2+b^2=c^2$ {\em bla}
\stoptext
</context>
 
[[Category:Basics]]
[[Category:Fonts]]
[[Category:Graphics]]
[[Category:Text elementsMath]]table> /td>

Navigation menu