From 84c5ef108e74ad1e377fcdb43823c4104630b09f Mon Sep 17 00:00:00 2001 From: Arash Esbati Date: Tue, 5 Oct 2021 16:35:30 +0200 Subject: [PATCH] Improve finding external documents * lisp/textmodes/reftex-parse.el (reftex-parse-from-file): Extend regexp in order to support \externalcitedocument macro and a second optional argument provided by LaTeX package xr-hyper. --- lisp/textmodes/reftex-parse.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index c521a07f19..b8c75cb21b 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el @@ -345,7 +345,17 @@ reftex-parse-from-file ;; Find external document specifications (goto-char 1) - (while (re-search-forward "[\n\r][ \t]*\\\\externaldocument\\(\\[\\([^]]*\\)\\]\\)?{\\([^}]+\\)}" nil t) + (while (re-search-forward + (concat "[\n\r][ \t]*" + ;; Support \externalcitedocument macro + "\\\\external\\(?:cite\\)?document" + ;; The optional prefix + "\\(\\[\\([^]]*\\)\\]\\)?" + ;; The 2nd opt. arg can only be nocite + "\\(?:\\[nocite\\]\\)?" + ;; Mandatory file argument + "{\\([^}]+\\)}") + nil t) (push (list 'xr-doc (reftex-match-string 2) (reftex-match-string 3)) docstruct)) -- 2.33.0