List spacing

The stylesheets provide options for controlling the vertical space before a list and between list items, and for controlling the horizontal spacing of a list and its markers.

List vertical spacing

The spacing between list items in an orderedlist or itemizedlist element can be minimized by the document author by adding a spacing="compact" attribute to the list element. In HTML output, the list will get a compact="compact" attribute on the list start tag to reduce spacing in the browser. In print output, the spacing between items will be determined by the compact.list.item.spacing attribute-set instead of the regular list.item.spacing attribute-set.

In HTML output, to further control vertical spacing, you could create CSS styles such as the following:

Space above a list:
div.orderedlist {
  margin-top: 3em;
}

Space between list items:
div.orderedlist li {
  margin-top: 1em;
}

You may want to pay attention to how nested lists are spaced by creating CSS selectors for them as well.

In print output, to control vertical spacing between list items you should customize the attribute-sets named list.item.spacing and compact.list.item.spacing. To customize the vertical space above and below a list, you should customize the attribute-set named list.block.spacing. The latter attribute-set is also used for procedure, substeps, and admonitions such as note.

List horizontal spacing

For HTML output, you can control horizontal spacing for itemizedlist and orderedlist elements using CSS styles. The following are two examples of setting the overall indent for itemizedlists, and the indent of the paragraph relative to the bullet character.

div.itemizedlist {
        margin-left: 2em;
}
div.itemizedlist li {
        padding-left: 1em;
}

The first style sets the overall left indent of the whole list to 2em. The second style increases the indent of the paragraph relative to the bullet character by 1em.

For print output, you can add a left indent to all lists by adding a margin-left attribute to the list.block.spacing attribute-set. That indent will be applied to all itemizedlist, orderedlist, variablelist, procedure, substeps, and admonition elements. If you only want the indent to apply to one type of list, then customize the attribute-set as follows:

<xsl:attribute-set name="list.block.spacing">
  <xsl:attribute name="margin-left">
    <xsl:choose>
      <xsl:when test="self::itemizedlist">1in</xsl:when>
      <xsl:otherwise>0pt</xsl:otherwise>
    </xsl:choose>
  </xsl:attribute>
</xsl:attribute-set>

When you use this technique, be sure to include an xsl:otherwise with some value, or you will generate an empty attribute which will likely produce an error message.

You can also set the indent of the paragraph relative to the bullet character. You do that using a dbfo label-width processing instruction on a list element in your document:

<itemizedlist>
<?dbfo label-width="0.25in"?>
  <listitem>
  ...

There is currently no way to set this relative indent globally for all itemizedlists.

The horizontal spacing of variablelist elements is more complex, and is discussed in the section “variablelist options”.