% The percent sign beginning this line is a comment for TeX or LaTeX,
% which will not appear in the final document.
%   As you can guess, this article is written for LaTeX, partly
% as an example of how to use this powerful system.
%   "TeX" is used to refer to any of the TeX macro packages,
% including LaTeX.  TeX commands begin with a \ and often have
% arguments enclosed in curly braces.
%   Every LaTeX document begins with a \documentstyle command,
% which loads a set of macros which determine how the output
% will look.
\documentstyle{article}

% After the \documentstyle command can come any of a wide number
% of commands which define your own macros, or alter some
% of LaTeX's default behavior.

% Here, we tell LaTeX what the title and author are.  These are
% used by the \maketitle command which appears at the beginning
% of the document.
\title{\TeX\ and \LaTeX\ for OS9}
\author{ Tim Kientzle}

% Here's where the actual document begins.  There is an \end{document}
% at the end that matches it.
\begin{document}

\maketitle    % In "book" style, this would create a title page

%  The actual text is typed however you like.  A blank line
%  separates paragraphs.  Other than that, the spacing is unimportant;
%  the indentation here is simply to make this file easier to read,
%  it has no impact on the result.

%  The first line has two macros.  The first is \TeX, which prints
%  the TeX logo.  The second is \<space>.  Normally, space after a macro
%  is removed, so this is needed to keep the TeX logo from colliding with
%  the following word.  If \TeX were followed by a punctuation mark,
%  this wouldn't be needed.

   For the last several months, I've been using my port of the \TeX\
typesetting system under OS9.  The primary motivation for porting the
system was my past experience with \TeX, which I find generates good
output with a minimal amount of effort.

   For people that are unfamiliar with \TeX\ and the various macro
packages available (particularly \LaTeX), I've put together this article
to explain what this system is and why I find it so attractive.

% New sections are created with the \section command.  Chapters can
% be created similarly.  Chapters, sections, and subsections are numbered
% automatically, and are entered in the Table of Contents if you have
% one.
\section{About the Name}

% The \em is a font-changing command that means the remaining
% text should be emphasized.  By default, LaTeX emphasizes by
% using italics.  The curly braces isolate the effect of the
% \em command.  The special macro \/ adds a tiny bit of space
% between italic and non-italic text to keep the characters
% from running together.  \tt is another type-changing command;
% it begins "typewriter" text, often used for the names of computer
% programs or files.

   The name ``\TeX'' comes from the greek letters $\tau\epsilon\chi$,
which form the root of such words as {\em technology\/} and {\em
technique}. As such, it is pronounced ``tek.'' In order to avoid
confusion with other systems with similar names, it is 
written with a lowered capital E when typeset, or with a single
lowercase ``e'' as {\tt TeX}.


\section{About \TeX}

   \TeX\ was designed by Donald Knuth, a professor of computer science
at Stanford University who is perhaps best known for his incomplete
series {\em The Art of Computer Programming}.  In the process of writing
those books, Knuth became dissatisfied with the tools available, and
began to design a system which could handle the type of writing he
was doing.  The result was \TeX, which features a powerful macro
language for simplifying common tasks and an impressive ability to
handle complex mathematical typesetting.  Knuth also designed the
MetaFont font-description language to accompany \TeX.

% To get left and right quote marks, use two single quotes together.
% TeX recognizes this and uses the correct double-quote character.

   ``Primitive'' \TeX\ is not a very useful system, as few people are
really interested in specifying every detail of their document. Knuth
wrote an extensive macro package called ``Plain \TeX'' to simplify
common tasks.  Deficiencies in Plain \TeX\ have led to a large number of
extensions.  For example, \LaTeX\ adds the ability to specify a {\em
document style\/} which can set the default handling for chapter and
section titles, page numbering, and many other details.  The American
Mathematics Society has sponsored the development and distribution of
AMS-\TeX, which adds many new macros for sophisticated mathematics, and
includes a large number of MetaFont fonts designed by Hermann Zapf.  The
Free Software Foundation has developed their {\tt texinfo} format 
which allows system documentation to be either typeset or browsed
with an on-line hypertext system.

\section{ The Parts of \TeX}

   As I hinted earlier, the name \TeX\ refers not only to a program, but
also to a language, and to the typesetting system that they are a part
of.  A complete system contains some or all of the following pieces:
\begin{itemize} 
    \item  The basic program is called {\tt virtex}.  This program knows
``Primitive \TeX,'' and is rarely run directly. 
    \item  Most systems allow you to type {\tt tex} to run the {\tt
virtex} program with the ``Plain \TeX'' macro package loaded
automatically. Similarly, {\tt latex} runs {\tt virtex} with the \LaTeX\
macro package loaded automatically. 
    \item  A special program called {\tt initex} is used to pre-compile
macro packages such as \LaTeX\ so that {\tt virtex} can load them more
quickly.  When you first install \TeX, you may need to run {\tt initex}
to generate the pre-compiled macro sets, called {\em formats}. 
    \item  \LaTeX\ and other macro packages may load other files of
macros in the process of typesetting your document.  These files are
stored in a special directory known as the ``\TeX\ inputs'' directory,
and have extensions of {\tt sty} or {\tt tex}. 
    \item  The result of typesetting your document is a DVI file
