diff options
author | Karl Berry <karl@freefriends.org> | 2017-04-16 22:25:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-04-16 22:25:15 +0000 |
commit | 75c789c980df299fd7e82e2a4f1e40e496bf3e3e (patch) | |
tree | a1d570e5bccdf4d18955f2b59f2e4df859cac685 | |
parent | ca335820d525cec5e0c68237c97333b952e61778 (diff) |
crossrefware (14apr17)
git-svn-id: svn://tug.org/texlive/trunk@43866 c570f23f-e606-0410-a88d-b1316a301751
62 files changed, 1634 insertions, 99 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index 09c2f3b6896..ca2e26bb171 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -97,7 +97,9 @@ texmf_other_scripts = \ cjk-gs-integrate/cjk-gs-integrate.pl \ context/perl/mptopdf.pl \ convbkmk/convbkmk.rb \ + crossrefware/bbl2bib.pl \ crossrefware/bibdoiadd.pl \ + crossrefware/bibmradd.pl \ crossrefware/bibzbladd.pl \ crossrefware/ltx2crossrefxml.pl \ ctanify/ctanify \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index 50e0d82452f..51fd0db035a 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -312,7 +312,9 @@ texmf_other_scripts = \ cjk-gs-integrate/cjk-gs-integrate.pl \ context/perl/mptopdf.pl \ convbkmk/convbkmk.rb \ + crossrefware/bbl2bib.pl \ crossrefware/bibdoiadd.pl \ + crossrefware/bibmradd.pl \ crossrefware/bibzbladd.pl \ crossrefware/ltx2crossrefxml.pl \ ctanify/ctanify \ diff --git a/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl b/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl new file mode 100755 index 00000000000..7a05297a0fd --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl @@ -0,0 +1,259 @@ +#!/usr/bin/env perl + +=pod + +=head1 NAME + +bbl2bib.pl - convert thebibliography environment to a bib file + +=head1 SYNOPSIS + +bbl2bib.pl [B<-o> I<output>] I<file> + +=head1 OPTIONS + +=over 4 + + + +=item B<-o> I<output> + +Output file. If this option is not used, the name for the +output file is formed by changing the extension to C<.bib> + + +=back + +=head1 DESCRIPTION + +The script tries to reconstruct a C<bib> file from the corresponding +C<thebibliography> environment. One can argue that this operation is +akin to reconstructing a cow from the steak. The way the script does +it is searching for the entry in the MR database, and +creating the corresponding BibTeX fields. + +The script reads a TeX or Bbl file and extracts from it the +C<thebibliography> environment. For each bibitem it creates a plain +text bibliography entry, and then tries to match it in +the database. +=head1 INPUT FILE + +We assume some structure of the input file: + +=over 4 + +=item 1. + +The bibliography is contained between the lines + + \begin{thebibliography}... + +and + + \end{thebibliography} + +=item 2. + +Each bibliography item starts from the line + + \bibitem[...]{....} + +=back + + + +=head1 EXAMPLES + + bbl2bib -o - file.tex > result.bib + bbl2bib -o result.bib file.bbl + bbl2bib file.tex + +=head1 AUTHOR + +Boris Veytsman + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014-2017 Boris Veytsman + +This is free software. You may redistribute copies of it under the +terms of the GNU General Public License +L<http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the +extent permitted by law. + +=cut + +use strict; +BEGIN { + # find files relative to our installed location within TeX Live + chomp(my $TLMaster = `kpsewhich -var-value=SELFAUTOPARENT`); # TL root + if (length($TLMaster)) { + unshift @INC, "$TLMaster/texmf-dist/scripts/bibtexperllibs"; + } +} +use IO::File; +use BibTeX::Parser; +use FileHandle; +use LaTeX::ToUnicode qw (convert); +use Getopt::Std; +use URI::Escape; +use LWP::Simple; + +my $USAGE="USAGE: $0 [-o output] file\n"; +my $VERSION = <<END; +bbl2bib v2.1 +This is free software. You may redistribute copies of it under the +terms of the GNU General Public License +http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the +extent permitted by law. +$USAGE +END +our %opts; +getopts('c:o:s:hV',\%opts) or die $USAGE; + +if ($opts{h} || $opts{V}){ + print $VERSION; + exit 0; +} + +################################################################ +# Defaults and parameters +################################################################ + +my $inputfile = shift; + +my $outputfile = $inputfile; + +$outputfile =~ s/\.([^\.]*)$/.bib/; + +if (exists $opts{o}) { + $outputfile = $opts{o}; +} + + + +my $input= IO::File->new($inputfile) or + die "Cannot find Bbl or TeX file $inputfile\n$USAGE\n"; +my $output = IO::File->new("> $outputfile") or + die "Cannot write to $outputfile\n$USAGE\n"; + +my $userAgent = LWP::UserAgent->new; + + +# Bibitem is a hash with the entries 'key', 'text', 'mr', +# 'zbl' +my $bibitem; + +while (<$input>) { + if (!(/\\begin\{thebibliography\}/../\\end\{thebibliography\}/) || + /\\begin\{thebibliography\}/ || /\\end\{thebibliography\}/) { + next; + } + if (/\\bibitem(\[[^\]]*\])?\{([^\}]*)\}/) { + ProcessBibitem($bibitem); + $bibitem = undef; + $bibitem->{key}=$2; + $bibitem->{text}=""; + } + if (!/^\s*$/) { + $bibitem -> {text} .= $_; + } +} +ProcessBibitem($bibitem); + + +exit 0; + +sub ProcessBibitem { + my $bibitem = shift; + my $key = $bibitem->{key}; + my $text=$bibitem->{text}; + if (!length($text) || $text =~ /^\s+$/s) { + return; + } + + my $printtext = $text; + $printtext =~ s/^(.)/% $1/mg; + print $output "$printtext"; + $text =~ s/\n/ /mg; + $text =~ s/\\bibitem(\[[^\]]*\])?\{[^\}]*\}//; + + # Arxiv entry? + if ($text =~ s/\\arxiv\{([^\}]+)\}\.?//) { + $bibitem->{arxiv}=$1; + } + + # Mr number exists? + if ($text =~ s/\\mr\{([^\}]+)\}\.?//) { + $bibitem->{mr}=$1; + } + + # zbl number exists? + if ($text =~ s/\\zbl\{([^\}]+)\}\.?//) { + $bibitem->{zbl}=$1; + } + + # doi number exists? + if ($text =~ s/\\doi\{([^\}]+)\}\.?//) { + $bibitem->{doi}=$1; + } + + $bibitem->{bib} = SearchMref($bibitem); + PrintBibitem($bibitem); + return; +} + + +sub SearchMref { + my $bibitem = shift; + my $mirror = "http://www.ams.org/mathscinet-mref"; + my $string=uri_escape_utf8($bibitem->{text}); + my $response = $userAgent->get("$mirror?ref=$string&dataType=bibtex") -> + decoded_content(); + if ($response =~ /<pre>(.*)<\/pre>/s) { + my $bib= $1; + my $fh = new FileHandle; + open $fh, "<", \$bib; + my $parser = new BibTeX::Parser($fh); + my $entry = $parser->next; + if ($entry->parse_ok()) { + $entry->key($bibitem->{key}); + return ($entry); + } + } +} + + + + +sub PrintBibitem { + print "\n"; + my $bibitem = shift; + if (!ref($bibitem->{bib})) { + return; + } + my $entry=$bibitem->{bib}; + if ($bibitem->{mr} && ! $entry->field('mrnumber')) { + $entry->field('mrnumber', $bibitem->{mr}); + } + if ($entry->field('mrnumber')) { + my $mr=$entry->field('mrnumber'); + while (length($mr)<7) { + $mr = "0$mr"; + } + $mr=$entry->field('mrnumber', $mr); + } + if ($bibitem->{zbl} && ! $entry->field('zblnumber')) { + $entry->field('zblnumber', $bibitem->{zbl}); + } + if ($bibitem->{doi} && ! $entry->field('doi')) { + $entry->field('doi', $bibitem->{doi}); + } + if ($bibitem->{arxiv} && ! $entry->field('arxiv')) { + $entry->field('arxiv', $bibitem->{arxiv}); + } + + print $entry->to_string(), "\n\n"; +} + + diff --git a/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl b/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl index 8937729a3ba..bf7bc1a2856 100755 --- a/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl +++ b/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl @@ -8,7 +8,7 @@ bibdoiadd.pl - add DOI numbers to papers in a given bib file =head1 SYNOPSIS -bibdoiadd [B<-c> I<config_file>] [B<-f>] [B<-o> I<output>] I<bib_file> +bibdoiadd [B<-c> I<config_file>] [B<-e> 1|0] [B<-f>] [B<-o> I<output>] I<bib_file> =head1 OPTIONS @@ -19,6 +19,12 @@ bibdoiadd [B<-c> I<config_file>] [B<-f>] [B<-o> I<output>] I<bib_file> Configuration file. If this file is absent, some defaults are used. See below for its format. +=item B<-e> + +If 1 (default), add empty doi if a doi cannot be found. This prevents +repeated searches for the same entries if you add new entries to the +file. Calling C<-e 0> suppresses this behavior. + =item B<-f> Force checking doi number even if one is present @@ -59,15 +65,15 @@ The configuration file is mostly self-explanatory: it has comments $field = value ; -The important parameters are C<$mode> (C<'free'> or C<'paid'>, +The important parameters are C<$mode> (C<'free'> or C<'paid'>), C<$email> (for free users) and C<$username> & C<$password> for paid members. =head1 EXAMPLES - bibdoiadd -c bibdoiadd.cfg citations.bib > result.bib - bibdoiadd -c bibdoiadd.cfg citations.bib -o result.bib + bibdoiadd -c bibdoiadd.cfg -o - citations.bib > result.bib + bibdoiadd -c bibdoiadd.cfg -o result.bib citations.bib =head1 AUTHOR @@ -75,7 +81,7 @@ Boris Veytsman =head1 COPYRIGHT AND LICENSE -Copyright (C) 2014-2016 Boris Veytsman +Copyright (C) 2014-2017 Boris Veytsman This is free software. You may redistribute copies of it under the terms of the GNU General Public License @@ -99,17 +105,17 @@ use Getopt::Std; use URI::Escape; use LWP::Simple; -my $USAGE="USAGE: $0 [-c config] [-f] [-o output] file\n"; +my $USAGE="USAGE: $0 [-c config] [-e 1|0] [-f] [-o output] file\n"; my $VERSION = <<END; -bibdoiadd v2.0 +bibdoiadd v2.1 This is free software. You may redistribute copies of it under the terms of the GNU General Public License http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the extent permitted by law. $USAGE END -my %opts; -getopts('fc:o:hV',\%opts) or die $USAGE; +our %opts; +getopts('fe:c:o:hV',\%opts) or die $USAGE; if ($opts{h} || $opts{V}){ print $VERSION; @@ -126,12 +132,15 @@ my $outputfile = $inputfile; $outputfile =~ s/\.([^\.]*)$/_doi.$1/; -if ($opts{o}) { +if (exists $opts{o}) { $outputfile = $opts{o}; } my $forceSearch=$opts{f}; - +my $forceEmpty = 1; +if (exists $opts{e}) { + $forceEmpty = $opts{e}; +} our $mode='free'; our $email; @@ -196,7 +205,7 @@ while (my $entry = $parser->next) { my $doi = GetDoi($prefix, $entry); - if (length($doi)) { + if (length($doi) || $forceEmpty) { $entry->field('doi',$doi); } print $output $entry->to_string(), "\n\n"; diff --git a/Build/source/texk/texlive/linked_scripts/crossrefware/bibmradd.pl b/Build/source/texk/texlive/linked_scripts/crossrefware/bibmradd.pl new file mode 100755 index 00000000000..8b1c9938a56 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/crossrefware/bibmradd.pl @@ -0,0 +1,210 @@ +#!/usr/bin/env perl + +=pod + +=head1 NAME + +bibmradd.pl - add MR numbers to papers in a given bib file + +=head1 SYNOPSIS + +bibmradd [-d] [B<-f>] [B<-e> 1|0] [B<-o> I<output>] I<bib_file> + +=head1 OPTIONS + +=over 4 + +=item B<-d> + +Debug mode + +=item B<-e> + +If 1 (default), add an empty mrnumber if a mr cannot be found. This +prevents repeated searches for the same entries if you add new entries +to the file. Calling C<-e 0> suppresses this behavior. + + +=item B<-f> + +Force searching for MR numbers even if the entry already has one. + +=item B<-o> I<output> + +Output file. If this option is not used, the name for the +output file is formed by adding C<_mr> to the input file + +=back + +=head1 DESCRIPTION + +The script reads a BibTeX file. It checks whether the entries have +mrnumberss. If not, tries to contact internet to get the numbers. The +result is a BibTeX file with the fields +C<mrnumber=...> added. + +The name of the output file is either set by the B<-o> option or +is derived by adding the suffix C<_mr> to the output file. + +=head1 AUTHOR + +Boris Veytsman + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014-2017 Boris Veytsman + +This is free software. You may redistribute copies of it under the +terms of the GNU General Public License +L<http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the +extent permitted by law. + +=cut + +use strict; +BEGIN { + # find files relative to our installed location within TeX Live + chomp(my $TLMaster = `kpsewhich -var-value=SELFAUTOPARENT`); # TL root + if (length($TLMaster)) { + unshift @INC, "$TLMaster/texmf-dist/scripts/bibtexperllibs"; + } +} +use IO::File; +use BibTeX::Parser; +use Getopt::Std; +use URI::Escape; +use LWP::UserAgent; +$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; + +my $USAGE="USAGE: $0 [-d] [-e 1|0] [-f] [-o output] file\n"; +my $VERSION = <<END; +bibmradd v2.1 +This is free software. You may redistribute copies of it under the +terms of the GNU General Public License +http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the +extent permitted by law. +$USAGE +END +my %opts; +getopts('de:fo:hV',\%opts) or die $USAGE; + +if ($opts{h} || $opts{V}){ + print $VERSION; + exit 0; +} + +################################################################ +# Defaults and parameters +################################################################ + +my $inputfile = shift; + +my $outputfile = $inputfile; + +$outputfile =~ s/\.([^\.]*)$/_mr.$1/; + +if ($opts{o}) { + $outputfile = $opts{o}; +} + +my $forceSearch=$opts{f}; + +my $forceEmpty = 1; +if (exists $opts{e}) { + $forceEmpty = $opts{e}; +} + +my $debug = $opts{d}; + +my $input= IO::File->new($inputfile) or + die "Cannot find BibTeX file $inputfile\n$USAGE\n"; +my $output = IO::File->new("> $outputfile") or + die "Cannot write to $outputfile\n$USAGE\n"; + +my $parser=new BibTeX::Parser($input); + + + +# Creating the HTTP parameters +my $mirror = + "http://www.ams.org/mathscinet-mref"; +my $userAgent = LWP::UserAgent->new; + +while (my $entry = $parser->next ) { + if (!$entry->parse_ok()) { + print STDERR "Cannot understand entry: "; + $entry->print(*STDERR); + print STDERR "Skipping this entry\n"; + next; + } + if ($entry->has('mrnumber') && !$forceSearch) { + print $output $entry->raw_bibtex(), "\n\n"; + if ($debug) { + print STDERR "DEBUG: entry ", $entry->key(), + " has mrnumber ", $entry->field('mrnumber'), + " and no forced search is requested\n"; + } + next; + } + + + # Now we have an entry with no MR. Let us get to work. + if ($debug) { + print STDERR "DEBUG: Searching for mr number for entry ", + $entry->key, "\n"; + } + my $mr = GetMr($entry, $userAgent, $mirror); + if (length($mr) || $forceEmpty) { + $entry->field('mrnumber', $mr); + } + print $output $entry->to_string(), "\n\n"; + +} + +$input->close(); +$output->close(); +exit 0; + +############################################################### +# Getting one MR +############################################################### + +sub GetMr { + my $entry=shift; + my $userAgent=shift; + my $mirror=shift; + + my @query; + + my $string=uri_escape_utf8($entry->to_string()); + + if ($debug) { + print STDERR "DEBUG: query: $mirror?ref=$string&dataType=bibtex\n" ; + } + + + my $response = $userAgent->get("$mirror?ref=$string&dataType=bibtex"); + if ($debug) { + print STDERR "DEBUG: response: ", + $response->decoded_content, "\n"; + } + + if ($response->decoded_content =~ /MRNUMBER\s*=\s*{(.*)}/m) { + my $mr=$1; + # Somehow mref deletes leading zeros. They are needed! + while (length($mr)<7) { + $mr = "0$mr"; + } + if ($debug) { + print STDERR "DEBUG: got MR: $mr\n", + } + return $mr; + } else { + if ($debug) { + print STDERR "DEBUG: Did not get MR\n", + } + return (""); + } + +} + diff --git a/Build/source/texk/texlive/linked_scripts/crossrefware/bibzbladd.pl b/Build/source/texk/texlive/linked_scripts/crossrefware/bibzbladd.pl index f348cd4b946..b946766fdf9 100755 --- a/Build/source/texk/texlive/linked_scripts/crossrefware/bibzbladd.pl +++ b/Build/source/texk/texlive/linked_scripts/crossrefware/bibzbladd.pl @@ -8,12 +8,23 @@ bibzbladd.pl - add Zbl numbers to papers in a given bib file =head1 SYNOPSIS -bibzbladd [B<-f>] [B<-o> I<output>] I<bib_file> +bibzbladd [-d] [B<-f>] [B<-e> 1|0] [B<-o> I<output>] I<bib_file> =head1 OPTIONS =over 4 +=item B<-d> + +Debug mode + +=item B<-e> + +If 1 (default), add an empty zblnumber if a zbl cannot be found. This +prevents repeated searches for the same entries if you add new entries +to the file. Calling C<-e 0> suppresses this behavior. + + =item B<-f> Force searching for Zbl numbers even if the entry already has one. @@ -41,7 +52,7 @@ Boris Veytsman =head1 COPYRIGHT AND LICENSE -Copyright (C) 2014-2016 Boris Veytsman +Copyright (C) 2014-2017 Boris Veytsman This is free software. You may redistribute copies of it under the terms of the GNU General Public License @@ -63,10 +74,11 @@ use BibTeX::Parser; use Getopt::Std; use URI::Escape; use LWP::UserAgent; +$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; -my $USAGE="USAGE: $0 [-f] [-o output] file\n"; +my $USAGE="USAGE: $0 [-d] [-e 1|0] [-f] [-o output] file\n"; my $VERSION = <<END; -bibzbladd v2.0 +bibzbladd v2.1 This is free software. You may redistribute copies of it under the terms of the GNU General Public License http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the @@ -74,7 +86,7 @@ extent permitted by law. $USAGE END my %opts; -getopts('fo:hV',\%opts) or die $USAGE; +getopts('de:fo:hV',\%opts) or die $USAGE; if ($opts{h} || $opts{V}){ print $VERSION; @@ -97,6 +109,13 @@ if ($opts{o}) { my $forceSearch=$opts{f}; +my $forceEmpty = 1; +if (exists $opts{e}) { + $forceEmpty = $opts{e}; +} + +my $debug = $opts{d}; + my $input= IO::File->new($inputfile) or die "Cannot find BibTeX file $inputfile\n$USAGE\n"; my $output = IO::File->new("> $outputfile") or @@ -118,19 +137,24 @@ while (my $entry = $parser->next ) { print STDERR "Skipping this entry\n"; next; } - if (!($entry->type() eq 'ARTICLE')) { - print $output $entry->raw_bibtex(), "\n\n"; - next; - } if ($entry->has('zblnumber') && !$forceSearch) { print $output $entry->raw_bibtex(), "\n\n"; + if ($debug) { + print STDERR "DEBUG: entry ", $entry->key(), + " has zblnumber ", $entry->field('zblnumber'), + " and no forced search is requested\n"; + } next; } # Now we have an entry with no Zbl. Let us get to work. + if ($debug) { + print STDERR "DEBUG: Searching for zbl number for entry ", + $entry->key, "\n"; + } my $zbl = GetZbl($entry, $userAgent, $mirror); - if (length($zbl)) { + if (length($zbl) || $forceEmpty) { $entry->field('zblnumber',$zbl); } print $output $entry->to_string(), "\n\n"; @@ -154,12 +178,26 @@ sub GetZbl { my $string=uri_escape_utf8($entry->to_string()); + if ($debug) { + print STDERR "DEBUG: query: $mirror?bibtex=$string\n" ; + } my $response = $userAgent->get("$mirror?bibtex=$string"); + if ($debug) { + print STDERR "DEBUG: response: ", + $response->decoded_content, "\n"; + } + if ($response->decoded_content =~ /^\s*"zbl_id":\s*"(.*)",\s*$/m) { + if ($debug) { + print STDERR "DEBUG: got zbl: $1\n", + } return $1; } else { + if ($debug) { + print STDERR "DEBUG: Did not get zbl\n", + } return (""); } diff --git a/Build/source/texk/texlive/linked_scripts/scripts.lst b/Build/source/texk/texlive/linked_scripts/scripts.lst index dd52f5545e1..ddf9ceaaefa 100644 --- a/Build/source/texk/texlive/linked_scripts/scripts.lst +++ b/Build/source/texk/texlive/linked_scripts/scripts.lst @@ -42,7 +42,9 @@ checkcites/checkcites.lua cjk-gs-integrate/cjk-gs-integrate.pl context/perl/mptopdf.pl convbkmk/convbkmk.rb +crossrefware/bbl2bib.pl crossrefware/bibdoiadd.pl +crossrefware/bibmradd.pl crossrefware/bibzbladd.pl crossrefware/ltx2crossrefxml.pl ctanify/ctanify diff --git a/Master/bin/amd64-freebsd/bbl2bib b/Master/bin/amd64-freebsd/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/amd64-freebsd/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/amd64-freebsd/bibmradd b/Master/bin/amd64-freebsd/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/amd64-freebsd/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/amd64-netbsd/bbl2bib b/Master/bin/amd64-netbsd/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/amd64-netbsd/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/amd64-netbsd/bibmradd b/Master/bin/amd64-netbsd/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/amd64-netbsd/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/armel-linux/bbl2bib b/Master/bin/armel-linux/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/armel-linux/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/armel-linux/bibmradd b/Master/bin/armel-linux/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/armel-linux/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/armhf-linux/bbl2bib b/Master/bin/armhf-linux/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/armhf-linux/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/armhf-linux/bibmradd b/Master/bin/armhf-linux/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/armhf-linux/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/i386-cygwin/bbl2bib b/Master/bin/i386-cygwin/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/i386-cygwin/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/i386-cygwin/bibmradd b/Master/bin/i386-cygwin/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/i386-cygwin/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/i386-freebsd/bbl2bib b/Master/bin/i386-freebsd/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/i386-freebsd/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/i386-freebsd/bibmradd b/Master/bin/i386-freebsd/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/i386-freebsd/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/i386-linux/bbl2bib b/Master/bin/i386-linux/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/i386-linux/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/i386-linux/bibmradd b/Master/bin/i386-linux/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/i386-linux/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/i386-netbsd/bbl2bib b/Master/bin/i386-netbsd/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/i386-netbsd/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/i386-netbsd/bibmradd b/Master/bin/i386-netbsd/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/i386-netbsd/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/i386-solaris/bbl2bib b/Master/bin/i386-solaris/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/i386-solaris/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/i386-solaris/bibmradd b/Master/bin/i386-solaris/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/i386-solaris/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/powerpc-linux/bbl2bib b/Master/bin/powerpc-linux/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/powerpc-linux/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/powerpc-linux/bibmradd b/Master/bin/powerpc-linux/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/powerpc-linux/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/sparc-solaris/bbl2bib b/Master/bin/sparc-solaris/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/sparc-solaris/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/sparc-solaris/bibmradd b/Master/bin/sparc-solaris/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/sparc-solaris/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/universal-darwin/bbl2bib b/Master/bin/universal-darwin/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/universal-darwin/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/universal-darwin/bibmradd b/Master/bin/universal-darwin/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/universal-darwin/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/win32/bbl2bib.exe b/Master/bin/win32/bbl2bib.exe Binary files differnew file mode 100755 index 00000000000..5777d90a17a --- /dev/null +++ b/Master/bin/win32/bbl2bib.exe diff --git a/Master/bin/win32/bibmradd.exe b/Master/bin/win32/bibmradd.exe Binary files differnew file mode 100755 index 00000000000..5777d90a17a --- /dev/null +++ b/Master/bin/win32/bibmradd.exe diff --git a/Master/bin/x86_64-cygwin/bbl2bib b/Master/bin/x86_64-cygwin/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/x86_64-cygwin/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-cygwin/bibmradd b/Master/bin/x86_64-cygwin/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/x86_64-cygwin/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-darwin/bbl2bib b/Master/bin/x86_64-darwin/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/x86_64-darwin/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-darwin/bibmradd b/Master/bin/x86_64-darwin/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/x86_64-darwin/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-linux/bbl2bib b/Master/bin/x86_64-linux/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/x86_64-linux/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-linux/bibmradd b/Master/bin/x86_64-linux/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/x86_64-linux/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-solaris/bbl2bib b/Master/bin/x86_64-solaris/bbl2bib new file mode 120000 index 00000000000..cac72dcafda --- /dev/null +++ b/Master/bin/x86_64-solaris/bbl2bib @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bbl2bib.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-solaris/bibmradd b/Master/bin/x86_64-solaris/bibmradd new file mode 120000 index 00000000000..536fae9c886 --- /dev/null +++ b/Master/bin/x86_64-solaris/bibmradd @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/bibmradd.pl
\ No newline at end of file diff --git a/Master/texmf-dist/doc/man/man1/bbl2bib.1 b/Master/texmf-dist/doc/man/man1/bbl2bib.1 new file mode 100644 index 00000000000..09596a64519 --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/bbl2bib.1 @@ -0,0 +1,202 @@ +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +. ds C` +. ds C' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "bbl2bib 1" +.TH bbl2bib 1 "2017-04-10" "" "CROSSREF LIBRARY" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +bbl2bib.pl \- convert thebibliography environment to a bib file +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +bbl2bib.pl [\fB\-o\fR \fIoutput\fR] \fIfile\fR +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-o\fR \fIoutput\fR" 4 +.IX Item "-o output" +Output file. If this option is not used, the name for the +output file is formed by changing the extension to \f(CW\*(C`.bib\*(C'\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The script tries to reconstruct a \f(CW\*(C`bib\*(C'\fR file from the corresponding +\&\f(CW\*(C`thebibliography\*(C'\fR environment. One can argue that this operation is +akin to reconstructing a cow from the steak. The way the script does +it is searching for the entry in the \s-1MR\s0 database, and +creating the corresponding BibTeX fields. +.PP +The script reads a TeX or Bbl file and extracts from it the +\&\f(CW\*(C`thebibliography\*(C'\fR environment. For each bibitem it creates a plain +text bibliography entry, and then tries to match it in +the database. +=head1 \s-1INPUT FILE\s0 +.PP +We assume some structure of the input file: +.IP "1." 4 +The bibliography is contained between the lines +.Sp +.Vb 1 +\& \ebegin{thebibliography}... +.Ve +.Sp +and +.Sp +.Vb 1 +\& \eend{thebibliography} +.Ve +.IP "2." 4 +Each bibliography item starts from the line +.Sp +.Vb 1 +\& \ebibitem[...]{....} +.Ve +.SH "EXAMPLES" +.IX Header "EXAMPLES" +.Vb 3 +\& bbl2bib \-o \- file.tex > result.bib +\& bbl2bib \-o result.bib file.bbl +\& bbl2bib file.tex +.Ve +.SH "AUTHOR" +.IX Header "AUTHOR" +Boris Veytsman +.SH "COPYRIGHT AND LICENSE" +.IX Header "COPYRIGHT AND LICENSE" +Copyright (C) 2014\-2017 Boris Veytsman +.PP +This is free software. You may redistribute copies of it under the +terms of the \s-1GNU\s0 General Public License +<http://www.gnu.org/licenses/gpl.html>. There is \s-1NO WARRANTY,\s0 to the +extent permitted by law. diff --git a/Master/texmf-dist/doc/man/man1/bbl2bib.man1.pdf b/Master/texmf-dist/doc/man/man1/bbl2bib.man1.pdf Binary files differnew file mode 100644 index 00000000000..54bfe817b71 --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/bbl2bib.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/bibdoiadd.1 b/Master/texmf-dist/doc/man/man1/bibdoiadd.1 index 53fe9f18313..6e22fc30c70 100644 --- a/Master/texmf-dist/doc/man/man1/bibdoiadd.1 +++ b/Master/texmf-dist/doc/man/man1/bibdoiadd.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -38,6 +38,8 @@ . ds PI \(*p . ds L" `` . ds R" '' +. ds C` +. ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. @@ -48,17 +50,24 @@ .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.ie \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX .. -. nr % 0 -. rr F -.\} -.el \{\ -. de IX +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -124,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "bibdoiadd 1" -.TH bibdoiadd 1 "2016-02-14" "" "CROSSREF LIBRARY" +.TH bibdoiadd 1 "2017-04-12" "" "CROSSREF LIBRARY" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -133,13 +142,18 @@ bibdoiadd.pl \- add DOI numbers to papers in a given bib file .SH "SYNOPSIS" .IX Header "SYNOPSIS" -bibdoiadd [\fB\-c\fR \fIconfig_file\fR] [\fB\-f\fR] [\fB\-o\fR \fIoutput\fR] \fIbib_file\fR +bibdoiadd [\fB\-c\fR \fIconfig_file\fR] [\fB\-e\fR 1|0] [\fB\-f\fR] [\fB\-o\fR \fIoutput\fR] \fIbib_file\fR .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-c\fR \fIconfig_file\fR" 4 .IX Item "-c config_file" Configuration file. If this file is absent, some defaults are used. See below for its format. +.IP "\fB\-e\fR" 4 +.IX Item "-e" +If 1 (default), add empty doi if a doi cannot be found. This prevents +repeated searches for the same entries if you add new entries to the +file. Calling \f(CW\*(C`\-e 0\*(C'\fR suppresses this behavior. .IP "\fB\-f\fR" 4 .IX Item "-f" Force checking doi number even if one is present @@ -151,7 +165,7 @@ output file is formed by adding \f(CW\*(C`_doi\*(C'\fR to the input file .IX Header "DESCRIPTION" The script reads a BibTeX file. It checks whether the entries have DOIs. If now, tries to contact http://www.crossref.org to get the -corresponding \s-1DOI\s0. The result is a BibTeX file with the fields +corresponding \s-1DOI. \s0 The result is a BibTeX file with the fields \&\f(CW\*(C`doi=...\*(C'\fR added. .PP The name of the output file is either set by the \fB\-o\fR option or @@ -175,23 +189,23 @@ The configuration file is mostly self-explanatory: it has comments \& $field = value ; .Ve .PP -The important parameters are \f(CW$mode\fR (\f(CW\*(Aqfree\*(Aq\fR or \f(CW\*(Aqpaid\*(Aq\fR, +The important parameters are \f(CW$mode\fR (\f(CW\*(Aqfree\*(Aq\fR or \f(CW\*(Aqpaid\*(Aq\fR), \&\f(CW$email\fR (for free users) and \f(CW$username\fR & \f(CW$password\fR for paid members. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 2 -\& bibdoiadd \-c bibdoiadd.cfg citations.bib > result.bib -\& bibdoiadd \-c bibdoiadd.cfg citations.bib \-o result.bib +\& bibdoiadd \-c bibdoiadd.cfg \-o \- citations.bib > result.bib +\& bibdoiadd \-c bibdoiadd.cfg \-o result.bib citations.bib .Ve .SH "AUTHOR" .IX Header "AUTHOR" Boris Veytsman .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" -Copyright (C) 2014\-2016 Boris Veytsman +Copyright (C) 2014\-2017 Boris Veytsman .PP This is free software. You may redistribute copies of it under the terms of the \s-1GNU\s0 General Public License -<http://www.gnu.org/licenses/gpl.html>. There is \s-1NO\s0 \s-1WARRANTY\s0, to the +<http://www.gnu.org/licenses/gpl.html>. There is \s-1NO WARRANTY,\s0 to the extent permitted by law. diff --git a/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf b/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf Binary files differindex 7e5a2cacaff..3ec7731e6d5 100644 --- a/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/bibmradd.1 b/Master/texmf-dist/doc/man/man1/bibmradd.1 new file mode 100644 index 00000000000..b4059b06121 --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/bibmradd.1 @@ -0,0 +1,182 @@ +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +. ds C` +. ds C' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "bibmradd 1" +.TH bibmradd 1 "2017-04-03" "" "CROSSREF LIBRARY" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +bibmradd.pl \- add MR numbers to papers in a given bib file +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +bibmradd [\-d] [\fB\-f\fR] [\fB\-e\fR 1|0] [\fB\-o\fR \fIoutput\fR] \fIbib_file\fR +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-d\fR" 4 +.IX Item "-d" +Debug mode +.IP "\fB\-e\fR" 4 +.IX Item "-e" +If 1 (default), add an empty mrnumber if a mr cannot be found. This +prevents repeated searches for the same entries if you add new entries +to the file. Calling \f(CW\*(C`\-e 0\*(C'\fR suppresses this behavior. +.IP "\fB\-f\fR" 4 +.IX Item "-f" +Force searching for \s-1MR\s0 numbers even if the entry already has one. +.IP "\fB\-o\fR \fIoutput\fR" 4 +.IX Item "-o output" +Output file. If this option is not used, the name for the +output file is formed by adding \f(CW\*(C`_mr\*(C'\fR to the input file +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The script reads a BibTeX file. It checks whether the entries have +mrnumberss. If not, tries to contact internet to get the numbers. The +result is a BibTeX file with the fields +\&\f(CW\*(C`mrnumber=...\*(C'\fR added. +.PP +The name of the output file is either set by the \fB\-o\fR option or +is derived by adding the suffix \f(CW\*(C`_mr\*(C'\fR to the output file. +.SH "AUTHOR" +.IX Header "AUTHOR" +Boris Veytsman +.SH "COPYRIGHT AND LICENSE" +.IX Header "COPYRIGHT AND LICENSE" +Copyright (C) 2014\-2017 Boris Veytsman +.PP +This is free software. You may redistribute copies of it under the +terms of the \s-1GNU\s0 General Public License +<http://www.gnu.org/licenses/gpl.html>. There is \s-1NO WARRANTY,\s0 to the +extent permitted by law. diff --git a/Master/texmf-dist/doc/man/man1/bibmradd.man1.pdf b/Master/texmf-dist/doc/man/man1/bibmradd.man1.pdf Binary files differnew file mode 100644 index 00000000000..bf287d42e92 --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/bibmradd.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/bibzbladd.1 b/Master/texmf-dist/doc/man/man1/bibzbladd.1 index f795148d0a7..2c95365d6a4 100644 --- a/Master/texmf-dist/doc/man/man1/bibzbladd.1 +++ b/Master/texmf-dist/doc/man/man1/bibzbladd.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -38,6 +38,8 @@ . ds PI \(*p . ds L" `` . ds R" '' +. ds C` +. ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. @@ -48,17 +50,24 @@ .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.ie \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX .. -. nr % 0 -. rr F -.\} -.el \{\ -. de IX +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -124,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "bibzbladd 1" -.TH bibzbladd 1 "2016-02-14" "" "CROSSREF LIBRARY" +.TH bibzbladd 1 "2017-04-12" "" "CROSSREF LIBRARY" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -133,9 +142,17 @@ bibzbladd.pl \- add Zbl numbers to papers in a given bib file .SH "SYNOPSIS" .IX Header "SYNOPSIS" -bibzbladd [\fB\-f\fR] [\fB\-o\fR \fIoutput\fR] \fIbib_file\fR +bibzbladd [\-d] [\fB\-f\fR] [\fB\-e\fR 1|0] [\fB\-o\fR \fIoutput\fR] \fIbib_file\fR .SH "OPTIONS" .IX Header "OPTIONS" +.IP "\fB\-d\fR" 4 +.IX Item "-d" +Debug mode +.IP "\fB\-e\fR" 4 +.IX Item "-e" +If 1 (default), add an empty zblnumber if a zbl cannot be found. This +prevents repeated searches for the same entries if you add new entries +to the file. Calling \f(CW\*(C`\-e 0\*(C'\fR suppresses this behavior. .IP "\fB\-f\fR" 4 .IX Item "-f" Force searching for Zbl numbers even if the entry already has one. @@ -157,9 +174,9 @@ is derived by adding the suffix \f(CW\*(C`_zbl\*(C'\fR to the output file. Boris Veytsman .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" -Copyright (C) 2014\-2016 Boris Veytsman +Copyright (C) 2014\-2017 Boris Veytsman .PP This is free software. You may redistribute copies of it under the terms of the \s-1GNU\s0 General Public License -<http://www.gnu.org/licenses/gpl.html>. There is \s-1NO\s0 \s-1WARRANTY\s0, to the +<http://www.gnu.org/licenses/gpl.html>. There is \s-1NO WARRANTY,\s0 to the extent permitted by law. diff --git a/Master/texmf-dist/doc/man/man1/bibzbladd.man1.pdf b/Master/texmf-dist/doc/man/man1/bibzbladd.man1.pdf Binary files differindex 9d45ecec113..b6bf92858f0 100644 --- a/Master/texmf-dist/doc/man/man1/bibzbladd.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/bibzbladd.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/ltx2crossrefxml.1 b/Master/texmf-dist/doc/man/man1/ltx2crossrefxml.1 index f1d5afcf43e..74fc82f69d4 100644 --- a/Master/texmf-dist/doc/man/man1/ltx2crossrefxml.1 +++ b/Master/texmf-dist/doc/man/man1/ltx2crossrefxml.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -38,6 +38,8 @@ . ds PI \(*p . ds L" `` . ds R" '' +. ds C` +. ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. @@ -48,17 +50,24 @@ .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.ie \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX .. -. nr % 0 -. rr F -.\} -.el \{\ -. de IX +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -124,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ltx2crossrefxml 1" -.TH ltx2crossrefxml 1 "2016-02-14" "" "CROSSREF LIBRARY" +.TH ltx2crossrefxml 1 "2017-03-28" "" "CROSSREF LIBRARY" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -176,5 +185,5 @@ Copyright (C) 2012\-2016 Boris Veytsman .PP This is free software. You may redistribute copies of it under the terms of the \s-1GNU\s0 General Public License -<http://www.gnu.org/licenses/gpl.html>. There is \s-1NO\s0 \s-1WARRANTY\s0, to the +<http://www.gnu.org/licenses/gpl.html>. There is \s-1NO WARRANTY,\s0 to the extent permitted by law. diff --git a/Master/texmf-dist/doc/man/man1/ltx2crossrefxml.man1.pdf b/Master/texmf-dist/doc/man/man1/ltx2crossrefxml.man1.pdf Binary files differindex 16d5e55b5b1..81a5cb0c32b 100644 --- a/Master/texmf-dist/doc/man/man1/ltx2crossrefxml.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/ltx2crossrefxml.man1.pdf diff --git a/Master/texmf-dist/doc/support/crossrefware/Makefile b/Master/texmf-dist/doc/support/crossrefware/Makefile index 76089804b3f..a59d207781b 100644 --- a/Master/texmf-dist/doc/support/crossrefware/Makefile +++ b/Master/texmf-dist/doc/support/crossrefware/Makefile @@ -1,7 +1,9 @@ SCRIPTS = \ ltx2crossrefxml.pl \ bibdoiadd.pl \ - bibzbladd.pl + bibzbladd.pl \ + bibmradd.pl \ + bbl2bib.pl MAN1 = ${SCRIPTS:%.pl=%.1} @@ -20,7 +22,8 @@ all: ${MAN1} ${PDF} clean: - $(RM) *.aux *.toc *.log *.tex *.idx *.ilg *.ind *.out *.zip *.tgz + $(RM) *.aux *.toc *.log *.tex *.idx *.ilg *.ind *.out *.zip *.tgz \ + *~ distclean: clean $(RM) *.pdf *.1 *.3 @@ -37,5 +40,5 @@ crossrefware.tex: ${SCRIPTS} pod2latex -modify -full -prefile head.ltx -out $@ $+ archive: all clean - cd ..; tar -czvf crossrefware.tgz crossref --exclude CVS \ - --exclude test --exclude *.bib
\ No newline at end of file + cd ..; tar -czvf crossrefware.tgz --exclude 'CVS' \ + --exclude 'test' --exclude *.bib crossref diff --git a/Master/texmf-dist/doc/support/crossrefware/README b/Master/texmf-dist/doc/support/crossrefware/README index 2d64b4ac5fb..4888089775d 100644 --- a/Master/texmf-dist/doc/support/crossrefware/README +++ b/Master/texmf-dist/doc/support/crossrefware/README @@ -1,11 +1,16 @@ Crossrefware Bundle - version 2.0 + version 2.1 -Scripts useful for working with crossref.org and Zentralblatt MATH. +Scripts useful for working with Crossref, MathSciNet and Zentralblatt MATH. + +This work was commissioned by The Saint Lois University and The +Princeton University (Mathematics Department) bibdoiadd.pl - add DOI numbers to papers in a given bib file bibzbladd.pl - add Zbl numbers to papers in a given bib file +bibmradd.pl - add MR numbers to papers in a given bib file +bbl2bib.pl - convert `thebibliography' environment to a bib file ltx2crossrefxml.pl - a tool for creation of XML files for submitting to crossref.org The scripts use bibtexperllibs libraries from CTAN @@ -21,6 +26,11 @@ Installation: Changes: + Version 2.1: New options to add empty doi and zbl when doi or zbl + are not found to prevent repeated searches. + Added bibmradd.pl + Added bbl2bib.pl + Version 2.0: Moved to BibTeX::Parser suite. Now we use new Zbmath interface. Now we use bibtexperllibs libraries diff --git a/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf b/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf Binary files differindex ce573948667..6cc43be3264 100644 --- a/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf +++ b/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf diff --git a/Master/texmf-dist/doc/support/crossrefware/head.ltx b/Master/texmf-dist/doc/support/crossrefware/head.ltx index 6b0160194e7..16391486bf9 100644 --- a/Master/texmf-dist/doc/support/crossrefware/head.ltx +++ b/Master/texmf-dist/doc/support/crossrefware/head.ltx @@ -1,18 +1,39 @@ \documentclass{article} \usepackage{makeidx} -\usepackage{librecaslon} +\usepackage[osf]{mathpazo} \usepackage[hidelinks]{hyperref} \makeindex \begin{document} -\title{Crossrefware documentation} -\author{Boris Veytsman} +\sloppy +\title{Crossrefware documentation\thanks{This work was commissioned by + The Saint Lois University and The Princeton University (Mathematics + Department)}} +\author{Boris Veytsman\thanks{borisv@lk.net, boris@varphi.com}} \maketitle \tableofcontents -These scripts can be used to submit files to Crossref, check and add -doi numbers and ZbMath numbers to papers. +\section{Introduction} +These scripts can be used to submit files to Crossref, check and add +doi numbers, MathSciNet numbers and ZbMath numbers to papers, and to +convert `bbl' files to `bib' files. I am grateful to Josko Plazonic from Princeton Math Dept whose (unpublished) Python script was an inspiration for this suite. +The script \path{ltx2crossrefxml} is used to extract the information +from a \LaTeX\ file and generate an XML file suitable for submission +to Crossref (the organization that keeps DOI numbering system). + +Several scripts, \path{bibdoiadd}, \path{bibmradd} and \path{bibmradd} +take a \path{bib} file, and add to each entry a DOI, MR or ZBL number +correspondingly, if they can find this entry in the corresponding +database. + +Script \path{bbl2bib} tries to reconstruct a \path{bib} file from the +corresponding \path{thebibliography} environment. One can argue that +this operation is akin to reconstructing a cow from the steak. The +way the script does it is searching for the entry in the MR database, +and creating the corresponding Bib\TeX\ fields. + +Below are manual pages for these scripts. diff --git a/Master/texmf-dist/doc/support/crossrefware/ltx2crossrefxml.exe b/Master/texmf-dist/doc/support/crossrefware/ltx2crossrefxml.exe Binary files differnew file mode 100755 index 00000000000..1e8a872b845 --- /dev/null +++ b/Master/texmf-dist/doc/support/crossrefware/ltx2crossrefxml.exe diff --git a/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl b/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl new file mode 100755 index 00000000000..7a05297a0fd --- /dev/null +++ b/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl @@ -0,0 +1,259 @@ +#!/usr/bin/env perl + +=pod + +=head1 NAME + +bbl2bib.pl - convert thebibliography environment to a bib file + +=head1 SYNOPSIS + +bbl2bib.pl [B<-o> I<output>] I<file> + +=head1 OPTIONS + +=over 4 + + + +=item B<-o> I<output> + +Output file. If this option is not used, the name for the +output file is formed by changing the extension to C<.bib> + + +=back + +=head1 DESCRIPTION + +The script tries to reconstruct a C<bib> file from the corresponding +C<thebibliography> environment. One can argue that this operation is +akin to reconstructing a cow from the steak. The way the script does +it is searching for the entry in the MR database, and +creating the corresponding BibTeX fields. + +The script reads a TeX or Bbl file and extracts from it the +C<thebibliography> environment. For each bibitem it creates a plain +text bibliography entry, and then tries to match it in +the database. +=head1 INPUT FILE + +We assume some structure of the input file: + +=over 4 + +=item 1. + +The bibliography is contained between the lines + + \begin{thebibliography}... + +and + + \end{thebibliography} + +=item 2. + +Each bibliography item starts from the line + + \bibitem[...]{....} + +=back + + + +=head1 EXAMPLES + + bbl2bib -o - file.tex > result.bib + bbl2bib -o result.bib file.bbl + bbl2bib file.tex + +=head1 AUTHOR + +Boris Veytsman + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014-2017 Boris Veytsman + +This is free software. You may redistribute copies of it under the +terms of the GNU General Public License +L<http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the +extent permitted by law. + +=cut + +use strict; +BEGIN { + # find files relative to our installed location within TeX Live + chomp(my $TLMaster = `kpsewhich -var-value=SELFAUTOPARENT`); # TL root + if (length($TLMaster)) { + unshift @INC, "$TLMaster/texmf-dist/scripts/bibtexperllibs"; + } +} +use IO::File; +use BibTeX::Parser; +use FileHandle; +use LaTeX::ToUnicode qw (convert); +use Getopt::Std; +use URI::Escape; +use LWP::Simple; + +my $USAGE="USAGE: $0 [-o output] file\n"; +my $VERSION = <<END; +bbl2bib v2.1 +This is free software. You may redistribute copies of it under the +terms of the GNU General Public License +http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the +extent permitted by law. +$USAGE +END +our %opts; +getopts('c:o:s:hV',\%opts) or die $USAGE; + +if ($opts{h} || $opts{V}){ + print $VERSION; + exit 0; +} + +################################################################ +# Defaults and parameters +################################################################ + +my $inputfile = shift; + +my $outputfile = $inputfile; + +$outputfile =~ s/\.([^\.]*)$/.bib/; + +if (exists $opts{o}) { + $outputfile = $opts{o}; +} + + + +my $input= IO::File->new($inputfile) or + die "Cannot find Bbl or TeX file $inputfile\n$USAGE\n"; +my $output = IO::File->new("> $outputfile") or + die "Cannot write to $outputfile\n$USAGE\n"; + +my $userAgent = LWP::UserAgent->new; + + +# Bibitem is a hash with the entries 'key', 'text', 'mr', +# 'zbl' +my $bibitem; + +while (<$input>) { + if (!(/\\begin\{thebibliography\}/../\\end\{thebibliography\}/) || + /\\begin\{thebibliography\}/ || /\\end\{thebibliography\}/) { + next; + } + if (/\\bibitem(\[[^\]]*\])?\{([^\}]*)\}/) { + ProcessBibitem($bibitem); + $bibitem = undef; + $bibitem->{key}=$2; + $bibitem->{text}=""; + } + if (!/^\s*$/) { + $bibitem -> {text} .= $_; + } +} +ProcessBibitem($bibitem); + + +exit 0; + +sub ProcessBibitem { + my $bibitem = shift; + my $key = $bibitem->{key}; + my $text=$bibitem->{text}; + if (!length($text) || $text =~ /^\s+$/s) { + return; + } + + my $printtext = $text; + $printtext =~ s/^(.)/% $1/mg; + print $output "$printtext"; + $text =~ s/\n/ /mg; + $text =~ s/\\bibitem(\[[^\]]*\])?\{[^\}]*\}//; + + # Arxiv entry? + if ($text =~ s/\\arxiv\{([^\}]+)\}\.?//) { + $bibitem->{arxiv}=$1; + } + + # Mr number exists? + if ($text =~ s/\\mr\{([^\}]+)\}\.?//) { + $bibitem->{mr}=$1; + } + + # zbl number exists? + if ($text =~ s/\\zbl\{([^\}]+)\}\.?//) { + $bibitem->{zbl}=$1; + } + + # doi number exists? + if ($text =~ s/\\doi\{([^\}]+)\}\.?//) { + $bibitem->{doi}=$1; + } + + $bibitem->{bib} = SearchMref($bibitem); + PrintBibitem($bibitem); + return; +} + + +sub SearchMref { + my $bibitem = shift; + my $mirror = "http://www.ams.org/mathscinet-mref"; + my $string=uri_escape_utf8($bibitem->{text}); + my $response = $userAgent->get("$mirror?ref=$string&dataType=bibtex") -> + decoded_content(); + if ($response =~ /<pre>(.*)<\/pre>/s) { + my $bib= $1; + my $fh = new FileHandle; + open $fh, "<", \$bib; + my $parser = new BibTeX::Parser($fh); + my $entry = $parser->next; + if ($entry->parse_ok()) { + $entry->key($bibitem->{key}); + return ($entry); + } + } +} + + + + +sub PrintBibitem { + print "\n"; + my $bibitem = shift; + if (!ref($bibitem->{bib})) { + return; + } + my $entry=$bibitem->{bib}; + if ($bibitem->{mr} && ! $entry->field('mrnumber')) { + $entry->field('mrnumber', $bibitem->{mr}); + } + if ($entry->field('mrnumber')) { + my $mr=$entry->field('mrnumber'); + while (length($mr)<7) { + $mr = "0$mr"; + } + $mr=$entry->field('mrnumber', $mr); + } + if ($bibitem->{zbl} && ! $entry->field('zblnumber')) { + $entry->field('zblnumber', $bibitem->{zbl}); + } + if ($bibitem->{doi} && ! $entry->field('doi')) { + $entry->field('doi', $bibitem->{doi}); + } + if ($bibitem->{arxiv} && ! $entry->field('arxiv')) { + $entry->field('arxiv', $bibitem->{arxiv}); + } + + print $entry->to_string(), "\n\n"; +} + + diff --git a/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl b/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl index 8937729a3ba..bf7bc1a2856 100755 --- a/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl +++ b/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl @@ -8,7 +8,7 @@ bibdoiadd.pl - add DOI numbers to papers in a given bib file =head1 SYNOPSIS -bibdoiadd [B<-c> I<config_file>] [B<-f>] [B<-o> I<output>] I<bib_file> +bibdoiadd [B<-c> I<config_file>] [B<-e> 1|0] [B<-f>] [B<-o> I<output>] I<bib_file> =head1 OPTIONS @@ -19,6 +19,12 @@ bibdoiadd [B<-c> I<config_file>] [B<-f>] [B<-o> I<output>] I<bib_file> Configuration file. If this file is absent, some defaults are used. See below for its format. +=item B<-e> + +If 1 (default), add empty doi if a doi cannot be found. This prevents +repeated searches for the same entries if you add new entries to the +file. Calling C<-e 0> suppresses this behavior. + =item B<-f> Force checking doi number even if one is present @@ -59,15 +65,15 @@ The configuration file is mostly self-explanatory: it has comments $field = value ; -The important parameters are C<$mode> (C<'free'> or C<'paid'>, +The important parameters are C<$mode> (C<'free'> or C<'paid'>), C<$email> (for free users) and C<$username> & C<$password> for paid members. =head1 EXAMPLES - bibdoiadd -c bibdoiadd.cfg citations.bib > result.bib - bibdoiadd -c bibdoiadd.cfg citations.bib -o result.bib + bibdoiadd -c bibdoiadd.cfg -o - citations.bib > result.bib + bibdoiadd -c bibdoiadd.cfg -o result.bib citations.bib =head1 AUTHOR @@ -75,7 +81,7 @@ Boris Veytsman =head1 COPYRIGHT AND LICENSE -Copyright (C) 2014-2016 Boris Veytsman +Copyright (C) 2014-2017 Boris Veytsman This is free software. You may redistribute copies of it under the terms of the GNU General Public License @@ -99,17 +105,17 @@ use Getopt::Std; use URI::Escape; use LWP::Simple; -my $USAGE="USAGE: $0 [-c config] [-f] [-o output] file\n"; +my $USAGE="USAGE: $0 [-c config] [-e 1|0] [-f] [-o output] file\n"; my $VERSION = <<END; -bibdoiadd v2.0 +bibdoiadd v2.1 This is free software. You may redistribute copies of it under the terms of the GNU General Public License http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the extent permitted by law. $USAGE END -my %opts; -getopts('fc:o:hV',\%opts) or die $USAGE; +our %opts; +getopts('fe:c:o:hV',\%opts) or die $USAGE; if ($opts{h} || $opts{V}){ print $VERSION; @@ -126,12 +132,15 @@ my $outputfile = $inputfile; $outputfile =~ s/\.([^\.]*)$/_doi.$1/; -if ($opts{o}) { +if (exists $opts{o}) { $outputfile = $opts{o}; } my $forceSearch=$opts{f}; - +my $forceEmpty = 1; +if (exists $opts{e}) { + $forceEmpty = $opts{e}; +} our $mode='free'; our $email; @@ -196,7 +205,7 @@ while (my $entry = $parser->next) { my $doi = GetDoi($prefix, $entry); - if (length($doi)) { + if (length($doi) || $forceEmpty) { $entry->field('doi',$doi); } print $output $entry->to_string(), "\n\n"; diff --git a/Master/texmf-dist/scripts/crossrefware/bibmradd.pl b/Master/texmf-dist/scripts/crossrefware/bibmradd.pl new file mode 100755 index 00000000000..8b1c9938a56 --- /dev/null +++ b/Master/texmf-dist/scripts/crossrefware/bibmradd.pl @@ -0,0 +1,210 @@ +#!/usr/bin/env perl + +=pod + +=head1 NAME + +bibmradd.pl - add MR numbers to papers in a given bib file + +=head1 SYNOPSIS + +bibmradd [-d] [B<-f>] [B<-e> 1|0] [B<-o> I<output>] I<bib_file> + +=head1 OPTIONS + +=over 4 + +=item B<-d> + +Debug mode + +=item B<-e> + +If 1 (default), add an empty mrnumber if a mr cannot be found. This +prevents repeated searches for the same entries if you add new entries +to the file. Calling C<-e 0> suppresses this behavior. + + +=item B<-f> + +Force searching for MR numbers even if the entry already has one. + +=item B<-o> I<output> + +Output file. If this option is not used, the name for the +output file is formed by adding C<_mr> to the input file + +=back + +=head1 DESCRIPTION + +The script reads a BibTeX file. It checks whether the entries have +mrnumberss. If not, tries to contact internet to get the numbers. The +result is a BibTeX file with the fields +C<mrnumber=...> added. + +The name of the output file is either set by the B<-o> option or +is derived by adding the suffix C<_mr> to the output file. + +=head1 AUTHOR + +Boris Veytsman + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014-2017 Boris Veytsman + +This is free software. You may redistribute copies of it under the +terms of the GNU General Public License +L<http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the +extent permitted by law. + +=cut + +use strict; +BEGIN { + # find files relative to our installed location within TeX Live + chomp(my $TLMaster = `kpsewhich -var-value=SELFAUTOPARENT`); # TL root + if (length($TLMaster)) { + unshift @INC, "$TLMaster/texmf-dist/scripts/bibtexperllibs"; + } +} +use IO::File; +use BibTeX::Parser; +use Getopt::Std; +use URI::Escape; +use LWP::UserAgent; +$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; + +my $USAGE="USAGE: $0 [-d] [-e 1|0] [-f] [-o output] file\n"; +my $VERSION = <<END; +bibmradd v2.1 +This is free software. You may redistribute copies of it under the +terms of the GNU General Public License +http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the +extent permitted by law. +$USAGE +END +my %opts; +getopts('de:fo:hV',\%opts) or die $USAGE; + +if ($opts{h} || $opts{V}){ + print $VERSION; + exit 0; +} + +################################################################ +# Defaults and parameters +################################################################ + +my $inputfile = shift; + +my $outputfile = $inputfile; + +$outputfile =~ s/\.([^\.]*)$/_mr.$1/; + +if ($opts{o}) { + $outputfile = $opts{o}; +} + +my $forceSearch=$opts{f}; + +my $forceEmpty = 1; +if (exists $opts{e}) { + $forceEmpty = $opts{e}; +} + +my $debug = $opts{d}; + +my $input= IO::File->new($inputfile) or + die "Cannot find BibTeX file $inputfile\n$USAGE\n"; +my $output = IO::File->new("> $outputfile") or + die "Cannot write to $outputfile\n$USAGE\n"; + +my $parser=new BibTeX::Parser($input); + + + +# Creating the HTTP parameters +my $mirror = + "http://www.ams.org/mathscinet-mref"; +my $userAgent = LWP::UserAgent->new; + +while (my $entry = $parser->next ) { + if (!$entry->parse_ok()) { + print STDERR "Cannot understand entry: "; + $entry->print(*STDERR); + print STDERR "Skipping this entry\n"; + next; + } + if ($entry->has('mrnumber') && !$forceSearch) { + print $output $entry->raw_bibtex(), "\n\n"; + if ($debug) { + print STDERR "DEBUG: entry ", $entry->key(), + " has mrnumber ", $entry->field('mrnumber'), + " and no forced search is requested\n"; + } + next; + } + + + # Now we have an entry with no MR. Let us get to work. + if ($debug) { + print STDERR "DEBUG: Searching for mr number for entry ", + $entry->key, "\n"; + } + my $mr = GetMr($entry, $userAgent, $mirror); + if (length($mr) || $forceEmpty) { + $entry->field('mrnumber', $mr); + } + print $output $entry->to_string(), "\n\n"; + +} + +$input->close(); +$output->close(); +exit 0; + +############################################################### +# Getting one MR +############################################################### + +sub GetMr { + my $entry=shift; + my $userAgent=shift; + my $mirror=shift; + + my @query; + + my $string=uri_escape_utf8($entry->to_string()); + + if ($debug) { + print STDERR "DEBUG: query: $mirror?ref=$string&dataType=bibtex\n" ; + } + + + my $response = $userAgent->get("$mirror?ref=$string&dataType=bibtex"); + if ($debug) { + print STDERR "DEBUG: response: ", + $response->decoded_content, "\n"; + } + + if ($response->decoded_content =~ /MRNUMBER\s*=\s*{(.*)}/m) { + my $mr=$1; + # Somehow mref deletes leading zeros. They are needed! + while (length($mr)<7) { + $mr = "0$mr"; + } + if ($debug) { + print STDERR "DEBUG: got MR: $mr\n", + } + return $mr; + } else { + if ($debug) { + print STDERR "DEBUG: Did not get MR\n", + } + return (""); + } + +} + diff --git a/Master/texmf-dist/scripts/crossrefware/bibzbladd.pl b/Master/texmf-dist/scripts/crossrefware/bibzbladd.pl index f348cd4b946..b946766fdf9 100755 --- a/Master/texmf-dist/scripts/crossrefware/bibzbladd.pl +++ b/Master/texmf-dist/scripts/crossrefware/bibzbladd.pl @@ -8,12 +8,23 @@ bibzbladd.pl - add Zbl numbers to papers in a given bib file =head1 SYNOPSIS -bibzbladd [B<-f>] [B<-o> I<output>] I<bib_file> +bibzbladd [-d] [B<-f>] [B<-e> 1|0] [B<-o> I<output>] I<bib_file> =head1 OPTIONS =over 4 +=item B<-d> + +Debug mode + +=item B<-e> + +If 1 (default), add an empty zblnumber if a zbl cannot be found. This +prevents repeated searches for the same entries if you add new entries +to the file. Calling C<-e 0> suppresses this behavior. + + =item B<-f> Force searching for Zbl numbers even if the entry already has one. @@ -41,7 +52,7 @@ Boris Veytsman =head1 COPYRIGHT AND LICENSE -Copyright (C) 2014-2016 Boris Veytsman +Copyright (C) 2014-2017 Boris Veytsman This is free software. You may redistribute copies of it under the terms of the GNU General Public License @@ -63,10 +74,11 @@ use BibTeX::Parser; use Getopt::Std; use URI::Escape; use LWP::UserAgent; +$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; -my $USAGE="USAGE: $0 [-f] [-o output] file\n"; +my $USAGE="USAGE: $0 [-d] [-e 1|0] [-f] [-o output] file\n"; my $VERSION = <<END; -bibzbladd v2.0 +bibzbladd v2.1 This is free software. You may redistribute copies of it under the terms of the GNU General Public License http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the @@ -74,7 +86,7 @@ extent permitted by law. $USAGE END my %opts; -getopts('fo:hV',\%opts) or die $USAGE; +getopts('de:fo:hV',\%opts) or die $USAGE; if ($opts{h} || $opts{V}){ print $VERSION; @@ -97,6 +109,13 @@ if ($opts{o}) { my $forceSearch=$opts{f}; +my $forceEmpty = 1; +if (exists $opts{e}) { + $forceEmpty = $opts{e}; +} + +my $debug = $opts{d}; + my $input= IO::File->new($inputfile) or die "Cannot find BibTeX file $inputfile\n$USAGE\n"; my $output = IO::File->new("> $outputfile") or @@ -118,19 +137,24 @@ while (my $entry = $parser->next ) { print STDERR "Skipping this entry\n"; next; } - if (!($entry->type() eq 'ARTICLE')) { - print $output $entry->raw_bibtex(), "\n\n"; - next; - } if ($entry->has('zblnumber') && !$forceSearch) { print $output $entry->raw_bibtex(), "\n\n"; + if ($debug) { + print STDERR "DEBUG: entry ", $entry->key(), + " has zblnumber ", $entry->field('zblnumber'), + " and no forced search is requested\n"; + } next; } # Now we have an entry with no Zbl. Let us get to work. + if ($debug) { + print STDERR "DEBUG: Searching for zbl number for entry ", + $entry->key, "\n"; + } my $zbl = GetZbl($entry, $userAgent, $mirror); - if (length($zbl)) { + if (length($zbl) || $forceEmpty) { $entry->field('zblnumber',$zbl); } print $output $entry->to_string(), "\n\n"; @@ -154,12 +178,26 @@ sub GetZbl { my $string=uri_escape_utf8($entry->to_string()); + if ($debug) { + print STDERR "DEBUG: query: $mirror?bibtex=$string\n" ; + } my $response = $userAgent->get("$mirror?bibtex=$string"); + if ($debug) { + print STDERR "DEBUG: response: ", + $response->decoded_content, "\n"; + } + if ($response->decoded_content =~ /^\s*"zbl_id":\s*"(.*)",\s*$/m) { + if ($debug) { + print STDERR "DEBUG: got zbl: $1\n", + } return $1; } else { + if ($debug) { + print STDERR "DEBUG: Did not get zbl\n", + } return (""); } diff --git a/Master/texmf-dist/tex/latex/crossrefware/bibdoiadd.cfg b/Master/texmf-dist/tex/latex/crossrefware/bibdoiadd.cfg index 05becec62c9..6b79abbce2f 100644 --- a/Master/texmf-dist/tex/latex/crossrefware/bibdoiadd.cfg +++ b/Master/texmf-dist/tex/latex/crossrefware/bibdoiadd.cfg @@ -1,7 +1,8 @@ -$mode = 'paid'; # Other option is 'free' +#$mode = 'paid'; # Other option is 'free' +$mode = 'free'; # Other option is 'paid' $email = 'user@company.domain'; -$username = 'XXXXXX'; # For paid users -$password = 'XXXXXX'; # For paid users +#$username = 'XXXXXX'; # For paid users +#$password = 'XXXXXX'; # For paid users diff --git a/Master/tlpkg/tlpsrc/crossrefware.tlpsrc b/Master/tlpkg/tlpsrc/crossrefware.tlpsrc index 6929fb622ea..f71b9cef035 100644 --- a/Master/tlpkg/tlpsrc/crossrefware.tlpsrc +++ b/Master/tlpkg/tlpsrc/crossrefware.tlpsrc @@ -1,6 +1,12 @@ +binpattern f bin/${ARCH}/bbl2bib +docpattern +f texmf-dist/doc/man/man1/bbl2bib.* +# binpattern f bin/${ARCH}/bibdoiadd docpattern +f texmf-dist/doc/man/man1/bibdoiadd.* # +binpattern f bin/${ARCH}/bibmradd +docpattern +f texmf-dist/doc/man/man1/bibmradd.* +# binpattern f bin/${ARCH}/bibzbladd docpattern +f texmf-dist/doc/man/man1/bibzbladd.* # |