Publish

\LaTeX is the recommended type-setting tool to write your papers and reports.

  • get an account on the Engineering Literature Database (maintained by Philip Eisenlohr)
  • download MacTeX and install
  • downgrade latexmk to version 4.22e
    cd $HOME/Library/TeXShop/bin/tslatexmk
    curl https://www.dropbox.com/s/y8bgp27jzxs06sl/latexmk-422e.zip?dl=0 > latexmk-422e.zip
    unzip -p latexmk-422e.zip latexmk.pl > latexmk_4.22e
    ln -sf latexmk_4.22e latexmk
    rm latexmk-422e.zip
    
  • install refbase script
    curl https://www.dropbox.com/s/q2d0qwrgms1m6z6/DOI2bib?dl=0 > /usr/local/bin/refbase
    
    chmod a+x /usr/local/bin/refbase
    
  • install DOI2bib script
    curl https://www.dropbox.com/s/fqitrk0nfbcif8i/refbase?dl=0 > /usr/local/bin/DOI2bib
    
    chmod a+x /usr/local/bin/DOI2bib
    

    This Python script depends on two modules that might require separate installation:

    • bibtexparser
    • habanero
  • set up the .latexmkrc configuration, replacing yourName and yourPwd with your Engineering Literature Database credentials
    curl https://www.dropbox.com/s/aepioh8uidfghqu/latexmkrc?dl=0 \
    | sed 's/USERNAME/yourName/g' \
    | sed 's/PWD/yourPwd/g' \
    > $HOME/.latexmkrc
    
  • install Mozilla::CA and/or CACertOrg::CA in case you encounter the error
    500 Can't verify SSL peers without knowing which Certificate Authorities to trust

    sudo cpan
    ::> install Mozilla::CA CACertOrg::CA
    
  • If latexmk does not run the custom dependency to automatically create the bibliography file, copy below script into your $PATH with a meaningful name (such as /usr/local/bin/assemble_bib) and call the command with
    assemble_bib LaTeXjobname
  • #!/usr/bin/env perl
    
    sub assemble_bib {
     @args = @_;
     DOI2bib(@args);
     refbase(@args);
     }
    
    sub DOI2bib {
     $source = $_[0];
     unlink('tmp.bib');
     system('DOI2bib'.
     ' '.$source.'.aux'.
     ' --bib tmp.bib');
     return 0;
     }
    
    sub refbase {
     $source = $_[0];
     system('refbase'.
     ' --host=https://www.egr.msu.edu/refbase/'.
     ' --user=YourEmail'.
     ' --password=YourPassword'.
     ' --extract='.$source.'.aux'.
     ' --format=bibtex'.
     ' --append=tmp.bib'.
     ' --update=1');
    
    open (OUT, ">$source".".bib") or warn ("Could not open bibliography output. $!");
     open (IN,"tmp.bib") or warn ("Non-existent bibliography");
     while (){
     s/title\s*=\s*"(.*)"/title = "{$1}"/g ;
     print OUT;
     }
     close (IN);
     close (OUT);
     unlink('tmp.bib');
     return 0;
     }
    assemble_bib(@ARGV);
    
Advertisements