Difference between revisions of "Command/definelistalternative"

From ConTeXt wiki
m (Fix renamed command in code)
(better syntax, more links)
Line 5: Line 5:
  
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
 +
<syntax>definelistalternative</syntax>
 +
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
   <tr>
 
   <tr>
Line 60: Line 62:
  
 
<texcode>
 
<texcode>
%% NB: this code is not executed on the wiki
 
 
\setupfootertexts
 
\setupfootertexts
 
   [\setups{footlist}]
 
   [\setups{footlist}]
Line 99: Line 100:
  
 
== See also ==
 
== See also ==
[[Command/setuplist|\setuplist]]
+
* {{cmd|setuplist}}
 +
* {{cmd|setuplistalternative}}
 +
* {{cmd|setupcombinedlist}}
 +
* [[Table of Contents]]
  
 
== Help from ConTeXt-Mailinglist/Forum ==
 
== Help from ConTeXt-Mailinglist/Forum ==

Revision as of 20:09, 17 September 2019

\definelistalternative

Syntax

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


\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: