Customizing list environments

Lists are made up of two principal ingredients: the outer list environment and the inner items. List environments may either be customized by customizing or redefining the rendering macros for these environments, or defining additional list environments which match the same abstract interface.

The rendering of the outer list environment is controlled by the render-list macro which takes the body of the list as its argument. For instance, consider the following redefinition of render-list:

< assign | render-list | < macro | body |

<\surround|

<no-page-break*><vspace*|0.5fn>

|

<right-flush><vspace|0.5fn><no-indent*>

|

<with|par-left|<plus|par-left|3fn>|par-right|<plus|par-right|3fn>|body>

>

> >

This redefinition affects the rendering of all list environments (itemize, enumerate, etc.) by reducing the right margin with a length of 3fn:

In a similar way, you may customize the rendering of list items by redefining the macros aligned-item and compact-item. These macros both take one argument with the text of the item and render it either in a right-aligned way (such that subsequent text is left aligned) or in a left-aligned way (such that subsequent text may not be aligned). For instance, consider the following redefinition of aligned-item:

< assign | aligned-item | < macro | x |

<\concat|

<vspace*|0.5fn>

|

<with|par-first|-3fn|<yes-indent>>

|

<resize|<with|color|red|x>|r-2.5fn||r+0.5fn|>

>

> >

Then items inside all list environments with compact items will appear in red:

Remark 1. The macros aligned-item and compact-item are required to produce inline content, so that they may be used in order to surround blocks. In particular, several other internal macros (aligned-space-item, long-compact-strong-dot-item, etc.) are based on aligned-item and compact-item, and used for the rendering of the different types of lists (itemize-arrow, description-long, etc.). In the future, we also plan to extend item and item* with a compulsory body argument. When customizing the list environments, it is important to keep that in mind, so as to make your style-sheets upward compatible.

The std-list d.t.d. also provides a macro new-list to define new lists. Its syntax is <new-list|name|item-render|item-transform>, where name is the name of the new list environment, item-render an (inline) macro for rendering the item and item-transform an additional transformation which is applied on the item text. For instance, the enumerate-roman environment is defined by

<document|<new-list|enumerate-roman|aligned-dot-item|<macro|x|<number|x|roman>>>>

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".