Home > best practices > Stamp Papers with Their Citation

Stamp Papers with Their Citation

Wouldn’t it be convenient if the citation of the paper was available as part of the pdf document? You wouldn’t have to google for the information.

We can do so with the help of a simple perl script — the stamp is formatted using latex and is integrated with the original document to generate another version that has the stamp at the top of the page.

Below is a snapshot of document that was stamped using this script. Note the publication venue, location, month and year of publication at the top of the paper. The pdf is available here.

stamp-research-paper-example

Here is the script:

#!/usr/bin/perl

$numArgs = $#ARGV + 1;
if($numArgs != 3){
    print "Usage: ./stamp.pl <input pdf> <output pdf> \"year etc.\"\n";
    exit;
}

$input_pdf = $ARGV[0];
$output_pdf = $ARGV[1];

$text = <<END 
\\documentclass[letter]{article}
\\usepackage{fancyhdr}
\\usepackage[left=2cm,top=1cm,right=2cm,nohead,nofoot]{geometry}
\\pagestyle{fancy}
\\begin{document}
%\\fancyhead[CO,CE]{\\protect \\centering $ARGV[2]}
\\centering $ARGV[2] 
\\fancyfoot[c]{} 
\\end{document}
END
; 

open TEX_OUT, '>stamp.tex';
print TEX_OUT $text;
close TEX_OUT;

system('pdflatex stamp.tex');
system("pdftk $input_pdf stamp stamp.pdf output $output_pdf"); 
Advertisements
Categories: best practices
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: