3

I have an org file that I want to export to both latex and html.

The file contains a bibliography, so I want to make sure that my org-exporter processes it correctly for both export backends.

For Latex things are easy, all I have to do is add the following:

#+BEGIN_EXPORT latex
\printbibliography
#+END_EXPORT

For html, things are also simple. All I have to do is add the following:

bibliography:~/org/library.bib

The problem is that, when I export to latex, I get \bibliography{../../org/library} written at the end of the file, which is unnecessary.

What I want, thus, is to wrap the call to bibliography within an IGNORE_LATEX block. How can I achieve that?

# # What I would like to have:

#+IGNORE_LATEX
bibliography:~/org/library.bib
#+END_IGNORE
  • 1
    Can you put the bibliography link in an HTML block? – John Kitchin Mar 1 '17 at 0:01
  • Thank you =) I tried #+BEGIN_EXPORT html first, but that was wrong. Using #+BEGIN_HTML is the correct solution. In any case, is there a simple way of ignoring a particular backend? – dangom Mar 1 '17 at 8:55
  • actually, #+BEGIN_HTML still inserts garbage into the latex output... – dangom Mar 1 '17 at 17:12
4

I see what you want I think. If I use this org file:

A citation cite:akhade-2011-effec.


bibliographystyle:unsrt
bibliography:~/Dropbox/bibliography/references.bib

then it exports with bibliography to both html and latex. I use bibtex for the bibliography for latex, and org generates a minimal bibliography for html. In general there is not a good way to get high quality bibliographies in html. The only option is unsorted, and there is no easy way to change it. The bibliography style is not used for the html export. You could check out http://kitchingroup.cheme.cmu.edu/blog/2015/12/11/Introduction-to-a-citation-processor-in-org-ref/, which lays out what is needed to do that. It is basically a citation processor (which is what bibtex is for latex).

0

Have you tried:

#+BIBLIOGRAPHY: bib/file/name apalike

at the document location where you want to have the bibliography? (Org-mode 9.0.5, Emacs-25.1)

  • I tried that at first, before choosing to use biblatex. The actual syntax that worked for me was bibliography:~/org/library.bib followed by bibliographystyle:apalike. Problem is that the citations aren't sorted, and I couldn't find a way to fix it. After a while my patience ran out. – dangom Mar 1 '17 at 9:09
  • @dangom: Were the other styles (sharelatex.com/learn/Bibtex_bibliography_styles) not working for you? – Dieter.Wilhelm Mar 1 '17 at 11:49
  • Not all of them work, interestingly. alpha works, but apalike doesn't. Do I need to install something or use an extra package? – dangom Mar 1 '17 at 13:51
  • Is there any documentation for the BIBLIOGRAPHY keyword? I am searching M-x info for it but cannot find anything. – Guilherme Salomé Aug 8 '18 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.