Chapter 2. Docbook Basics

Some of the most commonly used docbook patterns are described here for quick reference. For all the details (sometimes more than you wanted), try DocBook: The Definitive Guide by Norman Walsh and Leonard Muellner, which O'Reilly & Associates has generously placed on their web site. In this section, many of the SGML tags are linked to the page of Walsh's book that describes that tag in detail.

2.1. Small Tutorial

Docbook files are text files containing SGML. If you have ever looked at HTML, then a docbook file will look familiar. Not the same, but familiar. The easiest way of getting familiar with the docbook format is by looking at examples such as the Bochs documentation itself. When you compare the source code to the rendered documentation on the web site, it will be pretty obvious what all the codes are doing. HTML is very forgiving about breaking the syntax rules, such as not putting </h1> at then end of an <h1> section. SGML is picky; if you forget that kind of thing in SGML, it will insist that you fix it.

Every paragraph must begin with the <para> tag and end with the corresponding end tag, </para>.

This is a paragraph.

A chapter looks like this:

  <title>title of the chapter</title>
  text of the chapter
The text of the chapter must contain at least one complete <para> tag, and it can include <section>s.

A section looks like this:

  <title>title of the section</title>
  text of the section
The text of the section must contain at least one complete <para> tag, and it can include other <section>s.

To make a link to any URL, use the syntax:

<ulink url="URL">text of the hyperlink</ulink>
However, if you like to link to another target inside the same document, for example to a section, use something like that:
<section id="unique identifier">
  All stuff that is needed here...
<link linkend="unique identifier to link to">text of hyperlink</link>

To include a picture in the text, use the <graphic> tag. In SGML, this graphic tag has no closing tag.

<graphic format="fmt" fileref="filename">
The fmt can be one of many formats including GIF, JPG, PNG, PS, and EPS. The filename should be on the local disk. If there is a pathname, it should be relative to the source file or it won't be found on anyone's system other than yours.

There are over 300 tags defined in the latest version of docbook, so we won't try to list them all here. Once you get the idea, you can either find examples in the rest of the documentation that do what you need, or look at Walsh and Muellner's DocBook: The Definitive Guide for more details.