Next: , Up: Introduction

1.1 Installation

RefTeX has been bundled and pre-installed with Emacs since version 20.2. It has also been bundled and pre-installed with XEmacs 19.16–20.x. XEmacs 21.x users want to install the corresponding plug-in package which is available from the XEmacs FTP site. See the XEmacs 21.x documentation on package installation for details.

Users of earlier Emacs distributions (including Emacs 19) or people craving for new features and bugs can get a copy of the RefTeX distribution from the maintainer's web page. See Imprint, for more information. The following instructions will guide you through the process of installing such a distribution.

1.1.1 Building and Installing

Note: Currently installation is supported for Emacs only. XEmacs users might want to refer to the RefTeX package available through the package system of XEmacs.

Installation with make

In order to install RefTeX, unpack the distribution and edit the header of the Makefile. Basically, you need to change the path specifications for Emacs Lisp files and info files. Also, enter the name of your Emacs executable (usually either ‘emacs’ or ‘xemacs’).

Then, type

     make
     make install

to compile and install the code and documentation.

Per default RefTeX is installed in its own subdirectory which might not be on your load path. In this case, add it to load path with a command like the following, replacing the sample directory with the one where RefTeX is installed in your case.

     (add-to-list 'load-path "/path/to/reftex")

Put this command into your init file before other RefTeX-related settings.

Installation by Hand

If you want to get your hands dirty, there is also the possibility to install by manually copying files.

  1. Copy the reftex*.el lisp files to a directory on your load path. Make sure that no old copy of RefTeX shadows these files.
  2. Byte compile the files. The sequence of compiling should be: reftex-var.el, reftex.el, and then all the others.
  3. Copy the info file reftex.info to the info directory.

1.1.2 Loading RefTeX

In order to make the most important functions for entering RefTeX mode available add the following line to your init file.

     (require 'reftex)

1.1.3 Entering RefTeX Mode

To turn RefTeX Mode on and off in a particular buffer, use M-x reftex-mode <RET>. To turn on RefTeX Mode for all LaTeX files, add the following lines to your .emacs file:

     (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
     (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode

That's all!

To get started, read the documentation, in particular the summary. (see RefTeX in a Nutshell)

In order to produce a printed version of the documentation, use make pdf to produce a reftex.pdf file. Analogously you can use the dvi, ps, or html targets to create DVI, PostScript or HTML files.

1.1.4 Environment

RefTeX needs to access all files which are part of a multifile document, and the BibTeX database files requested by the \bibliography command. To find these files, RefTeX will require a search path, i.e., a list of directories to check. Normally this list is stored in the environment variables TEXINPUTS and BIBINPUTS which are also used by RefTeX. However, on some systems these variables do not contain the full search path. If RefTeX does not work for you because it cannot find some files, See Finding Files.