These are my notes on using tex on unix/linux machines. In principle, all you need is some sort of editor to create tex files, the command "tex" or "latex" to compile these to dvi. The command "xdvi" to preview them, and "dvips" to print them. But if you're documents are at all complicated you might need more.

- Donu

## Setting up emacs for latex

Emacs is a powerful editor which is well suited for editing (La)TeX files. But you have to take a few steps to take advantage of these features.

If you're setting up your linux machine, then you probably have emacs already, but you probably don't have the AUCtex package; you'll need to download and intall it first. (Purdue math Solaris users can ignore this, since it's already installed.)

Next create a file .emacs in your home directory if it doesn't already exist. Add these lines to it:

(require 'tex-site)
(setq reftex-plug-into-AUCTex t)
(global-font-lock-mode t)
The last line turns on syntax colouring. Omit it, if you don't like this feature. If AUCtex was installed in some nonstandard place, say /X/Y . You'll have to tell emacs to look there by adding
ahead of the previous lines. Restart emacs, and try editing a latex file. You'll notice some menus entitled "Latex", "Command" and "Ref" which are specific to editing/compiling/debugging latex files. Many of these commands should be self explanitory. See the manual for more information.

## Instructions for setting up and using the new xdvi.

I'll explain how to replace xdvi with the newer version which has many nice feature such as the ability to save, print, and search the tex source. (If you run linux with a recent version of kde, kdvi will have many of the same features.) This will use the existing tex installation, so you only need to create a few files. I've compiled this for Solaris 8 on the Suns for you, and linux for me. I'm including binaries for Solaris only, since you can probably compile it yourself if you run linux. More information is available here.

#### 1.a Basic Setup (Purdue math Solaris users)

If you haven't already done this, create a subdirectory ~/bin by
mkdir bin
and put this at the beginning of your path by putting
set path = ( ~/bin \$path . )
cp ~dvb/xdvik-22.76.1/texk/xdvik/xdvi-xaw.bin ~/bin
(Or if you're feeling adventurous, type
cp ~dvb/xdvik-22.76.1/texk/xdvik/xdvi-motif.bin ~/bin
instead. You'll get some annoying warnings if you use this version, but xdvi will look a lot nicer.)
mkdir xdviinputs
cp ~dvb/xdvik-22.76.1/texk/xdvik/texmf/* xdviinputs
mkdir texinputs
cp ~dvb/texinputs/src* texinputs
The first command ensures that you'll have a copy of the program regardless of what I do. Put
setenv TEXMF /pkgs/teTeX/texmf/
setenv XDVIINPUTS \$HOME/xdviinputs
setenv TEXINPUTS ".:\$HOME/texinputs/:"

#### 1.b Basic Setup (Linux)

Get the source from here. Then type:
tar xfvz xdvik-22.76.1.tar.gz
cd xdvik-22.76.1
kpsewhich --expand-path='\$TEXMFMAIN'
The output from the last command should give a directory, say /X/Y/texmf
make
If you're your own systems administrator, you can do an "su" and"make install" at this point. Or else modify the previous instructions appropriately.

#### 1.c Testing

In a shell, type
xdvi -version
to check. It should say:
Xdvi version 22.76.1 (Xaw toolkit)
kpathsea version 3.4.5
Copyright (C) 1990-2002 Paul Vojta and others. (Yes, that Vojta.)
...
Try an actual dvi file to really make sure this really works. It should do everything that the old xdvi did, and then some (such as interacting with an editor).

#### 2. More on Emacs

The nice thing about emacs is that it can communicate with other programs such as xdvi.

Tell xdvi to use emacs as the default editor by putting

xdvi.editor: emacsclient --no-wait +%l %f
(or
xdvi.editor: gnuclient -q +%l %f
if you prefer xemacs) in your .Xdefaults (create this if necessary), and type
xrdb .Xdefaults
or simply logout and back in.

Put emacs into server mode by putting

(server-start)