You define your own abbreviations in two (optional) files "html.ab1" and
"html.ab2", in the directory "DIR" that you have chosen in Section 1.1.
Alternatively, if you prefer not to maintain three separate user
files ("html.ab1", "html.ab2", and "html.ucm"), you can use one
single file "html.rc", which is a concatenation of the
three files in the above order.
If all four files exist in DIR,
"html.ab1" is read first, then "html.rc", with the first
section of abbreviations appended to those of "html.ab1". The other two
files are ignored. "html.rc" overides the others.
Here are the first few lines in an example of "html.ab1"
and the first few lines in an example of "html.ab2"
The first line in the file specifies a single character
(it can appear after any number of spaces) to be used to
request abbreviation expansion. Pick a symbol that you will rarely
use for other purposes when you write your HTML files.
Subsequent lines are the definitions of the abbreviations.
The abbreviated code is a 1 or 2-character string and
appears first, followed by any number of spaces. The rest of
the line (leading spaces are ignored, but NOT
trailing and intervening spaces) is the substitution text.
Maximum number of abbreviations allowed is 400 in "html.ab1" and 200 in
"html.ab2". Maximum number of characters in each expansion is 255. (PC version:
200, 100, and 120, respectively)
Alphabetical sorting is not necessary, but
facilitates maintenance of the list.
2-character codes have precedence over 1-character codes.
In case of duplicate codes, the latest (furthest down the
list) one prevails.
Blank lines can be inserted in the file for easy reading.
To use the abbreviations,
simply type ";H" instead of "HTML", for example, or "$h"
instead of "//www.mcs.anl.gov/home/kwong" in the raw file.
When certain words or phrases occur frequently in your
;dcs, ;abs offer significant saving in time.
EXAMPLE: What follows is a segment of a fictitious HTML document.
In
;;sc 2.3
we examined some basic ;H ;cms.
In the next ;sc, we will consider ;cms
for writing ;es.
It expands to
In
Section 2.3
we examined some basic HTML commands.
In the next section, we will consider commands
for writing equations.
TIP:Use "html.ab1" for common words and "html.ab2" for
HTML-specific words.
TIP:
Some common phrases that can be abbreviated include: "there is",
"there are", "there exist", "of course", "on the other hand",
"without loss of generality", "for example", "necessary and sufficient",
"with respect to", "Department of Mathematics".
Other rules:
You can double the symbol to capitalize or decapitalize:
";;cm" expands to "Command".
The replacement text may contain more than one word.
The replacement text can expand to more than one line,
by embedding a new line symbol '\n' in the definition.
Other escaped characters:
\\ \
\12x xxxxxxxxxxxx
\w add rest of text to next "word"
\W add rest of text to next "Word"
\c ditto; use ',' as pseudospace
The abbreviation can be part of a word. For example,
";cms" expands to "commands" and "sub;sc" to "subsection".
One-character codes should be with care if it is not to be followed
by a space. For example, ";es" is expanded into "equations" only if
the 2-character code "es" has not been defined (anywhere,
whether before or after the definition for "e") in the file.
Although nonalphanumeric characters can be used as part of
a code, they should be used with care.
You can add abbreviation definitions directly inside the source file.
This feature provides a way to dynamically add
definitions special to
the current document but otherwise seldom used in other documents.
For example, you are writing a joint document with Mr. A and have to
refer to his WEB directory frequently, but you do not
expect to write another document with him in the near future.
Or you constantly write joint documents with a dozen
different collaborators
and you do not want to keep a dozen different abbreviations in your
abbreviation files (it is hard to remember a dozen different
codes). You can use the same abbreviation code(s) to refer to
coauthor(s) and assign the appropriate substitution texts
in each document.
A line of the form
.ab AB SUBSTITUTION TEXT
makes the code "AB" available to subsequent lines.
The abbreviation is added
to the SECOND abbreviation list defined in "html.ab2".
If the code "AB" has been previously
defined in "html.ab2", the new definition now prevails.
If the file "html.ab2" does not exist,
the new abbreviation can be invoked with the default abbreviation symbol $.
The abbreviation symbols can also be dynamically changed within a
document by using the commands
.a1 \
.a2 !
The first command changes the first symbol from ; to \,
and the second changes the second symbol from $ to !.
This is useful when all of a sudden you realize that you need
the symbols ; and $ for other purposes in the rest of the document.
User-defined macros (3.3) can also be added dynamically
by using the command
In the (not very often) case in which you need the
string ";cm" to appear exactly as it is in the final manuscript,
try one of the following ways (each seems to have its own drawbacks,
so any suggestion of a better solution is welcome):
If a line contains the string
"NO XP", then
the next one will be left untouched, but
abbreviation and macro expansion resumes with the following line. This
means that you can insert a comment line such as
"<!-- NO XP NEXT LINE -->" before the line to be
protected.
A line with only the string ".nx" has the same effect as
above.
A line containing the string
"NO EXPANSION" suppresses
expansion for subsequent lines until another line containing
the string "RESUME EXPANSION" is encountered.
Lines starting with the strings ".v" and ".V", respectively have
the same effect as above.
You can define a code "X" in "html.ab1" to
expand to ";cm". "htxp" does not expand recursively.
"htxp" provides a shorthand for most HTML commands. The
shorthand is fashioned after NROFF, the forefather of text-formatting
tools. These commands are called "dot commands"
because each starts with a "dot" (a period).
A dot command must appear at the beginning of a line --
the dot must be the first nonwhite character of the line
(NROFF requires the dot to be THE first character. We
relax the restriction so that dot commands can be indented for
easy reading).
The dot is followed by a code of 2 or fewer characters.
The rest of the line may contain other text.
Most dot commands affect only the
current line.
In the simplest case, a dot command works like an abbreviation and expands
into a simple HTML command. Here are some examples
(the corresponding expansions are given in the second column):
.
.p
.o
.O
.ht
.Ht
.h1
.H1
A dot by itself (followed by a space) expands to <lineari>
and generates a bullet, used in making a list, as we have
here.
Unlike HTML tags, dot commands are case-sensitive. Hence ".Ht"
is defined but ".HT" is not.
In general, if an HTML tag comes in
a pair, such as <ht> and </ht>, the corresponding
dot commands are distinguished by the case of the first character.
Some HTML tag pairs are often used to enclose relatively short
pieces of text. For each of these, "htxp" uses one single dot command.
It assumes that the enclosed text can fit entirely
(which can be as long as the editor allows) in the same line
that contains the dot command. The dot command will then be expanded
into an enclosing pair of tags. Examples:
.t TEXT TEXT TEXT TEXT
.1 TEXT TEXT
TEXT TEXT
.em TEXT TEXT TEXT TEXT
Commands in the next level of complexity (for now, this is
is the highest level; future enhancements may produce more)
put extra text after the first white-space-delimited word,
in addition to enclosing the rest of the line. Examples:
So far, all the dot commands, when expanded, add something to
the beginning and the end of the line. There are occasions in
which one wants to have all the actions occurring in the interior
of the line. This can be achieved with a special format in
the usage of any dot command. As an example
.iTTEXT1{FILE TEXT}TEXT2
expands to
TEXT1TEXT2
Two conditions have to be satisfied to evoke this effect:
For 2-character commands TEXT1 follows the command immediately
with no intervening space. For 1-character commands a single
space precedes TEXT1. The space is used to avoid the
ambiguous situation when the single character in the dot
command combines with the first character in TEXT1 to form a
valid 2-character dot command.
A pair of balanced braces occurs in the line.
A more versatile construction is as follows:
.i+TEXT1+FILE TEXT+TEXT2
When the command ".i" is followed immediately (i.e. no spaces)
by a non-alphanumeric symbol other than "{", """, and any
of the abbreviation symbols, that symbol can
be used to delimit the segment instead of the "{", "}" pair
and achieve the same effect as above. This requires the
occurence of the symbol 3 times, but it lets you use any
symbol that is not used in the text.
The new construction can also be used for a multiline
structure such as
.t+Not part of the title. +This is a multiline
Title+
.t+This is a multiline
Title+
This construct CANNOT BE NESTED.
However, the first construct with "{" and "}" can be
nested within a multiline construct of the latter kind.
Other Abbreviations
Some additional built-in abbreviations are available, to expand to some
commonly used attributes, used inside tags. These are of the
form
?t which expands to align = "top"
See the on-line help for a list. The symbol "?" can be
change useing the command
".aq !"
To save space, for dot commands that exist in pairs, such as
.ht and .Ht for
<http> and
</http>, we list only the starting member.
As explained in 3.1, the enclosing dot command can be obtained
from the former by capitalizing the first character.
.ab co SUBS TEXT
.a1 x Change abbreviation symbol 1 to x
.a2 x Change abbreviation symbol 2 to x
.ap x Change pseudospace symbol to x
.aq x Change ? abbreviation symbol to x
.au co DEF Add macro definition
Although abbreviations can be used to insert text after the next word,
dot commands are more versatile in more complicated
situations that require insertion of text after the next
several words and to the end of the line.
"htxp" lets you create your own dot-macro look-alikes.
Although these are not full-fledged macros like those in C or
TeX, they are adequate for our purposes and we will happily
refer to them as "htxp" macros.
Like abbreviations macros are user-defined in a file, called "html.ucm",
in the directory DIR. The first line in the file specifies the
command symbol (used in place of the . in dot commands). I use
the symbol "]",
but any other reasonable symbol can be used.
If the line contains non-white text after the symbol, the
text is used to replace blank lines in the raw file. This is
used, for example, to automatically change a blank line to
<p>. Hint: Try putting \40 <p> after ']'.
The syntax of a definition line is
xy [-o] TEXT1_TEXT2__TEXT3
There is one "underscore" after "TEXT1" and two after "TEXT2".
"xy" is the command name. In expansion, "TEXT1" is added before
the text that follows the command, "TEXT2" is added after the
first space-delimited word and "TEXT3" is added to the end.
There can only be one double underscore "__" in the definition, but
there can be more than one "_". Each "TEXTn" is
added before the n-th word.
"-o" is an optional field that specifies options that can give
the command additional capabilities. Currently only three options
are available:
-x Current line is expanded but not the next line
-v subsequent lines will not be expanded
-V resume expansion for subsequent lines
Escaped sequences in "TEXT1", "TEXT2", etc. are treated as in
abbreviations, except for "\W", which has the same meaning as "\w".
A pseudospace (default ',') is always converted to space.
The pseudospace feature is used to handle attributes inside
tags (used extensively in HTML3). An example,
A typical header section of an HTML document looks like
Man Kam Kwong's home page1
This can be condensed to one single macro by defining
bt \n\n
\n
__\n
The above should be typed as one single line in "html.ucm" (or in
"html.rc"). To produce the header as shown above, invoke the macro as
]bt page1 Man Kam Kwong's home page1
Modify the definition to suit your own favorable header format
(for instance, to include
<isindex>).
Signature
Many people like to include a signature at the end of each
article. The signature can consist of a line (or some graphics),
the authors's name, email, address, and even a form for suggestions.
All these can be easily condensed into an abbreviation or a macro.
Lists
An unordered list can be entered as follows:
.u
. Item number 1
. Item number 2
.u
. Subitem number 1
. Subitme number 2
.U
. Item number 3
.U
Highlighted Items in a List
It is popular to include a small inline image to hightlight an
item in a list, such as a new item. This can be most conveniently
done by using either an abbreviation or a macro. For example, define
n
__
Then
.u
. Item number 1
]n Item number 2
]n Item number 3
.U
will disply Items numbers 2 and 3 with the image "new.gif"
and emphasize the text.
Environments
The "Tip:" environment used in Section 1.3 is defined as
tp
TIP:
Tp
Similar environments can be defined for "Remark", "Example",
"Theorem", etc.
Other Extentions of HTML
The dot commands cover HTML tags that are commonly supported by most browsers.
You can make your own macros to handle extensions such as those
used in Netscape.