The teTeX HOWTO: The Linux-teTeX Local Guide

Robert Kiesling

v3.7, 9 November 1998


This document covers the basic installation and usage of the teTeX TeX and LaTeX implementation under the major U.S. Linux distributions, and auxiliary packages like Ghostscript. Contents of the teTeX HOWTO: The Linux-teTeX Local Guide are Copyright (C) 1997, 1998 by Robert A. Kiesling. The exact terms of copying are given in the introduction and the appendices. Registered trademarks are the property of their respective owners. Please send all complaints, suggestions, errata, and any miscellany to kiesling@ix.netcom.com, so I can keep this document as complete and up to date as possible.

1. Introduction.

2. Using teTeX.

3. TeX commands.

4. LaTeX commands.

5. LaTeX extension packages and other resources.

6. Mixing text and graphics with dvips.

7. Using Postscript fonts.

8. Appendix A: CTAN site list.

9. Appendix B: Installing the CTAN teTeX distribution.

10. Appendix C: Distribution and Copyright.


1. Introduction.

1.1 Copyright.

The teTeX-HOWTO is copyright (C) 1997, 1998 by Robert Kiesling. Permission is granted to make and distribute verbatim copies of this manual provided that the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the sections entitled, ``Distribution,'' and, ``GNU General Public License,'' are included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions. except that the sections entitled, ``Distribution,'' and, ``GNU General Public License,'' may be included in a translation approved by the Free Software Foundation instead of in the original English. Please refer to Section Distribution and Copyright for terms of copying.

1.2 Software described in this document.

TeX handles only the formatting part of the document preparation. Generating output from TeX is like compiling source code into object code, which still needs to be linked. You prepare an input file with a text editor----what most people think of as ``word processing''--- and format the input file document with TeX to produce a device-independent output file, called a .dvi file.

You also need a program or two to translate TeX's .dvi output for your screen and printer. These programs are collectively known as ``dviware.'' For example, TeX itself only makes requests for fonts. It is up to the .dvi output translator to provide the actual font for the output regardless of whether the medium is a video screen or paper. This extra step may seem overly complicated, but the abstraction allows documents to display the same on different devices with little or no change to the original document.

teTeX.

TeX is implemented for practically every serious computer system in the world---and quite a few ``non-serious'' ones---so implementors must provide the installation facilities for all of them. This accounts in part for teTeX's complexity, in addition to the inherent complexity of any TeX installation. It also accounts for the fact that installing the system yourself is a significant task, and unless you are already familiar with TeX, it is easy to get lost in the numerous executable programs, TeX files, documentation, and fonts.

Fortunately, teTeX is part of the GNU/Linux distribution. You can install the package much more easily using GNU/Linux installation tools. You may already have teTeX installed on your system. If so, you can skip ahead to Section Using teTeX.

However, if you want to install the package, the archives necessary for a workable teTeX installation are on the CTAN archive network. There is a list of these sites in Section CTAN site list.

CTAN is the Comprehensive TeX Archive Network, a series of anonymous FTP sites that archive TeX programs, macros, fonts, and documentation. In the course of using TeX you'll probably become familiar with at least one CTAN site. In this document, a pathname like ~CTAN/contrib/pstricks means ``look in the directory contrib/pstricks of your nearest CTAN site.''

The installation of the generic teTeX distribution described in Section Installing the CTAN teTeX distribution concentrates on the Intel versions of Linux. Installing teTeX on other hardware should require only substituting the appropriate executable program archive in the installation process.

In addition to the executable programs, the distribution includes all of the TeX and LaTeX package, metafont and its sources, bibtex, makeindex, and all of the documentation... more than 4 megabytes' worth. The documentation covers everything you will forseeably need to know to get started. So, you should install all of the documents. Not only will you eventually read them, the documents themselves provide many examples of ``live'' TeX and LaTeX code.

TeX was written by Professor Donald Knuth of Stanford University. It is a lower-level typesetting language for all of the higher-level packages like LaTeX. Essentially, LaTeX is a set of TeX macros that provide convenient, predefined document formats for end users. If you like the formats provided by LaTeX, you may never need to learn bare-bones TeX programming. The difference between the two languages is like the difference between assembly language and C. You can have the speed and flexibility of TeX, or the convenience of LaTeX.

By the way, the letters of the word ``TeX'' are Greek, tau-epsilon-chi. It is not a fraternity, but the root of the Greek word, techne, which means art and/or science. ``TeX'' is not pronounced like the first syllable in ``Texas.'' The chi has no English equivalent, but TeX is generally pronounced so that it rhymes with ``yecch,'' to use Professor Knuth's example from The TeXBook, which is one of the standard TeX references. When writing, ``TeX,'' on character devices, always use the standard capitalization, or the \TeX{} macro in typesetting.

Text editors.

Any of the editors that work under Linux---jed, joe, jove, vi, vim, stevie, Emacs, and microemacs---will work to prepare a TeX input file, as long as the editor reads and writes plain-vanilla ASCII text. My preference is GNU Emacs. There are several reasons for this:

dvips.

Tomas Rokicki's dvips generates Postscript from a .dvi file. In addition, it runs Metafont if necessary to generate the bit mapped fonts it needs or uses Postscript fonts for the output. It can also crop and resize pages and perform graphics translations from instructions in a TeX or LaTeX file,

The dvips program is part of the teTeX distribution. It is discussed fully in Section Mixing text and graphics with <tt>dvips</tt>

Fonts.

Much of TeX's, and therefore LaTeX's, complexity, arises from its implementation of various font systems, and the way these fonts are specified. A major improvement of LaTeX 2e over its predecessor was the way users specify fonts, the former New Font Selection Scheme. They're discussed in Section Characters and type styles, Section TeX Font Commands, and Section Using Postscript fonts.)

teTeX comes distributed with about a dozen standard fonts preloaded, which is enough to get you started. Also provided are the font metrics descriptions, in .tfm (TeX font metric) files. To generate the other fonts that you need, it is simply a matter of installing the metafont sources. teTeX's .dvi utilities will invoke metafont automatically and generate the Computer Modern fonts you need.


2. Using teTeX.

Theoretically, at least, everything is installed correctly and is ready to run. teTeX is a very large software package. As with any complex software package, you'll want to start by learning teTeX slowly, instead of being overwhelmed by its complexity.

At the same time, we want the software to do something useful. So instead of watching TeX typeset

``Hello, World!''
as Professor Knuth suggests, we'll produce a couple of teTeX's own documents in order to test it.

2.1 Printing the documentation.

You should be logged in as root the first few times you run teTeX. If you aren't, Metafont may not be able to create the necessary directories for its fonts. The texconfig program includes an option to make the font directories world-writable, but if you're working on a multi-user system, security considerations may make this option impractical or undesirable.

In either instance, if you don't have the appropriate permissions to write to the directories where the fonts are stored, Metafont will complain loudly because it can't make the directories. You won't see any output because you have a bunch of zero-length font characters. This is no problem. Simply log out, re-login as root, and repeat the offending operation.

The nice thing about teTeX is that, if you blow it, no real harm is done. It's not like a compiler, where, say, you will trash the root partition if a pointer goes astray. What, you haven't read the teTeX manual yet? Of course you haven't. It's still in the distribution, in source code form, waiting to be output.

So, without further delay, you will want to read the teTeX manual. It's located in the directory

/usr/lib/teTeX/texmf/doc/tetex.

The LaTeX source for the manual is called TETEXDOC.tex. (The .tex extension is used for both TeX and LaTeX files. Some editors, like Emacs, can tell the difference.) There is also a file TETEXDOC.dvi included with the distribution, which you might want to keep in a safe place---say, another directory ---in case you want to test your .dvi drivers later. With that out of the way, type

latex TETEXDOC.tex
LaTeX will print several warnings. The first,
LaTeX Warning: Label(s) may have changed. Rerun to get the
cross-references right.
is standard. It's common to build a document's Table of Contents by LaTeXing the document twice. So, repeat the command. The other warnings can be safely ignored. They simply are informing you that some of the FTP paths mentioned in the documentation are too wide for their alloted spaces. Sections Paragraph styles and dimensions and Tolerances describe horizontal spacing in more detail.

teTeX will have generated several files from TETEXDOC.tex. The one that we're interested in is TETEXDOC.dvi. This is the device-independent output which you can send either to the screen or the printer. If you're running teTeX under the X Windows System, you can preview the document with xdvi.

For the present, let's assume that you have a HP LaserJet II. You would give the command

dvilj2 TETEXDOC.dvi 
which writes a PCL output file from TETEXDOC.dvi, including soft fonts which will be downloaded to the LaserJet. This is not a feature of TeX or LaTeX, but a feature provided by dvilj2. Other .dvi drivers provide features that are relevant to the devices they support. dvilj2 tries to fill the font requests which were made in the original LaTeX document with the the closest equivalents available on the system. In the case of a plain text document like TETEXDOC.tex, there isn't much difficulty. All of the fonts requested by TETEXDOC.tex will be generated by metafont, which is automatically invoked by dvilj2, if the fonts aren't already present. (If you're running dvilj2 for the first time, the program may need to generate all of the fonts.) There are several options that control font generation via dvilj2. They're outlined in the manual page. At this point, you shouldn't need to operate metafont directly. If you do, then something has gone awry with your installation. All of the .dvi drivers will invoke metafont directly via the kpathsea path-searching library---the discussion of which is beyond the scope of this document---and you don't need to do any more work with metafont for the present---all of the metafont sources for the Computer Modern font library are provided.

You can print TETEXDOC.lj with the command

lpr TETEXDOC.lj
You may also need to install a printer filter that understands PCL.

The nine-page teTeX Guide provides some useful information for further configuring your system, some of which I have mentioned, much that this document doesn't cover.

Some of the information in the next section I haven't been able to test, because I have a non-Postscript HP Deskjet 400 color ink jet printer connected to the computer's parallel port. However, not owning a Postscript printer is no barrier to printing text and graphics from your text documents. Ghostscript is available in most Linux distributions and it could already be installed on your system.


3. TeX commands.

Preparing documents for TeX typesetting is easy. Make sure there's a blank line between the paragraphs of a plain text file, and run file through the TeX program with the command

tex your_text_file
The result will be a file of the same base name and the extension .dvi. TeX formats the text in 10-point, Computer Modern Roman, single-spaced, with justified left and right margins. If you receive error messages from special characters like dollar signs, escape them with a backslash character, \, and run TeX on the file again. You should be able to process the resulting file with the .dvi file translator of your choice (see above) to get printed output.

One peculiarity of TeX input is that you must use opening and closing quotes, which are denoted in the input file with the grave accent and single quote characters. Emacs' TeX mode does this for you automatically.

"These are ASCII-type quotes."
``These are `TeX-style' quotes.''

3.1 Command overview.

Commands in TeX start with a backslash (``\''). For example, the command to change the spacing between lines is

\baselineskip=24pt

The baseline is the bottom of the characters on a line, not counting descenders. The distance between the baseline of one line and the next is the \baselineskip, and is assigned a value of 24 points.

Measurements or dimensions in TeX are often given in the following units:

pt                % Point        1/72 in.
pc                % Pica:        12 pt.
in                % Inch:        72.27 pt.
cm                % Centimeter:  2.54 cm = 1 in.
mm                % Millimeter:  10 mm = 1 cm.

Some commands do not take assignments. For example:

\smallskip        % Approximately 3 pt.
\medskip          % Two \smallskips.
\bigskip          % Two \medskips.

A \smallskip inserts a 3 pt. vertical space in the document. The measurements are approximate because TeX needs to adjust the dimensions for page breaks, section headings, and other units of vertical space. This is true for horizontal spacing as well.

\hsize=6.5in
This command sets the line length to a width of 6.5 inches. TeX tries to fill the line by adjusting the spacing between words, and some letters. If TeX cannot fill a line to within its tolerances, it produces a warning message, and adjusts the horizontal spacing within the line as best it can. Formatting tolerances are discussed in Section Tolerances.

There are many other commands that specify horizontal and vertical dimensions and tolerances, and the most commonly use commands are described below.

3.2 Font commands.

In TeX, the default font is 10 pt. Computer Modern Roman. To specify a typeface, like italic, bold, or monospaced, use the following commands.

\rm          % Roman (the default).
\it          % Italics.
\bf          % Bold.
\tt          % Monospaced (teletype).
\sl          % Oblique (slanted).
The commands change the typeface where they appear in the text, as in this example.
This text is Roman, \it and this text is italic.  \bf This text is
bold, and \rm this text is in Roman again.

To specify a font for your document, use the\font command.

\font\romantwelve=cmr12
This creates the font command \romantwelve, which, when used in the text, changes the font to Computer Modern Roman, 12 point.
\romantwelve
This is the Computer Modern Roman font at 12 points.
For information about the fonts in the teTeX distribution look at the file:
/usr/lib/teTeX/texmf/doc/fonts/fontname/fontname.dvi

If you want to print a sample of a font, TeX the file

/usr/lib/teTeX/texmf/tex/plain/base/fontchart.tex
and fill in the name of the font you want to print at the prompt.

You can also change the size of a font to get different effects. Font magnification is exponential, and specified with the scaled \magstep command, which is placed after the font specification.

\font\sfmedium=cmss12 scaled \magstep 1
This command will give you a sans serif font that is 120 percent the size of the 12-point Computer Modern sans serif font. Fonts can be magnified in steps from 0 to 5. Each step provides and additional 120 percent magnification.

3.3 Paragraph styles and dimensions.

As mentioned above, TeX typesets text in 10-point Computer Modern Roman by default. The length of a line is the value of \hsize, which defaults to 6.5 in. If you want to change the value of \hsize to 5.5 in. for example, use this command.

\hsize=5.5in

In TeX a dimension is an adjustable unit of length, either horizontal or vertical. The amount by which a dimension can be increased or decreased can be specified in its definition. Closely related to a dimension is a skip, which is a dimension that is placed in one of TeX's internal registers. Skips are defined with the \newskip command. The \smallskip dimension, as defined by TeX is:

\newskip\smallskipamount \smallskipamount=3pt plus 1pt minus 1pt
The \smallskip command is shorthand for:
\vskip\smallskipamount

There are a number of dimensions that control the page layout. They are summarized in Section Page layout.

TeX formats paragraphs with justified left and right margins. If you want the text to be left justified only, use this command:

\raggedright

To typeset a line that is justified to the right margin, use the \rightline command:

\rightline{This is the line to be typeset.}

The \line command typesets the text of its argument to fill the entire line.

\line{This text will be spaced to fit the entire line.}

The \hfil command adds space to fill out the line where it occurs. So, for example, the \rightline command is equivalent to:

\line{\hfilThis line will be right justified.}

To typeset a line that is centered, use the \centerline command.

\centerline{This is the line to be centered.}

To change the left margin, set the value of \hoffset, as in this example:

\hoffset=1.5in

The \parindent command specifies the amount that the first line of every paragraph is indented.

\parindent=.5in

Two other dimensions, \leftskip and \rightskip, will indent the right and left margins, respectively, of the paragraphs that come after them.

\leftskip=.5in
\rightskip=.5in
The control word \narrower is equivalent to:
\leftskip=\parindent
\rightskip=\parindent
That is, \narrower narrows the paragraph margins by the value of \parindent

As mentioned in the previous section, the \baselineskip specifies the distance between lines. The default is 12 pt. To approximate double-spaced text, use the following command.

\baselineskip=\baselineskip*1.6

The \parskip command specifies the distance in addition to \baselineskip between paragraphs. By default, no extra space is added, but the distance between paragraphs can stretch as much as 1 pt. to fill the page correctly. To put a blank line between paragraphs, use this command:

\parskip=\baselineskip

Tolerances. (What are those black rectangles after every line?)

TeX normally formats text to strict tolerances. If, for some reason, text cannot be formatted to within those tolerances, TeX produces a warning message and formats the text the best it can. If the text must be stretched too much to fit the line, TeX warns you that the \hbox is underfull. Text that must be squeezed to fit in the line produces an overfull \hbox warning.

For each overfull \hbox, TeX places a slug, a black rectangle, after the line. The slug indicates that the line could not be formatted to within the specifications set by the \hbadness parameter.

The fit of the text within its specified dimensions is measured by its badness, which is a number between 0 and 10000. A badness of 0 is a perfect fit, and a badness of 10000 means that the line probably will never fit. The default value of \hbadness is 1000. If you set \hbadness to 10000, TeX does not report underfull lines.

Sometimes TeX allows a line to extend past the right margin. This is an aesthetic decision on the part of TeX's author. The amount is determined by the \hfuzz parameter, which defaults to 0.1 pt. If the text does not fit within the line, the \tolerance parameter determines how TeX will handle the overfull \hbox. The default value of \tolerance is 200. Setting \tolerance to 1000 suppresses overfull \hbox warnings and the printing of slugs.

3.4 Page layout.

In addition to the left margin and line length dimensions that are described in the previous section, TeX also lets you specify top and bottom margins, and vertical spacing.

Like the \hsize and \hoffset dimensions described in the previous section, TeX also provides the \vsize and \voffset commands. The default for \vsize is 8.9 in., and \voffset defaults to 0.

Normally, teTeX places the beginning of the first line of text 1 in. below the top of the paper and 1 in. from the left edge. You can start the text closer to the top of the page with the command:

\voffset=-0.5in

If you want to add vertical space in a document, the commands \smallskip, \medskip, and \bigskip will add approximately 3, 6, and 12 points of blank vertical space. These measurements are approximate; TeX will adjust them by as much as 1 pt. so the page is filled correctly.

The \vfill command adds an adjustable vertical space between paragraphs on a page. It is infinitely stretchable, so it will add vertical space to fill as much of the rest of the page as possible. If you want to specify a dimension, use \vskip as in:

\vskip 10pt

The commands \hss and \vss are similar to \hfil and \vfill, but they provide dimensions that are infinitely shrinkable as well as infinitely stretchable.

The \vskip and \vfill commands produce flexible lengths. They do not add space where no text exists; for example, at the top of a page. Use \vglue if you want to add an absolute space.

TeX fills the \vsize dimension with as much text as possible before it starts a new page. To force a page break, use the \vfill \eject sequence. If \vfill is not used, the text before the \break will be spaced to fill the page.

If you want TeX to be more flexible about its vertical page sizing, place the \raggedbottom command in your document. TeX will then adjust the bottom margin of each page slightly to make vertical spacing more consistent.

3.5 Page numbers, headers, and footers.

teTeX by default places the page number at the bottom center of the page. If you want to change the location and style of the page number, you can specify alternate headers and footers by changing definitions of \headline and \footline. The default value for \footline contains the \folio command, which prints the page number. The default value for \headline is \hfil, so a blank line is printed.

The \pageno command is a synonym for TeX's internal page counter. You can change the page number by changing the value of \pageno. If \pageno is negative, the numbers are printed as Roman numerals.

\pageno=10
\pageno=-1

The command \nopagenumbers is shorthand for:

\headline={\hfil}
\footline={\hfil}

The default footline also contains the font command \tenrm, which sets the page number's font to 10-point Roman. If you want to print the page number in 12-point Roman, for example, you would first define a 12-point Roman font, and use that in the definition of \footline. Font commands are discussed in Section Font commands.

\font\twelvrm=cmr12
\footline={\hss\twelvrm\folio\hss}

You can put a rule, a horizontal line, at the top of each page by redefining \headline as:

\headline={\hrulefill}

To specify different headers for even and odd pages use the \ifoddcommand, which has the form:

\ifodd[condition][true-action]\else[false-action
An example \headline that uses different headers for even and odd pages would be:
\headline={\ifodd\pageno odd-page-header \else even-page-header}
The \ifodd statement uses the first argument if the page number is odd, and the second argument otherwise.

3.6 Titles and macros.

TeX provides only the \beginsection macro for section headings. It leaves a space above its argument, prints the text of the heading in bold type, adds a \smallskip after the text of the heading, and starts the next paragraph with no indent.

The LaTeX chapter and section commands described below add section numbering, and will print the section names and numbers in the page headings, and automatically add the sections to the Table of Contents.

In plain TeX, you must write these functions yourself. The \def command allows you to define new commands. Suppose you want to print a chapter title. First you define the font that you want to use. A large, sans serif font for chapter titles would be defined like this:

\font\chapterfontsans=cmss12 scaled \magstep 4
You can use the \chapterfontsans command anywhere you want to switch to this font, which is approximately 24 points in height. However, in this example, it will be used primarily in the command \chaptertitlesans. Here is its definition:
\def\chaptertitlesans#1{\hbox{}\bigskip\bigskip
  \noindent{\leftline{\chapterfontsans#1}}
  \par\bigskip\bigskip\noindent}
The first line, \hbox{}\bigskip, anchors a 12-point space at the top of the page by placing an empty \hbox{} there. The line with the chapter title is not indented, nor is the paragraph which immediately follows it. If you place a blank line between the \sschaptertitle macro and the next paragraph, the final \noindent applies to the blank line, not the text of the following paragraph. To format correctly, use the \sschaptertitle as in this example:

The #1 statement in the definition is replaced by the first argument to \chaptertitlesans; that is, the title of the chapter. Parameters TeX definitions are declared with #1, #2, #3, and so on. An example usage of \chaptertitlesans would be:

\chaptertitlesans{Chapter 1}
This is the starting text of the first paragraph of the chapter.  
The paragraph will not be indented.  The chapter's title is 
"Chapter 1."


4. LaTeX commands.

4.1 Document structure.

Documents formatted for LaTeX have a few more rules, but with complex documents, LaTeX can greatly simplify the formatting process.

Essentially, LaTeX is a document markup language which tries to separate the output style from the document's logical content. For example, formatting a section heading with TeX would require specifying 36 points of white space above the heading, then the heading itself set in bold, 24-point type, then copying the heading text and page number to the Table of Contents, then leaving 24 points of white space after the heading. By contrast, LaTeX has the \section{} command, which does all of the work for you. If you need to change the format of the section headings throughout your document, you can change the definition of \section{} instead of the text in the document. You can see where this would save hours of reformatting for documents of more than a dozen pages in length.

All LaTeX documents have three sections: a preamble, the body text, and a postamble. These terms are standard jargon and are widely used by TeXperts.

The preamble, at a minimum, specifies the type of document to be produced---the document class---and a statement which signals the beginning of the document's body text. For example:

\documentclass{article}
\begin{document}
The document's postamble is usually very simple. Except in specialized cases, it contains only the statement:
\end{document}
Note the \begin{document} and \end{document} pairing. In LaTeX, this is called an environment. All text must appear within an environment, and many commands are effective only in the environments in which they're called. The document environment is the only instance where LaTeX enforces this convention, however. That is, it's the only environment that is required in a document. (An exception is letter class, which also requires you to declare \begin{letter} and \end{letter}. See the section Letters.) However, many formatting features are specified as environments. They're described in the following sections.

The document classes can be called with arguments. For example, instead of the default, 10-point type used as the base point size, as in the previous example, we could have specified

\documentclass[12pt]{article}
to produce the document using 12 points as the base point size. The document class, article, makes the necessary adjustments.

There are a few document classes which are commonly used. They're described below. The report class is similar to article class, but produces a title page and starts each section on a new page. The letter class includes special definitions for addresses, salutations, and closings, a few of which are described below.

You can include canned LaTeX code, commonly known as a package, with the \usepackage{} command.

\usepackage{fancyhdr}
The command above would include the LaTeX style file fancyhdr.sty from one of the TEXINPUTS directories, which you and teTeX specified during installation and setup processes.

\documentclass{article}
\usepackage{fancyhdr}
\begin{document}

Note that the \usepackage{} declarations are given before the \begin{document} statement; that is, in the document preamble.

fancyhdr.sty extends the \pagestyle{} command so that you can create custom headers and footers. Most LaTeX document classes provide headers and footers of the following standard page styles:

\pagestyle{plain}       % default pages style -- page number centered at 
                        % the bottom of the page.
\pagestyle{empty}       % no headers or footers
\pagestyle{headings}    % print section number and page number at the 
                        % top of the page.
\pagestyle{myheadings}  % print custom information in the page heading.
Everything on a line to the right of the percent sign is a comment.

The \pagestyle{} command doesn't take effect until the following page. To change the headers and footers on the current page, use the command

\thispagestyle{the_pagestyle}

4.2 Characters and type styles.

Character styles are partially a function of the fonts specified in the document. However, bold and italic character emphasis should be available for every font present on the system. Underlining, too, can be used, though its formatting presents special problems. See section LaTeX extension packages and other resources, below.

You can specify text to be emphasized in several ways. The most portable is the \em command. All text within its scope is italicized by default. For example:

This word will be {\em emphasized.}
If you have italicized text that runs into text which is not italicized, you can specify an italic correction factor to be used. The command for this is \/; that is, a backslash and a forward slash.
This example {\em will\/} print correctly.

This example will {\em not} print correctly.
Slightly less portable, but still acceptable in situations where they're used singly, are the commands \it, \bf, and \tt, which specify that the characters within their scope be printed using italic, bold, and monospaced (teletype) typefaces, respectively.
{\tt This text will be printed monospaced,}
{\it this text will be italic,} and
{\bf this text will be bold\dots} all in one paragraph.
The command \dots prints a series of three periods for ellipses, which will not break across a line.

The most recent version of LaTeX, which is what you have, includes commands which account for instances where one emphasis command would supersede another.

This is {\it not {\bf bold italic!}}
What happens is that teTeX formats the text with the italic typeface until it encounters the \bf command, at which point it switches to boldface type.

To get around this, the NFSS scheme of selecting font shapes requires three parameters for each typeface: shape, series, and family. Not all font sets will include all of these styles. LaTeX will print a warning, however, if it needs to substitute another font.

You can specify the following font shapes:

\textup{text}           % upright shape (the default)
\textit{text}           % italic
\textsl{text}           % slanted
\textsc{text}           % small caps
These are the two series that most fonts have:
\textmd{text}           % medium series (the default)
\textbf{text}           % boldface series.
There are generally three families of type available.
\textrm{text}           % Roman (the default)
\textsf{text}           % sans serif
\texttt{text}           % typewriter (monospaced, Courier-like)
Setting font styles using these parameters, you can combine effects.
\texttt{\textit{This example likely will result in a font
substitution, because many fonts don't include a typewriter italic
typeface.}}
The font family defaults to Computer Modern, which is a bit-mapped font. Other font families are usually Postscript-format Type 1 fonts. See section Using PostScript fonts for details on how to specify them.

There are also many forms of accents and special characters which are available for typesetting. This is only a few of them. (Try typesetting these on your own printer.)

\'{o}   \`{e}   \^{o}   \"{u}   \={o}   \c{c}   `? `!
\copyright      \pounds         \dag
Finally, there are characters which are used as meta- or escape characters in TeX and LaTeX. One of them, the dollar sign, is mentioned above. The complete set of meta characters, which need to be escaped with a backslash to be used literally, is:
# $ % & _ { } 

There are also different alphabets available, like Greek and Cyrillic. LaTeX provides many facilities for setting non-English text, which are covered by some of the other references mentioned here

4.3 Margins and line spacing.

Changing margins in a TeX or LaTeX document is not a straightforward task. A lot depends on the relative indent of the text you're trying to adjust the margin for. The placement of the margin-changing command is also significant.

For document-wide changes to LaTeX documents, the \evensidemargin and \oddsidemargin commands are available. They affect the left-hand margins of the even-numbered and odd-numbered pages, respectively. For example,

\evensidemargin=1in
\oddsidemargin=1in
adds on inch to the left-hand margin of the even and odd pages in addition to the standard one-inch, left-hand margin. These commands affect the entire document and will shift the entire body of the text right and left across a page, regardless of any local indent, so they're safe to use with LaTeX environments like verse and list.

Below is a set of margin-changing macros which I wrote. They have a different effect than the commands mentioned above. Because they use plain TeX commands, they're not guaranteed to honor the margins of any LaTeX environments which may be in effect, but you can place them anywhere in a document and change the margins from that point on.

%%  margins.sty -- v. 0.1   by Robert Kiesling
%%  Copies of this code may be freely distributed in verbatim form.
%%
%%  Some elementary plain TeX margin-changing commands. Lengths are
%%  in inches:
%%  \leftmargin{1}   %% sets the document's left margin in 1 inch.
%%  \leftindent{1}   %% sets the following paragraphs' indent in 
%%                     1 inch.
%%  \rightindent{1}  %% sets the following paragraphs' right margins
%%                   %% in 1 inch.
%%  \llength{3}      %% sets the following lines' lengths to 3 inches.
%%
\message{Margins macros...}
\def\lmargin#1{\hoffset = #1 in}
\def\lindent#1{\leftskip = #1 in}
\def\rindent#1{\rightskip = #1 in}
\def\llength#1{\hsize = #1 in}
%%
%% (End of margins macros.}
Place this code in a file called margins.sty in your local $TEXINPUTS directory. The commands are explained in the commented section of the file. To include them in a document, use the command
\usepackage{margins}
in the document preamble.

While we're on the subject, if you don't want the right margin to be justified, which is the default, you can tell LaTeX to use ragged right margins by giving the command:

\raggedright

Setting line spacing also has its complexities.

The baselineskip measurement is the distance between lines of text. It is given as an absolute measurement. For example,

\baselineskip=24pt
or even better:
\setlength{\baselineskip}{24pt}
The difference between the two forms is that setlength will respect any scoping rules that may be in effect when you use the command.

The problem with using baselineskip is that it also affects the distance between section headings, footnotes, and the like. You need to take care that baselineskip is correct for whatever text elements you're formatting. There are, however, LaTeX macro packages, like setspace.sty, which will help you in these circumstances. See section LaTeX extension packages and other resources.

4.4 Document classes.

LaTeX provides document classes which provide standardized formats for documents. They provide environments to format lists, quotations, footnotes, and other text elements. Commonly used document classes are covered in the following sections.

Articles and reports.

As mentioned above, the article class and the report class are similar. The main differences are that the report class creates a title page by default and begins each section on a new page. Mostly, though, the two document classes are similar.

To create titles, abstracts, and bylines in these document classes, you can type, for example,

\title{The Breeding Habits of Cacti}
\author{John Q. Public}
\abstract{Description of how common desert cacti search
for appropriate watering holes to perform their breeding
rituals.}
in the document preamble. Then, the command
\maketitle
given at the start of the text, will generate either a title page in the report class, or the title and abstract at the top of the first page, in the article class.

Sections can be defined with commands that include the following:

\section
\subsection
\subsubsection
These commands will produce the standard, numbered sections used in technical documents. For unnumbered sections, use
\section*
\subsection*
\subsubsection*
and so on.

LaTeX provides many environments for formatting displayed material. You can include quoted text with the quotation environment.

\begin{quotation}
Start of paragraph to be quoted...

... end of paragraph.
\end{quotation}
For shorter quotes, you can use the quote environment.

To format verse, use the verse environment.

\begin{verse}
Because I could not stop for death\\
He kindly stopped for me
\end{verse}
Notice that you must use the double backslashes to break lines in the correct places. Otherwise, LaTeX fills the lines in a verse environment, just like any other environment.

Lists come in several flavors. To format a bulleted list, the list environment is used:

\begin{list}
\item
This is the first item of the list.
\item 
This is the second item of the list...
\item
... and so on.
\end{list}

A numbered list uses the enumerate environment:

\begin{enumerate}
\item 
Item No. 1.
\item
Item No. 2.
\item
\dots
\end{enumerate}

A descriptive list uses the description environment.

\begin{description}
\item{Oven} Dirty, needs new burner.
\item{Refrigerator}  Dirty.  Sorry.
\item{Sink and drainboard}  Stained, drippy, cold water faucet.
\end{description}

Letters.

The letter class uses special definitions to format business letters.

The letter environment takes one argument, the address of the letter's addressee. The address command, which must appear in the document preamble, defines the return address. The signature command defines the sender's name as it appears after the closing.

The LaTeX source of a simple business letter might look like this.

\documentclass[12pt]{letter}
\signature{John Q. Public}
\address{123 Main St.\\Los Angeles, CA.  96005\\Tel: 123/456-7890}
\begin{document}
\begin{letter}{ACME Brick Co.\\100 Ash St.\\San Diego, CA 96403}
\opening{Dear Sir/Madam:}

With regard to one of your bricks that I found on my living room
carpet surrounded by shards of my broken front window...

(Remainder of the body of the letter.)

\closing{Sincerely,}

\end{letter}
\end{document}
Note that the addresses include double backslashes, which specify where the line breaks should occur.


5. LaTeX extension packages and other resources.

We mentioned above that using underlining as a form of text emphasis presents special problems. Actually, TeX has no problem underlining text, because it is a convention of mathematical typesetting. In LaTeX, you can underline words with the command:

\underline{text to be underlined}
The problem is that underlining will not break across lines, and, in some circumstances, underlining can be uneven. However, there is a LaTeX macro package, ready-made, that makes underlining the default mode of text emphasis. It's called ulem.sty, and is one of the many contributed LaTeX packages that are freely available via the Internet.

To use ulem.sty, include the command:

\usepackage{ulem}
in the document preamble.

The packages which are available for LaTeX include:

ifthen

Include conditional statements in your documents.

initials

Defines a font for initial dropped capitals.

sanskrit

Font and preprocessor for producing documents in Sanskrit.

recipe

A LaTeX2e class to typeset recipes.

refman

Variant report and article styles.

To make the path given in the Catalogue into a fully-qualified URL, concatenate the path to the host name URL and top-level path of the CTAN archive you wish to contact. For example, the top-level CTAN directory of the site ftp.tex.ac.uk is ctan/tex-archive. The complete URL of the directory of the refman package would be:

ftp://ftp.tex.ac.uk/ctan/tex-archive/   + 
macros/latex/contrib/supported/refman   =

ftp://ftp.tex.ac.uk/ctan/tex-archive/macros/latex/contrib/supported/refman/
Some packages have more than one file, so only the path to the package's directory is given.

When you have the URL in hand, you can retrieve the package from one of the CTAN archive sites listed in section Appendix A. You can download a complete list of the archive's contents as the file FILES.byname, in the archive's top-level directory. You can also search the archive on line for a keyword with the ftp command

quote site index <keyword>


6. Mixing text and graphics with dvips.

In general, this section applies to any TeX or LaTeX document which mixes text and graphics. teTeX, like most other TeX distributions, is configured to request Computer Modern fonts by default. When printing documents with Type 1 scalable fonts or graphics, font and graphics imaging is the job of dvips. dvips can use either Computer Modern bit mapped fonts or Type 1 scalable fonts, or any combination of the two. First, let's concentrate on printing and previewing some graphics.

You will probably want to follow this procedure any time a LaTeX source document has the statement

 
\includepackage{graphics}
in the document preamble. This statement tells LaTeX to include the text of the graphics.sty package in the source document. There are other commands to perform graphics operations, and the statements in plain-TeX documents may not clue you in whether you need to use dvips. The difference will be apparent in the output, though, when the document is printed with missing figures and other graphics.

So, for now, we'll concentrate on printing documents which use the LaTeX graphics.sty package. You might want to take a look at the original TeX input. It isn't included in the teTeX distribution, but it is available at

~CTAN/macros/latex/packages/graphics/grfguide.tex.
What the teTeX distribution does include is the .dvi output file, and it is already TeXed for you. There is a reason for this, and it has to do with the necessity of including Type 1 fonts in the output in order for the document to print properly. If you want to LaTeX grfguide.tex, see the next section. For now, however, we'll work on getting usable output using dvips.

The file grfguide.dvi is located in the directory

texmf/doc/latex/graphics
The first step in outputting grfguide.dvi is to translate it to Postscript. The program dvips is used for this. It does just exactly what its name implies. There are many options available for invoking dvips, but the simplest (nearly) form is
dvips -f -r <grfguide.dvi >grfguide.ps
The -f command switch tells dvips to operate as a filter, reading from standard input and writing to standard output. dvips output can be configured so its output defaults to lpr.

If you can print Postscript directly to your printer via lpr, you can simply type

dvips -r grfguide.dvi
The -r option tells dvips to output the pages in reverse order so they stack correctly when they exit a printer. Use it or not, as appropriate for your output device.

Depending on whether you still have the fonts that dvilj2 generated from the last document, dvips and metafont may or may not need to create new fonts needed by grfguide.dvi. Eventually, though, dvips will output a list of the pages translated to Postscript, and you will have your Postscript output ready to be rendered on whatever output device you have available.

If you're lucky (and rich), then you have a Postscript-capable printer already and will be able to print grfguide.ps directly. You can either spool the output to the printer using lpr. If for some reason your printer software doesn't work right with Postscript files, you can, in a pinch, simply dump the file to printer, with

cat grfguide.ps >/dev/lp0
or whichever port your printer is attached to, though this is not recommended for everyday use.

If you want or need to invoke Ghostscript manually, this is the standard procedure for its operation. The first thing you want to do is invoke Ghostscript to view its command line arguments, like this:

gs -help | less
You'll see a list of supported output devices and sundry other commands. Pick the output device which most nearly matches your printer. I generally produce black-and-white text and use the cdjmono driver, which drives a color Deskjet in monochrome (black and white) mode.

The command line I would use is:

gs -dNOPAUSE -sDEVICE=cdjmono -sOutputFile=/tmp/gs.out grfguide.ps -c quit
This will produce my HP-compatible output in the /tmp directory. It's a good idea to use a directory like /tmp, because gs can be particular about access permissions, and you can't (and shouldn't) always count on being logged in as root to perform these steps. Now you can print the file:
lpr /tmp/gs.out
Obviously, this can all go into a shell script. On my system, I have two simple scripts written, pv and pr, which simply outputs the Postscript file either to the display or the printer. Screen previewing is possible without X, but it's far from ideal. So, it's definitely worth the effort to install XFree86 to view the output on the screen..

The order of commands in a gs command line is significant, because some of the options tell Ghostscript to look for pieces of Postscript code from its library.

The important thing to remember is that grfguide.dvi makes requests for both Computer Modern bit mapped and Type 1 scaled fonts. If you can mix scalable and bit mapped fonts in a document, you're well on the way to becoming a TeXpert.

6.1 What if my printer isn't supported?

The teTeX distribution comes with only a limited selection of DVI output drivers: dvips, drivers for Hewlett Packard LaserJets, and nothing else. You have two options if you have a printer which isn't LaserJet-compatible: You can use dvips and Ghostscript, which I would recommend anyway, for reasons already mentioned, or you can investigate other dviware sources.

A limited number of DVI drivers have been ported to Linux and are available as pre-built binaries. They are located in the Linux archives at ftp://sunsite.unc.edu/pub/Linux/apps/tex/dvi/.

The master dviware libraries are maintained at the University of Utah archives. If you can't find a DVI driver there that supports your printer, chances are that it doesn't exist. You can also write your own DVI driver using the templates available there. The library's URL is ftp://ftp.math.utah.edu/pub/tex/dvi/.


7. Using Postscript fonts.

It used to be that public domain, Type 1 fonts were much poorer quality than Computer Modern bit mapped fonts. This situation has improved in the last several years, though, but matching the fonts is up to you. Having several different font systems on one machine can seem redundant and an unnecessary waste of disk space. And the Computer Modern fonts can seem, well, a little too formal to be suitable for everyday use. It reminds me sometimes of bringing out the good China to feed the dog. At least you don't need to spend a bundle on professional quality fonts any longer.

One of the major improvements of LaTeX2e over its predecessor was the inclusion of the New Font Selection Scheme. (It's now called PSNFSS.) Formerly, TeX authors would specify fonts with commands like

\font=bodyroman = cmr10 scaled \magstep 1

which provides precision but requires the skills of a type designer and mathematician to make good use of. Also, it's not very portable. If another system didn't have the font cmr10 (this is TeX nomenclature for Computer Modern Roman, 10 point, with the default medium stroke weight), somebody would have to re-code the fonts specifications for the entire document. PSNFSS, however, allows you specify fonts by family (Computer Modern, URW Nimbus, Helvetica, Utopia, and so forth), weight (light, medium, bold), orientation (upright or oblique), face (Roman, Italic), and base point size. (See the section Characters and type styles for a description of the commands to specify typefaces.) Many fonts are packaged as families. For example, a Roman-type font may come packaged with a sans serif font, like Helvetica, and a monospaced font, like Courier. You, as the author of a LaTeX document, can specify an entire font family with one command.

There are, as I said, several high-quality font sets available in the public domain. One of them is Adobe Utopia. Another is Bitstream Charter. Both are commercial quality fonts which have been donated to the public domain.

These happen to be two of my favorites. If you look around one of the CTAN sites, you will find these and other fonts archived there. There are enough fonts around that you'll be able to design documents the way you want them to look, and not just English text, either. TeX was originally designed for mathematical typesetting, so there is a full range of mathematical fonts available, as well as Cyrillic, Greek, Kana, and other alphabets too numerous to mention.

The important thing to look for is files which have either the .pfa or .pfb extension. They indicate that these are the scalable fonts themselves, not simply the metrics files. Type 1 fonts use .pfm metric files, as opposed to the .tfm metric files which bit mapped fonts use. The two font sets I mentioned above are included in teTeX distributions, as well as separately.

What I said above, concerning the ease of font selection under PSNFSS, is true in this instance. If we want to use the Charter fonts in our document instead of Computer Modern bit mapped, all that is necessary is include the LaTeX statement

\renewcommand{\familydefault}{bch}
in the document preamble, where ``bch'' is the common designation for Bitstream Charter. The Charter fonts reside in the directory
/usr/lib/teTeX/texmf/fonts/type1/bitstrea/charter

There you'll see the .pfb files of the Charter fonts: bchb8a.pfb for Charter Bold, bchr8a.pfb for Charter Roman, bchbi8a.pfb for Charter Bold Italic. The ``8a'' in the font names indicates the character encoding. At this point you shouldn't need to worry much about them, because the encodings mostly differ for 8-bit characters, which have numeric values above 128 decimal. They mostly define accents and non-English characters. The Type 1 font encodings generally work well for Western alphabets because they conform to the ISO 8859 standards for international character sets, so this is an added benefit of using them.

To typeset a document which has Charter fonts selected, you would give the command

pslatex document.tex
pslatex is a variant of teTeX's standard latex command which defines the directories where the Type 1 fonts are, as well as some additional LaTeX code to load. You'll see the notice screen for pslatex followed by the status output of the TeX job itself. In a moment, you'll have a .dvi file which includes the Charter font requests. You can then print the file with dvips, and gs if necessary.

Installing a Type 1 font set is not difficult, as long as you follow a few basic steps. You should unpack the fonts in a subdirectory of the /usr/lib/teTeX/texmf/fonts/type1 directory, where your other Type 1 fonts are located, and then run texhash to let the directory search routines know that the fonts have been added. Then you need to add the font descriptions to the file psfonts.map so dvips knows they're on the system. The format of the psfonts.map file is covered in a couple different places in the references mentioned above. Again, remember to run the texhash program to update the teTeX directory database.

It is definitely an advantage to use the X Windows System with teTeX--- XFree86 under Linux---because it allows for superior document previewing. It's not required, but in general, anything that allows for easier screen previewing is going to benefit your work, in terms of the quality of the output. However, there is a tradeoff with speed of editing, which is much quicker on character-mode displays.


8. Appendix A: CTAN site list.

This is the text of the file CTAN.sites, which is available in the top-level directory of each CTAN archive or mirror site.

In order to reduce network load, it is recommended that you use the
Comprehensive TeX Archive Network (CTAN) host which is located in the
closest network proximity to your site.  Alternatively, you may wish to
obtain a copy of the CTAN via CD-ROM (see help/CTAN.cdrom for details).

Known mirrors of the CTAN reside on (alphabetically):
  cis.utovrm.it (Italia)                /TeX
  ctan.unsw.edu.au (NSW, Australia)     /tex-archive
  dongpo.math.ncu.edu.tw (Taiwan)       /tex-archive
  ftp.belnet.be (Belgium)               /packages/TeX
  ftp.ccu.edu.tw (Taiwan)               /pub/tex
  ftp.cdrom.com (West coast, USA)       /pub/tex/ctan
  ftp.comp.hkbu.edu.hk (Hong Kong)      /pub/TeX/CTAN
  ftp.cs.rmit.edu.au  (Australia)       /tex-archive
  ftp.cs.ruu.nl (The Netherlands)       /pub/tex-archive
  ftp.cstug.cz (The Czech Republic)     /pub/tex/CTAN
  ftp.duke.edu (North Carolina, USA)    /tex-archive
  ftp.funet.fi (Finland)                /pub/TeX/CTAN
  ftp.gwdg.de (Deutschland)             /pub/dante
  ftp.jussieu.fr (France)               /pub4/TeX/CTAN
  ftp.kreonet.re.kr (Korea)             /pub/CTAN
  ftp.loria.fr (France)                 /pub/unix/tex/ctan
  ftp.mpi-sb.mpg.de (Deutschland)       /pub/tex/mirror/ftp.dante.de
  ftp.nada.kth.se (Sweden)              /pub/tex/ctan-mirror
  ftp.oleane.net (France)               /pub/mirrors/CTAN/
  ftp.rediris.es (Espa\~na)             /mirror/tex-archive
  ftp.rge.com (New York, USA)           /pub/tex
  ftp.riken.go.jp (Japan)               /pub/tex-archive
  ftp.tu-chemnitz.de (Deutschland)      /pub/tex
  ftp.u-aizu.ac.jp (Japan)              /pub/tex/CTAN
  ftp.uni-augsburg.de (Deutschland)     /tex-archive
  ftp.uni-bielefeld.de (Deutschland)    /pub/tex
  ftp.unina.it (Italia)                 /pub/TeX
  ftp.uni-stuttgart.de (Deutschland)    /tex-archive (/pub/tex)
  ftp.univie.ac.at (\"Osterreich)       /packages/tex
  ftp.ut.ee (Estonia)                   /tex-archive
  ftpserver.nus.sg (Singapore)          /pub/zi/TeX
  src.doc.ic.ac.uk (England)            /packages/tex/uk-tex
  sunsite.auc.dk (Denmark)              /pub/tex/ctan
  sunsite.cnlab-switch.ch (Switzerland) /mirror/tex
  sunsite.icm.edu.pl (Poland)           /pub/CTAN
  sunsite.unc.edu (North Carolina, USA) /pub/packages/TeX
  wuarchive.wustl.edu (Missouri, USA)   /packages/TeX

Known partial mirrors of the CTAN reside on (alphabetically):
  ftp.adfa.oz.au (Australia)            /pub/tex/ctan
  ftp.fcu.edu.tw (Taiwan)               /pub2/tex
  ftp.germany.eu.net (Deutschland)      /pub/packages/TeX
  ftp.gust.org.pl (Poland)              /pub/TeX
  ftp.jaist.ac.jp (Japan)               /pub/TeX/tex-archive
  ftp.uu.net (Virginia, USA)            /pub/text-processing/TeX
  nic.switch.ch (Switzerland)           /mirror/tex
  sunsite.dsi.unimi.it (Italia)         /pub/TeX
  sunsite.snu.ac.kr (Korea)             /shortcut/CTAN

Please send updates to this list to <ctan@urz.uni-heidelberg.de>.

The participating hosts in the Comprehensive TeX Archive Network are:
  ftp.dante.de  (Deutschland)         
       -- anonymous ftp                 /tex-archive (/pub/tex /pub/archive)
       -- gopher on node gopher.dante.de
       -- e-mail via ftpmail@dante.de
       -- World Wide Web access on www.dante.de
       -- Administrator: <ftpmaint@dante.de>

  ftp.tex.ac.uk (England)               
       -- anonymous ftp                 /tex-archive (/pub/tex /pub/archive)
       -- gopher on node gopher.tex.ac.uk
       -- NFS mountable from nfs.tex.ac.uk:/public/ctan/tex-archive
       -- World Wide Web access on www.tex.ac.uk
       -- Administrator: <ctan-uk@tex.ac.uk>


9. Appendix B: Installing the CTAN teTeX distribution.

The generic, teTeX distribution isn't any harder to install than the Linux packages. See section Generic CTAN distribution, below.

You should consider installing the generic teTeX distribution from the CTAN archives if:

A complete installation of the binary distribution requires 40-50 Mb of disk space, and building the distribution from the source code takes about 75 Mb, so you should make sure that the disk space is available before you start. You don't need to have the GCC compiler or the X Windows System installed (although X certainly helps because it is much easier to preview documents on-screen). All you need is an editor that is capable of producing plain ASCII, text (see section 2). What could be simpler?

You can retrieve the files from one of the CTAN archives listed in section Appendix A. In the examples below, the files were retrieved from the CTAN archive at ftp.tex.ac.uk.

9.1 Installing the binary distribution.

Minimal installation.

First, FTP to ftp.tex.ac.uk and cd to the directory

ctan/tex-archive/systems/unix/teTeX/distrib/
Retrieve the files
INSTALL.bin
install.sh
and place them in the top-level directory where you want to install teTeX, for example, /var/teTeX if you plan to install teTeX in the /var file system.

Print out the INSTALL.bin file. Keep this file handy, because it describes how to install a minimal teTeX installation. The minimal installation requires only 10-15 MB of disk space, but it is recommended that you install the complete teTeX package if at all possible. For a minimum installation, you'll need the files

ctan/tex-archive/systems/unix/teTeX/distrib/base/latex-base.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/base/tetex-base.tar.gz
You'll also need one of two archives which contain the executable teTeX programs. Retrieve the archive file
ctan/tex-archive/systems/unix/teTeX/distrib/binaries/i386-linux.tar.gz
if your system uses the Linux ELF shared libraries, ld.so of at least version 1.73, and clibs of at least version 5.09. If it doesn't, retrieve the archive
ctan/tex-archive/systems/unix/teTeX/distrib/binaries/i386-linuxaout.tar.gz
which is compiled for systems that use the older, a.out-format static libraries.

Then, following the instructions in the file INSTALL.bin, execute the command

sh ./install.sh
while in the top-level teTeX installation directory. (Make sure that the teTeX archives are located there, too.) After a few moments, the installation program will warn you that you are missing some of the teTeX packages. However, if you're planning only a minimal teTeX installation, you should ignore the warnings and proceed. To configure the basic teTeX system, see section Base system configuration, below.

To install the remaining packages, see the next section.

Complete installation.

To perform a complete teTeX installation, retrieve the archive files listed in the previous section, as well as the following files:

ctan/tex-archive/systems/unix/teTeX/distrib/doc/ams-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/doc/bibtex-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/doc/eplain-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/doc/fonts-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/doc/general-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/doc/generic-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/doc/latex-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/doc/makeindex-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/doc/metapost-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/doc/programs-doc.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/fonts/ams-fonts.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/fonts/dc-fonts.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/fonts/ec-fonts.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/fonts/misc-fonts.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/fonts/postscript-fonts.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/fonts/sauter-fonts.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/goodies/amstex.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/goodies/bibtex.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/goodies/eplain.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/goodies/latex-extra.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/goodies/metapost.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/goodies/pictex.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/goodies/pstricks.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/goodies/texdraw.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/goodies/xypic.tar.gz
All of these files should be placed in the top-level directory where you want teTeX to reside. As with the minimal installation, execute the command
sh ./install.sh

9.2 Base system configuration.

The install.sh script, after determining which teTeX archive series are present, will present you with a menu of options. The only setting you need to make at this point is to set the top-level directory where you want teTeX installed, by selecting the ``D'' option. You must, of course, choose a directory in whose parent directory you have write permissions. For example, if you are installing teTeX in your home directory, you would specify the teTeX installation directory as

/home/john.q.public/teTeX
and, after returning to the main menu, select ``I'' to proceed with the installation. Note that the directory must not exist already: the install.sh script must be able to create it.

An option which you should consider enabling, is setting an alternative directory for generated fonts. Even if you plan to use only Postscript-format, Type 1 scalable fonts, occasionally you'll process a file that requires the Computer Modern fonts. Enabling this option requires that you enter the directory to use. You must have write permissions for the parent directory. Following the example above, you could specify

/home/john.q.public/texfonts
or, if you want the generated fonts to be accessible by all users on the system, specify a directory like
/var/texfonts
I would recommend that you not, however, use the default /var/tmp/texfonts directory for this option, because the generated fonts could be deleted after the next reboot, and the fonts will need to be generated again the next time they're needed.

After you've selected the option ``I'', and install.sh has installed the archives, set various permissions, and generated its links and format files, the program will exit with a message telling you to add the teTeX binary directory to your $PATH environment variable, and the directories where the man pages and info files reside to your $MANPATH and $INFOPATH environment variables. For example, add the statements

export PATH=$PATH:"/home/john.q.public/teTeX/bin"
export MANPATH=$MANPATH":/home/john.q.public/teTeX/man"
export INFOPATH$=INFOPATH":/home/john.q.public/teTeX/info"
to your ~/.bash_profile if you use bash as your shell, or to your ~/.profile if you use another shell for logins.

Log out, and then log in again, so the environment variables are registered. Then, run the command

texconfig confall
to insure that the installation is correct.

Next, you can configure teTeX for you specific hardware. See section Post-installation configuration details, below.

9.3 Installing the CTAN source distribution.

To install teTeX V. 0.4 from the source code, ftp to a CTAN site like ftp://ftp.tex.ac.uk and retrieve the files

ctan/tex-archive/systems/unix/teTeX/distrib/INSTALL.src
ctan/tex-archive/systems/unix/teTeX/distrib/sources/README.texmf-src
ctan/tex-archive/systems/unix/teTeX/distrib/sources/teTeX-lib-0.4pl8.tar.gz
ctan/tex-archive/systems/unix/teTeX/distrib/sources/teTeX-src-0.4pl7.tar.gz

Read over the instructions in INSTALL.src, then su to root and unpack the files in a directory for which you have read-write-execute permissions.

Remember to use the p argument to tar, and also remember to unset the noclobber option of bash. You can do this with the counterintuitive command

set +o noclobber
Note that the argument +o to set unsets a variable, just exactly backwards from what you might expect.

The file teTeX-lib-0.4pl8.tar.gz will create the directory ./teTeX. The file teTeX-src-0.4pl7.tar.gz will create the directory teTeX-src-0.4 Print out the file INSTALL.src and keep it nearby for the following steps. cd to the ./teTeX-src-0.4 directory, and, per the instructions in the INSTALL.src file, edit ./Makefile. You need to set the TETEXDIR variable to the absolute path of the parent teTeX directory. This will be the subdirectory teTeX of the directory where you unpacked the source and library archives. For example, if you unpacked the archives in your home directory, you would set TETEXDIR to

/home/john.q.public/teTeX
The rest of the Makefile options are pretty generic. With GCC version 2.7.2 and later, you should not need to make any further adjustments unless you have a non-standard compiler and library setup, or want the compiler to perform some further optimizations, or for some other reason. Check that the USE_DIALOG, USE_NCURSES, and HAVE_NCURSES variables are set correctly for your system, because the dialog program needs the ncurses library to be installed. A ncurses library is included in the source distribution, so the default values in the Makefile should work fine. If you can't get ncurses to compile or link, texconfig can also be run from the command line.

If you've done everything correctly up to this point, you should be able to type make world in the top-level source directory, and relax until the teTeX executables are built. This can take a few hours.

After the build has completed, set the environment variables $PATH, $MANPATH, and $INFOPATH to include the teTeX directories. The statements which would be added to the file ~/.bash_profile, in the example, above, would be

export PATH=$PATH":/home/john.q.public/teTeX/bin/i386-linux"
export MANPATH=$MANPATH":/home/john.q.public/teTeX/man"
export INFOPATH=$INFOPATH":/home/john.q.public/teTeX/info"
The $PATH variable is different in the source distribution than in the binary distribution. Note that here the path to the binaries is teTeX/bin/i386-linux instead of simply teTeX/bin as in the binary distribution.

At this point you can run texconfig confall to ensure that the paths have been set correctly, and then proceed to configure teTeX as in the binary distribution. See the section Post-installation configuration details, below.

9.4 Post-installation configuration details.

The first thing you want to do is look at Thomas Esser's README file. It contains a lot of hints on how to configure teTeX for your output device (i.e., printer). The README file is located in the directory

/usr/lib/teTeX/texmf/doc/tetex
Read the file over with the command (the path in the following examples is that of the Slackware distribution):
less /usr/lib/teTeX/texmf/doc/tetex/README
or, print it out with the command
cat /usr/lib/teTeX/texmf/doc/tetex/README >/dev/lp0
assuming that your printer is connected to /dev/lp0. Substitute the device driver file that your printer is connected to, as appropriate.

Or, better still, print it using the lpr command:

lpr /usr/lib/teTeX/texmf/doc/tetex/README
You should have installed the printer daemon that is included with your distribution of Linux. If not, do that now, per the instructions that come with the package.

Print out the teTeX-FAQ. Keep the FAQ handy because it contains useful hints for configuring teTeX's output drivers for your printer. We'll get to that in a moment. In more recent releases of teTeX, the teTeX-FAQ is viewable via the texconfig utility.

Next, you want to define a directory to store your own TeX format files. teTeX searches the directories listed by the $TEXINPUTS environment variable for local TeX input files:

export TEXINPUTS=".:~/texinputs:"
to the system-wide /etc/profile file. Individual users can set their own local $TEXINPUTS directory, by adding the line in their ~/.profile or ~/.bash_profile if bash is the default shell. The $TEXINPUTS environment variable tells teTeX to look for users' individual TeX style files in the ~/texinputs directories under each user's home directory. It is critical that a colon appear before and after this directory. teTeX is going to append its own directory searches to your own. You want to have teTeX search the local format files first, so it uses the local versions of any of the standard files you have edited.

Add the /usr/lib/teTeX/bin directory to the system-wide path if you're installing teTeX as root. Again, if you're installing a personal copy of teTeX, add the directory where the teTeX binaries are located to the front your $PATH with the following line in your ~/.profile or ~/.bash_profile:

export PATH="~/tetex/bin:"$PATH
Now, log in as root and run texconfig per the instructions in the teTeX-FAQ and choose the printer that is attached to your system. Make sure that you configure teTeX for both the correct printer and printer resolution.

Finally, run the texhash program. This ensures that teTeX's internal database is up to date. The database is actually a ls-lR file. You must run texhash every time you change the system configuration, or teTeX will not be able to locate your changes.


10. Appendix C: Distribution and Copyright.

10.1 Distribution.

teTeX is free software; this means everyone is free to use the software and free to redistribute it on certain conditions. The package is not in the public domain. It is copyrighted and there are restrictions on its distribution, but these restrictions are designed to permit everything that a good cooperating citizen would want to do. What is not allowed is to try to prevent others from further sharing any version of free software that they might get from you. The precise conditions are found in the GNU General Public License that comes with many of the software packages and also appears following this section.

One way to get a copy of the package is from someone else who has it. You need not ask for our permission to do so, or tell any one else; just copy it. If you have access to the Internet, you can get the latest distribution versions by anonymous FTP. See the chapter ``Sources'' for more information.

You may also receive the software when you buy a computer. Computer manufacturers are free to distribute copies on the same terms that apply to everyone else. These terms require them to give you the full sources, including whatever changes they may have made, and to permit you to redistribute these packages received from them under the usual terms of the General Public License. In other words, the program must be free for you when you get it, not just free for the manufacturer.

You can also order copies of GNU software from the Free Software Foundation on CD-ROM. This is a convenient and reliable way to get a copy; it is also a good way to help fund our work. (The Foundation has always received most of its funds in this way.) An order form is included many distribution, and on our web site in http://www.gnu.ai.mit.edu/order/order.html. For further information, write to

Free Software Foundation
59 Temple Place, Suite 330
Boston, MA  02111-1307 USA
USA

The income from distribution fees goes to support the foundation's purpose: the development of new free software, and improvements to our existing programs.

If you use GNU software at your workplace, please suggest that the company make a donation. If company policy is unsympathetic to the idea of donating to charity, you might instead suggest ordering a CD-ROM from the Foundation occasionally, or subscribing to periodic updates.

10.2 GNU GENERAL PUBLIC LICENSE

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

Preamble.

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software---to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

END OF TERMS AND CONDITIONS

10.3 How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the ``copyright'' line and a pointer to where the full notice is found.

[one line to give the program's name and an idea of what it does.
Copyright (C) 19[yy]  [name of author]

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) 19[yy] [name of author]
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'.  This is free software, and you are welcome
to redistribute it under certain conditions; type `show c' 
for details.

The hypothetical commands ``show w'' and ``show c'' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than ``show w'' and ``show c''; they could even be mouse-clicks or menu items---whatever suits your program.

You should also get your employer (if you work as a programmer) or your school, if any, to sign a ``copyright disclaimer'' for the program, if necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright
interest in the program `Gnomovision'
(which makes passes at compilers) written 
by James Hacker.

[signature of Ty Coon] 1 April 1989
Ty Coon, President of Vice

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.