Literal and Preformatted Text
[Top] [Up] [Next] [Previous]

11 - Literal and Preformatted Text


Preformatted text started off in HTML with a simple mechanism for showing computer output, for which the spaces and line breaks were significant in determining the layout. The desire to offer Unix manual pages as hypertext forced a rethink. The next version supported character emphasis and embedded hypertext buttons. HTML+ adds the capability to use variable pitch fonts and to set up tab stops.

The LIT element is rendered in a proportional font, e.g.

<LIT>
From Oberon in fairyland,
   The king of ghosts and shadows there,
Mad Robin I, at his command,
   Am sent to view the night sports here.
      What revel rout
      Is kept about,
   In every corner where I go,
      I will o'ersee
      And merry be
   And make good sport, with ho, ho, ho!
</LIT>
This is rendered literally as:

From Oberon in fairyland,
   The king of ghosts and shadows there,
Mad Robin I, at his command,
   Am sent to view the night sports here.
      What revel rout
      Is kept about,
   In every corner where I go,
      I will o'ersee
      And merry be
   And make good sport, with a ho, ho, ho!
The ability to set tab stops in LITeral text makes it much easier to write filters that convert documents written on word processors into HTML+. Tab stops can be set by the TAB element and apply for the scope of the LIT element, e.g.

<tab at=40 align=right>
The AT attribute specifies the position of the tab stop, as measured from the left margin in terms of the width of a capital M.*1 The ALIGN attribute can be LEFT, CENTER or RIGHT, defaulting to LEFT. These have the conventional meaning as used on most word processors. If greater control over fonts and layout is needed then authors should make a hypertext link to a document written in a page description format like Adobe's PDF.

For computer output or plain text files, you should use the PRE element which is rendered in a fixed pitch font. The following is part of the man page for the Unix ls command:

<PRE>
 The next 9 characters are interpreted as three sets of three
 bits each which identify access permissions for owner,
 group, and others as follows:

 +------------------ 0400 read by owner (<B>r</B> or <B>-</B>)
 | +---------------- 0200 write by owner (<B>w</B> or <B>-</B>)
 | | +-------------- 0100 execute (search directory) by owner
 | | | 			(<B>x</B>, <B>s</B>, <B>S</N>, or <B>-</B>)
 | | | +------------ 0040 read by group (<B>r</B> or <B>-</B>)
 | | | | +---------- 0020 write by group (<B>w</B> or <B>-</B>)
 | | | | | +-------- 0010 execute/search by group
 | | | | | | 			(<B>x</B>, <B>s</B>, <B>S</B>, or <B>-</B>)
 | | | | | | +------ 0004 read by others (<B>r</B> or <B>-</B>)
 | | | | | | | +---- 0002 write by others (<B>w</B> or <B>-</B>)
 | | | | | | | | +-- 0001 execute/search by others
 | | | | | | | | | 			(<B>x</B>, <B>t</B>, <B>T</B>, or <B>-</B>)
 | | | | | | | | |
 r w x r w x r w x

</PRE>
This is rendered as

 The next 9 characters are interpreted as three sets of three
 bits each which identify access permissions for owner,
 group, and others as follows:

 +------------------ 0400 read by owner (r or -)
 | +---------------- 0200 write by owner (w or -)
 | | +-------------- 0100 execute (search directory) by owner
 | | | 			(x, s, S, or -)
 | | | +------------ 0040 read by group (r or -)
 | | | | +---------- 0020 write by group (w or -)
 | | | | | +-------- 0010 execute/search by group
 | | | | | | 			(x, s, S, or -)
 | | | | | | +------ 0004 read by others (r or -)
 | | | | | | | +---- 0002 write by others (w or -)
 | | | | | | | | +-- 0001 execute/search by others
 | | | | | | | | | 			(x, t, T, or -)
 | | | | | | | | |
 r w x r w x r w x

The SEE ALSO section of the Unix manual pages can be processed to make references to other manual pages into hypertext buttons using the <A> element (see Section 5.2). The example shows how character emphasis can be added to literal or preformatted text.


HTML+ Discussion Document - November 8, 1993

[Top] [Up] [Next] [Previous]