Changes

Jump to navigation Jump to search
Created page with "Documentation for \setuplistalternative"
<cd:commandgroup name="setuplistalternative" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
<cd:shortdesc>The command <tt>\setuplistalternative</tt> is used to set up options for the <code>alternative</code> key in {{cmd|setuplist}}
</cd:shortdesc>
<cd:variants>
<cd:command category="structure" file="strc-lst.mkvi" interfacedate="2020-07-14T09:24" interfacefile="i-list.xml" level="style" name="setuplistalternative" variantnumber="1">
<cd:arguments>
<cd:keywords list="yes" optional="yes" ordinal="1">
<cd:keywordsdoc></cd:keywordsdoc>
<cd:constant type="cd:name"></cd:constant>
</cd:keywords>
<cd:assignments list="yes" ordinal="2">
<cd:assignmentsdoc></cd:assignmentsdoc>
<cd:parameter name="before">
<cd:paramdoc></cd:paramdoc>
<cd:constant type="cd:command"></cd:constant>
</cd:parameter>
<cd:parameter name="after">
<cd:paramdoc></cd:paramdoc>
<cd:constant type="cd:command"></cd:constant>
</cd:parameter>
<cd:parameter name="command">
<cd:paramdoc></cd:paramdoc>
<cd:constant type="cd:threearguments"></cd:constant>
</cd:parameter>
<cd:parameter name="renderingsetup">
<cd:paramdoc>see below</cd:paramdoc>
<cd:constant type="cd:name"></cd:constant>
</cd:parameter>
<cd:parameter name="width">
<cd:paramdoc></cd:paramdoc>
<cd:constant type="cd:dimension"></cd:constant>
</cd:parameter>
<cd:parameter name="distance">
<cd:paramdoc></cd:paramdoc>
<cd:constant type="cd:dimension"></cd:constant>
</cd:parameter>
<cd:parameter name="stretch">
<cd:paramdoc></cd:paramdoc>
<cd:constant type="cd:dimension"></cd:constant>
</cd:parameter>
<cd:parameter name="filler">
<cd:paramdoc></cd:paramdoc>
<cd:constant type="cd:command"></cd:constant>
</cd:parameter>
</cd:assignments>
</cd:arguments>
</cd:command>
</cd:variants>
<cd:description>The <cd:iref variant="" ordinal="2" name="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.

{|
|-
| {{cmd|currentlistentrylocation}}
| the location number is a sequential number for the list entry
|-
| {{cmd|namedstructureheadlocation|2={structureelementtype}}}
| location number of the current active chapter/section/other structure element.
|-
| {{cmd|currentlistentrynumber}}
| location number of the current list entry
|-
| {{cmd|currentlistentrytitle}}
| the argument of the <code>title</code> key of the structure element corresponding to the current list entry
|-
| {{cmd|currentlistentrypagenumber}}
| the page number of the structure element corresponding to the current list entry
|}</cd:description>
<cd:examples><cd:example title="">The following example prints a table of contents on every page and
highlights the current chapter name.

<texcode>
\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
</texcode>

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

[[File:result.png]]</cd:example></cd:examples>
<cd:notes></cd:notes>
<cd:seealso>
<cd:commandref name="definelistalternative" originator="system"></cd:commandref>
<cd:source file="strc-lst.mkvi" originator="system">for predefined examples, search for {{cmd|definelistalternative}}</cd:source>
<cd:wikipage originator="system" page="Category:Structure"></cd:wikipage>
<cd:commandref name="setuplist"></cd:commandref>
<cd:commandref name="setupcombinedlist"></cd:commandref></cd:seealso>
</cd:commandgroup>

Navigation menu