[Tex/LaTex] Bibtex to HTML/Markdown/etc., using Pandoc

bibliographiesconversionhtmlmarkdownpandoc

It seems that Pandoc is capable of dealing with references given in a .bib file. Yet, I haven't been able to simply ask Pandoc to convert a .bib file into html, markdown or other formats. Is there a way to do so?

As an example of what I mean (since I am not sure I am clear enough…), I would say the following to export myfile.bib to myfile.pdf: Create myfile.tex which contains

\documentclass{article}
\begin{document}
\nocite{*}
\bibliographystyle{abbrv} % or another bibliography style!
\bibliography{myfile.bib}
\end{document}

and compile it using pdflatex and bibtex.

Is there such a simple way to export myfile.bib to (say) myfile.html?

Best Answer

pandoc cannot convert a .bib file into another file format1. However, it can convert a .tex file which contains references (called from a .bib file) into a pdf, odt, html, ... If your .tex file just contains the \nocite{*} command, the result is similar (you will have all your references printed).

Here is the magic command:

pandoc test.tex -o output.odt --bibliography /my/bibliography.bib 

or (for pdf)

pandoc test.tex -o output.pdf --bibliography /my/bibliography.bib 

or (for html)

pandoc test.tex -o output.html --bibliography /my/bibliography.bib

Note that several launches of the pandoc command could be necessary to obtain a correct result.

MWE

Files

\documentclass{article}
\usepackage{biblatex}
\bibliography{mybib}

\begin{document}
\autocite{author00:_title}
\printbibliography
\end{document}

mybib.bib file:

@Book{author00:_title,
  author =   {Author},
  title =    {Title},
  publisher =    {Publisher},
  year =     2000}

Outputs

Pdf

enter image description here

html

html generated by pandoc test.tex -o output.html --bibliography mybib.bib:

<p><span class="citation">(Author 2000)</span></p>
<div class="references">
<p>Author. 2000. <em>Title</em>. Publisher.</p>
</div>

1 The documentation is not very clear about this point. Some phrasings could lead one to believe it's possible to directly convert from .bib to .*. I tested it and it isn't working. You have to use a .tex file if you want to convert a .bib file (today).