Slide Presentations Using LaTeX/xdvi - xdvipresent

Go to the first, previous, next, last section, table of contents.

# xdvipresent

`xdvipresent` provides glue for developing slides for on-line presentation using `LaTeX` and `xdvi`, and a (portable) computer with a sxga+ (1400x1050), sxga (1280x1024), xga (1024x768), svga (800x600), vga (640x480), or sun (1152x900) screen running Xwindows.The idea is that you prepare the slides in LaTeX with the enclosed style file(s) and you use the "`xdvipresent`" script (which simply calls `xdvi` with an appropriate set of options) to show the slides on the screen. The package also provides tips on preparing presentations with `xdvi`, for starting `xdvipresent` from emacs, etc.

- Installation
- Preparing the slides
- Displaying slides on the screen
- Printing the slides
- More details on what it does and why and some usage tips
- Automating xdvi startup from emacs/AucTeX

## Installation

- Installation using (g)make
- Manual installation

### Installation using (g)make

- Uncompress and untar the distribution in a suitable directory.
- Set `STYDIR` in Makefile to a place where LaTeX can find style files.
- Set `BINDIR` in Makefile to a place where executables can be found.
- Type `gmake install`.
- The `doc` directory contains this manual in several formats (postscript, emacs info, manl, ...). You should probably install them in a public area.
- Make sure you read the rest of this manual for important instructions on how to prepare the presentations (and try out the installation using the example provided)!

Note: Depending on your system setup you may need to be root to complete one or more of the steps above.

### Manual installation

If you find problems with the procedure above, you can perform the installation as follows:

- Copy the files in the `images` directory (.ps files to make the slides more appealing) to a place where LaTeX can find them.
- Copy the class/style files (`*.cls`,`*.sty`) to a place where LaTeX can find it (otherwise, put the whole path when using it).
- Copy `xdvipresent` to a place that is in your executable (bin) search path.
- Type `texhash` (this depends a bit on your LaTeX installation) so that LaTeX can find the new styles and files.
- The `doc` directory contains this manual in several formats (postscript, emacs info, manl, ...). You should probably install them in a public area.
- Make sure you read the rest of this manual for important instructions on how to prepare the presentations (and try out the installation using the example provided)!

Note: Depending on your system you may need to be root to complete one or more of the steps above.

## Preparing the slides

Use the file `example.tex` as a template. Observe how the front matter, slide boundaries, headers and footers, etc. are set up. Essentially:

- Use `xdvislides` as the document class, using the type of display on which you will present. For example, use `\documentclass[svga]{xdvislides}` if you plan to view the slides on an SVGA screen, and `\documentclass[a4paper]{xdvislides}` if you plan to print them on A4 paper. There is also a special option, `htmlslides`, which is intended for generating an HTML version of the slides using `latex2html`. The idea is that simpler macros are used which do not confuse `latex2html`.
- Nice headers and footers can be set: see the examples in `example.tex`.
- It is nice to use (possibly nested) item lists (`\itemize`), because the style typesets them in color.
- Put each slide title inside `\subsection{...}`. This has the advantage that `latex2html` creates a new HTML page for each slide.
- The use of Helvetica fonts, which are very readable on a computer screen is highly recommended. With latex2e, simply add: `\fontfamily{phv} \selectfont` just after `\begin{document}`, as in the `example.tex` file.

## Displaying slides on the screen

Once installation is completed, you are ready to test the package. To test viewing on, for example, an svga screen:

- Edit `example.tex` and comment in and out the right lines at the beginning of `example.tex` as appropriate for producing svga-sized output.
- If you use the `emacs` editor, also move the uncommented line to the top (this is so that AucTeX can see the format that you have chosen --See section Automating xdvi startup from emacs/AucTeX).
- Run LaTeX to generate the .dvi file for `example.tex`.
- (Make sure you are running Xwindows!)
- Type: `xdvipresent svga example.dvi`

This should start an `xdvi` window containing the slides. The `xdvi` window should cover the whole screen, and should have no controls or sliders, i.e., only the slides should appear, and covering the whole screen. If this is not the case, this is probably due to your window manager settings. Right "out of the box" `xdvipresent` works very well for example with `fvwm` or with the lightweight wondow managers that come with modern `gnome` desktops. If you use `fvwm` then simply add the line:

