auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] reftex-label-alist for ctable package


From: Tassilo Horn
Subject: Re: [AUCTeX] reftex-label-alist for ctable package
Date: Fri, 27 Jul 2012 09:32:38 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux)

Tassilo Horn <address@hidden> 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


reply via email to

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