浏览代码

Citations: Use RefTeX to insert citations

RefTeX can now be used to create a citation in Org-mode buffers.
Setup the buffer with #+BIBLIOGRAPHY: bibbase style

and create citations with `C-c C-x ['.
Carsten Dominik 16 年之前
父节点
当前提交
a7ed5b9b76
共有 3 个文件被更改,包括 38 次插入8 次删除
  1. 1 7
      doc/orgcard.tex
  2. 4 0
      lisp/ChangeLog
  3. 33 1
      lisp/org.el

+ 1 - 7
doc/orgcard.tex

@@ -682,18 +682,12 @@ after  ``{\tt :}'', and dictionary words elsewhere.
 \key{quit agenda, remove agenda buffer}{q}
 \key{exit agenda, remove all agenda buffers}{x}
 
-\section{Calendar and Diary Integration}
-
-Include Emacs diary entries into Org-mode agenda with:
-\beginexample%
-(setq org-agenda-include-diary t)
-\endexample
-
 \section{LaTeX and cdlatex-mode}
 
 \key{preview LaTeX fragment}{C-c C-x C-l}
 \key{expand abbreviation (cdlatex-mode)}{TAB}
 \key{insert/modify math symbol (cdlatex-mode)}{` / '}
+\key{insert citation using RefTeX}{C-c C-x [}
 
 \section{Exporting and Publishing}
 

+ 4 - 0
lisp/ChangeLog

@@ -1,3 +1,7 @@
+2009-03-28  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-reftex-citation): New command.
+
 2009-03-27  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-agenda.el (org-agenda-cmp-user-defined): New option.

+ 33 - 1
lisp/org.el

@@ -13516,6 +13516,9 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
 (define-key org-mode-map "\C-c\C-xg" 'org-feed-update-all)
 (define-key org-mode-map "\C-c\C-xG" 'org-feed-goto-inbox)
 
+(define-key org-mode-map "\C-c\C-x[" 'org-reftex-citation)
+
+
 (when (featurep 'xemacs)
   (org-defkey org-mode-map 'button3   'popup-mode-menu))
 
@@ -15376,6 +15379,36 @@ this line is also exported in fixed-width font."
 		(goto-char (match-end 0))
 		(insert org-quote-string " "))))))))
 
+(defun org-reftex-citation ()
+  "Use reftex-citation to insert a citation into the buffer.
+This looks for a line like
+
+#+BIBLIOGRAPHY: foo plain option:-d
+
+and derives from it that foo.bib is the bbliography file relevant
+for this document.  It then installs the necessary environment for RefTeX
+to work in this buffer and calls `reftex-citation'  to insert a citation
+into the buffer.
+
+Export of such citations to both LaTeX and HTML is handled by the contributed
+package org-exp-bibtex by Taru Karttunen."
+  (interactive)
+  (let ((reftex-docstruct-symbol 'rds)
+	(reftex-cite-format "\\cite{%l}")
+	rds bib)
+    (save-excursion
+      (save-restriction
+	(widen)
+	(let ((case-fold-search t)
+	      (re "^#\\+bibliography:[ \t]+\\([^ \t\n]+\\)"))
+	  (if (not (save-excursion
+		     (or (re-search-forward re nil t)
+			 (re-search-backward re nil t))))
+	      (error "No bibliography defined in file")
+	    (setq bib (concat (match-string 1) ".bib")
+		  rds (list (list 'bib bib)))))))
+    (call-interactively 'reftex-citation)))
+
 ;;;; Functions extending outline functionality
 
 (defun org-beginning-of-line (&optional arg)
@@ -15995,7 +16028,6 @@ Still experimental, may disappear in the future."
     ;; make tree, check each match with the callback
     (org-occur "CLOSED: +\\[\\(.*?\\)\\]" nil callback)))
 
-
 ;;;; Finish up
 
 (provide 'org)