-
-
Save hsanchez/2468896 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rakefile for building tex file | |
require "rake/clean" | |
BASE = "documentname" | |
TYPE = ".tex" | |
OUT = ".pdf" | |
TEXFILE = FileList[BASE+TYPE] | |
OUTFILE = FileList[BASE+OUT] | |
BIBTEXCMD = "bibtex" | |
LATEXCMD = "pdflatex" | |
TEMP = ["*.aux", "*.bbl", "*.blg", "*.idx", "*.log", | |
"*.out", "*.toc", "*.dvi", "*.lot"] | |
task :default => [:bibtex, :latex, :clean] | |
desc "compile tex file" | |
task :latex do | |
latex | |
end | |
desc "compile literature with bibtex" | |
task :bibtex do | |
latex | |
sh %{#{BIBTEXCMD} "#{BASE}"} | |
end | |
desc "convert eps to pdf" | |
task :epsconvert do | |
IMAGES.each do |i| | |
dir = File.dirname(i) | |
file = File.basename(i, ".eps") | |
pdffile = dir+"/"+file+".pdf" | |
if not File.exists?(pdffile) | |
sh %{#{PSCMD} -dEPSCrop #{i} #{pdffile}} | |
end | |
end | |
end | |
CLEAN.include(TEMP) | |
CLOBBER.include(TEMP, OUTFILE) | |
# ruby method to compile latex, which can be | |
# run more than once per rake run | |
def latex | |
2.times do | |
sh %{#{LATEXCMD} "#{TEXFILE.to_s}"} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment