Warning: include_once(/home/nullvoid/blog.mikezhang.com/wp-content/plugins/wordpress-support/wordpress-support.php): failed to open stream: Permission denied in /home/nullvoid/blog.mikezhang.com/wp-settings.php on line 217

Warning: include_once(): Failed opening '/home/nullvoid/blog.mikezhang.com/wp-content/plugins/wordpress-support/wordpress-support.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/nullvoid/blog.mikezhang.com/wp-settings.php on line 217
NullVoid » Blast from Past: ExtractBib.pl NullVoid » Blog Archive » Blast from Past: ExtractBib.pl


Blast from Past: ExtractBib.pl

By ET

A number of years ago, I wrote a program to extract the right subset of bib entries for a tex file from a huge bibtex file.

Today I received the following email from Dr. Florian Kluge of Universität Augsburg, Institut für Informatik:

Dear Professor Zhang,

Some years ago I found your extractbib.pl script – it was a great alleviation
for me. Thank you for the gread work!
In the meantime, my requirements changed a bit, and thus I extended the script
to able to handle multiple .tex and .bib file.
I attached the extended version to this mail, please use/distribute it if you
like.

Best regards,
Florian Kluge

This is a delightful surprise. I’m very happy that my work could be reused.

I attached Dr. Kluge’s new script here, hopefully it will benefit more people.

Updated Script

 

5 Responses to “Blast from Past: ExtractBib.pl”

  1. Charli Says:

    Judy I wish I could tell you! But frost dates are not organized by zip code. You rllaey need to go to the and follow the instructions. I just added a screencast to help walk you through the process.Depending on where you live, your frost dates may not be listed in my chart. I am working on a solution for those who have earlier frost dates.

  2. 1bnj61 Says:

    我来看看,欢迎不欢迎?

  3. szap Says:

    I’ve noticed that your code will not extract a reference \cite{Author:2001} if there is also a citation for \cite{Author:2001a}. This and a few other bugs were plaguing my bib extraction process. I’ve pasted the new “extract” and “compare” code below:

    sub extract {
    my $out;
    $references=@references;
    print “\% Total Number of Citations: $references\n”;
    for (my $i=0; $i<=$references-1; $i++) {
    my $found=0;
    my $line;
    my $entry;
    foreach $line (@bibliography) {
    if (($found<2)) {
    if ($line=~m/{\s*$references[$i],/i) {
    print "Reference #: i=$i\n";
    print "$line matches:\n";
    print "{\s*$references[$i],\n";
    $found=1;
    $entry = $line;
    }
    elsif ($found==1) {
    $entry .= $line;
    if ( ($line=~m/}}\n/)) {
    $entry .= "\n";
    $found=2;
    }
    }
    }
    }
    if(($found==2)){
    print "found: $found\n";
    print "Entry:\n $entry";
    $out .= $entry;
    $found=3;
    } else {
    die "Reference: $references[$i] not found!";
    }
    }
    return $out;
    }

    ################################################################################

    sub compare {
    my $cite=shift;
    $cite=~ s/^\s+//;
    $cite=~ s/\s+$//;
    my $ismatch=0;
    @match = grep(/$cite/s, @references);
    print "COMPARE: $cite\n";
    for my $str (@match) {
    print " — against: $str\n";
    if($str eq $cite){
    print " — – is a match!: $str\n";
    $ismatch=1;
    }
    }
    if ($ismatch == 0){
    print " — $cite is new!\n";
    push(@references, $cite);
    }
    }

  4. zengda Says:

    不错,不错,看看了!

  5. QQ583258278 Says:

    博客不错,嘎嘎!

Leave a Reply


BlogTimer
You are visitor number several since September 1, 2001

Copyright Xiaoquan (Michael) Zhang, 2004-2020. All rights reserved.
All trademarks property of their owners.