# Using Xdvi for presentations

Introduction | TeX | Xdvi | Simple stuff | Graphics | Fancier stuff | Incremental display | Credits

### 1. Introduction

You don't need PowerPoint. Xdvi does a great job for presentations.

People who come from the World of MS Windows and MS Word to the world of GNU/Linux and TeX are generally impressed by the power of the latter, but they often find themselves casting about for equivalents to some of the office software they are used to under Windows. PowerPoint is a case in point. "How can you do nice presentations under Linux?" is a question frequently asked on the newsgroups.

Well, there are numerous options, including using PowerPoint® clones offered in the office suites for Linux (e.g. Applixware, StarOffice). This page discusses a relatively light-weight, but full-featured, alternative that is more "in the spirit of Linux", namely preparing the presentation using TeX/LaTeX and displaying it using xdvi.

[I should point out that there is another TeX-based route to presentations, which involves generating output in Adobe's Portable Document Format (pdf) and displaying it in Acrobat Reader. For an exciting example of what can be done using TeX and pdf, see David Wilson's pages at utopiatype.com. New, September 1999: Klaus Guntermann has made available a java post-processor, PPower4, for pdf files (e.g. those created using pdftex) which lets you use all sorts of PowerPoint-type effects.]

### 2. TeX

TeX is a high quality typesetter. There are packages available for making presentation "slides".

The following assumes that you already know about TeX and LaTeX. If you don't, then try looking here and come back later. In brief, TeX is a (free) high quality typesetting program, and LaTeX is a large set of macros for TeX that enable you to write documents using logical markup. For many GNU/Linux users TeX is the system of choice for preparing printed documents.[1]

The demands of typesetting for a computer-based presentation are rather different from those associated with a printed text. Fortunately there are several LaTeX packages available that can be used to prepare text for presentations (using large, readable fonts, short "pages" and so on) -- for instance the foils documentclass and the seminar package. These packages were originally designed for producing printed transparencies to be used with an overhead projector, but you can bypass this traditional mode and show the "foils" directly from your computer.

### 3. Xdvi

By default the TeX typesetter produces output in the form of a dvi file (Device Independent). The standard viewer for such files in the *nix world (under the X window system) is xdvi. And I find that it works very well for making presentations.

I recommend xdvik, the version of xdvi that uses fast path-searching routines. This version is kept very much up to date: check its home page. It supports hypertex, which means that you can put hyperlinks (of various sorts -- see below) into the TeX document that forms the basis of your presentation. Randy O'Reilly offers a modified version of xdvik that supports the use of color specials to further enhance presentations. Using xdvi for presentation purposes, rather than its standard function of previewing documents prior to printing, may require some adjustments to its standard setup. Xdvi is very flexible; below I'll offer some tips, but if you want to pursue the xdvi option you should certainly study its manual page ("man xdvi", or "man -t xdvi | lpr" to get a printed copy).

### 4. Simple customization

How to make xdvi look right for presentations, using simple command-line options and/or X resources.

The appearance and behavior of xdvi can be controlled in (at least) three ways: via its "defaults" file, XDvi, which probably lives in either /etc/X11/app-defaults or /usr/share/texmf/xdvi; via the per-user file .Xdefaults, which lives in the user's home directory; and via command-line options. To mess with the first of these you have to be the root user of the system; but you can do what you want using the other options.

On my system the XDvi defaults file reads thus:

XDvi*pixelsPerInch: 300
XDvi*shrinkFactor: 4
XDvi*paper: 8.5x11
XDvi*geometry: +119+7
XDvi.expert: True
XDvi.yOffset: 1cm
XDvi.hushChecksums: True

The most relevant line here is "XDvi.expert: True". This removes the command buttons, giving a nice clean appearance. I prefer to work this way all the time. For presentations you probably want this in force. If need be, insert this line into your personal .Xdefaults, or just use the command line option "-expert".

How to get around without the buttons? Easy. Read the man page for full details; xdvi is well stocked with keyboard controls. For example, n and p take you to the next and previous pages respectively, 10g takes you straight to page 10, q quits, and so on.

The mouse retains its usefulness too. Use it to access hyperlinks (see below), and use buttons 2 or 3 to magnify stuff.

Some of the other xdvi defaults shown above are not suitable for presentations. To override them, I have a little shell script that I call "slideview", which reads as follows:

