Difference between revisions of "Command/writetolist"
< Command
Jump to navigation
Jump to search
m (default TOC settings) |
m (Fix two typos.) |
||
Line 24: | Line 24: | ||
</cd:command> | </cd:command> | ||
</cd:variants> | </cd:variants> | ||
− | <cd:description>If you use this command after an unnumbered section | + | <cd:description>If you use this command after an unnumbered section command beware that it will become a candidate for a page break. A workaround is: |
<texcode> | <texcode> | ||
Line 36: | Line 36: | ||
In addition you might get spurious spaces after this command. So it is best to add a % sign after it. | In addition you might get spurious spaces after this command. So it is best to add a % sign after it. | ||
− | The default table of contents is combined list. To write to it one has to choose the level to which it should be inserted: <tt>\writetolist[chapter]{1.}{Chapter list entry A}</tt>, <tt>\writetolist[section]{1.1}{Section list entry A}</tt>, etc. | + | The default table of contents is a combined list. To write to it one has to choose the level to which it should be inserted: <tt>\writetolist[chapter]{1.}{Chapter list entry A}</tt>, <tt>\writetolist[section]{1.1}{Section list entry A}</tt>, etc. |
</cd:description> | </cd:description> | ||
<cd:examples><cd:example title=""><texcode> | <cd:examples><cd:example title=""><texcode> |
Latest revision as of 00:43, 1 February 2024
Contents
\writetolist
Summary
The command \writetolist is used to write entries to a defined list.
Settings
\writetolist[...][...=...,...]{...}{...} | |
[...] | list |
...=...,... | inherits from \setuplist |
{...} | number |
{...} | text |
Option | Explanation |
---|---|
list | The name of a list defined with \definelist |
number | The "item number" |
text | Actual text |
Description
If you use this command after an unnumbered section command beware that it will become a candidate for a page break. A workaround is:
\subject{\bf My title!} \dontleavehmode \writetolist[myrandompart]{}{It's a test}
However, according to mailing list messages (from 2010), keep in mind that it introduces 'something' in the text stream, so when whitespace is setup, in some cases you can get some extra. Also, this box can end up on the current page or the next one, depending on the circumstances. In practice it's no real problem as one will do explicit writes inside boxes or so. I.e., just bind the write to some text.
In addition you might get spurious spaces after this command. So it is best to add a % sign after it.
The default table of contents is a combined list. To write to it one has to choose the level to which it should be inserted: \writetolist[chapter]{1.}{Chapter list entry A}, \writetolist[section]{1.1}{Section list entry A}, etc.
Examples
Example 1
\definelist[Reprints][criterium=all] \starttext \section{Sec 1} \writetolist[Reprints]{1.}{List entry A}% \writetolist[Reprints]{}{With no number}% \subsection{Subsec 1} \writetolist[Reprints]{2.}{List entry B}% \completelist[Reprints] \stoptext