`Style xdvi Notitle`

to your `.fvwmrc` file to ensure that the `xdvi` window started by `xdvipresent` does not have a title bar (which would take up precious display space). Otherwise, things should work right away, unless you have set unusually wide borders for the windows. If you use other window managers then you may want to fine tune some things (see later for explanations on how to do this).

## Printing the slides

To print the slides, uncomment the appropriate line in the `example.tex` file (e.g., the one containing `[a4paper]`), run LaTeX again to generate the appropriate `.dvi` file, and print normally, using a command such as:

`dvips -P <printer> example.dvi`

Yo can use:

`dvips -f < example.dvi > example.ps`

to generate a postscript file. Also, you can produce `pdf` output by coverting the `ps` file with, e.g., `ps2pdf`.

Selecting printing options, such as "`[a4paper]`", produces output in which the slides have a border. Note that this border looks good on paper but would only take up precious screen space duing a presentation.

## More details on what it does and why and some usage tips

You may ask, why use `xdvi` and not, e.g., `ghostscript`/`ghostview`? I prefer `xdvi` for a number of reasons. First, `xdvi` is soemwhat faster and seems to do somewhat better dithering of the fonts on the screen, which means that the text is more readable (although more recent versions of `ghostview` do a much better job). Also, `xdvi` can be started with no borders or buttons, which is more difficult to do with, e.g., `ghostview`. Also, with `xdvi` it is very easy and quick to move forwards and backwards with the keyboard during the presentation. The big drawback is that `xdvi` does not show (at least at the time time of writing this) text in color, such as that generated when using the `colordvi` package. Another alternative is to use `html` (perhaps generated with `latex2html`, in order to be able to have nice math notation) and a browser, but I find that it is very difficult to produce consistent results with this approach.

You may also consider using more sophisticated tools like `prosper`. This is a tool developed after `xdvipresent` and is an improvement in many ways. It provides very nice styles but on the other hand it almost requires that you generate `pdf` every time you want to see the slides, which results in a slower development cycle. I tend to use `xdvipresent` most of the time and `prosper` in some special cases, when addressing audiences used to animated slides with transitions, etc.

Given the considerations above, and assuming that you buy the idea that `xdvi` is the way to go, there are two main problems that this package solves:

- Giving the presentation a little color. As mentioned before, at the time of this writing `xdvi` unfortunately does not understand color commands included in the LaTeX source (e.g., by using \package{colordvi}). However, embedded postscript figures are rendered in color. This is used in the style definition to include some color in the presentation: a blue line between the slide title and the body, colored buttons as item bullets, and a red line to separate the footer. This is done in the `*.cls/*.sty` style files. When printing on a B/W printer this is all really superfluous and a different style, which uses no color, is used. For printing on a color printer the slides prepared for on-line presentation can be used.
- Forcing LaTeX and `xdvi` to produce output in such a way that it fits exactly on the screen of a portable. This is solved by:
  - Giving suitable page sizes and offsets to LaTeX, which is included in the `xdvislides.cls` (and the older `xdvi_slide.sty`) format. See `example.tex` for a typical use. Note that some lines in the LaTeX file have to be commented out and others in depending on whether the file should be formatted for a vga screen, an svga screen, an xga screen, a printer, etc.
  - Making `xdvi` start with the right parameters, by using the `xdvipresent` script instead of calling `xdvi` directly. The idea is to make the image fit exactly in the screen and avoid the presence of side bars, buttons, etc. The script takes at least two arguments. The first argument must be `vga`, `svga`, `a4paper`, etc., depending on the display to be used (entries such as `a4paper` mean view the slides as they will be printed). The second argument must be the .dvi file name (including the suffix). Any other arguments are passed directly to `xdvi`. Here are some possibilities:
    -bg <color>
      to change the color of the background (but note that white (the default) is often best for low-contrast displays)
    -fg <color>
      to change the color of the foreground (text, etc.)
    -geometry <xsize>x<ysize>+<xoffset>+<yoffset>
      the default values are, for example, "630x470+0+0" for vga (640x480 screen) and "790x590+0+0" for svga (800x600 screen) Note that 10 points are left for the window border, whose standard size is 5pt on each side under `fvwm` (this may need adjustment for other window managers). It is also assumed that the `xdvi` window does not have a title bar (which would take up precious display space). In order to ensure this in `fvwm`, add the line `Style xdvi Notitle` to your `.fvwmrc` (similar commands should be available in other window managers). If your setting is different from that assumed, you may have to tweak these values a bit. In `fvwm` and other window managers that support several working spaces it is sometimes useful to display the slides in another "page" of the display. This can be done by adding offsets (which will be applied >from the page in which the `xdvi` is started). E.g., `-geometry 790x590+0+1024` will start the `xdvi` in the screen below the current one in a standard X86Free 1280x1024 virtual display.
    -display <displayname>
      Useful for running LaTeX on one machine but showing the slides on another (e.g., `-display <machine_name>:0.0`).
    (see the `xdvi` documentation for more details on options).

## Automating xdvi startup from emacs/AucTeX

If you are using AucTeX and `emacs`, then by putting some additional lines in the `tex-site.el` file it is possible to make `emacs` automatically invoke `xdvipresent` with the right parameters when doing `C-c C-c View` or `C-c C-c Print`. The selection will be based automatically on the presentation option (vga, svga, xga, sun, svga, svga+, a4paper, letterpaper, ...) that you are using in the `documentclass` line in the latex file. Note that if you change this you will have to delete the buffer and open the file again for `emacs` to notice the changes. Also note that, if another, commented out `documentclass` line appears in the file before the one being used, then the commented one may be one seen by `emacs` instead. Thus, it is best to keep the active `documentclass` line the first one in the file.

These are examples of the entries that you may want to add to the `tex-site.el` file:

    (defvar TeX-view-style '(
        ;; xdvipresent entries
        ("^sxga\+" "xdvipresent sxga+ %d")
        ("^sxga$" "xdvipresent sxga %d")
        ("^sun$" "xdvipresent sun %d")
        ("^xga$" "xdvipresent xga %d")
        ("^svga$" "xdvipresent svga %d")
        ("^vga$" "xdvipresent vga %d")
        ("^a4paper$" "xdvipresent a4paper %d")
        ("^letterpaper$" "xdvipresent letterpaper %d")
        ;;
        ("^landscape$" "xdvi %d -paper a4r -s 4")
        ("^a5$" "xdvi %d -paper a5")
        ("." "xdvi %d -s 7 -hushspecials -hl green -bd red -cr blue
             -expert -paper a4 -geometry -0+0")
        )

(Note that if you are indeed an emacs/AucTex user you could also simply copy the `xdvi` commands with the right parameters from the `xdvipresent` script into this file and not use the `xdvipresent` script at all!)

In a portable, and running a window manager that supports several work surfaces, such as `fvwm`, it is convenient to start the `xdvi` in an adjacent work surface. These are examples:

    (defvar TeX-view-style '(
        ;; xdvipresent entries
        ("^sxga\+" "xdvipresent sxga+ %d -geometry 1390x1040+0+1050")
        ("^sxga$" "xdvipresent sxga %d -geometry 1270x1014+0+1024")
        ("^sun$" "xdvipresent sun %d -geometry 1142x890+0+900")
        ("^xga$" "xdvipresent xga %d -geometry 1014x758+0+768")
        ("^svga$" "xdvipresent svga %d -geometry 790x590+0+1024")
        ("^vga$" "xdvipresent vga %d -geometry 630x470+0+800")
        ("^a4paper$" "xdvipresent a4paper %d")
        ("^letterpaper$" "xdvipresent letterpaper %d")
        ;;
        ("^landscape$" "xdvi %d -paper a4r -s 4")
        ("^a5$" "xdvi %d -paper a5")
        ("." "xdvi %d -s 7 -hushspecials -hl green -bd red -cr blue
              -expert -paper a4 -geometry -0+0")
        )

In your `.emacs` file you should put something like:

      ;; Auc-TeX
      (setq load-path (cons "....../auctex-9.6" load-path))
      (load "tex-site")
      (setq-default TeX-parse-self t) ;; Forces parsing of options in file!

Go to the first, previous, next, last section, table of contents.