Changes

Jump to navigation Jump to search
3,800 bytes added ,  17:51, 30 January 2021
no edit summary
<cd:commandgroup name="setuphead" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
<cd:shortdesc>Former wiki page [[Command_old/{{cmd|setuphead]] is under migration }} is used to ConTeXtXML extension [[Command#Pre-existing_pages]]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="style">
<cd:paramdoc>See manual "[https://www.pragma-ade.com/general/manuals/ma-cb-en.pdf#page=81 Context: an excursion" section 31.3 Style 33], Fonts and size switch in commandsfont 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: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~]
\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