Tassilo Horn <[email protected]> writes:

Hi again,

> Ah, and one restriction: You have to write labels like so
>
>   [..., label={tab:foo}, ...]
>
> that is, no spaces around the =, and the {} are mandatory.  That could
> probably be relaxed a bit, but maybe you'd get false positives then...

I think, I've made it.  Now you can write your label = foo style as
you've had in your example.  I tested it with ctable and listings, and
it seems to work as intended.

Could you also give it a try?

Bye,
Tassilo

=== modified file 'lisp/textmodes/reftex-vars.el'
--- lisp/textmodes/reftex-vars.el	2012-04-09 13:05:48 +0000
+++ lisp/textmodes/reftex-vars.el	2012-07-26 19:15:59 +0000
@@ -116,13 +116,17 @@
       ("\\footnote[]{}" ?n "fn:" "~\\ref{%s}" 2
        (regexp "footnotes?" "Fussnoten?"))
 
+      ;; ctable package
+      ("\\ctable[]{}{}{}" ?t "tab:" "\\ref{%s}" 1 ("table" "Tabelle"))
+
+      ;; listings package
+      ("lstlisting" ?l "lst:" "~\\ref{%s}" nil (regexp "[Ll]isting"))
+
       ("any"       ?\  " "   "~\\ref{%s}" nil)
 
       ;; The label macro is hard coded, but it *could* be defined like this:
       ;;("\\label{*}" nil nil nil nil)
-      ))
-
-    )
+      )))
   "The default label environment descriptions.
 Lower-case symbols correspond to a style file of the same name in the LaTeX
 distribution.  Mixed-case symbols are convenience aliases.")

=== modified file 'lisp/textmodes/reftex.el'
--- lisp/textmodes/reftex.el	2012-01-19 07:21:25 +0000
+++ lisp/textmodes/reftex.el	2012-07-27 07:28:52 +0000
@@ -1284,7 +1284,15 @@
 ;          (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
            (wbol "\\(^\\)[ \t]*")  ; Need to keep the empty group because
                                   ;;; because match number are hard coded
-           (label-re "\\\\label{\\([^}]*\\)}")
+           (label-re (concat "\\(?:"
+			     ;; Normal \label{...}
+			     "\\\\label{\\([^}]*\\)}"
+			     "\\|"
+			     ;; keyvals [..., label = {foo}, ...]
+			     ;; forms used by ctable, listings,
+			     ;; minted, ...
+			     "\\[[^]]*label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?[^[]*\\]"
+			     "\\)"))
            (include-re (concat wbol
                                "\\\\\\("
                                (mapconcat 'identity

_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to