~mwshinn/+junk/notes

« back to all changes in this revision

Viewing changes to latexify-notes.pl.n

  • Committer: Max Shinn
  • Date: 2014-06-01 15:56:21 UTC
  • Revision ID: trombonechamp@gmail.com-20140601155621-unpq2iko5gf37vaa
Font fixes and incroporating doi references with natbib bibliography

Show diffs side-by-side

added added

removed removed

Lines of Context:
885
885
===>
886
886
# Implement ISBN with http://xisbn.worldcat.org/webservices/xid/isbn/1401307787?method=getMetadata&format=xml&fl=*
887
887
sub get_citation_from_doi {
888
 
    my $url = shift;
 
888
    my $doi = shift;
889
889
    my $output = "";
890
890
    # Resolve the DOI and write it to a text file
891
 
    $command = "curl -LH \"Accept: application/x-research-info-systems\" 'http://dx.doi.org/$url'";
892
 
    $bibcommand = "curl -LH \"Accept: text/bibliography; style=bibtex\" 'http://dx.doi.org/$url'";
 
891
    $command = "curl -LH \"Accept: application/x-research-info-systems\" 'http://dx.doi.org/$doi'";
 
892
    $bibcommand = "curl -LH \"Accept: text/bibliography; style=bibtex\" 'http://dx.doi.org/$doi'";
893
893
    if ($properties{'Debug'} ne "True") {
894
894
        $output = command_or_cache($command);
895
895
        if (exists $properties{'Bibliography'} && $properties{'Bibliography'} eq "auto") {
896
 
            $bibtex_entries .= command_or_cache($bibcommand) . "\n";
 
896
            my $bibtex_text = command_or_cache($bibcommand) . "\n";
 
897
            my $key = do {no Regexp::Grammars; $1 if ($bibtex_text =~ /\@article{([-A-Za-z0-9_]+),/);};
 
898
            do {no Regexp::Grammars; $key =~ s/_/-/;};
 
899
            $bibtex_entries .= $bibtex_text;
 
900
            return "\\citep{$key}";
897
901
        }
898
902
    }
899
903
    else {
908
912
        }
909
913
    }
910
914
    else {
911
 
        return $url;
 
915
        return "(doi:$doi)";
912
916
    }
913
917
}
914
918
# TODO get Bibtex entry for ISBNs
1647
1651
\\usepackage[pdftex]{graphicx}
1648
1652
\\usepackage{epstopdf}
1649
1653
\\epstopdfsetup{outdir=/tmp/}
 
1654
\\usepackage{microtype} % Supposed to make things look better
1650
1655
\\usepackage[colorlinks=true,filecolor=blue]{hyperref}\n";
1651
1656
 
1652
1657
if (exists $properties{'Project'}) { $subject = "ID: $id, Project: $properties{'Project'}"; }
1679
1684
\\usepackage{gensymb}
1680
1685
\\usepackage{amsmath}
1681
1686
\\usepackage{amssymb}
1682
 
\\renewcommand*\\rmdefault{ppl}\\normalfont\\upshape % Palatino font
 
1687
%\\renewcommand*\\rmdefault{ppl}\\normalfont\\upshape % Palatino font
 
1688
\\usepackage[sc]{mathpazo} % Palatino font
 
1689
%\\usepackage[T1]{fontenc} % Supposed to help copy and paste, but screws up bibliographies
1683
1690
 
1684
1691
\\usepackage{mathtools}
1685
1692
\\usepackage{bm} % For typesetting matrices