LaTeXML
LaTeXML copied to clipboard
rudimentary biblatex support
[Originally Ticket 1697]
It seems that more and more people are moving over to biblatex, so we should have some rudimentary support. I started with my private stub biblatex.sty.ltxml by copying from LaTeX.pool.ltxml and got stumped.
I think we should support at least the three main commands
\addbibresourcewhich specifies a bibTeX (or other) database, the bibTeX case seems the most prevalent to support\bibliographydoes the same, but allows multiple bibTeX files. Note that this is deprecated in favor of\addbibresourcebut is still commonly used.\printbibliographywhich prints the bibliography So\bibliography/\addbibresourcedo the same as the old\bibliographyfrom LaTeX, so I thought I would just copy and split the code; but this here does not quite work.
DefConstructor('\printbibliography []',
"<ltx:bibliography files='local'>"# files='#1' xml:id='#id'>"
. "<ltx:title>References</ltx:title>"# font='#titlefont' _force_font='1'>#title</ltx:title>"
."</ltx:bibliography>");
DefConstructor('\bibliography Semiverbatim','',
afterDigest=>sub { $_[0]->begingroup; # wrapped so redefns don't take effect!
beginBibliography($_[1]);
$_[0]->endgroup; });
DefConstructor('\addbibresource Semiverbatim','',
afterDigest=>sub { $_[0]->begingroup; # wrapped so redefns don't take effect!
beginBibliography($_[1]);
$_[0]->endgroup; });
I would be grateful, if I could get my hands on a functional replacement. All I really want is a functional
<bibliography files='foo bar'>
<title>References</title>
</bibliography>
from
\addbibresource{foo}
\addbibresource{bar}
...
\printbibliography
More coverage of biblatex would be nice, but this would be sufficient for the majority (all of mine) cases.
with #381 (bibliography support) maturing, it seems that for rudimentary biblatex support, we just have to get these three macros above supportd to go a whole long way. That should be quite simple to do.
Of course, it would be good if we could also support the new biblatex entry types and fields. I made issue #398 for that, since it is a separate issue.
Oh, and there is of course one thing that will also have to be supported as well: the package options of biblatex. There are many (and they are in key/value form, which I am not sure LaTeXML currently supports). The most important one (and I guess the only one we really need for rudimentary support) is the style option. Here is a typical invocation from my papers:
\usepackage[hyperref=auto,style=alphabetic,isbn=false,mincrossrefs=2]{biblatex}
I guess we need to just translate this into \bibliographystyle{alpha}.
I think you're misunderstanding the structure of the bibliography stuff; or the constructors.
I would assume that \bibliography and \addbibresource would need to
accumulate the names of the databases in some variable; these would likely be DefPrimitive.
And then \printbibliography would be a constructor that generates the ltx:bibliography, but it's the one that needs to run beginBibliography, in order
to set up the bibliography element.
Would you consider this a high priority item for the 0.8 milestone? We're high on items for that milestone as-is. Maybe we could push it back to 0.9?
I would be happy to have it pushed to 0.9, it is more important to get 0.8 out of the door.
Thanks, bumping the milestone.
Giving this issue a :+1: for higher priority, now that I am looking at the latest arXiv rerun. biblatex is not too common (~0.02% ?), but it could potentially be easy to add rudimentary support as far as an arXiv document is concerned (as it uses .bbl directly).
As an example, one of our very own articles would be upgraded from error status to no_problem, with just the most basic of biblatex support:
https://corpora.mathweb.org/preview/arxmliv/tex_to_html/1404.6549
I am very happy to hear that. Do you have numbers for biblatex usage?
The full warning report for missing_file is here, including all warning messages from warning, error and fatal tasks:
https://corpora.mathweb.org/corpus/arxmliv/tex_to_html/warning/missing_file?all=true
So far it looks like only 0.1-0.2% of arXiv documents will require biblatex support, so it's really not that frequent.
While we're at it, I should also throw in that so far (50% of run finished), we're looking at a long tail of ~13,300 .sty and .cls files reported for arXiv as not yet present in latexml, in the report I linked here
Ah, interesting. But I think the more interesting question is what is the percentage in 2018. I would suspect for me personally, the percentage of biblatex usage in my papers is 25%, but in 2018 100%. The latter makes a better prediction over future usage.
+1 count of usage in 2019 ;-) I also don't know if ArXiv stats are representative. Since my usual stack is XeLaTeX and recently also biblatex but ArXiv is not able to compile XeLaTeX documents, thus I have to upload PDFs and get an exception. I don't know if these cases are considered in the stats.
I have started playing around with basic support for arXiv for biblatex, which tries to simply map back into the existing {thebibliography} support. A minimal pragmatic stopgap, that resonates with the word "rudimentary" in the issue title here.
I welcome some feedback from @brucemiller (email works too, just connecting the issue to keep track with the github side as well). Maybe it's something to keep developing in this vein, maybe not... I am working on it in the extended arxmliv bindings repository, specifically here.