Changes

Jump to navigation Jump to search
2,793 bytes added ,  15:36, 17 September 2006
reftex - a first attempt, please elaborate
== What is reftex? ==

[http://staff.science.uva.nl/~dominik/Tools/reftex/ Reftex] comes bundled with newer versions of emacs. It allows you to manage citations, indexes, references, etc. It integrates nicely with [[More_AUCTeX|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 <tt>\bibliography</tt> or <tt>\nobibliography.</tt>

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:
<texcode> def\bibliography#1{\setupbibtex[database=[{#1}]}</texcode>

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

=== Crossreferences ===

If you have lots of <tt>\pagereference</tt> 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 <tt>.emacs</tt>:
<pre>(setq reftex-label-alist '(("\\pagereference[*]" ?a nil "~\\at[%s]" nil nil)))
</pre>

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

=== Citations ===

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

== Using Reftex ==

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

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

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

<tt>C-c [</tt> lets you insert <tt>cite[]</tt> 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!

[[User:Thomas|Thomas]] 17:34, 17 September 2006 (CEST)
gardener
111

edits

Navigation menu