PART 2 (Man Kam Kwong, kwong@mcs.anl.gov)

Contents

  1. What is "htxp"? How does it work? Do I want to go on?
    Installation Disclaimers
  2. Abbreviations In-doc abbreviations
    Abbreviation suppression
  3. Built-in Dot commands Dot commands grouped by categories User commands Examples of User Commands
  4. Goals and what-nexts

2.1 Abbreviations

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.

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.

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. It expands to

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:

2.2 In-doc abbreviations

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

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

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

2.3 Abbreviation Suppression

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):

3.1 Built-in Dot Commands and Abbreviations with ?

"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).

EXAMPLE: "htxp" dot commands provide shorthand for several common linking constructs. They can be used in combination with abbreviations. expands to (with appropriate definitions of the abbreviations ";m", ";w", etc. given in "html.ab1".)

Other Abbreviations

Some additional built-in abbreviations are available, to expand to some commonly used attributes, used inside tags. These are of the form See the on-line help for a list. The symbol "?" can be change useing the command ".aq !"

3.2 Dot Commands Grouped by Categories

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.

1. Header materials

2. Headings

3. Simple formatting

4. Fonts

5. Lists

6. Images

7. Links

8. Others

9. Symbols and abbreviations

3.3 User commands

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.

The syntax of a definition line is

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:

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.

3.4 Examples of User Commands

Header Materials

A typical header section of an HTML document looks like This can be condensed to one single macro by defining 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 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:

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 Then 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 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.

Go on to Section 4



Mathematics and Computer Science Division
Argonne National Laboratory
9700 S Cass Ave
Argonne, IL 60439