Skip to content

Commit 3875cd6

Browse files
authored
[arXiv] bibconfig option for latexml.sty (#2683)
* introduce usebbl option, prefer .bbl if present, otherwise process .bib * feedback: use bblconfig KV option
1 parent e6db087 commit 3875cd6

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

lib/LaTeXML/Engine/latex_constructs.pool.ltxml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3957,7 +3957,11 @@ DefMacro('\lx@ifusebbl{}{}{}', sub {
39573957

39583958
my $bbl_path = FindFile($jobname, type => 'bbl');
39593959
my $missing_bibs = '';
3960-
if (LookupValue("NO_BIBTEX")) {
3960+
my $bib_config = LookupValue("BIB_CONFIG") || ['bib', 'bbl'];
3961+
if ((ref $bib_config ne 'ARRAY') || scalar(@$bib_config) == 0) {
3962+
Info('missing', 'bib_config', $gullet, "BIB_CONFIG was empty, ignoring bibliography phase.");
3963+
return; }
3964+
if ($$bib_config[0] eq 'bbl') {
39613965
if (not $bbl_path) {
39623966
Info('expected', "bbl", $_[0], "Couldn't find bbl file, bibliography may be empty.");
39633967
return Tokens(); }

lib/LaTeXML/Package/latexml.sty.ltxml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ DeclareOption('noguesstabularheaders', sub { AssignValue(GUESS_TABULAR_HEADERS =
5151

5252
# 'nobibtex' intended to be used for arXiv-like build harnesses, where there
5353
# is explicit instruction to only use ".bbl" and that bibtex will not be ran.
54-
DeclareOption('bibtex', sub { AssignValue('NO_BIBTEX' => 0, 'global'); });
55-
DeclareOption('nobibtex', sub { AssignValue('NO_BIBTEX' => 1, 'global'); });
54+
DeclareOption('bibtex', sub { AssignValue('BIB_CONFIG' => ['bib', 'bbl'], 'global'); });
55+
DeclareOption('nobibtex', sub { AssignValue('BIB_CONFIG' => ['bbl'], 'global'); });
56+
57+
DefKeyVal('LTXML', 'bibconfig', 'Semiverbatim', '', code => sub {
58+
AssignValue('BIB_CONFIG' => [split(',', ToString($_[1]))], 'global');
59+
return; });
5660

5761
# Lexeme serialization for math formulas
5862
DeclareOption('mathlexemes', sub { AssignValue('LEXEMATIZE_MATH' => 1, 'global'); });
@@ -101,7 +105,7 @@ ProcessOptions(inorder => 1, keysets => ['LTXML']);
101105
# [does this really belong here? or should this be disableable?]
102106
DefConstructor('\URL[] Verbatim', "<ltx:ref href='#href'>?#1(#1)(#href)</ltx:ref>",
103107
enterHorizontal => 1,
104-
properties => sub { (href => CleanURL($_[2])); });
108+
properties => sub { (href => CleanURL($_[2])); });
105109
DefMacro('\XML', '\textsc{xml}'); # '\URL[\texttt{XML}]{http://www.w3.org/XML/}');
106110
DefMacro('\SGML', '\textsc{sgml}'); # '\URL[\texttt{HTML}]{http://www.w3.org/MarkUp/SGML/}');
107111
DefMacro('\HTML', '\textsc{html}'); #'\URL[\texttt{HTML}]{http://www.w3.org/html/}');
@@ -127,7 +131,7 @@ DefConstructor('\LaTeXML@logo',
127131
. "<ltx:text cssstyle='font-size:90%' yoffset='-0.2ex'>XML</ltx:text>"
128132
. "</ltx:text>",
129133
enterHorizontal => 1,
130-
sizer => sub { (Dimension('3.8em'), Dimension('1.6ex'), Dimension('0.4ex')); });
134+
sizer => sub { (Dimension('3.8em'), Dimension('1.6ex'), Dimension('0.4ex')); });
131135

132136
DefMacro('\LaTeXMLversion', sub { ExplodeText($LaTeXML::VERSION); });
133137
DefMacro('\LaTeXMLrevision', sub { ExplodeText($LaTeXML::Version::REVISION); });
@@ -223,7 +227,7 @@ DefConstructor('\lxWithAnnotation RequiredKeyVals {}', sub {
223227
DefConstructor('\lxRef Semiverbatim {}',
224228
"<ltx:ref labelref='#label'>#2</ltx:ref>",
225229
enterHorizontal => 1,
226-
properties => sub { (label => CleanLabel($_[1])); });
230+
properties => sub { (label => CleanLabel($_[1])); });
227231

228232
#======================================================================
229233
# Resources
@@ -381,7 +385,7 @@ DefConstructor('\@lxDefMathDeclare{} RequiredKeyVals:XMath', sub {
381385
$document->insertElement('ltx:text', $description); }
382386
$document->closeElement('ltx:declare');
383387
$document->setNode($save); },
384-
mode => 'restricted_horizontal',
388+
mode => 'restricted_horizontal',
385389
afterDigest => sub { my ($stomach, $whatsit) = @_;
386390
my ($id, $kv) = $whatsit->getArgs;
387391
normalizeDeclareKeys($kv, $whatsit);

0 commit comments

Comments
 (0)