Difference between revisions of "Command/definelistalternative"

From ConTeXt wiki
m (Syntax: add inherited setup syntax)
 
Line 3: Line 3:
 
|attributes=
 
|attributes=
 
}}
 
}}
 +
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>definelistalternative</syntax>
  
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==

Latest revision as of 16:52, 12 November 2019

\definelistalternative

Syntax (autogenerated)

\definelistalternative[...][...][...=...,...]
[...]name
[...]name
...=...,...inherits from \setuplistalternative


Syntax

\definelistalternative[...][...][...=...,...]
[...]name
[...]name
...=...,...inherits from \setuplistalternative


\setuplistalternative[...,...][...=...,...]
[...,...]name
beforecommand
aftercommand
commandthreearguments
renderingsetupname
widthdimension
distancedimension
stretchdimension
fillercommand


\definelistalternative[...][...,...=...,...]
[...] list name
renderingsetup setup

Description

The renderingsetup points to a custom defined setup name. This setup is executed once per list entry. Within this setup the following control sequences are defined to print the list contents or react to particular events.

\currentlistentrylocation the location number is a sequential number for the list entry
\namedstructureheadlocation{structureelementtype} location number of the current active chapter/section/other structure element.
\currentlistentrynumber location number of the current list entry
\currentlistentrytitle the argument of the title key of the structure element corresponding to the current list entry
\currentlistentrypagenumber the page number of the structure element corresponding to the current list entry

Example

The following example prints a table of contents on every page and highlights the current chapter name.

\setupfootertexts
  [\setups{footlist}]

\startsetups [footlist]
  \framed[align=normal, frame=off]
    {\placelist [chapter] [alternative=footlist, criterium=all]}
\stopsetups

\definelistalternative
  [footlist]
  [renderingsetup=list:footlist]

\startsetups [list:footlist]
\starttabulate
    \NC location                \EQ \currentlistentrylocation       \NC\NC\NR
    \NC headlocation\{chapter\} \EQ \namedstructureheadlocation{chapter} \NC\NC\NR
    \NC entrynumber             \EQ \currentlistentrynumber         \NC\NC\NR
    \NC title                   \EQ \currentlistentrytitle          \NC
        \doifelse\currentlistentrylocation{\structureheadlocation{chapter}}
            {{\bfb\currentlistentrytitle}}
            {     \currentlistentrytitle}\NC\NR
    \NC page                    \EQ \currentlistentrypagenumber     \NC\NC\NR
    \HL
\stoptabulate
\stopsetups

\starttext
  \startchapter [title=alpha] \stopchapter
  \startchapter [title=beta]  \stopchapter
  \startchapter [title=gamma] \stopchapter
\stoptext

This is the resulting table from the second page, i.e. in chapter Beta:

result.png

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: