Indiana University Multi-campus Modular Computing Curriculum

HtX to Latex

Module # 1: Test Document

Goals

• To demonstrate mmcc style translation to L^{A}TEX

• To serve as a model.

Prerequisite Skills

• None

To fully understand this document, you must have the HtX source. Compare the various features described below with their implementations in the HtX source.

Some L^{A}TEX-like features

It is a design goal of HtX to be as compatable as possible with L^{A}TEX. Note that, as with L^{A}TEX, line breaks are usually meaningless (except in verbatim environments). Double-line breaks produce the HTML <p> tag.

Now, if you look at the HtX source, you find that you can use ¡ and ¿ without worry .. HtX takes care of turning them into entities.

Other obvious correspondences are italics and bold-face commands (using \bf and \it; see the HtX source.

Itemize-Enumerate-Description

HtX maps the LaTeX itemize-enumerate-description list environments to HTML unordered lists, ordered lists and definition lists, respectively.

We begin with the “itemize” environment. It’s very much like what you find in LaTeX.

• This is item number 1, which is followed by:

• item number 2.

• Finally, we have the third item.

Similar to itemize, we have an “enumerate” environment:

1. one

2. two

3. buckle

4. my shoe

Finally, there is “description” (or definition): the first number one the second number two, and the third number six

Tables HtX implements versions of L^{A}TEX’s tabular and array environments using Netscape tables:

left center right
1  2  3
a  b  c

Also try:

left center right
1  2  3
a  b  c

The array environment is similar for math displays

Headers-fonts-alignment We can put in headlines: Hello in various sizes: Hello Again and center them if need be:

And Hello Again You also can center this way

and this way

We can italicize and bold-face and typewriter-font our text. Soon, math mode will be available. In the meantime we have some limited math mode commands:

Inline: T (n) = T (\frac{n}{2}) + T (\frac{n}{2}) + a; or in displays:

T (n) = T (\frac{n}{2}) + T (\frac{n}{2}) + aT (1) = b

or:

T (n) = T (2^{m})
= U(m)
= O(mlog(m))
= O(log(n)(log(log(n))))

To engage a typewriter font, as we often do for including sections of program code, we can use the “code” environment. It switches to a fixed-width font and produces HTML that respects the layout of the HtX file.

(define i-am-a-program-sample
  (lambda (x y)
    (cond
      ((= x y) 'now-i-stop)
      ((or (not (integer x)) (not (integer y)))
       (display "This program works with two integers")
       (newline))
      ((> x y) (display "x is too big")
               (newline)
               (i-am-a-program-sample x (+ 1 y)))
      ((< x y) (display "x is too small")
               (newline)
               (i-am-a-program-sample (+ 1 x) y)))))

You can also enter a similar environment “in-line” with (i-am-a-program-sample 2 8).