Changes

Jump to navigation Jump to search
6,071 bytes added ,  17:51, 30 January 2021
no edit summary
<cd:commandgroup name="setuphead" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
<cd:shortdesc><!-- a short command summary goes here -->The command <tt>\{{cmd|setuphead</tt> is }} is used for to configure headings and titles.Being structuring elements of any document, the possibilities are quite extensive..</cd:shortdesc>
<cd:variants>
<cd:command category="structure" file="strc-sec.mkiv" interfacedate="2020-06-19T13:41" interfacefile="i-section.xml" level="style" name="setuphead" variantnumber="1">
<cd:parameter name="expansion">
<cd:paramdoc></cd:paramdoc>
<cd:constant type="yes">expands the xml reference to actual content for title and bookmark <code>\xmlatt {xml:name::4}{title}</code> → <code>First section</code>, see TUC file.  To expand userdata also use <code>\normalexpanded{\startsection[title=\xmlatt{#1}{title}]}</code> instead of <code>expansion=yes</code>. <code>\normalexpanded{}</code> and are not in conflict, so you can use both.</cd:constant> <cd:constant default="yes" type="no">no expansion, xml reference is used</cd:constant> <cd:constant type="xml">?</cd:constant>
</cd:parameter>
<cd:parameter name="catcodes">
</cd:parameter>
<cd:parameter name="sectionsegments">
<cd:paramdoc>which level(s) should be included, e. g. when head is numbered. Note, ":" specifies a range (e. g. "chapter:subsubsection")</cd:paramdoc>
<cd:constant type="cd:number"></cd:constant>
<cd:constant method="range" prefix="cd:number" type="cd:number"></cd:constant>
</cd:parameter>
<cd:parameter name="style">
<cd:paramdoc>See manual [https://www.pragma-ade.com/general/manuals/ma-cb-en.pdf#page=81 Context: an excursion" section 33], Fonts and font switches, e.g. for large, bold, sans serif section headers use <code>style=\tfa\bf\ss</code>.</cd:paramdoc>
<cd:constant type="cd:style"></cd:constant>
<cd:constant type="cd:command"></cd:constant>
<cd:parameter name="number">
<cd:paramdoc></cd:paramdoc>
<cd:constant default="yes" type="yes">Include number before chapter/section title</cd:constant> <cd:constant type="no">Do not include number before chapter/section title</cd:constant>
</cd:parameter>
<cd:parameter name="page">
<cd:paramdoc>- 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</cd:paramdoc>
<cd:inherit name="page"></cd:inherit>
</cd:parameter>
</cd:parameter>
<cd:parameter name="header">
<cd:paramdoc>Set a particular header style, see {{cmd|setupheader}}.</cd:paramdoc>
<cd:constant type="start"></cd:constant>
<cd:constant type="stop"></cd:constant>
<cd:parameter name="continue">
<cd:paramdoc></cd:paramdoc>
<cd:constant default="yes" type="yes">If the section immediately follows a chapter it will be on the same page even though page=yes.</cd:constant> <cd:constant type="no">If the section immediately follows a chapter it will start on a new page.</cd:constant>
</cd:parameter>
<cd:parameter name="aligntitle">
<cd:paramdoc></cd:paramdoc>
<cd:constant type="yes">use the current local hsize; flush side float first</cd:constant> <cd:constant default="yes" type="no">use the current global hsize</cd:constant> <cd:constant type="float">use the current local hsize; do not flush side floats</cd:constant>
</cd:parameter>
<cd:parameter name="interlinespace">
</cd:command>
</cd:variants>
<cd:description><!-- To headings is associated the long description text, i.e. the content of the heading, but can also be associated numbers. These data can be processed for typesetting : * add a dot between the text and the number,* add a generic text before the "pure text"* appearance can be different for the text if we use it in the headers / footers, or in the Table of Content.* add vertical spaces before or after the text* add rules before or after the whole section under the heading* select if the command goes here -->title should appear on a right or a left page. 
</cd:description>
<cd:examples><cd:example title="First example"><context source="yes" text="produces">\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</context></cd:example><cd:example title="Big space before a smaller space behind the heading"><context source="yes" text="produces"> \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</context></cd:example><cd:example title="Setting label of a new section head"><context mode="mkiv" source="yes" text="produces">\definehead[mychapter][chapter][bodypartlabel=mychapter] \setuplabeltext[en][mychapter=My Chapter~] \starttext\mychapter{Animals}\stoptext</context></cd:example><cd:example title="Inline headings similar to LaTeX &amp;squo;s `\paragraph{}`">Modified from (https://tex.stackexchange.com/questions/375922/paragraph-title-in-context-similar-to-latex-paragraph). <context mode="mkiv" source="yes" text="produces">\definehead[paragraph][subsubsubsubject]\setuphead [paragraph] [ textdistance=0pt, commandafter={.}, alternative=text, style=sc, ] \startparagraph[title=Knuth quote] \input knuth\stopparagraph</context></cd:example><cd:example title="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): <context mode="mkiv" source="yes" text="because it produces">\setuphead[part][placehead=yes] \starttext\part{A part} \stoptext</context> For MkIV, add <code>bodypartlabel=part</code> to the <code>setuphead</code>: <context mode="mkiv" source="yes">\setuphead[part][placehead=yes, bodypartlabel=part] \starttext\part{A part} \stoptext</context> (Thanks to Wolfgang Schuster on the mailing list for this information.)</cd:example><cd:example title="Example of hidden sections"><context mode="mkiv" source="yes" text="produces">\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</context></cd:example><cd:example title="Modifying the page before a chapter">Here is an example which shows how you can change the background colorof an empty page before the chapter title. <context mode="mkiv" source="yes" text="produces">% next five lines just to show the effect on this wiki\setuppapersize[A8][A5,landscape]\setuppaper[nx=4, ny=2]\setuplayout[page][location=middle, marking=on]\setuparranging [XY]\setupbodyfont[6pt] % actual example starts here\setuppagenumbering [alternative=doublesided] \startsetups [chapter:before] \doifoddpageelse {} {\pushbackground[page] \setupbackgrounds[page][background=color,backgroundcolor=gray] \page[right] \popbackground}\stopsetups \setuphead [chapter] [page=yes, before=\directsetup{chapter:before}] \starttext \startchapter[title={Knuth}]\dorecurse{2}{\samplefile{knuth}}\stopchapter \startchapter[title={Ward}]\dorecurse{1}{\samplefile{ward}}\stopchapter \startchapter[title={Zapf}]\dorecurse{2}{\samplefile{zapf}}\stopchapter  \stoptext</context> The command \pushbackground stores the values of the background which is modified. After the execution of \page[right] the old values of background are restored by \popbackground.</cd:example></cd:examples>
<cd:notes></cd:notes>
<cd:seealso>

Navigation menu