Convenient Preparation of Presentations in HTML

by Hugh McGuire

Abstract

The system presented here, a computer program named "fmt_html", takes straightforwardly typed text and formats it in HTML. The main intention is for producing dynamic lecture-notes for Computer Science courses. The automatic formatting is naturally convenient, and having the result in HTML means that it is easily viewable on any machine -- nicely accessible past the presentation, if desired -- plus the material is as infinitely extensible as the World-Wide Web, with images, outlines, applets, ... A distinguishing feature is that in addition to the main material for public display in the presentation, with this system one also has a private document with annotations such as what to say integrated with the public material. This program is written in C, so it runs on any machine.


Illustration

Here is an example of the output:


CMPSC 10
Document #36
2001:March:02

CMPSC 10 Lecture-notes #20: Multidimensional Arrays

declaration:
elt.-type[][] m-array-name;
e.g.  int[][] cell;

allocation:
m-array-name = new elt.-type[num.-rows][num.-columns];
e.g.  cell = new int[5][4];
    cell[][] :
   
   
   
   
   

usage:
multiple indexing to get individual elements
m-array-name[row-index][column-index]
        variable of  elt.-type

e.g.:
    cell[3][2] = -5;
    cell[4][0] = 8;
not comma-separated
    cell[3,2] = -5;  



Details of that output such as "UCSB" and "CMPSC 10" are specified via command-line options. But the main source-material for the preceding is as follows:


    Multidimensional Arrays
    Document #36
    2001:March:02

    <!--
	PRE-LOAD (IDE) WITH |life.java|, |life.html|
    -->

    <!-- IF WRITING (BY HAND)
	REM DON'T USE ADDITIONAL PUNCTUATION THIS LECTURE
	E.G. "<", ">": "<array-name>"
	-->

    <!--
    <font color="b07000">Announcements</font>

    load your |.html| and |.class| files for Exercise~A
    into a sub-folder which you create in your |www|-folder

    <hr>
    -->
    declaration:
    |@elt.-type@[][] @m-array-name@;|
	<!-- this is for two dimensions; for more dimensions, more sets of brackets -->
    e.g.  |int[][] cell;|
    <!-- again, can be done with brackets following,
	but it's clearer this way
	-->

    allocation:
    |@m-array-name@ = new @elt.-type@[@num.-rows@][@num.-columns@];|
    e.g.  |cell = new int[5][4];|
      |cell[][]| :
      ^00^ ^00^ ^00^ ^00^ 
      ^00^ ^00^ ^00^ ^00^ 
      ^00^ ^00^ ^00^ ^00^ 
      ^00^ ^00^ ^00^ ^00^ 
      ^00^ ^00^ ^00^ ^00^ 

    usage:
    multiple indexing to get individual elements
    |@m-array-name@[@row-index@][@column-index@]|
	variable of |@elt.-type@|

    e.g.:
      |cell[3][2] = -5;|    <!-- PUT IT THERE -->
      |cell[4][0] = 8;|     <!-- PUT IT THERE -->
    not comma-separated
      |cell[3,2] = -5;| ~ ^compilation would fail^


This source-material can be used as lecture-notes while presenting the formatted material further above. During the presentation, one can type material in the input-fields as shown with the "-5" and the "8" and as would be done with "compilation would fail".


Related Work

There are many other products that format material for presentation, e.g. Microsoft PowerPoint and LaTeX. Those are powerful products, with custom features including graphics. But fmt_html differs from those products in various details: One question might be: why not write directly in HTML, or perhaps related markup-languages such as XML? The problem is like that with Postscript: one can write it, and it does everything, but writing everything desired in it is tedious. For example, here is some of the HTML from the example above:


    allocation:
    <br>
    <var>m-array-name</var><code> = new </code><var>elt.-type</var><code>[</code><var>num.-rows</var><code>][</code><var>num.-columns</var><code>];</code>
    <br>
    e.g.  &nbsp;<code>cell = new int[5][4];</code>
    <br>
    &nbsp; &nbsp; <code>cell[][]</code> :
    <br>
    &nbsp; &nbsp; <input type="text" size=3> <input type="text" size=3> <input type="text" size=3> <input type="text" size=3> 
    <br>
    &nbsp; &nbsp; <input type="text" size=3> <input type="text" size=3> <input type="text" size=3> <input type="text" size=3> 


It is easy to make mistakes if trying to type e.g. "&nbsp;" many times.
XML with XSL may address that point somewhat, enabling less typing via one's own definitions, but there's a remaining issue: error-checking. With HTML (or WYSIWYG systems), the standard for checking for errors such as forgetting to close a quoted string or forgetting to type the "/" in "<code>...</code>" is: you view the result, you check if it's OK, and if it's not you must find what's wrong in your specification. By contrast, fmt_html finds such errors and tells you where they may be.


Acknowledgements

The way fmt_html uses control- or escape-characters, particularly "|", is derived from TeX/LaTeX.


Future Work

The main aspect of fmt_html being developed right now is its flexibility, so it will be usable more ways by more people. E.g. a planned improvement is to make its control-characters such as "|" and "@" command-line switchable.


For More Information

Contact Hugh McGuire via   mcguire@cs.ucsb.edu   or  (805) 893-5412. His main Web-page is http://www.cs.ucsb.edu/~mcguire/ ; starting from there, you can browse more examples of the use of fmt_html among the Web-pages of courses taught by him.