IDVI User's Guide

Back to the table of contents.

Controlling the HTML Files Generated by IDVI

Two methods of controlling the HTML files generated by idvi are available. A few of the command-line options to idvi modify the standard HTML template. You may also provide your own HTML template file.

HTML Options

The following options allow you to control the HTML files generated by idvi (examples follow):
-title <string>
(default "DVI Document")
Title string to be used on every page. This string will appear between the <title> and </title> tags in the HTML file, and will appear in the title of the user's browser window when your document is viewed.

-titleTemplate<string>
(default '$title - $page')
Pattern which combines the title string with other information to produce the actual title used on each page. The string should be quoted with single quotes to protect the $ character from the the shell.

-noAppletText <string>
(default "Sorry, your browser does not support Java applets.")
String shown when the user's browser does not support Java applets.

-templateFile <filename>
The name of a file containing a template HTML page, to be copied for each page and scale factor.

Examples

A document designed from the beginning as hypertext probably won't have meaningful page numbers. You can remove page numbers from page titles using the -titleTemplate option:
idvi mydocument.dvi \
     -title "My Document" \
     -titleTemplate '$title'
Some users will be using browsers which do not support Java applets. You can provide an alternate method of obtaining your document for these users by using the -noAppletText option:
idvi mydocument.dvi \
     -noAppletText "<a href=mydocument.dvi>DVI File</a>"

Writing HTML template files

The standard HTML template file contains:
<html>
    <head>
        <title>
            $titleTemplate
        </title>
    </head>

    <body bgcolor=$backgroundColor text=$foregroundColor link=$linkColor alink=$selectedLinkColor>
        <p align=center>
            $applet
        </p>
    </body>
</html>
If you wanted to provide additional navigation controls, you could use the -templateFile option to provide a replacement for the standard HTML template file:
idvi mydocument.dvi \
     -templateFile myTemplate.html
For example, myTemplate.html might contain:
<html>
    <head>
        <title>
            My Document
        </title>
    </head>

    <body bgcolor=$backgroundColor text=$foregroundColor link=$linkColor alink=$selectedLinkColor>
        <a href=../>home page</a> - <a href=../papers.html>papers</a> - <a href=related.html>related work</a>
        <p align=center>
            $applet
        </p>
        <a href=../>home page</a> - <a href=../papers.html>papers</a> - <a href=related.html>related work</a>
    </body>
</html>

List of Available Parameters

You may include references to other parameters within the text you give for the -title, -titleTemplate, and -noAppletText options, and within your HTML template file. These references are of the form $parametername or ${parametername}.

To obtain a $ character in the resulting HTML file, use a $ character which is not immediately followed by a letter or underscore, or a pair of $ characters together. The string ${} expands to the name of the source dvi file.

Note that the $ character is special to the shell. If you refer to other parameters in the -title, -titleTemplate, or -noAppletText options, be careful to use single quotes "'" around the parameter value.

You may refer to all of the idvi command-line options by name. You may also refer to the following parameters, which change for each page:

page
Current page number, counting from pageFirst.

scale
Current scale factor.

applet
The applet reference, from <applet> to </applet>.

width
Width of the DVI Viewer applet, in pixels.

height
Height of the DVI Viewer applet, in pixels.

leftMarginDelta
Offset to apply to left page margin, in pixels.

topMarginDelta
Offset to apply to top page margin, in pixels.

Back to the table of contents.