Skip to content

Instantly share code, notes, and snippets.

@mrtazz
Created March 16, 2010 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrtazz/334160 to your computer and use it in GitHub Desktop.
Save mrtazz/334160 to your computer and use it in GitHub Desktop.
# 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