#!/bin/sh
exec xdvi -bg AntiqueWhite -geometry +118+3 -paper 8.5x7.8 "$@" &  You should experiment here. I like the "AntiqueWhite" background color; the geometry specification "+118+3" puts xdvi in a suitable place on my screen, and the "paper size" of 8.5x7.8 gives a suitable aspect ratio for the foils I create. You can, if you want, adjust the paper size so that xdvi is "full screen", but I prefer to have a bit of desktop showing to access root menus. ### 5. Graphics LaTeX graphics are good for presentations. Xdvi can "do" postscript too. Besides text (and possibly mathematics, at which TeX excels) you may well wish to include graphics in your presentation. If you want to display graphs, plots or diagrams, I would suggest creating the graphics using a flexible tool such as gnuplot or xfig where you have the option of creating "native" TeX/LaTeX output. This will render fast and look good in xdvi. Using postscript (eps graphics) does give you more flexibility, however. Recent versions of xdvi (see above) will call gs to render postscript, so that's not a problem. Tip: The rendering of eps graphics in xdvi can be a bit slow. But generally it's only slow on the first loading, as gs is started up. So it's worth "visiting" a page of your presentation containing eps graphics prior to the actual presentation: the first graphic will appear much more quickly in the actual presentation. (Of course, for this to work xdvi must not be closed down between the dummy run and the presentation.) ### 6. Fancier options Use of mailcap and mime.types. Use of special window manager settings. Xdvi and "plugins". More on graphics. Showing movies in xdvi. This section discusses use of hypertex to jazz up a presentation. The key idea is to enable the shell (bash, in my case) as a "viewer" within xdvi, making it possible to access any program on your system via a mouse click in xdvi, and to have any program act as if it were an xdvi "plugin". This will probably require setting up custom versions of the files mailcap and mime.types for xdvi. In my main TeX configuration file, texmf.cnf, I have the following entry telling xdvi where to find its custom files: % For xdvi to find mime.types and .mailcap, if they do not exist in %$HOME.  These are single directories, not paths.
% (But the default mime.types, at least, may well suffice.)
MIMELIBDIR = $prefix/etc MAILCAPLIBDIR =$prefix/etc

