Difference between revisions of "Command/setuplist"

From Wiki
Jump to navigation Jump to search
m (Added alternative meaning)
(explain alternative=command/interactive)
Line 167: Line 167:
  
 
* 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 {{code|alternative}}, see {{cmd|definelistalternative}}.
 
* 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 {{code|alternative}}, see {{cmd|definelistalternative}}.
** a: number -- title -- pagenumber
+
** a: number title pagenumber
** b: number -- title -- spaces -- pagenumber
+
** b: number title spaces pagenumber
** c: number -- title -- dots -- pagenumber
+
** c: number title dots pagenumber
** d: number -- title -- pagenumber (continuous)
+
** d: number title pagenumber (continuous)
 
** e: title (framed)
 
** e: title (framed)
** f: title (left, middle or right alinged)
+
** f: title (left, middle or right aligned)
 
** g: title (centered)
 
** g: title (centered)
 +
** command/interactive: use with own 3-parameter macro (<tt>command=\MyListEntry</tt>), <tt>interactive</tt> keeps linking and bookmarks in the parameters, <tt>command</tt> depends on your own programming
 
* interaction: what part of content line should be interactive if {{cmd|setupinteraction}}<tt>[state=start]</tt>.
 
* interaction: what part of content line should be interactive if {{cmd|setupinteraction}}<tt>[state=start]</tt>.
 
* criterium: Default criterium is <tt>local</tt> for a newly defined list. That can cause an empty {{cmd|placelist}}. Criterium <tt>component</tt> 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].
 
* criterium: Default criterium is <tt>local</tt> for a newly defined list. That can cause an empty {{cmd|placelist}}. Criterium <tt>component</tt> 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].

Revision as of 11:03, 16 May 2020

\setuplist

Syntax (autogenerated)

\setupcombinedlist[...][...=...,...]
[...]list
criteriumlocal intro reference sectionblock:reference all sectionblock:all text sectionblock:text current sectionblock:current here previous sectionblock:previous component section sectionblock:section
referencenumber
extrasname
ordercommand all title
alternativea b c d e f g left right top bottom command none interactive paragraph horizontal vertical name


Syntax

\setuplist[...,...,...][...,...=...,...]
[...,...,...] name
state start stop
alternative a b c ... none command
coupling on off
criterium section component local previous current all
pageboundaries list
style normal bold slanted boldslanted type cap small... command
textstyle normal bold slanted boldslanted type cap small... command
pagestyle normal bold slanted boldslanted type cap small... command
color name
numbercolor name
command threearguments
textcommand oneargument
pagecommand oneargument
interaction sectionnumber text pagenumber all
before command
after command
inbetween command
left text
right text
label yes no
prefix yes no none
pagenumber yes no
headnumber yes no
sectionnumber yes no
aligntitle yes no
margin dimension
width dimension fit
height dimension fit broad
depth dimension fit broad
distance dimension
separator text
stopper text
symbol none 1 2 3 ...
expansion yes no command
maxwidth dimension
[...,...=...,...] see \framed

\setupcombinedlist inherits from \setuplist.

Description

  • 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.
    • 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/interactive: use with own 3-parameter macro (command=\MyListEntry), interactive keeps linking and bookmarks in the parameters, command depends on your own programming
  • interaction: what part of content line should be interactive if \setupinteraction[state=start].
  • criterium: Default criterium is local for a newly defined list. That can cause an empty \placelist. Criterium component is used to establish ToC (and other lists) via project structures.
  • order: order=title sorts the list by title

Comment

Examples

\definelist[Reprints][criterium=all]

\starttext
  \section{Sec 1}
  \writetolist[Reprints]{1.}{List entry A}
  \subsection{Subsec 1}
  \writebetweenlist[Reprints]{\hrule}
  \writetolist[Reprints]{2.}{List entry B}
  \completelist[Reprints]
\stoptext

Left-hand Page Number

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

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: