auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX] Re: reftex-label-alist not consistent


From: Emilio Jesús Gallego Arias
Subject: [AUCTeX] Re: reftex-label-alist not consistent
Date: Sun, 13 Apr 2008 09:06:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Dear Ralf, 

thanks a lot for your comments!

Ralf Angeli <address@hidden> writes:

> The \begin{lemma} like all the other section stuff from
> `reftex-section-levels' and `reftex-label-alist' is only found if it is
> followed by "[[{ \t\r\n]" (regexp-wise).  I have to check if this
> restriction can be loosened.

I wonder what's the rationale behind this. I changed that to be 
"[[{ \t\r\n]?" and indeed the lemmas show now correctly in the TOC.

I have checked with some documents I've got here and I couldn't see any
adverse effect, but sure we should first know the rationale behind the
old regex before changing that.

> The first \begin{lemma} is found and since it is treated as a section,
> the bound for looking backwards during parsing is set to the point right
> after it (in `reftex-parse-from-file').  Now when the label after it is

Umm, it seems that the bound is only used when calling
reftex-label-location. I don't see a rationale to "cut" the search space
whenever a section appears other than avoid in 

\begin{lemma}
\subsection{akdjf}
\label{hi-3}

that hi-3 is recognized as a lemma's label.

But if we set the bound to the start of the match, this doesn't happen
while allowing lemma's labels to be recognized as such. 

Another solution would involve modifying reftex-label-location to
explicitly check for sections, instead defaulting to section (as the
comment says).

I modified the code to set the bound to the start of the match, and then
everything work as expected in my files, but unfortunately I don't think
they are complex enough to say this works in every case.

> I'll need to check more closely how the bugs can be fixed.

I hope my experiment is useful. At least I now understand what the code
is doing thanks to your explanations.

Attached is the patch I'm using right now. I think is not safe to apply
it until someone (could be myself if got time) analyzes it in deep.

BTW, it seems we don't have a test case for reftex. I think it would be
cool to have a pair (file.tex,file.rel) so any change to parsing can be
tested.

Regards,

Emilio

diff -x '*.elc' -x '*~' -u reftex.old/reftex-base.el reftex/reftex-base.el
--- reftex.old/reftex-base.el   2007-08-23 17:36:03.000000000 -0400
+++ reftex/reftex-base.el       2008-04-13 08:56:17.000000000 -0400
@@ -922,7 +922,10 @@
             (concat wbol "\\\\\\("
                     (mapconcat (lambda (x) (regexp-quote (car x)))
                                reftex-section-levels-all "\\|")
-                    "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]"))
+;;; Emilio's modifications
+;;;                     "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]"))
+                     "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]?"))
+
            (appendix-re (concat wbol "\\(\\\\appendix\\)"))
            (macro-re
             (if macros-with-labels
diff -x '*.elc' -x '*~' -u reftex.old/reftex-parse.el reftex/reftex-parse.el
--- reftex.old/reftex-parse.el  2007-08-23 17:36:02.000000000 -0400
+++ reftex/reftex-parse.el      2008-04-13 08:54:02.000000000 -0400
@@ -239,7 +239,9 @@
 
                 ((match-end 3)
                  ;; It is a section
-                 (setq bound (point))
+;;; Emilio's modifications. Is this unicode safe?
+;;;                  (setq bound point)
+                (setq bound (- (match-beginning 3) 1))
 
                  ;; Insert in List
                  (setq toc-entry (reftex-section-info file))

Attachment: pgpgXl7SmUP70.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]