Typesetting SGML Documents Using
be explicitly requested by setting the i n h e r i t at- tribute of the affected category to one, as shown in Listing 2. Explicitly assigned characteristic values override inherited values.
The usual method of determining the value of a characteristic that has not been explicitly assigned in the e-i-c is to look up its value in an environ- ment. Every FOSI contains the document environ- ment that explicitly mentions all 128 formatting characteristics. This is the default or "unnamed" environment normally used when a lookup must be done. For example, the prespace category (presp) was entirely omitted from the declaration for head in Listing 2. So head was typeset using the default environment's prespace characteristic values, which were all zero.
Other "named" environments may optionally be defined in the envdesc section. For an e-i-c's characteristic to be looked up from a named envi- ronment, the structure in an e-i-c that contains the categories (charlist) must set its envname attribute to the environment name.
Of the two methods of determining the values of unspecified characteristics (inheriting from a parent and defaulting from an environment), the inheritance method is the more problematic. Since the value of an inherited characteristic cannot be decided until the element's context is known, current characteristic values must be tracked by
fragment is the leading category (which controls line spacing), then there is no reason to change the current font. By keeping track of the categories that have not changed since the last time the bottom layer was called, we save the overhead of computing
parameter that relies entirely on those
Whatever optimizations are used, it is required
that the current font, horizontal and vertical sizes, margins, indent, interword space, page and line breaking, and baselineskip parameters be properly set. Some non-primitive parameters (for example, for controling the number of columns) must also be set. In addition, certain commands, such as inserts, vertical and horizontal skips, counter increments, macro text expansions for typesetting, and so on, must be executed at the appropriate times. All of these actions must conform to the
current settings of the FOSI characteristics.
Sometimes the correspondence between FOSI characteristics and W capabilities is close, and a simple transformation will allow T@to produce the results specified by the FOSI. An example is the transformation of the pre-space category
which controls characteristics,
vertical spacing. Presp called minimum, nominal,
precedes an e-i-c. The be defined by means of
actions T@must take the transformation:
m. Fortunately, W ' s grouping already works this way. The characteristic values that must be looked up from an environment can be added to the definitions in the FOSI as part of the translation process, or the lookup can be performed by TEX as part of the typesetting process.
Typesetting the Translated SGML Document
The processes performed by m that culminate in typesetting the translated document can be sepa- rated into two levels. The top level is responsible for the inheritance, lookup, and setting of charac- teristic values, as discussed above. Macros, such as \ s t a r t e i c and \endeic used in Listing 4, group these values to restrict inheritance, while \font, \textbrk, and the like are used to set explicit overrides.
The bottom level is responsible for the setting
of TEX parameters.
This layer is invoked
at the call to
\eiccont e n t
Various optimizations are possible. For exam- ple, if the only category changed since the last text
Cpresp nominal=x minimum=y maximum=%> \vskip z plus min(% - x, 0) minus min(x - y,0) +--+
The indent category's characteristics are also easy to transform into w. There are only three indent characteristics, all of which are dimensions: leftind, rightind, and firstln. It is possible to specify that a dimension be absolute or relative to its current value. So, assuming that the con- ditional \ i f abslind is set to false if the leftind is specified relatively and to true if it is specified as an absolute value, and likewise assuming that \ i f absrind and \ i f absf ind are appropriately set, the transformation becomes:
<indent leftind=x rightind=y firstind=z> \ifabslind\else\advance\fi\leftskip x \ifabsrind\else\advance\fi\rightskip y \ifabsfind\else\advance\f i\parindent (z- x) +-+
is the font assignment.
The FOSI font category
style, famname, size,
allcap, smallcap, and
TUGboat, Volume 12 (1991), No. 3-Proceedings
of the 1991 Annual Meeting