where $prefix means /usr/local. My /usr/local/etc/mailcap reads as follows: image/jpeg; xv %s application/x-tex; nedit %s audio/*; play %s video/mpeg; mtvp -l %s audio/x-pn-realaudio; /usr/local/bin/rvplay %s application/pdf; acroread %s audio/basic; play %s audio/midi; xplaymidi %s audio/x-midi; xplaymidi %s audio/x-wav; vplay %s image/x-png; xv %s video/avi; xanim %s application/postscript; /usr/local/bin/gv %s x-world/x-vrml; /usr/local/vrwave-0.9/vrwave %s application/x-dvi; xdvi %s application/msword; wordview %s image/tiff; xv %s application/x-sh; /bin/bash %s  For present purposes the key line here is the last one. You don't want any such thing enabled in your regular web browser, but in xdvi it's alright so long as you know what you're doing. The associated /usr/local/etc/mime.types must, alongside the standard stuff, contain a line like this: # MIME type Extension ... application/x-sh sh ...  Having enabled bash as a viewer, what you can do in an xdvi presentation is limited only by your imagination. Here are a couple of ideas to get you started. #### hyperlinks 1: stacks of images At the top of my seminar tex source file I have (to permit hyperlinks in xdvi): \def\href#1#2{\special{html:<a href="#1">}{#2}\special{html:</a>}} \documentclass[17pt]{foils}  Further down I have, for instance: \begin{itemize} ... \item Example: BMP image of \href{file:/home/cottrell/mytex/scripts/xv_1.sh}{ThinkPad} (77880 bytes), GIF version (13256 bytes), JPEG version (8464 bytes).} ... \end{itemize}  Clicking on the word "ThinkPad" in the xdvi display of the above invokes the shell script xv_1.sh, which looks like this: xv -geometry +270+320 /home/cottrell/mytex/sct/wfu_seminar/xv/atp*  that is, it calls the image viewer program XV, which loads the files atp.bmp, atp.gif and atp.jpg (in a "stack"). The geometry specifier for xv places it in a suitable blank spot on the "canvas" presented by the xdvi window, below the link that calls it. I can now "page through" the images in xv, using a mouse-click to advance to the next (q typed when the mouse is over the xv window closes xv). This way you can run a little "slide show" of images in any format supported by your specialized image viewer, from within your xdvi presentation. A refinement is to give the viewer, in this case xv, the seamless appearance of a plugin, rather than have it look like a regular program sitting on top of xdvi. That can be done via a directive to the window manager. I use fvwm, the appearance of which is controlled by the file .fvwmrc in my home directory. When doing this sort of presentation I replace my regular .fvwmrc with one that contains the line Style "xv*" NoTitle, BorderWidth 0, NoHandles  so I see the plain image with no surrounding border, title or other apparatus. (I also use the "NoTitle" flag for xdvi itself when doing a presentation.) #### hyperlinks 2: movies Further on in the tex source of the presentation mentioned above we find: \begin{center} \begin{tabular}{cc} \href{file:/home/cottrell/video/play_1.sh}{Constant bit rate} & \href{file:/home/cottrell/video/play_2.sh}{Equalized marginal MSE} \\ \end{tabular} \end{center}  Clicking on the hyperlink "Constant bit rate" invokes play_1.sh: echo "AWTapp.geometry: +225+220" | xrdb -merge appletviewer /home/cottrell/video/play_norc  which runs a java viewer for a specialized compressed video format. The little trick with xrdb places the appletviewer on the fly; play_2.sh will place another instance of appletviewer alongside the first so that two movies can be compared. ### 7. Incremental display Getting itemized stuff on a given "page" to appear in sequence This is something that's easy in PowerPoint, and quite useful. You may not want your audience to get distracted by points 2 and 3 while you're elaborating on point 1. But it might look awkward to take separate "pages" for each of points 1, 2 and 3 if the text for each is brief. What you'd like is for a page to display with only point 1 shown; you hit the spacebar and point 2 appears below it, and so on. Klaus Guntermann has written a style file that permits this in TeX. You can view or download his pause.sty here. Here's an example of the use of Klaus's package: \documentclass[17pt,video]{foils} \usepackage{pause} \foilhead{Why Compress?} \begin{itemize} \item Consider a video window$400 \times 300$pixels (quarter the area of a ThinkPad display). \pause \item Suppose the display is capable of showing 65,536 colors ("16 bit color depth"). \pause \item One such bitmapped image requires$(400 \times 300 \times 16) =$1,920,000 bits$=$240,000 bytes. \pause \item At a frame rate of 25 per second, this requires 6,000,000 bytes per second (5.7MB/sec). \pause \item A CD holds about 650MB of data. It would therefore hold about 114 seconds or two minutes of uncompressed, bitmapped video. \pause \item Cf.\ CDROM of \textit{Titanic}. \end{itemize}  The \pause command causes TeX to typeset the page up to the given point, and to save the content of the page so far. When the next item is added, it is typeset in addition to the saved material. When you hit n for next, or spacebar, in xdvi the next incremented page is shown. It's actually a new page, but to the viewer it looks as if you've added an item to the existing page. (You may see a little flicker as items are added, but with a fast machine this is hardly noticeable.) ### 8. Credits All of the software referenced above is both free (you can download the programs at zero cost from various internet sites) and open-source (you can download the source code for the software, enabling you to peruse it and modify it at will). With free software, where the authors are not making money off the users, I believe it is particularly important to give credit where credit is due. It is in the nature of free software that many people contribute to its development; in the following, I have tried to identify at least the original authors and the primary current maintainers. If I have inadvertantly slighted anyone by omission I apologise in advance (and an email to me should rectify the situation fairly quickly). TeX: Donald Knuth. LaTeX: Leslie Lamport (many current maintainers). Xdvi: Paul Vojta, Nicolai Langfeldt. "k" path-searching: Karl Berry. Gnuplot: Thomas Williams and Colin Kelley (many current maintainers). Xfig: Supoj Sutanthavibul, Brian V. Smith. XV: John Bradley Please note that John Bradley, the author of xv, asks for a registration fee of$25 from satisfied users, and insists on this from people who use xv in the course of their work. Unlike most "shareware", however, the freely available version of xv is in no way disabled, and source code is provided.

Also note that while source code is available for all the programs mentioned here, distribution of modified versions may be governed by various requirements. Pay attention to the documentation included with the source code.

Notes

1. For a personal view on why TeX is greatly superior to the commercially dominant word processors, look here.

Allin Cottrell (cottrell@ricardo.ecn.wfu.edu) May 14, 1999
With thanks to Paul Vojta, David Wilson and Klaus Guntermann. All errors herein are my own responsibility.