# [NTG-context] Setup for appendices: a bunch of questions

Wolfgang Schuster schuster.wolfgang at gmail.com
Thu Feb 5 12:42:42 CET 2015

> Am 04.02.2015 um 22:06 schrieb Mojca Miklavec <mojca.miklavec.lists at gmail.com>:
>
> Hello,
>
> I need a tiny bit of help with properly setting up the appendices.
>
> 1.) I would like to include both chapters and titles. Is this the
> proper way to go? (It took me a while to figure out how to include the
> titles at all.)
>
>        [title]
>        [incrementnumber=list]
>    \placelist
>        [title,chapter,section]
>        [criterium=all,alternative=c]
>
> But why is there less space in front of a \title{...} in TOC than in
> front of a \chapter{…}?

You can use the “margin” key to indent the title entries but unnumbered chapter are still wrong aligned.

> 2.) How can I define a different width for appendices in TOC (to
> reserve enough space for the word "Appendix")?
>
> I use
>
> \setuplist
>    [section]
>    [width=10mm,numberstyle=\os\bf,pagestyle=\os,label=yes]
>
> but I would like to use "width=27mm" for sections inside
> \startappendices ... \stopappendices than for regular sections. Is
> there any workaround?

Use the “numbercommand” key to measure the width of the number
and apply different widths for narrow and wide entries.

> 3.) For appendices I want to set
>
>    [chapter]
>    [number=no]
>    [section]
>    [page=yes,sectionsegments=section,conversion=Character,sectionstopper=:]
>
> without affecting regular sections and chapters.
>
> Is it possible to do this on top of the document (or in the layout) as
> opposed to changing the settings just before appendices start? I would
> like to avoid messing up with such settings in the middle of the
> document.

Use \startsectionblockenvironment to set the setups at the begin of the document.

> I tried to play with
>    \defineconversionset
> and
>    \setupsectionblock
>        [appendix]
>        [sectionconversionset=...]
> but I'm unable to understand how these commands work exactly.

Take a look at the example below how this can be achieved.

%%%% begin example

\setuplabeltext
[appendix=Appendix~]

[title]
[incrementnumber=list,page=yes]

[chapter]
[page=no,numberstyle=\os]

[section]
[style=\bfb,numberstyle=\os,appendixlabel=appendix]

\setuplist
[title,chapter]
[width=10mm,textstyle=\sc\bfb,numberstyle=\os\bfb,pagestyle=\os,aligntitle=no]

\setuplist
[title]
[margin=10mm]

\define[1]\SectionlistNumber
{\dowithnextbox
{\ifdim\nextboxwd<10mm
\simplealignedbox{10mm}{flushleft}{\flushnextbox}%
\else
\simplealignedbox{27mm}{flushleft}{\flushnextbox}%
\fi}
\hbox{#1}}

\setuplist
[section]
[width=0pt,numberstyle=\os\bf,pagestyle=\os,label=yes,numbercommand=\SectionlistNumber]

% The \defineconversionset command allows you to define
% different conversion for each sectionblock in your
% document by adding the name of the sectionblock in
% front of the name of the conversion set.

\defineconversionset [bodypart:sectioncounter] [n,n,n] [n]
\defineconversionset [appendix:sectioncounter] [n,n,A] [n]

% With the sectionblock environment you can list setups
% which are applied at the begin of the specified block
% in your document, e.g. the following setups are used
% after \startappendices:

\startsectionblockenvironment[appendix]

[chapter]
[number=no]

[section]
[page=yes,
sectionsegments=section,
sectionstopper=:]

\stopsectionblockenvironment

\setupbodyfont[palatino]

\starttext

\startfrontmatter

\title{Contents}
\placelist[title,chapter,section][criterium=all,alternative=c]

Why is there less space in front of a title in TOC than in front of a chapter?

How to define a different width for appendices (to reserve enough space for the word "Appendix")?

\stopfrontmatter

\startbodymatter

\chapter{First Chapter}
\section{First Section}
\chapter{Second Chapter}
\section{Second Section}

\stopbodymatter

\startappendices

\chapter{Appendices}

\section{First Appendix}
\input tufte

\section{Second Appendix}
\input zapf

\title{Why is there less space in toc?}

\stopappendices

\stoptext

%%%% end example

Wolfgang