.\" @(#)u3 6.1 (Berkeley) 5/22/86
III. DOCUMENT PREPARATION
systems are used extensively for document preparation.
programs that produce a text with
justified right margins, automatic page numbering and titling,
is designed to produce output on terminals and
(pronounced ``tee-roff'')
instead drives a phototypesetter,
which produces very high quality output
This paper was formatted with
is that the text to be formatted contains within it
``formatting commands'' that indicate in detail
how the formatted text is to look.
For example, there might be commands that specify how long
lines are, whether to use single or double spacing,
and what running titles to use on each page.
are relatively hard to learn to use effectively,
``packages'' of canned formatting requests are available
paragraphs, running titles, footnotes, multi-column output,
and so on, with little effort
and without having to learn
These packages take a modest effort to learn,
but the rewards for using them are so great
that it is time well spent.
we will provide a hasty look at the ``manuscript''
Formatting requests typically consist of a period and two upper-case letters,
which is used to introduce a title,
to begin a new paragraph.
A document is typed so it looks something like this:
The lines that begin with a period are the formatting requests.
calls for starting a new paragraph.
depends on what output device is being used
(typesetter or terminal, for instance),
and on what publication the document will appear in.
normally assumes that a paragraph is preceded by a space
and the first word is indented.
These rules can be changed if you like,
but they are changed by changing the interpretation
not by re-typing the document.
To actually produce a document in standard format
to use the manuscript package of formatting requests.
There are several similar packages;
check with a local expert to determine which ones
are in common use on your machine.
In addition to the basic formatters,
a host of supporting programs
that help with document preparation.
The list in the next few paragraphs
so browse through the manual
and check with people around you for other possibilities.
let you integrate mathematics
into the text of a document,
in an easy-to-learn language that closely resembles the way
you would speak it aloud.
sum from i=0 to n x sub i ~=~ pi over 2
sum from i=0 to n x sub i ~=~ pi over 2
provides an analogous service for preparing tabular material;
it does all the computations necessary to align complicated columns
with elements of varying widths.
prepares bibliographic citations from a data base,
in whatever style is defined by the formatting package.
It looks after all the details of numbering references in sequence,
filling in page and volume numbers,
getting the author's initials and the journal name right,
detect possible spelling mistakes in a document.\(dg
\(dg "typo" is not provided with Berkeley Unix.
works by comparing the words in your document
printing those that are not in the dictionary.
It knows enough about English spelling to detect plurals and the like,
so it does a very good job.
looks for words which are ``unusual'',
Spelling mistakes tend to be more unusual,
and thus show up early when the most unusual words
looks through a set of files for lines
that contain a particular text pattern
(rather like the editor's context search does,
but on a bunch of files).
will find all lines that end with
(It is almost always a good practice to put single quotes around
the pattern you're searching for,
in case it contains characters like
that have a special meaning to the shell.)
is often useful for finding out in which of a set of files
the misspelled words detected by
prints a list of the differences between
two versions of something automatically
(which certainly beats proofreading by hand).
counts the words, lines and characters in a set of files.
translates characters into other characters;
for example it will convert upper to lower case and vice versa.
This translates upper into lower:
tr A-Z a-z <input >output
sorts files in a variety of ways;
(keyword-in-context listing).
provides many of the editing facilities
but can apply them to arbitrarily long inputs.
provides the ability to do both pattern matching and numeric computations,
and to conveniently process fields within lines.
These programs are for more advanced users,
and they are not limited to document preparation.
Put them on your list of things to learn about.
Most of these programs are either independently documented
or are sufficiently simple that the description in
Hints for Preparing Documents
Most documents go through several versions (always more than you expected) before they
Accordingly, you should do whatever possible to make
the job of changing them easy.
First, when you do the purely mechanical operations of typing,
type so that subsequent editing will be easy.
Start each sentence on a new line.
and break lines at natural places,
such as after commas and semicolons,
Since most people change documents by rewriting phrases
and adding, deleting and rearranging sentences,
these precautions simplify any editing
Keep the individual files of a document down
perhaps ten to fifteen thousand characters.
Larger files edit more slowly,
and of course if you make a dumb mistake
it's better to have clobbered a small file than a big one.
Split into files at natural boundaries in the document,
for the same reasons that you start each sentence
The second aspect of making change easy
is to not commit yourself to formatting details too early.
One of the advantages of formatting packages like
is that they permit you to delay decisions
to the last possible moment.
until a document is printed,
it is not even decided whether it will be typeset
or put on a line printer.
As a rule of thumb, for all but the most trivial jobs,
you should type a document in terms of a set of requests
and then define them appropriately,
either by using one of the canned packages
As long as you have entered the text in some systematic way,
it can always be cleaned up and re-formatted
by a judicious combination of
editing commands and request definitions.