which specifies what fonts to use, and where to put each letter on the
page. In order to print this, you'll need a program which can combine
this with the actual font information to generate output for your
particular printer. 
    \item  Typically, a \TeX\ system uses MetaFont to generate the
fonts. This requires that you have {\tt virmf} and {\tt inimf}, which
function similarly to {\tt virtex} and {\tt initex}.  You'll also need
the MetaFont font description files, typically stored in a ``MetaFont
inputs'' directory.
    Running MetaFont to create a font generates two files.  The TFM file
contains information about the size of each character, and is used by
\TeX\ to typeset your document.  Since TFM files are fairly small,
it makes sense to keep many of them available.  MetaFont also creates
a GF file, which contains bitmaps for each character.  You can use
the {\tt gftopk} program to convert these into a similar but smaller PK
file.  Most DVI output programs can handle either PK or GF files.
    It is possible to use other sources of fonts, such as the fonts
built-in to a Postscript printer.  This requires TFM files with
the correct information for those fonts.  Problems with different
character numberings are usually resolved through what are called
{\em virtual fonts}.
\end{itemize}

% Many things that exist only for a while (called "environments") are
% bracketed with \begin{} and \end{}.  The above creates a bulleted list,
% where each \item command starts a new entry.  Using "enumerate" instead
% would have created a numbered lists.  Such lists can be nested in any
% way you like.

    There are a lot of pieces, and it can take a while to get everything
setup just right, but in typical use, most of this is invisible.  You
use {\tt tex} or {\tt latex} to typeset your document, then run another
program to print it out.  When you lack a font that you need, you may
need to run MetaFont to create it, but after using the system for a while,
that happens very infrequently.


\section{ Logical Design}

   In many ways, I actually consider \LaTeX\ to be easier to use than
many of the popular ``WYSIWYG'' word processors.  This is primarily
because \LaTeX\ does not require me to spend a lot of time worrying
about how my document looks.  Unless you have studied graphical design,
you're likely to be just as uncertain as I am about exactly what fonts
and styles are appropriate for which situation.  While \LaTeX\ will let
you specify the exact font to use for each letter, it generally lets you
concentrate on how your document is structured.  \LaTeX's standard
document styles have reasonable defaults for most things. In the
introduction to the {\em \LaTeX\ User's Guide and Reference Manual},
Leslie Lamport discusses this by contrasting {\em visual design}, where
the author specifies the visual appearance of their document, and
{\em logical design}, which insists the author specify the logical
structure.

% The \verb macro is a special LaTeX macro that puts it's argument
% in typewriter type, allowing any character to appear (even %, \, etc.)

    I was reminded of this when I had an opportunity recently to use a
popular Macintosh word processor.  Where in \LaTeX\ one might start a new
section with \verb|\section{ Logical Design}|, in this word processor I
had to spend several minutes looking at lists of available fonts, sizes,
and styles before I could type the section title. Every time I started a
new section I was forced to remember exactly which font, size, and style
I had used before.  While attention to the appearance of your document
is important, it seems that many of these popular word processors force
you to spend so much time specifying the appearance that you may easily
lose sight of what you are trying to communicate.

\section{ Finding out More}

   I suggest anyone interested in using this system begin with Leslie
Lamport's \LaTeX\ system and the accompanying manual {\em \LaTeX\ User's
Guide and Reference Manual}, published by Addison-Wesley.  After using
it for a while, you will doubtless eventually want to do more
sophisticated work with it, at which time you should get a copy of
Knuth's {\em The \TeX{}book\/}, also published by Addison-Wesley.
If you use extensive mathematics, you may also be interested
in Michael Spivak's {\em The Joy of \TeX\/}, which documents
the AMS-\TeX\ macro package.  As \TeX's popularity grows, there
have been an increasing number of other getting-started books,
which are available at many bookstores.

\section{ \TeX\ under OS9}

   \TeX\ was originally written in Pascal, then rewritten using Knuth's
WEB system, from which a Pascal program can be built. Due to the general
lack of Pascal compilers for Unix, early versions
for Unix were written from scratch in C, and several of these have been
ported to OS9.  More recently, a program to translate Pascal to C has
been used to port the newest WEB sources to Unix and other systems.  My
OS9 port started with this translator program, which has allowed me to
compile the most recent versions of \TeX, MetaFont, and other \TeX\
software under OS9.  I have also ported the suite of DVI translator
programs maintained by Nelson Beebe at the  University of Utah.  These
include translators for several popular dot-matrix printers and the more
common laser printers.

   Unfortunately, the newer versions of {\tt virtex} and {\tt initex} do
require substantial amounts of memory.  On my 3-megabyte MM/1, I have
found that the largest free block of memory needs to be in excess of
1500k in order to run {\tt initex}.  Fortunately, the other programs are
somewhat leaner; {\tt virtex} requires 1400k, {\tt inimf} and {\tt
bibtex} each require 800k, and the various DVI translators require from
100k to 600k depending on the printer and the document.  Many users
may be forced to use one of the older versions of {\tt initex} and
{\tt virtex} due to memory constraints.

\end{document}
% The \end{document} matches the \begin{document} at the beginning.

