带有 biblatex 的 make4ht 对于使用 \url 的记录在使用标题字段时失败,但在消除标题字段时则不会

make4ht with biblatex fails for records using \url when title field used but not when title field eliminated

当我使用 make4ht(或 htlatex)编译包含 biblatex 参考书目的 .tex 文件时,出现错误:

! Illegal parameter number in definition of \blx@tempa.
<to be read again> 
                   1
l.19 \printbibliography[heading=bibintoc]

当 .bib 文件中的书目记录包含 url(我使用 \url{link is here})时会出现此错误,并且似乎与记录有多少字段,如标题,已发布(或@misc 的发布方式),因为当我制作一个没有很多字段的更简单的书目记录时,不会发生此错误。

此外,当我为 latex 编译时,我对参考书目没有任何问题。

MWE (main_test_file.tex):

\documentclass[11pt]{article}

% Use Chicago Manual of Style:
\usepackage[authordate,autocite=inline,backend=biber,natbib]{biblatex-chicago}
\usepackage[colorlinks]{hyperref}
% References file:
\addbibresource{bib_test_file.bib}
%

\begin{document}

Some writing stuff: \autocite{trialurl1} works with make4ht when no extra stuff before $\backslash$url, but doesn't work when add another feature, like a title or howpublished, etc.
% Uncomment the following line, and the make4ht fails:
, as in \cite{trialurl2}.

More interesting stuff: \autocite{vanier} should have no problems with make4ht.

% The list of references is printed:
\printbibliography[heading=bibintoc]

\end{document}

引用 trialurl2 时,以下失败并出现 above-mentioned 错误:

make4ht -ue mybuild.mk4 main_test_file.tex

但在未引用 trialurl2 时工作正常。在这两种情况下,我是否使用 \cite、\autocite、\citeauthor 等都没有关系。发生相同的行为。

此外,使用 latex,然后是 biber,然后是 latex,然后是 latex,效果很好,即使引用了 trialurl2。

bib_test_file.bib 文件是:

@misc{trialurl1,
author = {George, Birdie},
note = {\url{https://mail.yahoo.com/} Accessed 24 July 2020},
year = {2020},
}

@misc{trialurl2,
author = {George, Birdie},
title = {Hi},
note = {\url{https://mail.yahoo.com/} Accessed 24 July 2020},
year = {2020},
}

@book{vanier,
title = {Living Gently in a Violent World: The Prophetic Witness of Weakness},
author = {Vanier, Jean and Hauerwas, Stanley},
edition = {Second},
year = {2018},
publisher = {InterVarsity Press},
}

而 mybuild.mk4 是

Make:add("biber","biber ${input}")
if mode=="draft" then
  Make:htlatex {}
else
  Make:htlatex {}
  Make:biber {}
  Make:htlatex {}
  Make:htlatex {}
  Make:htlatex {}
end

mybuild.mk4 取自 michael.h21 的回答 https://tex.stackexchange.com/questions/244828/illegal-parameter-with-biblatex

michael.h21 的回答帮助我解决了一些其他问题,但对我当前的问题没有帮助。

显然,对于 biblatex,.bib 文件需要更改(参见 moewe 的回答: https://tex.stackexchange.com/questions/345175/bibtex-url-problem 即使问题本身没有相关性)。

而不是:

note = {\url{https://mail.yahoo.com/} Accessed 24 July 2020},

我应该放:

url = {https://mail.yahoo.com/},
urldate = {2020-07-24},

所以 .bib 文件应该是:

@misc{trialurl1,
author = {George, Birdie},
url = {https://mail.yahoo.com/},
urldate = {2020-07-24},
year = {2020},
}

@misc{trialurl2,
author = {George, Birdie},
title = {Hi},
url = {https://mail.yahoo.com/},
urldate = {2020-07-24},
year = {2020},
}

@book{vanier,
title = {Living Gently in a Violent World: The Prophetic Witness of Weakness},
author = {Vanier, Jean and Hauerwas, Stanley},
edition = {Second},
year = {2018},
publisher = {InterVarsity Press},
}

那就一切都好了。