Flexible Formatting with Linuxdoc-SGML

Have your cake and eat it too with this simple but powerful text processing facility assembled by a well-known Linux guru.
The Details

Now that we have explained the necessary “overhead”, we can start writing larger documents. Therefore, you will probably want to create sections and subsections, start the document with an abstract, and insert a table of contents. You can just add the following lines after the date line:

Here is the abstract.
<sect>The First Section
<sect1>The First Subsection

Depending on the output format you want to create, the table of contents will have different styles: in a LaTeX document you get a standard table of contents, and in an HTML file you will get a list of cross references for the different sections and subsections.

As you can see from our example, the <sect> command creates a new section and the <sect1> command a new subsection. You can access five different levels simply by increasing the number in the command name. Note that you will still have to insert the <p> command to start the first paragraph after an sectioning command. For technical documentation it is often necessary to include “verbatim” text—text that is passed through without interpretation by the SGML parser. You can do this with the <verb> command:

<verb>This text is not interpreted <verb>

However, some very special characters do need some additional handling even when they appear inside a verbatim environment. For example, the sequence of an opening angle bracket and a slash (</) has to be written as &ero;etago;. The manual that comes with the Linuxdoc-SGML package includes a list of all special characters and the commands used to enter them as literal characters.

The Linuxdoc-SGML package supports three different font styles beside the normal font: boldface, italics, and typewriter. To select a font insert the command bf, em, or tt, respectively. To switch back to the default font just use the corresponding “slashed” command, as in the following example:

This <em>text</em> is written in italics!

An abbreviated version of each of these is sometimes useful:

This <em/text/ is written in italics!

Now let's take a look at different list types that are supported:

  1. itemize for bulleted lists

  2. enum for numbered lists, and

  3. descrip for description lists, as demonstrated in this list.

You just start the list “environment” with the <list> command and close it with </list>. To produce a new item (either a bullet or a number) you can use the <item> command. In the description environment, you have to use the <tag> command with an argument that contains the “keyword”, as in the following example:

<tag/First./ This is the first point.
<tag>Second.</tag> And this is the second.

If you want to create WWW pages with this package, you may want to create cross references to other WWW pages. This is done with the <url> command, as in the following example:

<url url=-http://gnus.com/pub/text.html- name=-Text

This creates a link to the WWW page text.html on the specified host and displays Text document as the title of the link. When you create non-HTML documents, both the name and the URL are shown, so that the reader can still find the document.

Christian Schwarz studies mathematics in Munich and has worked with Linux for two years. He contributed the texinfo support for the Linuxdoc-SGML package. You may reach him at the address schwarz@monet.m.isar.de.


White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState