lyx_mirror/3rdparty/dtl/example.tex

238 lines
10 KiB
TeX
Raw Normal View History

% This file is public domain.
% Originally written 1995, Geoffrey Tobin.
% The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
% This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
% This is the TeX source file for the "TeXnical Typesetting" document.
% Notice how you can put in comments? If TeX sees a % it simply ignores
% the rest of the line.
% A4 paper is 8.3in wide and 11.7in high; we set the page dimensions so that
% there are 1in margins all around:
\hsize 6.3in % page width
\vsize 9.7in % page height
\parskip 8pt plus 2pt minus 1pt % glue before a paragraph
% Define a few extra fonts for later use:
\font\bigrm=cmr10 scaled\magstep4 % big version of the standard roman font
\font\ninerm=cmr9 % 9pt roman
\font\fiverm=cmr5 % 5pt roman
\font\sm=cmcsc10 % caps and small caps
\font\ss=cmss10 % sans serif
% Here's a macro that we'll use to produce all subheadings:
\def\subhead#1{\bigskip % extra glue before subheading
\noindent{\bf #1}\par % unindented boldface subheading
\nobreak} % prevent a page break after subheading
\centerline{\bigrm \TeX nical Typesetting}
\vskip 2.5cm % dimensions can be metric
\subhead{What is \TeX?}
\TeX\ (pronounced ``teck'') is a computerized typesetting system developed by
Donald Knuth and others at Stanford University. It is used to create
high-quality documents, particularly those containing mathematics.
The name \TeX\ is an uppercase form of the Greek letters $\tau\epsilon\chi$,
the first three letters of a Greek word meaning {\sl art} as well as
{\sl technology}.
The lowering of the ``E'' is a reminder that \TeX\ is about typesetting,
which can be thought of as the next stage beyond word processing.
On devices where such lowering is difficult or impossible you may see \TeX\
written as {\tt TeX}.
% the above blank line ends the first paragraph
Most word processors allow you to
create and modify a document interactively --- what
you see on the screen is usually what your output will look like.
\TeX\ does {\it not} work in this way.
Like other typesetting systems (such as SCRIBE and
{\sl troff\/}), \TeX\ is known as a ``document compiler''. Using your
favourite text editor you need to create a file containing the
text of your manuscript along with the \TeX\ typesetting commands.
\TeX\ gives you the ability to produce printed matter with a quality
matching that found in books, depending on the output device.
Adelaide University has an {\sm imagen} laser printer
with a resolution of 240 dots per inch.
This publication shows both the capabilities of \TeX\ and
the output quality of the laser printer.
\subhead{Fonts}
One of the more obvious advantages of \TeX\ is the large range of fonts from
which you can choose. A font is a collection of characters each having a
similar size and style. Some of the fonts currently available include:
$$ % enter display math mode just to get space above and below \line
\line
{\hfil % infinitely stretchable glue
\rm roman\hfil \sl slanted\hfil \it italic\hfil \bf boldface\hfil
\tt typewriter\hfil \ss sans serif\hfil \sm small caps\hfil
} % take care to ensure each { has a matching }
$$
Many of these also come in a variety of sizes:
$$
\centerline{{\bigrm from the very big},~ % extra space after comma
{\ninerm to the very small},~
{\fiverm to the ridiculous}.}
$$
Apart from a large selection of mathematical symbols,
many special characters and accents are available:
$$
\vbox
{\tabskip 10pt plus 1fil % glue before and after all columns
\halign to\hsize
{& \hfil#\hfil\cr % specify a variable number of centred columns
\copyright& \it\$& \S& \P& \dag& \ddag&
$\circ$& $\bigcirc$& % some symbols must be accessed from math mode
$\leftarrow$& $\rightarrow$& $\triangle$& $\clubsuit$&
\`a& \'e& \c c& \^o& \"u\cr
}
}
$$
\TeX\ does a few subtle things automatically.
Certain sequences of characters in your text will
be replaced by {\sl ligatures} in the printed output (consider the ``{\tt ffi}''
in ``difficult''), while other pairs of characters need to be {\sl kerned}
(e.g., the ``o'' and ``x'' in ``box'' look better if they are moved closer
together). The range and quality of fonts available will continue to improve.
\subhead{Mathematics}
A major design goal of \TeX\ was to simplify the task of typesetting
mathematics --- and to do it properly. Mathematicians will be pleasantly
surprised at the ease with which formulae and expressions can be created;
from simple in-line equations
such as $e^{i\pi}=-1$ and $f_{n+2}=f_{n+1}+f_n$, to more extravagant displays:
$$
\sum_{k\ge1} \sqrt{x_k-\ln k}\quad\ne\quad
\int_{0}^\infty {e^{-x^3}+\sqrt{x} \over \left(123-x\right)^3} \,dx
$$
\TeX\ looks after most of the nitty gritty details, such as spacing things
correctly and choosing the right sizes for superscripts, parentheses,
square root signs etc. (The discoverer of the above relation wishes to
remain anonymous.)
\subhead{Alignment}
The preparation of tabular material such as in lists and matrices can be a
tedious job for a person armed only with a typewriter and a bottle of
correction fluid. With a little help from \TeX, computers can make it so
much easier:
$$
\vcenter % a vertically centred \vbox
{\tabskip 0pt % no space before column 1
\halign to 3.5in % width of table
{\strut#& % col 1 is a strut
\vrule#\tabskip .5em plus2em& % col 2 is a vrule; also set col spacing
#\hfil& % col 3 is left justified
\vrule#& % col 4 is a vrule
\hfil#\hfil& % col 5 is centred
\vrule#& % col 6 is a vrule
\hfil#& % col 7 is right justified
\vrule#\tabskip 0pt % col 8 is a vrule; no space after it
\cr % end of the preamble
\noalign{\hrule}
& & \multispan5 \hfil Oldest players to represent\hfil& \cr
& & \multispan5 \hfil England in a Test Match\hfil& \cr
\noalign{\hrule}
& & \omit\hfil Name\hfil& & % \omit ignores template in preamble
\omit\hfil Age\hfil& &
\omit\hfil Versus\hfil& \cr
\noalign{\hrule}
& & W.Rhodes& & 52y 165d& & West Indies, 1930& \cr
\noalign{\hrule}
& & W.G.Grace& & 50y 320d& & Australia, 1899& \cr
\noalign{\hrule}
& & G.Gunn& & 50y 303d& & West Indies, 1929& \cr
\noalign{\hrule}
& & J.Southerton{\ninerm*}& & 49y 139d& & Australia, 1877& \cr
\noalign{\hrule\smallskip}
& \multispan7\ninerm* (This was actually his Test debut.)\hfil \cr
}
}
\hskip .5in % space between table and matrix
A=\pmatrix % parenthesized matrix
{a_{11}& a_{12}& \ldots& a_{1n}\cr
a_{21}& a_{22}& \ldots& a_{2n}\cr
\vdots& \vdots& \ddots& \vdots\cr
a_{m1}& a_{m2}& \ldots& a_{mn}\cr
}
$$
\vskip -\the\belowdisplayskip % avoid too much space below display
\subhead{Other features}
Space does not permit examples of all the things \TeX\ can do. Here are some
more features you might like to know about:
\item{$\bullet$}
Multi-column output can be generated.
{\parskip=0pt % temporarily turn off the skipping between paragraphs
\item{$\bullet$}
\TeX\ has a very sophisticated paragraph building algorithm and rarely needs
to resort to hyphenation. Paragraphs can be indented and shaped in many
different ways.
\item{$\bullet$}
Automatic insertion of footnotes,\footnote{\dag}{\ninerm Here is
a footnote.} running heads, page numbers etc.
\item{$\bullet$}
\TeX\ makes provision for generating a table of contents, a bibliography, even
an index. Automatic section numbering and cross referencing are also possible.
\item{$\bullet$}
A powerful macro facility is built into \TeX. This lets you do some very
useful things, like creating an abbreviation for a commonly used phrase, or
defining a new command that will have varying effects depending on the
parameters it is given. A macro package can enhance \TeX\ by making it much
easier to generate a document in a predefined format.
\par % end the last paragraph BEFORE ending the group
} % \parskip will now revert to its previous value
\subhead{What CAN'T \TeX\ do?}
Complex graphics such as diagrams and illustrations pose
a major problem --- at the moment you have to leave an appropriate amount of
blank space and paste them in later.
Graphic facilities are the subject of current research.
\subhead{\TeX\ and VAX/VMS}
The \TeX\ source file used to generate this document is available for
inspection on any VAX node that has \TeX ---
just type `{\tt scroll tex\char'137 inputs:example.tex}'.
A few steps are needed to print such a file:
\item{(1)}
Type `{\tt tex example}' to ``compile'' the file.
(\TeX\ looks for a {\tt .tex} file by default. If it can't find the given
file in your current directory it will look in {\tt tex\char'137 inputs}.)
Two new files will be created in your current directory:
{\tt example.dvi} and {\tt example.lis}.
The former is a device independent description of the document;
the latter is simply a log of the \TeX\ run.
{\parskip=0pt % temporarily turn off \parskip
\item{(2)}
Type `{\tt dvitovdu example}' to preview the document on a terminal screen.
This program can be used to detect a variety of formatting problems,
saving both time and paper.
\item{(3)}
Type `{\tt imprint example}' to print the document.
(Note that the DVIto\kern-.15em VDU and IMPRINT commands
accept a {\tt .dvi} file by default).
} % restore \parskip
Detailed help on all these commands is available on-line --- try typing
`{\tt help tex}' to get started.
\bye