LinuxDoc-Tools User's Guide: Formatting SGML Documents

## 4. Formatting SGML Documents

Let's say you have the SGML document `foo.sgml`, which you want to format. Here is a general overview of formatting the document for different output. For a complete list of options, consult the man pages.

## 4.1 Checking SGML Syntax

If you just want to capture your errors from the SGML conversion, use the ```linuxdoc -B check`''. For example.

> `

>     % linuxdoc -B check foo.sgml

> `

If you see no output from this check run other than the ``Processing...'' message, that's good. It means there were no errors.

## 4.2 Creating Plain Text Output

If you want to produce plain text, use the command:

> `

>     % linuxdoc -B txt foo.sgml

> `

You can also create groff source for man pages, which can be formatted with `groff -man`. To do this, do the following:

> `

>     % linuxdoc -B txt --man foo.sgml

> `

## 4.3 Creating LaTeX, DVI, PostScript or PDF Output

To create a LaTeX documents from the SGML source file, simply run:

> `

>     % linuxdoc -B latex foo.sgml

> `

If you want to produce PostScript output (via `dvips`), use the ```-o`'' option:

> `

>     % linuxdoc -B latex --output=ps foo.sgml

> `

Or you can produce a DVI file:

> `

>     % linuxdoc -B latex --output=dvi foo.sgml

> `

Also, you can produce a PDF file:

> `

>     % linuxdoc -B latex --output=pdf foo.sgml

> `

## 4.4 Creating HTML Output

If you want to produce HTML output, do this:

> `

>     % linuxdoc -B html --imagebuttons foo.sgml

> `

This will produce `foo.html`, as well as `foo-1.html`, `foo-2.html`, and so on -- one file for each section of the document. Run your WWW browser on `foo.html`, which is the top level file. You must make sure that all of the HTML files generated from your document are all installed in the directory, as they reference each other with local URLs.

The ```--imagebuttons`'' option tells html backend driver to use graphic arrows as navigation buttons. The names of these icons are ``next.png'', ``prev.png'', and ``toc.png'', and the LinuxDoc-Tools system supplies appropriate PNGs in its library directory.

If you use ```linuxdoc -B html`'' without the ```-img`'' flag, HTML documents will by default have the English labels ``Previous'', ``Next'', and ``Table of Contents'' for navigation. If you specify one of the accepted language codes in a ```--language`'' option, however, the labels will be given in that language.

## 4.5 Creating GNU Info Output

If you want to format your file for the GNU info browser, just run the following command:

> `

>     % linuxdoc -B info foo.sgml

> `

## 4.6 Creating LyX Output

For LyX output, use the the command:

> `

>     % linuxdoc -B lyx foo.sgml

> `

## 4.7 Creating RTF Output

If you want to produce RTF output, run the command:

> `

>     % linuxdoc -B rtf foo.sgml

> `

This will produce `foo.rtf`, as well as `foo-1.rtf`, `foo-2.rtf`, and so on; one file for each section of the document.