auctex-devel
[Top][All Lists]

## Re: [AUCTeX-devel] reftex patch to support resolved labels

 From: Tim Toolan Subject: Re: [AUCTeX-devel] reftex patch to support resolved labels Date: Fri, 24 Oct 2008 09:52:24 -0400 User-agent: Internet Messaging Program (IMP) H3 (4.2)


Because of the size of the patch, I have included a more detailed
description of what this patch does, and how it does it.  I understand
that more work needs to be done to get the most out of access to these
resolved labels, and also ensure it works nicely with the rest of
AUCTeX.  I am willing to spend more time on it if there is interest.

The steps for resolving the labels from the typeset document are given
below.  Note that other than the three calls to sort', all operations
are of order N, where N is the number of labels.

1) Create a list which contains the labels as they appear in the .tex
file, along with how they are resolved in the typeset document.

- Call reftex-TeX-master-file to get the master TeX file, then open
the .aux file corresponding to this file.

- Find all of the \newlabel commands in the .aux file.  This
command tells LaTeX how to resolve a label when it sees a \ref
command.

- Find all of the address@hidden commands in the master .aux file, and
repeat the search for \newlabel commands in these files.

2) Add the resolved labels to a new seventh column in the scan info
(reftex-docstruct-symbol).

- Construct a list similar to the one created in step 1 from the
information in reftex-docstruct-symbol.  Give uncommented labels
a resolved value of "?" and commented labels a unique identifier
of the form "?-N".  Also include the index of each label in this
list so we can easily restore the original order after sorting
by label name.

- Sort both lists by label, then transfer the resolved labels to
this new list.

- Sort this new list by the index field, then transfer the resolved
labels to reftex-docstruct-symbol.

The two ways that an incorrect label can be given are:
1) If label names are reused for different objects and LaTeX is not
rerun.  This can occur after running reftex-renumber-simple-labels.
2) If the .aux files generated by LaTeX are inconsistent with what the
user is looking at.  This can happen when using preview-latex.
Both of these should be addressed.

Regards,

Tim Toolan


Hello,

Attached is a patch which adds support for resolved labels as they
appear the typeset document to the reftex-reference command.  It
places them where the counter used to be, and enables interactive
filtering based on these resolved labels.  It makes selecting labels
significantly more efficient when looking at typeset document.

To reference a label, run reftex-reference "C-c )", then enter the
number as it appears in the typeset document (ie. "1.2", "IV", "123").  If
there is more than one exact match, such as section 3, equation 3, and
figure 3, press tab to cycle between these choices.

When in this filtering mode, any special commands that are printable
characters (like "f" to toggle follow mode) must be preceded by a
"C-c" prefix.  At any time, press the delete key to toggle between
filter mode and the previous behavior for reftex-reference.

It is currently setup to disable prompting for reference macro type
and label type by default, and going directly to the filter selection
process.  To revert to the old behavior, set the variables:
(setq reftex-ref-type-prompt t)
(setq reftex-ref-start-in-filter-mode nil)
(setq reftex-ref-macro-prompt t)

Regards,

Tim Toolan




`