Difference between revisions of "Command/setuplist"
< Command
Jump to navigation
Jump to search
(Created page with "Documentation for \setuplist") |
BruceH2020 (talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 28: | Line 28: | ||
</cd:parameter> | </cd:parameter> | ||
<cd:parameter name="criterium"> | <cd:parameter name="criterium"> | ||
− | <cd:paramdoc></cd:paramdoc> | + | <cd:paramdoc>Default criterium is <cd:iref name="criterium" type="local"/> for a newly defined list. That can cause an empty {{cmd|placelist}}. Criterium <cd:iref name="criterium" type="component"/> is used to establish [http://wiki.contextgarden.net/Table_of_Contents#ToC_.28and_other_lists.29_via_project_structures ToC (and other lists) via project structures].</cd:paramdoc> |
<cd:constant default="yes" type="local"></cd:constant> | <cd:constant default="yes" type="local"></cd:constant> | ||
<cd:constant type="intro"></cd:constant> | <cd:constant type="intro"></cd:constant> | ||
Line 51: | Line 51: | ||
</cd:parameter> | </cd:parameter> | ||
<cd:parameter name="width"> | <cd:parameter name="width"> | ||
− | <cd:paramdoc></cd:paramdoc> | + | <cd:paramdoc>The width of the heading number (which is left aligned).</cd:paramdoc> |
<cd:constant type="fit"></cd:constant> | <cd:constant type="fit"></cd:constant> | ||
<cd:constant type="broad"></cd:constant> | <cd:constant type="broad"></cd:constant> | ||
Line 133: | Line 133: | ||
</cd:parameter> | </cd:parameter> | ||
<cd:parameter name="margin"> | <cd:parameter name="margin"> | ||
− | <cd:paramdoc></cd:paramdoc> | + | <cd:paramdoc>Extra indent between the margin (where text would normally start) and the heading number.</cd:paramdoc> |
<cd:constant type="none"></cd:constant> | <cd:constant type="none"></cd:constant> | ||
<cd:constant type="cd:dimension"></cd:constant> | <cd:constant type="cd:dimension"></cd:constant> | ||
</cd:parameter> | </cd:parameter> | ||
<cd:parameter name="distance"> | <cd:parameter name="distance"> | ||
− | <cd:paramdoc></cd:paramdoc> | + | <cd:paramdoc>The gap between the heading number and the heading.</cd:paramdoc> |
<cd:constant type="none"></cd:constant> | <cd:constant type="none"></cd:constant> | ||
<cd:constant type="cd:dimension"></cd:constant> | <cd:constant type="cd:dimension"></cd:constant> | ||
Line 175: | Line 175: | ||
</cd:parameter> | </cd:parameter> | ||
<cd:parameter name="interaction"> | <cd:parameter name="interaction"> | ||
− | <cd:paramdoc></cd:paramdoc> | + | <cd:paramdoc>what part of content line should be interactive if {{cmd|setupinteraction|2=[state=start]}}</cd:paramdoc> |
<cd:constant type="yes"></cd:constant> | <cd:constant type="yes"></cd:constant> | ||
<cd:constant type="no"></cd:constant> | <cd:constant type="no"></cd:constant> | ||
Line 240: | Line 240: | ||
<cd:constant type="command"></cd:constant> | <cd:constant type="command"></cd:constant> | ||
<cd:constant type="all"></cd:constant> | <cd:constant type="all"></cd:constant> | ||
− | <cd:constant type="title"></cd:constant> | + | <cd:constant type="title">sorts the list by title</cd:constant> |
</cd:parameter> | </cd:parameter> | ||
<cd:parameter name="alternative"> | <cd:parameter name="alternative"> | ||
− | <cd:paramdoc></cd:paramdoc> | + | <cd:paramdoc>Overall layout of the list. The alternatives a, b, c, etc. are predefined. The most flexible solution to implement a custom layout is to define a new custom one which can be set as argument to alternative, see {{cmd|definelistalternative}} for exact details.</cd:paramdoc> |
− | <cd:constant type="a"></cd:constant> | + | <cd:constant type="a">number – title – pagenumber</cd:constant> |
− | <cd:constant default="yes" type="b"></cd:constant> | + | <cd:constant default="yes" type="b">number – title – spaces – pagenumber</cd:constant> |
− | <cd:constant type="c"></cd:constant> | + | <cd:constant type="c">number – title – dots – pagenumber</cd:constant> |
− | <cd:constant type="d"></cd:constant> | + | <cd:constant type="d">number – title – pagenumber (continuous)</cd:constant> |
− | <cd:constant type="e"></cd:constant> | + | <cd:constant type="e">title (framed)</cd:constant> |
− | <cd:constant type="f"></cd:constant> | + | <cd:constant type="f">title (left, middle or right aligned)</cd:constant> |
− | <cd:constant type="g"></cd:constant> | + | <cd:constant type="g">title (centered)</cd:constant> |
<cd:constant type="left"></cd:constant> | <cd:constant type="left"></cd:constant> | ||
<cd:constant type="right"></cd:constant> | <cd:constant type="right"></cd:constant> | ||
<cd:constant type="top"></cd:constant> | <cd:constant type="top"></cd:constant> | ||
<cd:constant type="bottom"></cd:constant> | <cd:constant type="bottom"></cd:constant> | ||
− | <cd:constant type="command"></cd:constant> | + | <cd:constant type="command">use with own 3-parameter macro, e.g <code>command=\MyListEntry</code>. removes linking and bookmarks in the parameters, unless added by the supplied macro.</cd:constant> |
<cd:constant type="none"></cd:constant> | <cd:constant type="none"></cd:constant> | ||
− | <cd:constant type="interactive"></cd:constant> | + | <cd:constant type="interactive">use with own 3-parameter macro <code>command=\MyListEntry</code>. keeps linking and bookmarks in the parameters.</cd:constant> |
<cd:constant type="paragraph"></cd:constant> | <cd:constant type="paragraph"></cd:constant> | ||
<cd:constant type="horizontal"></cd:constant> | <cd:constant type="horizontal"></cd:constant> | ||
Line 323: | Line 323: | ||
<cd:description><!-- the long description of the command goes here --> | <cd:description><!-- the long description of the command goes here --> | ||
</cd:description> | </cd:description> | ||
− | <cd:examples></cd:examples> | + | <cd:examples><cd:example title="Unnumbered ToC items, with some shift">Sometimes we need to insert unnumbered items into the ToC, and to specify them horizontal shift to "keep the look" of the other (numbered) items. Here "margin" option comes into play: |
+ | |||
+ | <context source="yes"> | ||
+ | \setuppapersize[A7,landscape] | ||
+ | \setuplist[alternative=c] | ||
+ | |||
+ | \setuphead[subsubsection][number=no] | ||
+ | \setuplist[subsubsection][margin=20mm] | ||
+ | |||
+ | \starttext | ||
+ | \placecontent | ||
+ | \hairline | ||
+ | \section{Section} | ||
+ | \subsection{Subsection} | ||
+ | \subsubsection{Subsubsection} | ||
+ | \stoptext | ||
+ | </context> | ||
+ | </cd:example><cd:example title="Use different alternatives for different levels in the same ToC">You can use different alternatives for different levels. | ||
+ | |||
+ | <context source="yes"> | ||
+ | \setuppapersize[A7,landscape] | ||
+ | \setuplist[alternative=c] | ||
+ | \setuplist[subsection][alternative=d] | ||
+ | |||
+ | \starttext | ||
+ | \placecontent | ||
+ | \hairline | ||
+ | \section{Section} | ||
+ | \subsection{Subsection} | ||
+ | \subsubsection{Subsubsection} | ||
+ | \stoptext | ||
+ | </context></cd:example><cd:example title="Left-hand page numbers">The following example positions the page number to the left of the list entry title: | ||
+ | |||
+ | <texcode> | ||
+ | \define[3]\SectionToCEntry{ | ||
+ | \leftaligned\bgroup | ||
+ | \hbox to 2em{#3}% | ||
+ | \hskip 1em | ||
+ | \vtop{\hsize\dimexpr\textwidth-3em\relax#2}% | ||
+ | \egroup | ||
+ | } | ||
+ | |||
+ | \setuplist | ||
+ | [section] | ||
+ | [alternative=interactive, | ||
+ | command=\SectionToCEntry, | ||
+ | after=\endgraf] | ||
+ | </texcode> | ||
+ | |||
+ | The <code>alternative=interactive</code> is required to maintain hyperlinked page numbers when links are enabled in the document. Without the <code>after=\endgraf</code> items would be displayed on one line.</cd:example><cd:example title="Using tabular numbers">In a long TOC it looks awkward if proportional numbers are used. It is better to enable the font feature tabularnumbers: | ||
+ | |||
+ | <texcode> | ||
+ | \setuplist | ||
+ | [chapter] | ||
+ | [pagestyle={\feature[+][tabularnumbers]}] | ||
+ | </texcode></cd:example></cd:examples> | ||
<cd:notes></cd:notes> | <cd:notes></cd:notes> | ||
<cd:seealso> | <cd:seealso> | ||
Line 336: | Line 391: | ||
<cd:commandref name="setupcombinedlist"></cd:commandref> | <cd:commandref name="setupcombinedlist"></cd:commandref> | ||
<cd:commandref name="definecombinedlist"></cd:commandref> | <cd:commandref name="definecombinedlist"></cd:commandref> | ||
− | <cd:commandref name="definelistalternative"></cd:commandref></cd:seealso> | + | <cd:commandref name="definelistalternative"></cd:commandref> |
+ | <cd:wikipage page="Table of Contents"></cd:wikipage></cd:seealso> | ||
</cd:commandgroup> | </cd:commandgroup> |
Latest revision as of 21:03, 6 October 2022
Contents
\setuplist
Summary
The command \setuplist configures collected lists like for the TOC
Settings
\setuplist[...,...][...=...,...] | |
[...,...] | list |
state | start stop |
location | none here |
type | simple command userdata |
criterium | local intro reference sectionblock:reference all sectionblock:all text sectionblock:text current sectionblock:current here previous sectionblock:previous component section sectionblock:section |
list | name |
width | fit broad dimension |
height | fit broad dimension |
depth | fit broad dimension |
symbol | one two three none default |
label | yes no none name |
starter | command |
stopper | command |
command | threearguments |
numbercommand | oneargument |
textcommand | oneargument |
pagecommand | oneargument |
pagenumber | yes no always realpage |
headnumber | yes no always |
before | command |
after | command |
inbetween | command |
margin | none dimension |
distance | none dimension |
aligntitle | yes no |
numberalign | left right middle flushleft flushright inner outer |
align | see \setupalign |
hang | yes no |
left | command |
right | command |
interaction | yes no all number text title page sectionnumber pagenumber |
limittext | yes no text |
style | style command |
color | color |
numberstyle | style command |
numbercolor | color |
textstyle | style command |
textcolor | color |
pagestyle | style command |
pagecolor | color |
reference | number |
extras | name |
order | command all title |
alternative | a b c d e f g left right top bottom command none interactive paragraph horizontal vertical name |
maxwidth | dimension |
pageprefix | yes no |
pageprefixseparatorset | name |
pageprefixconversionset | name |
pageprefixset | name |
pageprefixsegments | number number:number number:* number:all section section:section section:* section:all current |
pageprefixconnector | command processor->command |
pageconversionset | name |
pagestarter | command processor->command |
pagestopper | command processor->command |
...=...,... | inherits from \setupcounter |
...=...,... | inherits from \setupframed |
Option | Explanation | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
criterium |
| ||||||||||||||||||||
width |
| ||||||||||||||||||||
margin |
| ||||||||||||||||||||
distance |
| ||||||||||||||||||||
interaction |
| ||||||||||||||||||||
order |
| ||||||||||||||||||||
alternative |
|
Description
Examples
Unnumbered ToC items, with some shift
Sometimes we need to insert unnumbered items into the ToC, and to specify them horizontal shift to "keep the look" of the other (numbered) items. Here "margin" option comes into play:
\setuppapersize[A7,landscape] \setuplist[alternative=c] \setuphead[subsubsection][number=no] \setuplist[subsubsection][margin=20mm] \starttext \placecontent \hairline \section{Section} \subsection{Subsection} \subsubsection{Subsubsection} \stoptext
Use different alternatives for different levels in the same ToC
You can use different alternatives for different levels.
\setuppapersize[A7,landscape] \setuplist[alternative=c] \setuplist[subsection][alternative=d] \starttext \placecontent \hairline \section{Section} \subsection{Subsection} \subsubsection{Subsubsection} \stoptext
Left-hand page numbers
The following example positions the page number to the left of the list entry title:
\define[3]\SectionToCEntry{ \leftaligned\bgroup \hbox to 2em{#3}% \hskip 1em \vtop{\hsize\dimexpr\textwidth-3em\relax#2}% \egroup } \setuplist [section] [alternative=interactive, command=\SectionToCEntry, after=\endgraf]
The alternative=interactive
is required to maintain hyperlinked page numbers when links are enabled in the document. Without the after=\endgraf
items would be displayed on one line.
Using tabular numbers
In a long TOC it looks awkward if proportional numbers are used. It is better to enable the font feature tabularnumbers:
\setuplist [chapter] [pagestyle={\feature[+][tabularnumbers]}]