# biblatex + TeX4ht

My tags are follows:

\documentclass{book}
\usepackage[english]{babel}
\usepackage[notes, short, backend=biber]{biblatex-chicago}

\usepackage{xpatch}

\usepackage{endnotes}%
\let\footnote\endnote%
\makeatletter
\@addtoreset{endnote}{chapter}%
\makeatother

\xapptobibmacro{cite:short}
{\setunit{\addcomma\space}%
\usebibmacro{date}}
{}
{}

\bibliography{525-76472_6P}

\begin{document}

In a similar vein, Abolafia argues that market institutions are
produced and redefined as a result of the purposeful action and interaction of powerful interests competing for control.''\autocite[191]{Abolafia1996} Members, owners, and users of market organizations will forge formal or informal coalitions to attain their \cite{Abolafia1996} goals.

\backmatter

\printbibliography[
heading=bibintoc,
title={BIBLIOGRAPHY}
]

\end{document}


%%% content of bbbl file%%%

% $biblatex auxiliary file$
% $biblatex bbl format version 2.8$
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated by
% biber as required.
%
\begingroup
\makeatletter
\@ifundefined{ver@biblatex.sty}
{\@latex@error
{Missing 'biblatex' package}
{The bibliography requires the 'biblatex' package.}
\aftergroup\endinput}
{}
\endgroup

\refsection{0}
\sortlist[entry]{cms/global/}
\entry{Abolafia1996}{book}{}
\name{author}{1}{}{%
{{hash=400ff12d316695feb92062860fedf647}{%
family={Abolafia},
familyi={A\bibinitperiod},
given={Mitchel},
giveni={M\bibinitperiod}}}%
}
\list{location}{1}{%
{Cambridge, MA:}%
}
\list{publisher}{1}{%
{Harvard University Press}%
}
\strng{namehash}{400ff12d316695feb92062860fedf647}
\strng{fullhash}{400ff12d316695feb92062860fedf647}
\strng{authornamehash}{400ff12d316695feb92062860fedf647}
\strng{authorfullhash}{400ff12d316695feb92062860fedf647}
\field{sortinit}{A}
\field{sortinithash}{3248043b5fe8d0a34dab5ab6b8d4309b}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{title}{{Making Markets}}
\field{year}{1996}
\endentry
\endsortlist
\endrefsection
\endinput


%%%BibTeX source code:

@book{Abolafia1996,
Address = {Cambridge},
Author = {Abolafia, Mitchel},
Publisher = {Harvard University Press},
Title = {{Making Markets}},
Year = {1996}}


I am converting the above code to HTML by using the command:

htlatex test "xhtml" " -cunihft" " -cvalidate -p"


No errors are shown, but the ouput does not comes in a correct manner. Please suggest how to achieve the HTML text equal to TeX output.

• The redefinitions of thebibliography should not do anything for biblatex, can they be removed from the MWE? Do you need the rotating package? Are all the font changes relevant or can the issue be reproduced without them? Would it be possible to post the relevant .bib entries instead of the .bbl? The .bbl is tied to one specific biblatex version, so people with newer versions (like me) won't be able to make use of it. The .bib on the other hand is of course usable with all versions. – moewe Jan 11 '19 at 16:43
• @moewe Modified the MWE as you said, thanks... – MadyYuvi Jan 12 '19 at 5:39
• I get sensible output (MikTeX 2.9 fully updated, tex4ht 2018-06-12-16:01, biblatex 3.12 etc. pp.), but the compilation on the way throws errors about english not being a supported language (similar to tex.stackexchange.com/q/292268/35864). – moewe Jan 12 '19 at 9:05
• I also checked the MWE with TeX live 2018 on Ubuntu 18.04. If I run htlatex, Biber and htlatex again I get a usable bibliography from your MWE. I do still get the errors about English, though, should probably report that. Did you run Biber and can you show us a screenshot of the output you get from the MWE? – moewe Jan 12 '19 at 16:28

## 1 Answer

I don't see a difference in the output of tex4ht and pdflatex on your sample file. But I got some compilation errors:

Package biblatex Warning: Language 'english' not supported. (biblatex) Using fallback language 'english' on input line 24.

! Package biblatex Error: Language 'english' not found.

See the biblatex package documentation for explanation. Type H for immediate help. ...

l.24 \begin{document}

This of course doesn't make a sense, as English is clearly supported by Biblatex. I've found that the issue was caused by a redefinition of the \IfFileExists command by tex4ht. It is used in the language loading in Biblatex for the language detection. The issue is that due the redefinition of \IfFileExists wrong code is skipped and code for both found and missing language is executed. So even if the language is found and loaded, the error message is shown.

The fix has already been posted to the tex4ht repository and it is included in TL. An alternative version of the \blx@lbxinput@iii must be used in the usepackage.4ht file. It must be used here instead of biblatex.4ht, because the Biblatex language loading happens before normal .4ht files are loaded, so it would have no effect in biblatex.4ht.

\def\blx@lbxinput@iii#1#2{%
\global\csundef{blx@lng@#2}%
\:IfFileExists{#1.lbx}
{\blx@lbxinput@iv{#2}{#1}{language '#2' -> '#1'}}
{\ifcsdef{blx@suffmaptried@#2}
{}
{\blx@warning@noline{%
File '#1.lbx' not found!\MessageBreak
Ignoring mapping '#2' -> '#1'}%
\global\cslet{blx@suffmaptried@#2}\@empty}%
\blx@lbxinput@iv{#2}{#2}{language '#2'}}}


The only difference from the Biblatex sources is the use of \:IfFileExists instead of \IfFileExists. It contains the original code of \IfFileExists so it doesn't cause the wrong code execution.

• +1. Interestingly the error about English not being supported does not occur when biblatex is used directly instead of the wrapper biblatex-chicago. And I really don't understand why the redefined \IfFileExists would fail so spectacularly... – moewe Jan 13 '19 at 14:54
• @moewe it seems that it happens especially with language mappings. – michal.h21 Jan 13 '19 at 15:07
• @moewe it caused \expandafter\@firstoftwo to skip code appended to \IfFileExists instead of the error messages. – michal.h21 Jan 13 '19 at 15:09
• @michal.h21 Just a small updation, please remove the } at the last line of the biblatex.4ht which you mentioned in your answer...apology for the so late in checking – MadyYuvi Dec 18 '19 at 6:11
• @MadyYuvi which version of biblatex.4ht do you mean? there is no } in the distributed version. – michal.h21 Dec 18 '19 at 7:24