Next Previous Contents

3. Writing Documents With LinuxDoc-Tools

For the most part, writing documents using LinuxDoc-Tools is very simple, and rather like writing HTML. However, there are some caveats to watch out for. In this section we'll give an introduction on writing SGML documents. See the file example.sgml for a SGML example document (and tutorial) which you can use as a model when writing your own documents. Here we're just going to discuss the various features of LinuxDoc-Tools, but the source is not very readable as an example. Instead, print out the source (as well as the formatted output) for example.sgml so you have a real live case to refer to.

3.1 Basic Concepts

Looking at the source of the example document, you'll notice right off that there are a number of ``tags'' marked within angle brackets ( and ). A tag simply specifies the beginning or end of an element, where an element is something like a section, a paragraph, a phrase of italicized text, an item in a list, and so on. Using a tag is like using an HTML tag, or a LaTeX command such as item or section{...}.

As a simple example, to produce this boldfaced text, you would type

As a simple example, to produce <bf>this boldfaced text</bf>, ...
in the source. bf> begins the region of bold text, and </bf> ends it. Alternately, you can use the abbreviated form
As a simple example, to produce <bf/this boldfaced text/, ...
which encloses the bold text within slashes. (Of course, you'll need to use the long form if the enclosed text contains slashes, such as the case with Unix filenames).

There are other things to watch out with respect to special characters (that's why you'll notice all of these bizarre-looking ampersand expressions if you look at the source; I'll talk about those shortly).

In some cases, the end-tag for a particular element is optional. For example, to begin a section, you use the sect> tag, however, the end-tag for the section (which could appear at the end of the section body itself, not just after the name of the section!) is optional and implied when you start another section of the same depth. In general you needn't worry about these details; just follow the model used in the tutorial (example.sgml).

3.2 Special Characters

Obviously, the angle brackets are themselves special characters in the SGML source. There are others to watch out for. For example, let's say that you wanted to type an expression with angle brackets around it, as so: foo. In order to get the left angle bracket, you must use the lt; element, which is a ``macro'' that expands to the actual left-bracket character. Therefore, in the source, I typed

angle brackets around it, as so: <tt>&lt;foo&gt;</tt>.
Generally, anything beginning with an ampersand is a special character. For example, there's percnt; to produce , verbar; to produce , and so on. For every special character that might otherwise confuse LinuxDoc-Tools if typed by itself, there is an ampersand "entity" to represent it. The most commonly used are:

Here is a complete list of the entities recognized by 0.1. Note that not all back-ends will be able to make anything useful from every entity -- if you see parantheses with nothing between them in the list, it means that the back-end that generated what you're looking at has no replacement for the entity. The ``common'' ones listed above are pretty reliable.

half ()

vertical 1/2 fraction

frac12 ()

typeset 1/2 fraction

frac14 ()

typeset 1/4 fraction

frac34 ()

typeset 3/4 fraction

frac18 ()

typeset 1/8 fraction

frac38 ()

typeset 3/8 fraction

frac58 ()

typeset 5/8 fraction

frac78 ()

typeset 7/8 fraction

sup1 ()

superscript 1

sup2 ()

superscript 2

sup3 ()

superscript 3

plus ()

plus sign

plusmn ()

plus-or-minus sign

lt ()

less-than sign

equals ()

equals sign

gt ()

greater-than sign

divide ()

division sign

times ()

multiplication sign

curren ()

currency symbol

pound ()

symbol for ``pounds''

dollar ()

dollar sign

cent (
Next Previous Contents