; (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
"\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))
(find-label-re-format
(concat "\\("
+ "\\[[^]]*label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?[^[]*\\]"
+ "\\|"
(mapconcat 'regexp-quote (append '("\\label")
macros-with-labels) "\\|")
"\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))