[BACK]Return to u3 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / doc / usd / 01.begin

File: [cvs.NetBSD.org] / src / share / doc / usd / 01.begin / u3 (download)

Revision 1.1, Thu Nov 29 12:35:06 2007 UTC (16 years, 4 months ago) by mjf
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, mjf-devfs2-base, mjf-devfs2, matt-premerge-20091211, matt-nb8-mediatek-base, matt-nb8-mediatek, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-premerge-20101231, matt-mips64-base2, matt-armv6-nbase, matt-armv6-base, localcount-20160914, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, is-mlppp-base, is-mlppp, hpcarm-cleanup-nbase, hpcarm-cleanup-base, cube-autoconf-base, cube-autoconf, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, cherry-xenmp-base, cherry-xenmp, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver, HEAD
Branch point for: matt-armv6

Commit Caldera licensed documentation from 4.4BSD. This was taken from the
OpenBSD tree.

No objections on netbsd-docs.

.\"	$NetBSD: u3,v 1.1 2007/11/29 12:35:06 mjf Exp $
.\"
.\" Copyright (C) Caldera International Inc.  2001-2002.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code and documentation must retain the above
.\"    copyright notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed or owned by Caldera
.\"	International, Inc.
.\" 4. Neither the name of Caldera International, Inc. nor the names of other
.\"    contributors may be used to endorse or promote products derived from
.\"    this software without specific prior written permission.
.\"
.\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
.\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE FOR ANY DIRECT,
.\" INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.\"	@(#)u3	8.1 (Berkeley) 6/8/93
.\"
.sp
.SH
III. DOCUMENT PREPARATION
.PP
.UC UNIX
systems are used extensively for document preparation.
There are two major 
formatting
programs,
that is,
programs that produce a text with
justified right margins, automatic page numbering and titling,
automatic hyphenation,
and the like.
.UL nroff
is designed to produce output on terminals and
line-printers.
.UL troff
(pronounced ``tee-roff'')
instead drives a phototypesetter,
which produces very high quality output
on photographic paper.
This paper was formatted with
.UL troff .
.SH
Formatting Packages
.PP
The basic idea of
.UL nroff 
and 
.UL troff
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.
.PP
Because
.UL nroff
and
.UL troff
are relatively hard to learn to use effectively,
several
``packages'' of canned formatting requests are available
to let you specify
paragraphs, running titles, footnotes, multi-column output,
and so on, with little effort
and without having to learn
.UL nroff
and
.UL troff .
These packages take a modest effort to learn,
but the rewards for using them are so great
that it is time well spent.
.PP
In this section,
we will provide a hasty look at the ``manuscript'' 
package known as
.UL \-ms .
Formatting requests typically consist of a period and two upper-case letters,
such as
.UL .TL ,
which is used to introduce a title,
or
.UL .PP
to begin a new paragraph.
.PP
A document is typed so it looks something like this:
.P1
\&.TL
title of document
\&.AU
author name
\&.SH
section heading
\&.PP
paragraph ...
\&.PP
another paragraph ...
\&.SH
another section heading
\&.PP
etc.
.P2
The lines that begin with a period are the formatting requests.
For example,
.UL .PP
calls for starting a new paragraph.
The precise meaning of
.UL .PP
depends on what output device is being used
(typesetter or terminal, for instance),
and on what publication the document will appear in.
For example,
.UL \-ms
normally assumes that a paragraph is preceded by a space
(one line in
.UL nroff ,
\(12 line in
.UL troff ),
and the first word is indented.
These rules can be changed if you like,
but they are changed by changing the interpretation
of
.UL .PP ,
not by re-typing the document.
.PP
To actually produce a document in standard format
using
.UL \-ms ,
use the command
.P1
troff -ms files ...
.P2
for the typesetter, and
.P1
nroff -ms files ...
.P2
for a terminal.
The
.UL \-ms
argument tells
.UL troff
and
.UL nroff
to use the manuscript package of formatting requests.
.PP
There are several similar packages;
check with a local expert to determine which ones
are in common use on your machine.
.SH
Supporting Tools
.PP
In addition to the basic formatters,
there is
a host of supporting programs
that help with document preparation.
The list in the next few paragraphs
is far from complete,
so browse through the manual
and check with people around you for other possibilities.
.PP
.UL eqn
and
.UL neqn
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.
For example, the
.UL eqn
input
.P1
sum from i=0 to n x sub i ~=~ pi over 2
.P2
produces the output
.EQ
sum from i=0 to n x sub i ~=~ pi over 2
.EN
.PP
The program
.UL tbl
provides an analogous service for preparing tabular material;
it does all the computations necessary to align complicated columns
with elements of varying widths.
.PP
.UL refer
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,
and so on.
.PP
.UL spell
and
.UL typo
detect possible spelling mistakes in a document.\(dg
.FS
\(dg "typo" is not provided with Berkeley Unix.
.FE
.UL spell
works by comparing the words in your document
to a dictionary,
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.
.UL typo
looks for words which are ``unusual'',
and prints those.
Spelling mistakes tend to be more unusual,
and thus show up early when the most unusual words
are printed first.
.PP
.UL grep
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).
For example,
.P1
grep \(fming$\(fm chap*
.P2
will find all lines that end with
the letters
.UL ing
in the files
.UL chap* .
(It is almost always a good practice to put single quotes around
the pattern you're searching for,
in case it contains characters like
.UL *
or
.UL $
that have a special meaning to the shell.)
.UL grep
is often useful for finding out in which of a set of files
the misspelled words detected by
.UL spell
are actually located.
.PP
.UL diff
prints a list of the differences between
two files,
so you can compare
two versions of something automatically
(which certainly beats proofreading by hand).
.PP
.UL wc
counts the words, lines and characters in a set of files.
.UL tr
translates characters into other characters;
for example it will convert upper to lower case and vice versa.
This translates upper into lower:
.P1
tr A-Z a-z <input >output
.P2
.PP
.UL sort
sorts files in a variety of ways;
.UL sed
provides many of the editing facilities
of
.UL ed ,
but can apply them to arbitrarily long inputs.
.UL awk
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.
.PP
Most of these programs are either independently documented
(like
.UL eqn
and
.UL tbl ),
or are sufficiently simple that the description in
the
.ul 2
.UC UNIX
Programmer's Manual
is adequate explanation.
.SH
Hints for Preparing Documents
.PP
Most documents go through several versions (always more than you expected) before they
are finally finished.
Accordingly, you should do whatever possible to make
the job of changing them easy.
.PP
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.
Make lines short,
and break lines at natural places,
such as after commas and semicolons,
rather than randomly.
Since most people change documents by rewriting phrases
and adding, deleting and rearranging sentences,
these precautions simplify any editing
you have to do later.
.PP
Keep the individual files of a document down
to modest size,
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
on a new line.
.PP
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
.UL \-ms
is that they permit you to delay decisions
to the last possible moment.
Indeed,
until a document is printed,
it is not even decided whether it will be typeset
or put on a line printer.
.PP
As a rule of thumb, for all but the most trivial jobs,
you should type a document in terms of a set of requests
like
.UL .PP ,
and then define them appropriately,
either by using one of the canned packages
(the better way)
or by defining your own
.UL nroff
and
.UL troff
commands.
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.