It seems that ox-bibtex is not included in the latest org package (8.2.10-34-gc41bbc-elpa). So I searched it online and put into directory /org/lisp/ once downloaded. But I ran into the following error when trying to do an export involving some bibtex.
Symbol's function definition is void: org-element-insert-before
Then I check the file 'org-element.el', of course there is no such function predefined. But why isn't there? The online API document of org-element mentioned it in once.
So I guess currently it is impossible to use RefTeX as the way the document describes unless you are willing to switch to the beta version or some older one. See
Here I share my way to use the beta version
git clone git://orgmode.org/org-mode.git
Move the folder to ~/.emacs.d/
and name it as org-beta
Modify load-path
, let the beta version shadow other version, and include the user contribute directory
(add-to-list 'load-path (expand-file-name "org-beta\\lisp" user-emacs-directory))
(add-to-list 'load-path (expand-file-name "org-beta\\org-contrib\\lisp" user-emacs-directory))
(optional) you can use make command to compile the source file and build the doc
Now you can (require 'ox-bibtex)
. I prefer to write like this: (eval-after-load 'org (require 'ox-bibtex))
In order to generate reference list at the right place, put something like #+BIBLIOGRAPHY: your_bib_lib_name plain option:-d
to the end of the org file. More options please refer to the help document in ox-bibtex.el
To make the HTML export part work right, you may need the latest bibtex2html, i.e., 1.98. To build it from source, download it from github, and follow the instruction in the 'README' help document.
If you are using windows like me, use Cygwin64 with all the devel packages. Using Cygwin64, cd to the dir of bibtex2html, and type ./configure
, wait finish, then type make
, wait finish. Now in this dir, you will get bib2bib.exe
, bibtex2html.exe
and aux2bib
. Copy them to some dir in your environment var PATH
. Test it by typing bibtex2html
in the cmd.
I have to do the above job because I use texlive2014. If you are a miktek user, bibtex2html 1.95 may just work well, which can be easily installed with a windows installer.
To make the PDF export part work right, use the following code to initialize your org-mode:
(setq org-latex-pdf-process
'("xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"bibtex %b"
"xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
It is the 'bibtex' part that does the job. I use the shell escape command for minted package of latex.
M-x add-file-local-variable
#+STARTUP: do this
.add-file-local-variable-prop-line
I could generate the# -*- reftex-default-bibliography: ("./references.bib"); -*-
line at the beginning of the file.