Exporting citations with biblatex

| categories: org-mode | tags: | View Comments

Table of Contents

This post illustrates that org-ref works with biblatex. We create a simple document and export it to pdf, and HTML for this post. We also explore how to modify the export behavior of a link. You should look at the org-source at the bottom to see the whole setup; it does not all export to either format.

We need a simple export type with no default packages to avoid the natbib packages I have setup in my default list. Here is the setup. Just run C-c C-c in the block to temporarily add this to your setup.

(add-to-list 'org-latex-classes
	     '("article-biblatex"                         
	       "\\documentclass{article}
 [NO-DEFAULT-PACKAGES]
 [PACKAGES]
 [EXTRA]"        
	       ("\\section{%s}" . "\\section*{%s}")
	       ("\\subsection{%s}" . "\\subsection*a{%s}")
	       ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
	       ("\\paragraph{%s}" . "\\paragraph*{%s}")
	       ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

Add some citations andriotis-2014-infor,armiento-2014-high,biskup-2014-insul-ferrom-films,chemelewski-2014-amorp-feooh,chen-2014-inter-effec and then a single citation chen-2014-inter-effec.

and a complicated latex \cite[pre text][post text]{chen-2014-inter-effec}. Note this one will export to LaTeX fine, but not to HTML.

I would like to create a citation link that exports that way. We will do it by using a parseable syntax in the description of a link. We will have to temporarily define a new format function to achieve this. Here it is, just for the autocite command.

(defun org-ref-format-autocite (keyword desc format)
  (when (eq format 'latex)
    (concat "\\autocite"
	    (cond
	     ((string-match "::" desc)
	      (format "[%s][%s]" (car (setq results (split-string desc "::"))) (cadr results)))
	     (desc (format "[%s]" desc)))
	    (format "{%s}" keyword))))

This is the syntax:

a citation with post text: [[autocite:armiento-2014-high][post text]]

a citation with pre and post text:  [[autocite:andriotis-2014-infor][pre text::post text]]

a citation with post text: armiento-2014-high (the post text is not rendered in html).

a citation with pre and post text: andriotis-2014-infor (the pre/post text is not rendered in html).

The links in org-mode are no longer that readable when they are collapsed as descriptive links, but they are not too bad as literal links.

Here is the file and exporting-with-biblatex.pdf . One of those links is for the pdf, and one is for the HTML file.

1 Summary

org-ref seems to work pretty well with biblatex now.

We use a printbibliography link here. This exports to the latex command, or an html bibliography.

Bibliography

Copyright (C) 2014 by John Kitchin. See the License for information about copying.

org-mode source

Org-mode version = 8.2.6

blog comments powered by Disqus