ECN No Name Newsletter: Summer, 1997

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article] [next article]

ECN Apache: Inline TEX

Kyler Laird
kyler@purdue.edu

This is the first of a series which will feature special functions in ECN's HTTP server, Apache. In order to better serve our users, Apache has been modified for ECN use. Some of its functionality will not be found elsewhere.

Most ECN web servers currently run the NCSA server software. Servers are being converted to Apache server software. To date, 31 ECN web servers are running Apache. If you need Apache, contact with your ECN site specialist.

Why Do I Want To Use TEX In HTML?

Engineers often need to use more than simple text to describe their thoughts. A quick look at some Engineering technical papers or textbooks will yield many examples of material which cannot be represented using plain HTML. The usual solution to this is to present the material using an inline (GIF) image.

Normally, such inline images take a few steps to create. Using FrameMaker, for example, you could enter an equation and then export it as a PostScript file. You might then use ImageMagick's convert program to crop, scale and convert the image to a GIF. After you had saved the resulting GIF in a Web-accessible location, you would then need to insert a reference to it in your HTML document. ( You would have to make sure that you saved the original FrameMaker document in case you would ever want to change/regenerate the image.)

With repetition, this process is not daunting. However, it takes time. Until now, it has been the only option. Inline TEX changes this.

Using inline TEX, you can quickly create inline figures without having to go through the usual steps. Simply type in the TEX code and you are done. (And, no, TEX is not difficult to learn for simple figures. An hour with a good book should be enough for most uses.)

How Do I Put TEX In My HTML?

Inline TEX has been implemented in ECN's Apache as an extension to server-side includes (SSI). To enable the TEX interpretation, you will need to enable SSI for your document. The easy way to do this is to use the extension .shtml for your webpage filename. (As long as you have not disabled MultiViews, you can drop the .shtml from any URL's that you use to reference the document.)

8 In your document, you can use standard HTML just as you normally would. When you want a TEX figure, enter a command of the form

<!--#tex source="TeX code"-->

Let's say that I'm describing a process and I want to say "...the square root of x cubed plus the square root of alpha..." The text is bulky, not quickly understood, and sometimes ambiguous. Instead, I could use

<!--#tex source="$\sqrt{x^3+\sqrt\alpha}$"-->

which results in

Inline TEX code can be used for simple single characters like

and for complex equations like

It is not, however, intended to be used for pages that are predominantly TEX. There are better tools for that.

How Does It Work?

Apache converts the <!--#tex --> into an <img> tag with the appropriate arguments to reference an ECN TEX image server. For now, this server simply turns the TEX code into a GIF image. This image is returned directly to the user; you will never need to manipulate it.

In the early versions of this system, each image was created each time it was needed. This resulted in waits of up to 15 seconds. The current version uses a cache so that your figures should show up almost as quickly as normal inline GIF images after the initial request.

In the future, GIF images will not be the only way of viewing your inline TEX. With the availability of inline TEX, DVI and/or PostScript plugins, Apache will be able to return the most appropriate format for the calling browser. By returning TEX/DVI/PostScript to the browser, printing on high-resolution devices will be greatly enhanced since these formats are not resolution-dependent (like GIF is). No modifications to your code will be necessary in order to take advantage of this feature.


webmaster@ecn.purdue.edu
Last modified: Monday, 16-Jun-97 11:33:34 EST

[HTML Check] HTML