Command/setuplist

From Wiki
< Command
Revision as of 19:52, 25 September 2020 by Taco (talk | contribs)
Jump to navigation Jump to search


\setuplist

Summary

The command \setuplist configures collected lists like for the TOC

Settings

\setuplist[...,...][...=...,...]
[...,...]list
statestart stop
locationnone here
typesimple command userdata
criteriumlocal intro reference sectionblock:reference all sectionblock:all text sectionblock:text current sectionblock:current here previous sectionblock:previous component section sectionblock:section
listname
widthfit broad dimension
heightfit broad dimension
depthfit broad dimension
symbolone two three none default
labelyes no none name
startercommand
stoppercommand
commandthreearguments
numbercommandoneargument
textcommandoneargument
pagecommandoneargument
pagenumberyes no always realpage
headnumberyes no always
beforecommand
aftercommand
inbetweencommand
marginnone dimension
distancenone dimension
aligntitleyes no
numberalignleft right middle flushleft flushright inner outer
alignsee \setupalign
hangyes no
leftcommand
rightcommand
interactionyes no all number text title page sectionnumber pagenumber
limittextyes no text
stylestyle command
colorcolor
numberstylestyle command
numbercolorcolor
textstylestyle command
textcolorcolor
pagestylestyle command
pagecolorcolor
referencenumber
extrasname
ordercommand all title
alternativea b c d e f g left right top bottom command none interactive paragraph horizontal vertical name
maxwidthdimension
pageprefixyes no
pageprefixseparatorsetname
pageprefixconversionsetname
pageprefixsetname
pageprefixsegmentsnumber number:number number:* number:all section section:section section:* section:all current
pageprefixconnectorcommand processor->command
pageconversionsetname
pagestartercommand processor->command
pagestoppercommand processor->command
...=...,...inherits from \setupcounter
...=...,...inherits from \setupframed

OptionExplanation
criterium
Default criterium is criterium=local for a newly defined list. That can cause an empty \placelist. Criterium criterium=component is used to establish ToC (and other lists) via project structures.
local list of the current section/chapter
all complete list (e.g. ToC of a whole book)
list
Inherit settings from this named list
width
The width of the heading number (which is left aligned).
starter
Gets inserted before the (section) number
stopper
Gets inserted after the (section) number
command
Replace the rendering of the whole list entry with your own macro (number, text, page no.).
numbercommand
Replace the rendering of the number with your own macro.
textcommand
Replace the rendering of the list entry text with your own macro.
pagecommand
Replace the rendering of the page number with your own macro.
pagenumber
Show page number?
headnumber
Show head number?
before
Insert before list.
after
Insert after list.
inbetween
Insert between list entries.
margin
Extra indent between the margin (where text would normally start) and the heading number.
distance
The gap between the heading number and the heading.
aligntitle
should an unnumbered section will align in the table of contents under the number rather than the title?
numberalign
Alignment of the number
align
Alignment of the text
hang
indented text after number?
left
Insert before entry text
right
Insert after entry text
interaction
what part of content line should be interactive if \setupinteraction[state=start]
style
style of the whole entry
color
color of the whole entry
numberstyle
style of the number
numbercolor
color of the number
textstyle
style of the entry text
textcolor
color of the entry text
pagestyle
style of the page number
pagecolor
color of the page number
extras
Trick to insert stuff into a list, e.g. page breaks
order
Sort entries?
title sorts the list by title
alternative
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 \definelistalternative for exact details.
a number – title – pagenumber
b number – title – spaces – pagenumber
c number – title – dots – pagenumber
d number – title – pagenumber (continuous)
e title (framed)
f title (left, middle or right aligned)
g title (centered)
command use with own 3-parameter macro, e.g command=\MyListEntry. removes linking and bookmarks in the parameters, unless added by the supplied macro.
interactive use with own 3-parameter macro command=\MyListEntry. keeps linking and bookmarks in the parameters.
maxwidth
Max. width of the entry text
pageprefix
prefix of the page number; see prefix in \setupcounter
pagestarter
Insert before the page number
pagestopper
Insert after the page number

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]}]

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: