auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] RefTeX: Create BibTeX file misses citations


From: Wolfgang Mayer
Subject: [AUCTeX-devel] RefTeX: Create BibTeX file misses citations
Date: Wed, 25 Feb 2009 19:59:34 +1030
User-agent: Thunderbird 2.0.0.19 (X11/20081209)

reftex-all-used-citation-keys extracts only the cite keys that appear in the last \cite{} command in a line, but skips other \cite{}'s on the same line.

Enclosed are:
* a test case to demonstrate the problem (.tex and .bib file)
   (tested using Emacs 22.3.1, today's CVS checkout, reftex-cite.el revision 
1.52)
* a patch to fix it.


A proposed changelog entry (feel free to change as desired):

2009-02-25  Wolfgang Mayer  <address@hidden>

        * lisp/reftex-cite.el (reftex-all-used-citation-keys):
        Fix regexp to correctly extract all citations in the same line.



Regards,

- Wolfgang
--- reftex-cite.el.orig 2008-06-07 21:48:21.000000000 +0930
+++ reftex-cite.el      2009-02-25 19:30:54.000000000 +1030
@@ -1147,7 +1147,7 @@
           (save-restriction
             (widen)
             (goto-char (point-min))
-            (while (re-search-forward 
"^[^%\n\r]*\\\\\\(bibentry\\|[a-zA-Z]*cite[a-zA-Z]*\\)\\(\\[[^\\]]*\\]\\)?{\\([^}]+\\)}"
 nil t)
+            (while (re-search-forward 
"\\(?:^\\|\\=\\)[^%\n\r]*?\\\\\\(bibentry\\|[a-zA-Z]*cite[a-zA-Z]*\\)\\(\\[[^\\]]*\\]\\)?{\\([^}]+\\)}"
 nil t)
               (setq kk (match-string-no-properties 3))
               (while (string-match "%.*\n?" kk)
                 (setq kk (replace-match "" t t kk)))
@Misc{citea,
  title =     {Cited A},
}

@Misc{citeb,
  title =     {Cited B},
}

\documentclass{article}
\begin{document}

\cite{citea} and \cite{citeb}

\bibliographystyle{plain}
\bibliography{test}
\end{document}

reply via email to

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