10

I am trying to export a LaTeX document to OpenDocument (.odt) format. This operation is requested by some publishers which do not know how to handle LaTeX files.

I can't find a way of exporting LaTeX documents with Biblatex references in a proper way.

Here is a example. I use TeX4ht to convert .tex files to .odt

\begin{filecontents}{biblio.bib}
@Book{author00:_title,
 author =    {Author},
 title =     {Title},
 publisher =     {Publisher},
 year =      2000}
\end{filecontents}

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear-comp,hyperref]{biblatex}
\renewcommand*{\newunitpunct}{\addcomma\space}
\bibliography{biblio}
\title{Test}
\author{Title}
\begin{document}

Test\cite{author00:_title}

\printbibliography
\end{document}

TeX4ht command lign to export to .odt is :

mk4ht oolatex test.tex 

This command works but create a OpenDocument file without references. References are replaced by their keys (in our example : author00:_title).

The output of mk4ht oolatex says about biblatex :

No file test.bbl.

LaTeX Warning: Citation 'author00:_title' on page 1 undefined on input line 11.

LaTeX Warning: Empty bibliography on input line 13.

[1] (./test.aux)

LaTeX Warning: There were undefined references.


Package biblatex Warning: Please (re)run Biber on the file:
(biblatex)                test
(biblatex)                and rerun LaTeX afterwards.

 )

So I re-run Biber which found the reference :

biber test
defined(@array) is deprecated at /usr/share/perl5/Log/Log4perl/Config.pm line 864.
        (Maybe you should just omit the defined()?)
INFO - This is Biber 1.7
INFO - Logfile is 'test.blg'
INFO - Reading 'test.bcf'
INFO - Found 1 citekeys in bib section 0
INFO - Processing section 0
INFO - Looking for bibtex format file 'biblio.bib' for section 0
INFO - Decoding LaTeX character macros into UTF-8
INFO - Found BibTeX data source 'biblio.bib'
INFO - Overriding locale 'fr_FR.UTF-8' default tailoring 'variable = shifted' with 'variable = non-ignorable'
INFO - Sorting 'entry' list 'nyt' keys
INFO - Writing 'test.bbl' with encoding 'UTF-8'
INFO - Output to test.bbl

And I re-run TeX4ht (mk4ht oolatex test.tex) which ends unexpectedly :

(/usr/share/texmf/tex/generic/tex4ht/ooffice-mml.4ht)) (./test.aux) (./test.bbl
)
! Undefined control sequence.
\blx@begunit ...penalty \@M \hskip -\blx@unitmark 
                                                  \relax \hskip \blx@unitmar...
l.11 Test\cite{author00:_title}

? 

How can I fix this error and export my biblatex references into odt format?

  • 2
    with texlive 2013, your sample compiles correctly for me. with sequence latex test; biber test; mk4ht oolatex test – michal.h21 Oct 6 '13 at 17:01
  • it could be that the biber backend option was not specified? – doed Oct 6 '13 at 17:14
  • It often depends on the versions of tex4ht and biblatex etc. It often has to be updated to work with specific versions I believe. – PLK Oct 8 '13 at 14:25
  • I specified explicitly the biber backend option (with \usepackage[style=authoryear-comp,backend=biber]{biblatex} lign). No change – ppr Oct 9 '13 at 19:02
  • 2
    sometimes it's just better to htlatex (or mk4ht htlatex) the source and then open the html file in libreoffice and save it as odt (what can be done in command line, via libreoffice --headless --convert-to odt) – henrique Oct 10 '13 at 2:51
4

I found a solution to my problem (which was export to odt with biblatex references) with pandoc :

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

Hope It could help another one.

P-S : Tex4ht was definitively not rendering biblatex for me even after upgrade.

  • Did you try rendering into PDF and opening PDF in Open Office? – ajeh Jan 16 '14 at 20:06
  • @ajeh no, sorry! – ppr Jan 16 '14 at 21:45
  • But aren't pandoc lose things like page breaks? – Hi-Angel Jul 26 '15 at 15:19

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.