Difference between revisions of "Reftex"

From Wiki
Jump to navigation Jump to search
(reftex - a first attempt, please elaborate)
Line 43: Line 43:
[[User:Thomas|Thomas]] 17:34, 17 September 2006 (CEST)
[[User:Thomas|Thomas]] 17:34, 17 September 2006 (CEST)
[[Category:Text Editors]]

Revision as of 02:16, 28 January 2008

What is reftex?

Reftex comes bundled with newer versions of emacs. It allows you to manage citations, indexes, references, etc. It integrates nicely with Auctex. It is mainly targeted at LaTeX users, but since it is highly customizable, it can easily be adapted for use with ConTeXt.

Customizations for ConTeXt

If you use reftex regularly with ConTeXt, you may want to customize a few variables which make your work a lot easier:

Bibliography Files

Reftex automatically parses bib-files referenced in the main document, but it expects to be told which files are referenced with the LaTeX commands \bibliography or \nobibliography.

You have two possibilities to make it recognize the bibliographies as specified by Taco's bib module:

(1) You can define a macro that will fool reftex:


(2) More elegant: you can add the ConTeXt command to the reftex customization. Call M-x customize-variable [RET] reftex-bibliography-commands. In the customization buffer, add the string setupbibtex\[database= to the list of commands.


If you have lots of \pagereference commands in your file, you want reftex to manage them for you. Again, you have to add the proper command to its customization. I have this line in my .emacs:

(setq reftex-label-alist '(("\\pagereference[*]" ?a nil "~\\at[%s]" nil nil)))

This will include all pagereferences in the reftex list; if you choose one of them at the reftex prompt, it will insert \at~[] into your file and place the cursor inside the brackets.


You want the \cite command to follow ConTeXt syntax and use square brackets, so run M-x customize-variable [RET] reftex-cite-format and change the string to \cite[%t].

Using Reftex

Just a few very basic hints --- you have to try it yourself; there are just too many commands to mention:

C-c ( presents you with a buffer for inserting references, including the different sections and all pagereferences (if you have customized like described above).

C-c < lets you insert \index{} commands; it offers tab-completion for all index references already present in the document.

C-c [ lets you insert cite[] references. You can type a string or regexp to search for in you bib file, and reftex will open a new buffer with all entries that match the string/regexp.

All of this is very convenient and saves you from making typos in these tedious tags. I only wish I had known about it earlier!

Thomas 17:34, 17 September 2006 (CEST)