Blame doc/guide.sgml

Packit 9741aa
Packit 9741aa
     This is originally written by Matt Welsh and updated by many people.
Packit 9741aa
     See guide.txt or guide.ps for formatted output.
Packit 9741aa
-->
Packit 9741aa
Packit 9741aa
Packit 9741aa
Packit 9741aa
<article>
Packit 9741aa
Packit 9741aa
<title>LinuxDoc-Tools User's Guide
Packit 9741aa
<author>
Packit 9741aa
  <name>written by Matt Welsh as the LinuxDoc-SGML User's Guide.</name>
Packit 9741aa
  <and>
Packit 9741aa
    <name>Updated by Greg Hankins, and rewritten by Eric S. Raymond
Packit 9741aa
          for SGML-Tools.</name>
Packit 9741aa
  <and>
Packit 9741aa
    <name>Updated and renamed by Taketoshi Sano, for LinuxDoc-Tools</name>
Packit 9741aa
</author>
Packit 9741aa
<date>$Date: 2002/03/18 13:39:10 $ ($Revision: 1.2 $)
Packit 9741aa
<abstract>
Packit 9741aa
This document is a user's guide to the LinuxDoc-Tools formatting system,
Packit 9741aa
a SGML-based system which allows you to produce a variety of output 
Packit 9741aa
formats.  You can create plain text output (ASCII, ISO-8859-1, and EUC-JP),
Packit 9741aa
DVI, PostScript, PDF, HTML, GNU info, LyX, and RTF output from a single 
Packit 9741aa
document source file.  LinuxDoc-Tools is a new branch from SGML-Tools 1.0.9,
Packit 9741aa
and an descendant of the original LinuxDoc-SGML.
Packit 9741aa
</abstract>
Packit 9741aa
Packit 9741aa
<toc>
Packit 9741aa
Packit 9741aa
<sect>Introduction
Packit 9741aa

Packit 9741aa
This document is the user's guide to the LinuxDoc-Tools document 
Packit 9741aa
processing system.  LinuxDoc-Tools is a suite of programs to help 
Packit 9741aa
you write source documents that can be rendered as plain text, 
Packit 9741aa
hypertext, or LaTeX files.  It contains what you need to know to 
Packit 9741aa
set up LinuxDoc-Tools and write documents using it.  
Packit 9741aa
See 
Packit 9741aa
that you can use as a model for your own documents.
Packit 9741aa
The ``LinuxDoc'' means the name of a specific SGML DTD here.
Packit 9741aa

Packit 9741aa
<sect1>What's the DTD ?
Packit 9741aa

Packit 9741aa
The DTD specifies the names of ``elements'' within the document.
Packit 9741aa
An element is just a bit of structure; like a section, a subsection, 
Packit 9741aa
a paragraph, or even something smaller like 
Packit 9741aa
You may know the HTML has their own DTD.

Packit 9741aa

Packit 9741aa
Don't be confusing.  SGML is 
Packit 9741aa
SGML itself is used only to specify the document structure.  There are 
Packit 9741aa
no text-formatting facilities or ``macros'' intrinsic to SGML itself. 
Packit 9741aa
All of those things are defined within the DTD.
Packit 9741aa
You can't use SGML without a DTD; a DTD defines what SGML does.
Packit 9741aa
For more Detail, please refer the later section of this document
Packit 9741aa
 (<ref id="sgml" name="How LinuxDoc-Tools Works">).
Packit 9741aa

Packit 9741aa
Packit 9741aa
<sect1>History of the LinuxDoc
Packit 9741aa

Packit 9741aa
The LinuxDoc DTD is created by Matt Welsh as the core part of his
Packit 9741aa
Linuxdoc-SGML document processing system.  This DTD is based heavily
Packit 9741aa
on the QWERTZ DTD by Tom Gordon, 
Packit 9741aa
The target of the QWERTZ DTD is to provide the simple way to create
Packit 9741aa
LaTeX source for document publishing.  Matt Welsh took and shaped it 
Packit 9741aa
into Linuxdoc-SGML because he needed it to produce a lot of Linux 
Packit 9741aa
Documentations.  It can convert a single source of documentation into
Packit 9741aa
various output formats such as plain text, html, and PS.  No work for
Packit 9741aa
synchronization between various output formatted documents are needed.
Packit 9741aa

Packit 9741aa

Packit 9741aa
The Linuxdoc-SGML system had been maintained for years by Matt Welsh
Packit 9741aa
and many others, but it has some limitations.  Then Cees de Groot came
Packit 9741aa
and created the new system using perl.  The new system is called as
Packit 9741aa
``SGML-Tools''.  The perl based version for LinuxDoc had been maintained
Packit 9741aa
for a year, then totally new system using the original python scripts 
Packit 9741aa
and some stylesheets with the jade has been released.  This system is
Packit 9741aa
called as ``SGML-Tools 2.0'' and it does not use the LinuxDoc DTD as
Packit 9741aa
the main DTD, but uses the new standard one, the DocBook DTD. 
Packit 9741aa
Now ``SGML-Tools 2.0'' becomes ``SGMLtools-Lite'' and is distributed
Packit 9741aa
from <url url="http://sgmltools-lite.sourceforge.net/">.
Packit 9741aa

Packit 9741aa

Packit 9741aa
Recently, the DocBook DTD is the standard DTD for the technical
Packit 9741aa
software documentation, and used by many project such as GNOME and
Packit 9741aa
KDE, as well as many professional authors and commercial publishers.
Packit 9741aa
But some people in the LDP, and users of the various LinuxDoc SGML 
Packit 9741aa
documents, still needs the support of the tools for the LinuxDoc.
Packit 9741aa
This ``LinuxDoc-Tools'' is created for those people.  If you need
Packit 9741aa
the tools for the LinuxDoc DTD, then you may wish to use this.  But 
Packit 9741aa
remember, the LinuxDoc DTD is not the standard way now even in the
Packit 9741aa
Linux world.  If you can, try the DocBook DTD.  It is the standard,
Packit 9741aa
and full-featured way of writing the documentations.

Packit 9741aa
Packit 9741aa
<sect>Installation
Packit 9741aa

Packit 9741aa
<sect1>Where to get the source archive
Packit 9741aa

Packit 9741aa
You can get the source archive of the linuxdoc-tools from:
Packit 9741aa
<itemize>
Packit 9741aa
<item><url url="http://www.debian.org/˜sano/linuxdoc-tools/">
Packit 9741aa
</itemize>
Packit 9741aa
The name of the archive may be 
Packit 9741aa
Packit 9741aa
These have the equivalent contents. You can use anyone.
Packit 9741aa

Packit 9741aa
Packit 9741aa
<sect1>What LinuxDoc-Tools Needs
Packit 9741aa

Packit 9741aa
LinuxDoc-Tools depends on the usage of sgml parser from Jade or OpenJade
Packit 9741aa
(nsgmls or onsgmls). You have to install either of them to use this.
Packit 9741aa

Packit 9741aa

Packit 9741aa
The source archive of the linuxdoc-tools contains the tools and data
Packit 9741aa
that you need to write SGML documents and convert them to groff, LaTeX,
Packit 9741aa
PostScript, HTML, GNU info, LyX, and RTF.  In addition to this package, 
Packit 9741aa
you will need some additional tools for generating formatted output.
Packit 9741aa
<enum>
Packit 9741aa
<item>
Packit 9741aa
You can get this from <url url="ftp://prep.ai.mit.edu/pub/gnu">.
Packit 9741aa
There is a Linux binary
Packit 9741aa
version at 
Packit 9741aa
name="ftp://sunsite.unc.edu/pub/Linux/utils/text"> as well.  You
Packit 9741aa
will need 
Packit 9741aa
Packit 9741aa
You can find the version of your <tt/groff/ from <tt>groff -v < /dev/null</tt>.
Packit 9741aa
Packit 9741aa
<item>TeX and LaTeX.  This is available more or less everywhere; you should
Packit 9741aa
have no problem getting it and installing it (there is a Linux binary
Packit 9741aa
distribution on 
Packit 9741aa
if you want to format your SGML documents with LaTeX.  So, installing 
Packit 9741aa
TeX/LaTeX is optional. If you need PDF output, then you need pdfLaTeX also.
Packit 9741aa
Packit 9741aa
<item>
Packit 9741aa
<tt>
Packit 9741aa
name="ftp://prep.ai.mit.edu/pub/gnu"></tt>.
Packit 9741aa
Packit 9741aa
<item>
Packit 9741aa
info files.  These are also available on 
Packit 9741aa
<tt>
Packit 9741aa
name="ftp://prep.ai.mit.edu/pub/gnu"></tt>, or on 
Packit 9741aa
<tt>
Packit 9741aa
name="ftp://sunsite.unc.edu/pub/Linux/utils/text"></tt> 
Packit 9741aa
(for 
Packit 9741aa
<tt>
Packit 9741aa
name="ftp://sunsite.unc.edu/pub/Linux/system/Manual-pagers"></tt> 
Packit 9741aa
(for GNU info tools).  
Packit 9741aa
Packit 9741aa
<item>LyX (a quasi-WYSIWYG interface to LaTeX, with SGML layouts), is
Packit 9741aa
available on 
Packit 9741aa
<htmlurl url="ftp://ftp.via.ecp.fr" name="ftp://ftp.via.ecp.fr">.
Packit 9741aa
</enum>
Packit 9741aa
Packit 9741aa
<sect1>Installing The Software
Packit 9741aa

Packit 9741aa
The steps needed to install and configure the LinuxDoc-Tools are:
Packit 9741aa
Packit 9741aa
<enum>
Packit 9741aa
<item>First, unpack the tar file of the source archive somewhere.
Packit 9741aa
This will create the directory 
Packit 9741aa
It doesn't matter where you unpack this file; just don't move things 
Packit 9741aa
around within the extracted source tree.
Packit 9741aa
Packit 9741aa
<item>Read the 
Packit 9741aa
Follow them.  If all went well, you should be ready to use the system
Packit 9741aa
immediately once you have done so.
Packit 9741aa
</enum>
Packit 9741aa
Packit 9741aa
<sect>Writing Documents With LinuxDoc-Tools
Packit 9741aa

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

Packit 9741aa
Looking at the source of the example document, you'll notice right off
Packit 9741aa
that there are a number of ``tags'' marked within angle brackets
Packit 9741aa
(<tt><</tt> and <tt/></tt>).  A tag simply specifies the beginning or end
Packit 9741aa
of an element, where an element is something like a section, a paragraph,
Packit 9741aa
a phrase of italicized text, an item in a list, and so on.  Using a tag
Packit 9741aa
is like using an HTML tag, or a LaTeX command such as <tt>\item</tt> or 
Packit 9741aa
<tt>\section{...}</tt>.
Packit 9741aa
Packit 9741aa
As a simple example, to produce <bf>this boldfaced text</bf>, you would type
Packit 9741aa
<tscreen><verb>
Packit 9741aa
As a simple example, to produce <bf>this boldfaced text&etag;;bf>, ...
Packit 9741aa
</verb></tscreen>
Packit 9741aa
in the source.  <tt><bf></tt> begins the region of bold text, and
Packit 9741aa
<tt>&etag;;bf></tt> ends it.  Alternately, you can use the abbreviated form
Packit 9741aa
<tscreen><verb>
Packit 9741aa
As a simple example, to produce 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
which encloses the bold text within slashes.  (Of course, you'll need to
Packit 9741aa
use the long form if the enclosed text contains slashes, such as the
Packit 9741aa
case with Unix filenames).  
Packit 9741aa
Packit 9741aa
There are other things to watch out with respect to special characters 
Packit 9741aa
(that's why you'll notice all of these bizarre-looking ampersand 
Packit 9741aa
expressions if you look at the source; I'll talk about those shortly).
Packit 9741aa
Packit 9741aa
In some cases, the end-tag for a particular element is optional.  For
Packit 9741aa
example, to begin a section, you use the <tt><sect></tt> tag, 
Packit 9741aa
however, the end-tag for the section (which could appear at the end of
Packit 9741aa
the section body itself, not just after the name of the section!) 
Packit 9741aa
is optional and implied when you start another section of the same depth.
Packit 9741aa
In general you needn't worry about these details; just follow the model
Packit 9741aa
used in the tutorial (
Packit 9741aa
Packit 9741aa
<sect1>Special Characters
Packit 9741aa

Packit 9741aa
Obviously, the angle brackets are themselves special characters in the
Packit 9741aa
SGML source.  There are others to watch out for.  For example, let's say 
Packit 9741aa
that you wanted to type an expression with angle brackets around it,
Packit 9741aa
as so: <tt><foo></tt>.  In order to get the left angle bracket, you
Packit 9741aa
must use the <tt>&lt;</tt> element, which is a ``macro'' that expands
Packit 9741aa
to the actual left-bracket character.  Therefore, in the source, I typed
Packit 9741aa
<tscreen><verb>
Packit 9741aa
angle brackets around it, as so: <tt>&ero;lt;foo&ero;gt;&etag;;tt>.
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Generally, anything beginning with an ampersand is a special
Packit 9741aa
character.  For example, there's 
Packit 9741aa
%, 
Packit 9741aa
special character that might otherwise confuse LinuxDoc-Tools if typed by
Packit 9741aa
itself, there is an ampersand "entity" to represent it.  The most
Packit 9741aa
commonly used are:
Packit 9741aa
<itemize>
Packit 9741aa
<item>Use <tt>&amp;</tt> for the ampersand (&), 
Packit 9741aa
<item>Use <tt>&lt;</tt> for a left bracket (<),
Packit 9741aa
<item>Use <tt>&gt;</tt> for a right bracket (&gt),
Packit 9741aa
<item>Use <tt>&etago;</tt> for a left bracket with a slash 
Packit 9741aa
(<tt>&etag;;</tt>)
Packit 9741aa
<item>Use <tt>&dollar;</tt> for a dollar sign ($),
Packit 9741aa
<item>Use <tt>&num;</tt> for a hash (#),
Packit 9741aa
<item>Use <tt>&percnt;</tt> for a percent (%),
Packit 9741aa
<item>Use <tt>&tilde;</tt> for a tilde (˜),
Packit 9741aa
<item>Use <tt>``</tt> and <tt>''</tt> for quotes, or use
Packit 9741aa
   <tt>&dquot;</tt> for &dquot;.
Packit 9741aa
<item>Use <tt>&shy;</tt> for a soft hyphen (that is, an indication
Packit 9741aa
   that this is a good place to break a word for horizontal justification).  
Packit 9741aa
</itemize>
Packit 9741aa

Packit 9741aa
Here is a complete list of the entities recognized by 0.1.  Note
Packit 9741aa
that not all back-ends will be able to make anything useful from every
Packit 9741aa
entity -- if you see parantheses with nothing between them in the
Packit 9741aa
list, it means that the back-end that generated what you're looking at
Packit 9741aa
has no replacement for the entity.  The ``common'' ones listed above
Packit 9741aa
are pretty reliable.
Packit 9741aa
Packit 9741aa
<descrip>
Packit 9741aa
<tag>&half   (½)</tag>vertical 1/2 fraction
Packit 9741aa
<tag>&frac12 (½)</tag>typeset 1/2 fraction
Packit 9741aa
<tag>&frac14 (¼)</tag>typeset 1/4 fraction
Packit 9741aa
<tag>&frac34 (¾)</tag>typeset 3/4 fraction
Packit 9741aa
<tag>&frac18 (⅛)</tag>typeset 1/8 fraction
Packit 9741aa
<tag>&frac38 (⅜)</tag>typeset 3/8 fraction
Packit 9741aa
<tag>&frac58 (⅝)</tag>typeset 5/8 fraction
Packit 9741aa
<tag>&frac78 (⅞)</tag>typeset 7/8 fraction
Packit 9741aa
<tag>&sup1   (¹)</tag>superscript 1
Packit 9741aa
<tag>&sup2   (²)</tag>superscript 2
Packit 9741aa
<tag>&sup3   (³)</tag>superscript 3
Packit 9741aa
<tag>&plus   (+)</tag>plus sign
Packit 9741aa
<tag>&plusmn (±)</tag>plus-or-minus sign
Packit 9741aa
<tag>&lt     (<)</tag>less-than sign
Packit 9741aa
<tag>&equals (=)</tag>equals sign
Packit 9741aa
<tag>&gt     (>)</tag>greater-than sign
Packit 9741aa
<tag>&divide (÷)</tag>division sign
Packit 9741aa
<tag>&times  (×)</tag>multiplication sign
Packit 9741aa
<tag>&curren (¤)</tag>currency symbol
Packit 9741aa
<tag>&pound  (£)</tag>symbol for ``pounds''
Packit 9741aa
<tag>&dollar ($)</tag>dollar sign
Packit 9741aa
<tag>&cent   (¢)</tag>cent sign
Packit 9741aa
<tag>&yen    (¥)</tag>yen sign
Packit 9741aa
<tag>&num    (#)</tag>number or hash sign
Packit 9741aa
<tag>&percnt (%)</tag>percent sign
Packit 9741aa
<tag>&amp    (&)</tag>ampersand
Packit 9741aa
<tag>&ast    (*)</tag>asterisk
Packit 9741aa
<tag>&commat (@)</tag>commercial-at sign
Packit 9741aa
<tag>&lsqb   ([)</tag>left square bracket
Packit 9741aa
<tag>&bsol   (\)</tag>backslash
Packit 9741aa
<tag>&rsqb   (])</tag>right square bracket
Packit 9741aa
<tag>&lcub   ({)</tag>left curly brace
Packit 9741aa
<tag>&horbar (―)</tag>horizontal bar
Packit 9741aa
<tag>&verbar (|)</tag>vertical bar
Packit 9741aa
<tag>&rcub   (})</tag>right curly brace
Packit 9741aa
<tag>&micro  (µ)</tag>greek mu (micro prefix)
Packit 9741aa
<tag>&ohm    (Ω)</tag>greek capital omega (Ohm sign)
Packit 9741aa
<tag>&deg    (°)</tag>small superscript circle sign (degree sign)
Packit 9741aa
<tag>&ordm   (º)</tag>masculine ordinal
Packit 9741aa
<tag>&ordf   (ª)</tag>feminine ordinal
Packit 9741aa
<tag>&sect   (§)</tag>section sign
Packit 9741aa
<tag>&para   (¶)</tag>paragraph sign
Packit 9741aa
<tag>&middot (·)</tag>centered dot
Packit 9741aa
<tag>&larr   (←)</tag>left arrow
Packit 9741aa
<tag>&rarr   (→)</tag>right arrow
Packit 9741aa
<tag>&uarr   (↑)</tag>up arrow
Packit 9741aa
<tag>&darr   (↓)</tag>down arrow
Packit 9741aa
<tag>&copy   (©)</tag>copyright
Packit 9741aa
<tag>&reg    (®)</tag>r-in-circle marl
Packit 9741aa
<tag>&trade  (™)</tag>trademark sign
Packit 9741aa
<tag>&brvbar (¦)</tag>broken vertical bar
Packit 9741aa
<tag>&not    (¬)</tag>logical-negation sign
Packit 9741aa
<tag>&sung   (♪)</tag>sung-note sign
Packit 9741aa
<tag>&excl   (!)</tag>exclamation point
Packit 9741aa
<tag>&iexcl  (¡)</tag>inverted exclamation point
Packit 9741aa
<tag>&quot   (")</tag>double quote
Packit 9741aa
<tag>&apos   (')</tag>apostrophe (single quote)
Packit 9741aa
<tag>&lpar   (()</tag>left parenthesis
Packit 9741aa
<tag>&rpar   ())</tag>right parenthesis
Packit 9741aa
<tag>&comma  (,)</tag>comma
Packit 9741aa
<tag>&lowbar (_)</tag>under-bar
Packit 9741aa
<tag>&hyphen (‐)</tag>hyphen
Packit 9741aa
<tag>&period (.)</tag>period
Packit 9741aa
<tag>&sol    (/)</tag>solidus
Packit 9741aa
<tag>&colon  (:)</tag>colon
Packit 9741aa
<tag>&semi   (;)</tag>semicolon
Packit 9741aa
<tag>&quest  (?)</tag>question mark
Packit 9741aa
<tag>&iquest (¿)</tag>interrobang
Packit 9741aa
<tag>&laquo  («)</tag>left guillemot
Packit 9741aa
<tag>&raquo  (»)</tag>right guillemot
Packit 9741aa
<tag>&lsquo  (‘)</tag>left single quote
Packit 9741aa
<tag>&rsquo  (’)</tag>right single quote
Packit 9741aa
<tag>&ldquo  (“)</tag>left double quote
Packit 9741aa
<tag>&rdquo  (”)</tag>right double quote
Packit 9741aa
<tag>&nbsp   ( )</tag>non-breaking space
Packit 9741aa
<tag>&shy    (­)</tag>soft hyphen
Packit 9741aa
</descrip>
Packit 9741aa
Packit 9741aa
<sect1>Verbatim and Code Environments
Packit 9741aa

Packit 9741aa
While we're on the subject of special characters, we might as well mention
Packit 9741aa
the verbatim ``environment'' used for including literal text in the output
Packit 9741aa
(with spaces and indentation preserved, and so on).  The 
Packit 9741aa
<tt>verb</tt> element is used for this; it looks like the following:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<verb>
Packit 9741aa
 Some literal text to include as example output.
Packit 9741aa
&etag;;verb>
Packit 9741aa
</verb></tscreen>
Packit 9741aa
The <tt>verb</tt> environment doesn't allow you to use 
Packit 9741aa
within it literally.  Specifically, you must do the following within
Packit 9741aa
Packit 9741aa
<itemize>
Packit 9741aa
<item>Use <tt>&ero;</tt> to get an ampersand, 
Packit 9741aa
<item>Use <tt>&etago;</tt> to get <tt>&etag;;</tt>,
Packit 9741aa
<item>Don't use <tt>\end{verbatim}</tt> within a <tt>verb</tt>
Packit 9741aa
environment, as this is what LaTeX uses to end the <tt>verbatim</tt> 
Packit 9741aa
environment.  (In the future, it should be possible to hide the underlying
Packit 9741aa
text formatter entirely, but the parser doesn't support this feature yet.) 
Packit 9741aa
</itemize>
Packit 9741aa
The <tt>code</tt> environment is much just like the 
Packit 9741aa
except that horizontal rules are added to the surrounding text, as so:
Packit 9741aa
Packit 9741aa
Here is an example code environment.
Packit 9741aa
Packit 9741aa
Packit 9741aa
You should use the 
Packit 9741aa
as so:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<tscreen><verb>
Packit 9741aa
Here is some example text.  
Packit 9741aa
&etag;;verb>&etag;;tscreen>
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa
sets the default font to 
Packit 9741aa
in the LaTeX and plain text versions.  You can use 
Packit 9741aa
without 
Packit 9741aa
example you'll need to use both of them.  
Packit 9741aa
special characters.  See 
Packit 9741aa
Packit 9741aa
The 
Packit 9741aa
not set the default font to 
Packit 9741aa
non-computer-interaction quotes, as in:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<quote>
Packit 9741aa
Here is some text to be indented, as in a quote.
Packit 9741aa
&etag;;quote>
Packit 9741aa
</verb></tscreen>
Packit 9741aa
which will generate:
Packit 9741aa
<quote>
Packit 9741aa
Here is some text to be indented, as in a quote.
Packit 9741aa
</quote>
Packit 9741aa
Packit 9741aa
<sect1>Overall Document Structure
Packit 9741aa

Packit 9741aa
Before we get too in-depth with details, we're going to describe the
Packit 9741aa
overall structure of an LinuxDoc-Tools document.  Look at
Packit 9741aa
Packit 9741aa
Packit 9741aa
<sect2>The Preamble
Packit 9741aa

Packit 9741aa
In the document ``preamble'' you set up things such as the title
Packit 9741aa
information and document style: 
Packit 9741aa
<tscreen><verb>
Packit 9741aa
Packit 9741aa
Packit 9741aa
<article>
Packit 9741aa
Packit 9741aa
<title>Linux Foo HOWTO
Packit 9741aa
<author>Norbert Ebersol, 
Packit 9741aa
<date>v1.0, 9 March 1994
Packit 9741aa
<abstract>
Packit 9741aa
This document describes how to use the 
Packit 9741aa
bar libraries, using the 
Packit 9741aa
&etag;;abstract>
Packit 9741aa
Packit 9741aa
<toc>
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa
The elements should go more or less in this order.  The first line
Packit 9741aa
tells the SGML parser to use the linuxdoc DTD.  We'll explain that in
Packit 9741aa
the later section on <ref id="sgml" name="How LinuxDoc-Tools Works">; for
Packit 9741aa
now just treat it as a bit of necessary magic.  The
Packit 9741aa
<tt><article></tt> tag forces the document to use the ``article''
Packit 9741aa
document style.
Packit 9741aa
Packit 9741aa
The 
Packit 9741aa
<tt>date</tt> tag include the version number and last modification time of
Packit 9741aa
the document.
Packit 9741aa
Packit 9741aa
The 
Packit 9741aa
document, 
Packit 9741aa
include a table of contents (the 
Packit 9741aa
need an 
Packit 9741aa
Packit 9741aa
<sect2>Sectioning And Paragraphs
Packit 9741aa

Packit 9741aa
After the preamble, you're ready to dive into the document.  The following
Packit 9741aa
sectioning commands are available:
Packit 9741aa
<itemize>
Packit 9741aa
<item>
Packit 9741aa
<item>
Packit 9741aa
<item>
Packit 9741aa
<item>
Packit 9741aa
<item>
Packit 9741aa
</itemize>
Packit 9741aa
These are roughly equivalent to their LaTeX counterparts 
Packit 9741aa
Packit 9741aa
Packit 9741aa
After the 
Packit 9741aa
name of the section.  For example, at the top of this document, after
Packit 9741aa
the preamble, comes the tag:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<sect>Introduction
Packit 9741aa
</verb></tscreen>
Packit 9741aa
And at the beginning of this section (Sectioning and paragraphs), there
Packit 9741aa
is the tag:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<sect2>Sectioning And Paragraphs
Packit 9741aa
</verb></tscreen>
Packit 9741aa
After the section tag, you begin the body of the section.  However, you
Packit 9741aa
must start the body with a <tt><p></tt> tag, as so:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<sect>Introduction
Packit 9741aa

Packit 9741aa
This is a user's guide to the LinuxDoc-Tools document processing...
Packit 9741aa
</verb></tscreen>
Packit 9741aa
This is to tell the parser that you're done with the section title
Packit 9741aa
and are ready to begin the body.  Thereafter, new paragraphs are started
Packit 9741aa
with a blank line (just as you would do in TeX).  For example,
Packit 9741aa
<tscreen><verb>
Packit 9741aa
Here is the end of the first paragraph.
Packit 9741aa
Packit 9741aa
And we start a new paragraph here.
Packit 9741aa
</verb></tscreen>
Packit 9741aa
There is no reason to use <tt><p></tt> tags at the beginning of
Packit 9741aa
every paragraph; only at the beginning of the first paragraph after
Packit 9741aa
a sectioning command.
Packit 9741aa
Packit 9741aa
<sect2>Ending The Document
Packit 9741aa

Packit 9741aa
At the end of the document, you must use the tag:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
&etag;;article>
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa
to tell the parser that you're done with the 
Packit 9741aa
embodies the entire document).  
Packit 9741aa
</sect2>
Packit 9741aa
Packit 9741aa
<sect1>Internal Cross-References<label id="cross-ref">
Packit 9741aa

Packit 9741aa
Now we're going to move onto other features of the system.  
Packit 9741aa
Cross-references are easy.  For example, if you want to make a
Packit 9741aa
cross-reference to a certain section, you need to label that section
Packit 9741aa
as so:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<sect1>Introduction<label id="sec-intro">
Packit 9741aa
</verb></tscreen>
Packit 9741aa
You can then refer to that section somewhere in the text using the
Packit 9741aa
expression:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
See section <ref id="sec-intro" name="Introduction"> for an introduction.
Packit 9741aa
</verb></tscreen>
Packit 9741aa
This will replace the 
Packit 9741aa
as 
Packit 9741aa
groff and HTML translations.  The groff macro set used by LinuxDoc-Tools 
Packit 9741aa
does not currently support cross-references, and it's often nice to refer 
Packit 9741aa
to a section by name instead of number.  
Packit 9741aa
Packit 9741aa
For example, this section is <ref id="cross-ref" name="Cross-References">.
Packit 9741aa
Packit 9741aa
Some back-ends may get upset about special characters in reference labels.
Packit 9741aa
In particular, latex2e chokes on underscores (though the latex back end
Packit 9741aa
used in older versions of this package didn't).  Hyphens are safe.
Packit 9741aa
Packit 9741aa
<sect1>Web References
Packit 9741aa

Packit 9741aa
There is also a 
Packit 9741aa
URLs, used on the World Wide Web.  This element should be used to refer
Packit 9741aa
to other documents, files available for FTP, and so forth.  For
Packit 9741aa
example,
Packit 9741aa
<tscreen><verb>
Packit 9741aa
You can get the Linux HOWTO documents from 
Packit 9741aa
Packit 9741aa
   name="The Linux HOWTO INDEX">.
Packit 9741aa
</verb></tscreen>
Packit 9741aa
The 
Packit 9741aa
URL in question will be automatically added to the HTML document.
Packit 9741aa
The optional 
Packit 9741aa
the URL (for HTML conversion) or named as the description of the
Packit 9741aa
URL (for LaTeX and groff).  If no 
Packit 9741aa
URL itself will be used.
Packit 9741aa
Packit 9741aa
A useful variant of this is 
Packit 9741aa
the URL part in every context except HTML.  What this is useful for
Packit 9741aa
is things like a person's email addresses; you can write
Packit 9741aa
<tscreen><verb>
Packit 9741aa
Packit 9741aa
      name="esr@snark.thyrsus.com">
Packit 9741aa
</verb></tscreen>
Packit 9741aa
and get ``esr@snark.thyrsus.com'' in text output rather than the
Packit 9741aa
duplicative ``esr@snark.thyrsus.com <mailto:esr@snark.thyrsus.com>''
Packit 9741aa
but still have a proper URL in HTML documents.
Packit 9741aa
Packit 9741aa
<sect1>Fonts
Packit 9741aa

Packit 9741aa
Essentially, the same fonts supported by LaTeX are supported
Packit 9741aa
by LinuxDoc-Tools.  Note, however, that the conversion to 
Packit 9741aa
plain text (through 
Packit 9741aa
information.  So, you should use fonts 
Packit 9741aa
as for the benefit of the conversion to LaTeX,
Packit 9741aa
but don't depend on the fonts to get a point across in the plain
Packit 9741aa
text version.  
Packit 9741aa
Packit 9741aa
In particular, the 
Packit 9741aa
get constant-width ``typewriter'' font which should be used for
Packit 9741aa
all e-mail addresses, machine names, filenames, and so on.  
Packit 9741aa
Example:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
Here is some <tt>typewriter text&etag;;tt> to be included in the document.
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Equivalently:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
Here is some 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Remember that you can only use this abbreviated form if the enclosed
Packit 9741aa
text doesn't contain slashes.
Packit 9741aa
Packit 9741aa
Other fonts can be achieved with 
Packit 9741aa
for 
Packit 9741aa
we don't suggest you use them, because we'll be converting these
Packit 9741aa
documents to other formats such as HTML which may not support them.
Packit 9741aa
Boldface, typewriter, and italics should be all that you need.
Packit 9741aa
Packit 9741aa
<sect1>Lists
Packit 9741aa

Packit 9741aa
There are various kinds of supported lists.  They are:
Packit 9741aa
<itemize>
Packit 9741aa
<item>
Packit 9741aa
<item>
Packit 9741aa
<item>
Packit 9741aa
</itemize>
Packit 9741aa
Each item in an 
Packit 9741aa
with an 
Packit 9741aa
For example,
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<itemize>
Packit 9741aa
<item>Here is an item.
Packit 9741aa
<item>Here is a second item.
Packit 9741aa
&etag;;itemize>
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Looks like this:
Packit 9741aa
<itemize>
Packit 9741aa
<item>Here is an item.
Packit 9741aa
<item>Here is a second item.
Packit 9741aa
</itemize>
Packit 9741aa
Or, for an 
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<enum>
Packit 9741aa
<item>Here is the first item.
Packit 9741aa
<item>Here is the second item.
Packit 9741aa
&etag;;enum>
Packit 9741aa
</verb></tscreen>
Packit 9741aa
You get the idea.  Lists can be nested as well; see the example document
Packit 9741aa
for details.
Packit 9741aa
Packit 9741aa
A 
Packit 9741aa
you might want to use it for some situations:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<descrip>
Packit 9741aa
Packit 9741aa
Packit 9741aa
&etag;;descrip>
Packit 9741aa
</verb></tscreen>
Packit 9741aa
ends up looking like:
Packit 9741aa
<descrip>
Packit 9741aa
Packit 9741aa
Packit 9741aa
</descrip>
Packit 9741aa
Packit 9741aa
<sect1>Conditionalization
Packit 9741aa

Packit 9741aa
The overall goal of LinuxDoc-tools is to be able to produce from one set
Packit 9741aa
of masters output that is semantically equivalent on all back ends.
Packit 9741aa
Nevertheless, it is sometimes useful to be able to produce a document
Packit 9741aa
in slightly different variants depending on back end and version.  
Packit 9741aa
LinuxDoc-Tools supports this through the <#if> and <#unless>
Packit 9741aa
bracketing tags.
Packit 9741aa
Packit 9741aa
These tags allow you to selectively include and uninclude portions of
Packit 9741aa
an SGML master in your output, depending on filter options set by your
Packit 9741aa
driver.  Each tag may include a set of attribute/value pairs.  The
Packit 9741aa
most common are ``output'' and ``version'' (though you are not
Packit 9741aa
restricted to these) so a typical example might look like this:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
Some <#if output=latex2e version=drlinux>conditional</#if> text.
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Everything from this <#if> tag to the following </#if> would
Packit 9741aa
be considered conditional, and would not be included in the document
Packit 9741aa
if either the filter option ``output'' were set to something that
Packit 9741aa
doesn't match ``latex2e'' or the filter option ``version'' were set 
Packit 9741aa
to something that doesn't match ``drlinux''.  The double negative is
Packit 9741aa
deliberate; if no ``output'' or ``version'' filter options are set,
Packit 9741aa
the conditional text will be included.
Packit 9741aa
Packit 9741aa
Filter options are set in one of two ways.  Your format driver sets
Packit 9741aa
the ``output'' option to the name of the back end it uses; thus, in
Packit 9741aa
particular, ``<tt>linuxdoc -B latex</tt>'' sets 
Packit 9741aa
``output=latex2e'',  Or you may set an attribute-value pair with 
Packit 9741aa
the ``-D'' option of your format driver.  Thus, if the above tag were
Packit 9741aa
part of a file a file named ``foo.sgml'', then formatting with either 
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B latex -D version=drlinux foo.sgml
Packit 9741aa
</verb></tscreen>
Packit 9741aa
or
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B latex foo.sgml
Packit 9741aa
</verb></tscreen>
Packit 9741aa
would include the ``conditional'' part, but neither
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B html -D version=drlinux foo.sgml
Packit 9741aa
</verb></tscreen>
Packit 9741aa
nor
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B latex -D private=book foo.sgml
Packit 9741aa
</verb></tscreen>
Packit 9741aa
would do so.
Packit 9741aa
Packit 9741aa
So that you can have conditionals depending on one or more of several
Packit 9741aa
values matching, values support a simple alternation syntax using
Packit 9741aa
``|''.  Thus you could write:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
Some <#if output="latex2e|html" version=drlinux>conditional</#if> text.
Packit 9741aa
</verb></tscreen>
Packit 9741aa
and formatting with either ``-B latex'' or ``-B html'' will include the
Packit 9741aa
``conditional'' text (but formatting with, say, ``-B txt'' will not).
Packit 9741aa
Packit 9741aa
The <#unless> tag is the exact inverse of <#if>; it
Packit 9741aa
includes when <#if>; would exclude, and vice-versa.
Packit 9741aa
Packit 9741aa
Note that these tags are implemented by a preprocessor which runs
Packit 9741aa
before the SGML parser ever sees the document.  Thus they are
Packit 9741aa
completely independent of the document structure, are not in the DTD,
Packit 9741aa
and usage errors won't be caught by the parser.  You can seriously
Packit 9741aa
confuse yourself by conditionalizing sections that contain unbalanced
Packit 9741aa
bracketing tags.  
Packit 9741aa
Packit 9741aa
The preprocessor implementation also means that standalone SGML
Packit 9741aa
parsers will choke on LinuxDoc-Tools documents that contain conditionals.
Packit 9741aa
However, you can validity-check them with ``<tt>linuxdoc -B check</tt>''.
Packit 9741aa
Packit 9741aa
Also note that in order not to mess up the source line numbers in
Packit 9741aa
parser error messages, the preprocessor doesn't actually throw
Packit 9741aa
away everything when it omits a conditionalized section.  It still
Packit 9741aa
passes through any newlines.  This leads to behavior that may 
Packit 9741aa
suprise you if you use <if> or <unless> within a
Packit 9741aa
<verb> environment, or any other kind of bracket that changes
Packit 9741aa
SGML's normal processing of whitespace.
Packit 9741aa
Packit 9741aa
These tags are called ``#if'' and ``#unless'' (rather than ``if'' and
Packit 9741aa
``unless'') to remind you that they are implemented by a preprocessor
Packit 9741aa
and you need to be a bit careful about how you use them.
Packit 9741aa
Packit 9741aa
<sect1>Index generation
Packit 9741aa

Packit 9741aa
To support automated generation of indexes for book publication of
Packit 9741aa
SGML masters, LinuxDoc-Tools supports the <idx> and <cdx>
Packit 9741aa
tags.  These are bracketing tags which cause the text between them to
Packit 9741aa
be saved as an index entry, pointing to the page number on which it
Packit 9741aa
occurs in the formatted document.  They are ignored by all backends
Packit 9741aa
except LaTeX, which uses them to build a .ind file suitable for
Packit 9741aa
processing by the TeX utility makeindex.
Packit 9741aa
Packit 9741aa
The two tags behave identically, except that <idx> sets the
Packit 9741aa
entry in a normal font and <cdx> in a constant-width one.
Packit 9741aa
Packit 9741aa
If you want to add an index entry that shouldn't appear in the text
Packit 9741aa
itself, use the <nidx> and <ncdx> tags.
Packit 9741aa
Packit 9741aa
<sect1>Controlling justification
Packit 9741aa

Packit 9741aa
In order to get proper justification and filling of paragraphs in
Packit 9741aa
typeset output, LinuxDoc-Tools includes the &shy; entity.  This
Packit 9741aa
becomes an optional or `soft' hyphen in back ends like latex2e
Packit 9741aa
for which this is neaningful.
Packit 9741aa
Packit 9741aa
The bracketing tag <file> can be used to surround filenames in
Packit 9741aa
running text.  It effectively inserts soft hyphens after each slash in
Packit 9741aa
the filename.
Packit 9741aa
Packit 9741aa
One of the advantages of using the <url> and <htmlurl>
Packit 9741aa
tags is that they do likewise for long URLs.
Packit 9741aa
  
Packit 9741aa
<sect>Formatting SGML Documents
Packit 9741aa

Packit 9741aa
Let's say you have the SGML document 
Packit 9741aa
Here is a general overview of formatting the document for different output.
Packit 9741aa
For a complete list of options, consult the man pages.
Packit 9741aa
Packit 9741aa
<sect1>Checking SGML Syntax
Packit 9741aa

Packit 9741aa
If you just want to capture your errors from the SGML conversion,
Packit 9741aa
use the ``<tt>linuxdoc -B check</tt>''.  For example.
Packit 9741aa
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B check foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa
If you see no output from this check run other than the
Packit 9741aa
``Processing...'' message, that's good.  It means there were no errors.
Packit 9741aa
Packit 9741aa
<sect1>Creating Plain Text Output
Packit 9741aa

Packit 9741aa
If you want to produce plain text, use the command:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B txt foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa

Packit 9741aa
You can also create groff source for man pages, which can be formatted with
Packit 9741aa
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B txt --man foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa
<sect1>Creating LaTeX, DVI, PostScript or PDF Output 
Packit 9741aa

Packit 9741aa
To create a LaTeX documents from the SGML source file, simply run:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B latex foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa

Packit 9741aa
If you want to produce PostScript output (via 
Packit 9741aa
``<tt>-o</tt>'' option:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B latex --output=ps foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa

Packit 9741aa
Or you can produce a DVI file:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B latex --output=dvi foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa

Packit 9741aa
Also, you can produce a PDF file:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B latex --output=pdf foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa
Packit 9741aa
<sect1>Creating HTML Output
Packit 9741aa

Packit 9741aa
If you want to produce HTML output, do this:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B html --imagebuttons foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa

Packit 9741aa
This will produce <tt>foo.html</tt>, as well as <tt>foo-1.html</tt>,
Packit 9741aa
Packit 9741aa
document.  Run your WWW browser on <tt>foo.html</tt>, which is the top
Packit 9741aa
level file.  You must make sure that all of the HTML files generated
Packit 9741aa
from your document are all installed in the directory, as they
Packit 9741aa
reference each other with local URLs.
Packit 9741aa

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

Packit 9741aa
If you use ``<tt>linuxdoc -B html</tt>'' without the ``<tt>-img</tt>''
Packit 9741aa
flag, HTML documents will by default have the English labels
Packit 9741aa
``Previous'', ``Next'', and ``Table of Contents'' for navigation.
Packit 9741aa
If you specify one of the accepted language codes in 
Packit 9741aa
a ``<tt>--language</tt>'' option, however, the labels will be given
Packit 9741aa
in that language.
Packit 9741aa
Packit 9741aa
<sect1>Creating GNU Info Output
Packit 9741aa

Packit 9741aa
If you want to format your file for the GNU info browser, just run the
Packit 9741aa
following command:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B info foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa
<sect1>Creating LyX Output
Packit 9741aa

Packit 9741aa
For LyX output, use the the command:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B lyx foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa
<sect1>Creating RTF Output
Packit 9741aa

Packit 9741aa
If you want to produce RTF output, run the command:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B rtf foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa

Packit 9741aa
This will produce <tt>foo.rtf</tt>, as well as <tt>foo-1.rtf</tt>,
Packit 9741aa
Packit 9741aa
Packit 9741aa
<sect>Internationalization Support
Packit 9741aa

Packit 9741aa
The ISO 8859-1 (latin1) character set may be used for international characters 
Packit 9741aa
in plain text, LaTeX, HTML, LyX, and RTF output (GNU info support for 
Packit 9741aa
ISO 8859-1 may be possible in the future).  To use this feature, give the
Packit 9741aa
formatting scripts the ``<tt>--charset=latin</tt>'' flag, for example:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
% linuxdoc -B txt --charset=latin foo.sgml 
Packit 9741aa
</verb></tscreen>
Packit 9741aa
You also can use ISO 8859-1 characters in the SGML source, they will 
Packit 9741aa
automatically be translated to the proper escape codes for the corresponding 
Packit 9741aa
output format.
Packit 9741aa

Packit 9741aa

Packit 9741aa
Currently, EUC-JP (ujis) character set is partially supported.
Packit 9741aa
Source SGML file using this character set can be converted
Packit 9741aa
in plain text, HTML, and LaTeX. Other output formats are not
Packit 9741aa
tested fully.
Packit 9741aa

Packit 9741aa
Packit 9741aa
<sect>How LinuxDoc-Tools Works<label id="sgml">
Packit 9741aa

Packit 9741aa
Technically, the tags and conventions we've explored in previous
Packit 9741aa
sections of this use's guide are what is called a markup
Packit 9741aa
language -- a way to embed formatting information in a document
Packit 9741aa
so that programs can do useful things with it.  HTML, Tex, and Unix
Packit 9741aa
manual-page macros are well-known examples of markup languages.
Packit 9741aa
Packit 9741aa
<sect1>Overview of SGML
Packit 9741aa

Packit 9741aa
LinuxDoc-Tools uses a way of describing markup languages called SGML
Packit 9741aa
 (Standard Generalized Markup Language).  SGML itself doesn't describe 
Packit 9741aa
a markup language; rather, it's a language for writing specifications 
Packit 9741aa
for markup languages.  The reason SGML is useful is that an SGML markup 
Packit 9741aa
specification for a language can be used to generate programs that 
Packit 9741aa
``know'' that language with much less effort (and a much lower bugginess 
Packit 9741aa
rate!) than if they had to be coded by hand.
Packit 9741aa
Packit 9741aa
In SGML jargon, a markup language specification is called a ``DTD''
Packit 9741aa
(Document Type Definition).  A DTD allows you to specify the
Packit 9741aa
Packit 9741aa
order, make up a document of that kind.  Given a DTD, an SGML parser
Packit 9741aa
can check a document for correctness.  An SGML-parser/DTD combination
Packit 9741aa
can also make it easy to write programs that translate that structure
Packit 9741aa
into another markup language -- and this is exactly how LinuxDoc-Tools
Packit 9741aa
actually works.
Packit 9741aa
Packit 9741aa
LinuxDoc-Tools provides a SGML DTD called ``linuxdoc'' and a set of
Packit 9741aa
``replacement files'' which convert the linuxdoc documents to groff,
Packit 9741aa
LaTeX, HTML, GNU info, LyX, and RTF source.  This is why the example 
Packit 9741aa
document has a magic cookie at the top of it that says ``linuxdoc system'';
Packit 9741aa
that is how one tells an SGML parser what DTD to use.
Packit 9741aa
Packit 9741aa
Actually, LinuxDoc-Tools provides a couple of closely related DTDs.  But
Packit 9741aa
the ones other than linuxdoc are still experimental, and you probably
Packit 9741aa
do not want to try working with them unless you are an LinuxDoc-Tools guru.
Packit 9741aa
Packit 9741aa
If you are an SGML guru, you may find it interesting to know that the 
Packit 9741aa
LinuxDoc-Tools DTDs are based heavily on the QWERTZ DTD by Tom Gordon,
Packit 9741aa
Packit 9741aa
Packit 9741aa
If you are not an SGML guru, you may not know that HTML (the markup
Packit 9741aa
language used on the World Wide Web) is itself defined by a DTD.
Packit 9741aa
Packit 9741aa
<sect1>How SGML Works
Packit 9741aa

Packit 9741aa
An SGML DTD like linuxdoc specifies the names of ``elements'' within a
Packit 9741aa
document type.  An element is just a bit of structure; like a
Packit 9741aa
section, a subsection, a paragraph, or even something smaller like
Packit 9741aa
Packit 9741aa
Packit 9741aa
Unlike in LaTeX, however, these elements are not in any way intrinsic to
Packit 9741aa
SGML itself.  The linuxdoc DTD happens to define elements that look a
Packit 9741aa
lot like their LaTeX counterparts---you have sections, subsections,
Packit 9741aa
verbatim ``environments'', and so forth.  However, using SGML you can
Packit 9741aa
define any kind of structure for the document that you like.  In a
Packit 9741aa
way, SGML is like low-level TeX, while the linuxdoc DTD is like LaTeX.
Packit 9741aa
Packit 9741aa
Don't be confused by this analogy.  SGML is 
Packit 9741aa
There is no ``SGML formatter'' per se.  SGML source is 
Packit 9741aa
to other formats for processing.  Furthermore, SGML itself is used only to 
Packit 9741aa
specify the document structure.  There are no text-formatting facilities or
Packit 9741aa
``macros'' intrinsic to SGML itself.  All of those things are defined within
Packit 9741aa
the DTD.  You can't use SGML without a DTD, a DTD defines what SGML does.
Packit 9741aa
Packit 9741aa
<sect1>What Happens When LinuxDoc-Tools Processes A Document
Packit 9741aa

Packit 9741aa
Here's how processing a document with LinuxDoc-Tools works.  First, you
Packit 9741aa
need a DTD, which sets up the structure of the document.  A small
Packit 9741aa
portion of the normal (linuxdoc) DTD looks like this:
Packit 9741aa
Packit 9741aa
<tscreen><verb>
Packit 9741aa
Packit 9741aa
    (titlepag, header?, 
Packit 9741aa
     toc?, lof?, lot?, p*, sect*, 
Packit 9741aa
     (appendix, sect+)?, biblio?) +(footnote)>
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Packit 9741aa
This part sets up the overall structure for an ``article'', which is like
Packit 9741aa
a ``documentstyle'' within LaTeX.  The article consists of a titlepage
Packit 9741aa
(
Packit 9741aa
contents (
Packit 9741aa
(
Packit 9741aa
sections (
Packit 9741aa
bibliography (
Packit 9741aa
Packit 9741aa
As you can see, the DTD doesn't say anything about how the document should
Packit 9741aa
be formatted or what it should look like.  It just defines what parts make
Packit 9741aa
up the document.  Elsewhere in the DTD the structure of the 
Packit 9741aa
Packit 9741aa
Packit 9741aa
You don't need to know anything about the syntax of the DTD in order
Packit 9741aa
to write documents.  We're just presenting it here so you know what it
Packit 9741aa
looks like and what it does.  You 
Packit 9741aa
document 
Packit 9741aa
violate the structure when attempting to write a document, and be very
Packit 9741aa
confused about the resulting error messages.
Packit 9741aa
Packit 9741aa
The next step is to write a document using the structure defined by
Packit 9741aa
the DTD.  Again, the linuxdoc DTD makes documents look a lot like
Packit 9741aa
LaTeX or HTML -- it's very easy to follow.  In SGML jargon a single
Packit 9741aa
document written using a particular DTD is known as an ``instance'' of
Packit 9741aa
that DTD.
Packit 9741aa
Packit 9741aa
In order to translate the SGML source into another format (such as LaTeX
Packit 9741aa
or groff) for processing, the SGML source (the document that you wrote)
Packit 9741aa
is 
Packit 9741aa
uses the 
Packit 9741aa
The former is the successor of the latter. 
Packit 9741aa
by James Clark, 
Packit 9741aa
of 
Packit 9741aa
The parser (
Packit 9741aa
and verifies that it follows the structure set forth by the DTD.  
Packit 9741aa
It also spits out a more explicit form of your document, with all 
Packit 9741aa
 ``macros'' and elements expanded, which is understood by 
Packit 9741aa
the next part of the process.  
Packit 9741aa
Packit 9741aa
Packit 9741aa
another format (such as LaTeX).  It does this using 
Packit 9741aa
which describe how to convert elements in the original SGML document into
Packit 9741aa
corresponding source in the ``target'' format (such as LaTeX or groff).  
Packit 9741aa
Packit 9741aa
For example, part of the replacement file for LaTeX looks like:
Packit 9741aa
<tscreen><verb>
Packit 9741aa
<itemize>    +    "\\begin{itemize}   +
Packit 9741aa
&etag;;itemize>   +    "\\end{itemize}    +
Packit 9741aa
</verb></tscreen>
Packit 9741aa
Which says that whenever you begin an 
Packit 9741aa
SGML source, it should be replaced with 
Packit 9741aa
<tscreen><verb>
Packit 9741aa
\begin{itemize}
Packit 9741aa
</verb></tscreen>
Packit 9741aa
in the LaTeX source.  (As I said, elements in the DTD
Packit 9741aa
are very similar to their LaTeX counterparts).  
Packit 9741aa
Packit 9741aa
So, to convert the SGML to another format, all you have to do is write
Packit 9741aa
a new replacement file for that format that gives the appropriate 
Packit 9741aa
analogies to the SGML elements in that new format.  In practice, it's not
Packit 9741aa
that simple---for example, if you're trying to convert to a format that
Packit 9741aa
isn't structured at all like your DTD, you're going to have trouble.  In 
Packit 9741aa
any case, it's much easier to do than writing individual parsers and
Packit 9741aa
translators for many kinds of output formats; SGML provides a generalized
Packit 9741aa
system for converting one source to many formats.
Packit 9741aa
Packit 9741aa
Once 
Packit 9741aa
corresponds to your original SGML document, which you can format using
Packit 9741aa
LaTeX as you normally would.
Packit 9741aa
Packit 9741aa
<sect1>Further Information
Packit 9741aa

Packit 9741aa
	<itemize>
Packit 9741aa
	<item>The QWERTZ User's Guide is available from 
Packit 9741aa
	<tt>
Packit 9741aa
	name="ftp://ftp.cs.cornell.edu/pub/mdw/SGML"></tt>.
Packit 9741aa
	QWERTZ (and hence, LinuxDoc-Tools) supports many features such as 
Packit 9741aa
	mathematical formulae, tables, figures, and so forth.
Packit 9741aa
	If you'd like to write general 
Packit 9741aa
	documentation in SGML, I suggest using the original QWERTZ DTD instead 
Packit 9741aa
	of the hacked-up linuxdoc DTD, which I've modified for use 
Packit 9741aa
	particularly by the Linux HOWTOs and other such documentation.  
Packit 9741aa
Packit 9741aa
	<item>Tom Gordon's original QWERTZ tools can be found at 
Packit 9741aa
	<tt>
Packit 9741aa
	name="ftp://ftp.gmd.de/GMD/sgml"></tt>.
Packit 9741aa
Packit 9741aa
	<item>More information on SGML can be found at the following WWW 
Packit 9741aa
	pages: 
Packit 9741aa
	<enum>
Packit 9741aa
	<item><tt>
Packit 9741aa
	name="SGML and the Web"></tt>
Packit 9741aa
	<item><tt>
Packit 9741aa
	name="SGML Web Page"></tt>
Packit 9741aa
	<item><tt><url url="http://www.yahoo.com/Computers_and_Internet/Software/Data_Formats/SGML" name="Yahoo's SGML Page"></tt>
Packit 9741aa
	</enum>
Packit 9741aa
Packit 9741aa
	<item>James Clark's 
Packit 9741aa
	and other tools can be found at
Packit 9741aa
	<tt><htmlurl url="ftp://ftp.jclark.com" name="ftp://ftp.jclark.com">
Packit 9741aa
	</tt> and at <tt>
Packit 9741aa
	name="James Clark's WWW Page"></tt>.
Packit 9741aa
Packit 9741aa
	<item>The emacs psgml package can be found at
Packit 9741aa
	<tt>
Packit 9741aa
	name="ftp://ftp.lysator.liu.se/pub/sgml"></tt>.  This package
Packit 9741aa
	provides a lot of SGML functionality.
Packit 9741aa
Packit 9741aa
	<item>More information on 
Packit 9741aa
	<tt>
Packit 9741aa
	name="LyX WWW Page"></tt>.  
Packit 9741aa
	frontend to LaTeX.  Quasi-WYSIWYG interface, many LaTeX styles and 
Packit 9741aa
	layouts automatically generated.  Speeds up learning LaTeX and makes 
Packit 9741aa
	complicated layouts easy and intuitive.
Packit 9741aa
Packit 9741aa
	</itemize>
Packit 9741aa
</article>