From: feng shu <tumashu@gmail.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [PATCH] Add "latex" option to ox-bibtex.el
Date: Fri, 12 Jul 2013 15:26:08 +0800 [thread overview]
Message-ID: <CAJpRBme5CXDjfhV0z84_cKEJ0euLyNiZmFGBH39hyUdO-egZ=w@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #1.2: Type: text/html, Size: 26 bytes --]
[-- Attachment #2: 0001-Add-latex-optional-option-to-ox-bibtex.patch --]
[-- Type: application/octet-stream, Size: 3393 bytes --]
From 34d1af7f1b0ecb38000f7a19ad17f3d7bfdf26fa Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@gmail.com>
Date: Fri, 12 Jul 2013 15:14:56 +0800
Subject: [PATCH] Add "latex" optional option to ox-bibtex
* ox-bibtex.el (org-latex-keyword, org-bibtex-get-arguments):
Add `:latex' properties.
If "latex" option is set to `nil', when export to latex,
"ox-bibtex" will not insert bibliography commands in output file.
you should insert the commands manually, for example:
\#+BIBLIOGRAPHY: foo plain option:-d latex:nil
\bibliographystyle{otherbibstyle}
\bibliography{foo}
or:
\#+BIBLIOGRAPHY: foo plain option:-d latex:nil
\printbibliography
---
contrib/lisp/ox-bibtex.el | 21 +++++++++++++++------
1 个文件被修改,插入 15 行(+),删除 6 行(-)
diff --git a/contrib/lisp/ox-bibtex.el b/contrib/lisp/ox-bibtex.el
index 29a97eb..3e0b3a4 100644
--- a/contrib/lisp/ox-bibtex.el
+++ b/contrib/lisp/ox-bibtex.el
@@ -63,6 +63,12 @@
;; \bibliographystyle{plain}
;; \bibliography{foo}
;;
+;; If you prefer to use different latex command for LaTeX export,
+;; For example: \printbibliography, you can use "latex" option:
+;;
+;; #+BIBLIOGRAPHY: foo plain option:-d latex:nil
+;; \printbibliography
+;;
;; into the TeX file when exporting.
;;
;; For HTML export it:
@@ -103,21 +109,23 @@ return nil instead."
(defun org-bibtex-get-arguments (keyword)
"Return \"bibtex2html\" arguments specified by the user.
KEYWORD is a \"BIBLIOGRAPHY\" keyword. Return value is a plist
-containing `:options' and `:limit' properties. The former
+containing `:options' `:limit' and `latex' properties. The first one
contains a list of strings to be passed as options ot
-\"bibtex2html\" process. The latter contains a boolean."
+\"bibtex2html\" process. The rest contains a boolean."
(let ((value (org-element-property :value keyword)))
(and value
(string-match "\\(\\S-+\\)[ \t]+\\(\\S-+\\)\\(.*\\)" value)
- (let (options limit)
+ (let (options limit latex)
(dolist (arg (org-split-string (match-string 3 value))
;; Return value.
- (list :options (nreverse options) :limit limit))
+ (list :options (nreverse options) :limit limit :latex latex))
(let* ((s (split-string arg ":"))
(key (car s))
(value (nth 1 s)))
(cond ((equal "limit" key)
(setq limit (not (equal "nil" value))))
+ ((equal "latex" key)
+ (setq latex (not (equal "nil" value))))
((equal "option" key) (push value options)))))))))
(defun org-bibtex-citation-p (object)
@@ -148,9 +156,10 @@ Fallback to `latex' back-end for other keywords."
(if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
ad-do-it
(let ((file (org-bibtex-get-file keyword))
- (style (org-bibtex-get-style keyword)))
+ (style (org-bibtex-get-style keyword))
+ (ox-bibtex-export-latex-p (plist-get (org-bibtex-get-arguments keyword) :latex)))
(setq ad-return-value
- (when file
+ (when (and file ox-bibtex-export-latex-p)
(concat (and style (format "\\bibliographystyle{%s}\n" style))
(format "\\bibliography{%s}" file))))))))
--
1.7.10.4
next reply other threads:[~2013-07-12 7:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-12 7:26 feng shu [this message]
2013-07-12 10:36 ` [PATCH] Add "latex" option to ox-bibtex.el Nicolas Goaziou
2013-07-12 13:17 ` feng shu
2013-07-12 13:36 ` Nicolas Goaziou
2013-07-12 23:15 ` feng shu
2013-07-13 8:41 ` Nicolas Goaziou
2013-07-13 11:36 ` Feng Shu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJpRBme5CXDjfhV0z84_cKEJ0euLyNiZmFGBH39hyUdO-egZ=w@mail.gmail.com' \
--to=tumashu@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.