1

A document using abnt style for biblatex and also including hyperref packages leads to an error when compiling make4ht. The following error appears:

[ERROR]   htlatex: Compilation errors in the htlatex run
[ERROR]   htlatex: Filename Line    Message
[ERROR]   htlatex: ./article.tex    21   Argument of \@secondoftwo has an extra }.
[ERROR]   htlatex: ./article.tex    21   Paragraph ended before \@secondoftwo was complete.
[ERROR]   htlatex: ./article.tex    21   Missing number, treated as zero.
[ERROR]   htlatex: ./article.tex    21   Missing = inserted for \ifnum.
[ERROR]   htlatex: ./article.tex    21   Missing number, treated as zero.

In the .log file lies the following message:

! Argument of \@secondoftwo has an extra }.
<inserted text>
                \par
l.21 Test \cite{knuth1986}.

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce

The .tex example to reproduce this error is:

\documentclass{article}
\begin{filecontents*}[overwrite]{article.bib}
@book{knuth1986,
  address = {Reading, Mass},
  series = {Computers \& typesetting},
  title = {The {TeXbook}},
  isbn = {9780201134476 9780201134483},
  number = {A},
  publisher = {Addison-Wesley},
  author = {Knuth, Donald Ervin and Knuth, Donald Ervin},
  year = {1986},
  keywords = {TeX (Computer file), Computerized typesetting, Mathematics printing, Computer programs},
}
\end{filecontents*}
\usepackage[backend=biber,style=abnt]{biblatex}
\addbibresource{article.bib}
\usepackage{hyperref}
\begin{document}
Test \cite{knuth1986}.
%\href{https://tex.stackexchange.com/}{TeX StackExchange}
\printbibliography
\end{document}

Removing the option style=abnt, it compiles without errors.

Versions used:

biblatex version: 2020/12/31 3.16
hyperref version: 2020-05-15 v7.00
make4ht version: v0.3f

1 Answer 1

2

This is a bit strange issue, but it seems to be related to the fact that both TeX4ht and BibLaTeX patches the \ifthenelse command. We need to make some workarounds because of it in biblatex.4ht, but it seems that these fail with the abnt style. In the end, I've found that loading of the Nameref package helps. That's because Nameref redefines \ifthenelse too and this version works with both BibLaTeX and TeX4ht.

So, you can try this version of biblatex-hooks.4ht:

% biblatex-hooks.4ht (2020-10-17-13:53), generated from tex4ht-4ht.tex
% Copyright 2020 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version 2020-10-17-13:53}

\:AtEndOfPackage{%
  \def\blx@mknoautolang{%
    \blx@lbxinput{\blx@languagename}%
    {}{}%
  }%
  \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'}}}

}

\RequirePackage{nameref}

This is early hooks file, which means that it is loaded at the same moment as you use \usepackage{biblatex}. Usual .4ht files are processed at the end of document preamble and it is too late for this to work.

This is the result:

enter image description here

5
  • note that a (rather complex) document of mine that uses biblatex doesn't compile anymore after this fix. The error message is similar than the one reported here. Commenting out the loading of nameref in biblatex-hooks.4ht cures it. So maybe loading nameref unconditionally with biblatex is not such a good idea.
    – JSpitzm
    Nov 5, 2021 at 11:14
  • @JSpitzm ah, that's bad. could you please make a MWE for testing?
    – michal.h21
    Nov 5, 2021 at 12:30
  • I try and post it to the tracker if I succeed.
    – JSpitzm
    Nov 5, 2021 at 13:18
  • Report with MWE created here: puszcza.gnu.org.ua/bugs/index.php?534
    – JSpitzm
    Nov 5, 2021 at 14:53
  • @JSpitzm thanks, I will take a look
    – michal.h21
    Nov 5, 2021 at 15:31

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.