Next / Previous / Contents / TCC Help System / NM Tech homepage

8. Special paragraph shapes

8.1. Bullet lists: <itemizedlist>

A bullet list is a set of narrower paragraphs shown with a round dot (the bullet) before each one. Typical uses are lists of features, lists of important points, and such.

Enclose the entire bullet list inside an <itemizedlist>...</itemizedlist> element. Each item is then enclosed within a <listitem>...</listitem> element containing one or more <para> or <simpara> elements.

For example, this input:

    <itemizedlist>
      <listitem>
        <para>Mangos.</para>
      </listitem>
      <listitem>
        <para>Chirimoya.</para>
      </listitem>
    </itemizedlist>

produces this output:

  • Mangos.

  • Chirimoya.

Normally, bullet lists have a fairly generous amount of space between the bullets. To reduce this space, add a spacing="compact" attribute to the <itemizedlist> element. Here is the example list again in compact spacing:

  • Mangos.

  • Chirimoya.

8.2. Numbered lists: <orderedlist>

To produce a numbered list of items, use the <orderedlist> construct. Here's an example:

  1. DocBook renders documents in both print and Web form.

  2. It frees the author from most concerns of presentation.

Here's how the above list looks in source form:

      <orderedlist>
        <listitem>
          <para>DocBook renders documents in both print and Web
            form.</para></listitem>
        <listitem>
          <para>It frees the author from most concerns of
            presentation.</para></listitem>
      </orderedlist>

There are a number of attributes you can add to the <orderedlist> element to change the way the entries are numbered:

numeration

The default value is numeration="arabic", with entries numbered 1., 2., 3., …. Other possible values include:

  • numeration="loweralpha" for a., b., …

  • numeration="lowerroman" for i., ii., iii., …

  • numeration="upperalpha" for A., B., C., …

  • numeration="upperroman" for I., II., III., …

inheritnum="inherit"

Normally, when you use an ordered list inside another ordered list, the inner list has its own numbering. However, if you specify inheritnum="inherit", each item number in the inner list will have the item number from the next outer list prepended to it.

For example, if an inner list is under an outer-list item numbered 17, and the inner list had the inheritnum="inherit" attribute, its items would be numbered 17.1, 17.2, 17.3, ….

spacing="compact"

Normally the items of an ordered list are separated by generous amounts of space. Use the spacing="compact" attribute to squeeze out most of the space between the items.

continuation="continues"

Sometimes you have to break an ordered list into multiple pieces, with text paragraphs or other material between the pieces. This attribute allows you to start the numbering of a new list where the old one left off.

For example, suppose the first chunk of an ordered list ended with item XIV, and another ordered list followed it starting with:

    <orderedlist numeration="upperroman" continuation="continues">

That second list would start with item XV.

8.3. Procedures

A step-by-step procedure is generally presented in a form similar to the bullet list, but with step numbers taking the place of bullets.

Enclose the entire procedure within a <procedure>...</procedure> element. Each step is enclosed within a <step>...</step> element containing one or more <para> or <simpara> elements.

For example, this input:

    <procedure>
      <step><para>Throw the football.</para>
      </step>
      <step><para>Pick it up first.</para>
      </step>
    </procedure>

produces this output:

  1. Throw the football.

  2. Pick it up first.

If the steps of your procedure refer to other steps, you can get DocBook to insert the step number into each reference automatically. To do this:

  1. Invent a name I for each step, and add an attribute id=I to the corresponding <step> tag.

  2. Wherever you want to refer to a step, use this tag: <xref linkend=I> where I is the name from the step you are referring to. This tag will be replaced by the text “step N” where N is the step number.

Here's an example. This is a (facetious) solution to the famous Halting Problem. First, in output form:

  1. Has the program halted? If so, go to Step 3.

  2. Go to Step 1.

  3. Done: we now know that the program halts.

And now the source for the above:

      <procedure>
        <step id="start-step">
          <para>Has the program halted?  If so, go to
            <xref linkend="done-step"/>.</para></step>
        <step id="loop-step">
          <para>Go to <xref linkend="start-step"/>.</para></step>
        <step id="done-step">
          <para>Done: we now know that the program halts.</para></step>
      </procedure>

8.4. Definition lists: <variablelist>

Another commonly used special paragraph shape is to display a list of terms to be defined, each followed by an indented paragraph containing the description.

For this shape, enclose the entire list in a <variablelist> tag. Each term-definition pair is enclosed in a <varlistentry> element. Inside that element, enclose the term to be defined inside a <term> element, and enclose the paragraph or paragraphs defining the term inside a <listitem> element.

Here is an example of a list containing two terms:

      <variablelist>
        <varlistentry>
          <term><userinput>.__abs__(self)</userinput></term>
          <listitem>
            <para>Defines the behavior of the
              <userinput>abs()</userinput> function when
              applied to an object of your class.</para></listitem>
        </varlistentry>
        <varlistentry>
          <term><userinput>.__add__(self,<replaceable
            >other</replaceable>)</userinput></term>
          <listitem>
            <para>Defines the behavior of this class for
              <userinput>self+<replaceable>other</replaceable
              ></userinput>.</para></listitem>
        </varlistentry>
      </variablelist>

And here is how that looks when formatted:

.__abs__(self)

Defines the behavior of the abs() function when applied to an object of your class.

.__add__(self,other)

Defines the behavior of this class for self+other.

8.5. Notes, warnings, cautions, etc.

Sometimes you need to make some text stand out against the background. DocBook has several tags for such purposes:

  • <note>

  • <warning>

  • <important>

  • <caution>

  • <tip>

Typically you will put one or more regular paragraphs (using the <para> tag) inside such elements. Here's an example:

Warning

Do not touch the electric fence!

And here's that warning in source form:

    <warning>
      <para>Do not touch the electric fence!</para>
    </warning>

8.6. Block quotations

Two different elements are used to present quotations set off in separate blocks:

  • Use <epigraph> when the quotation starts a new chapter or section.

  • Use <blockquote> for quotations elsewhere.

In either case, the content of the element consists of an optional <attribution> element that tells the reader who said this. The actual quotation follows, typically wrapped in one or more <para> elements. Generally the attribution will be presented after the quotation.

Here's an example:

 

There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.

 
--C. A. R. Hoare 

The source for the quote looks like this:

      <blockquote>
        <attribution>C. A. R. Hoare</attribution>
        <para>
          There are two ways of constructing a software
          design. One way is to make it so simple that there are
          obviously no deficiencies. And the other way is to make
          it so complicated that there are no obvious
          deficiencies.
        </para>
      </blockquote>