Created
February 15, 2012 17:40
-
-
Save crguezl/1837547 to your computer and use it in GitHub Desktop.
Example of Rakefile (used to produce pdf files from LaTeX source)
This file contains hidden or 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
LPPbook_git (master)$ rake -T | |
rake clean # Remove any temporary products. | |
rake clobber # Remove any generated file. | |
rake dist # Builds a zip file | |
rake html # Build the HTML from the latex sources | |
rake images # Copy images into perlexamples/ | |
rake perlexamples.pdf # Build perlexamples.pdf with index and biblio | |
rake perlexamples.tex # Builds perlexamples.tt2 (Using Perl Template) to LaTeX | |
rake perlexamples/index.html # Build the HTML from the latex sources | |
rake publichtml # Publish the HTML files into the remote server |
This file contains hidden or 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
# Moving to Git 7 12 2011 | |
# mac OS latex | |
#MacBook-Air-de-casiano:LPPbook casiano$ tree ~/Library/texmf/ | |
#/Users/casiano/Library/texmf/ | |
#├── bibtex | |
#├── makeindex | |
#└── tex | |
# └── latex | |
# └── html.sty | |
# | |
MAINNAME = 'perlexamples' | |
PDFLATEX = "/usr/texbin/pdflatex" | |
ZIPFILE = "LPPbook" | |
TEXFILES = ['ruby.tex', 'perlbib/perl.bib'] | |
LATEX2HTMLOPTIONS = '-html_version 4.0,latin1,unicode -contents_in_navigation -style mystyle.css -white -local_icons' | |
task :default => [:images, :publichtml, :dist] | |
desc "Build #{MAINNAME}.pdf with index and biblio" | |
file "#{MAINNAME}.pdf" => ["#{MAINNAME}.tex"]+TEXFILES do | |
sh "#{PDFLATEX} #{MAINNAME}.tex" | |
sh "bibtex #{MAINNAME}" | |
sh "makeindex -c #{MAINNAME}.idx" | |
sh "#{PDFLATEX} #{MAINNAME}.tex" | |
end | |
desc "Builds #{MAINNAME}.tt2 (Using Perl Template) to LaTeX" | |
file "#{MAINNAME}.tex" => [ "#{MAINNAME}.tt2"] do | |
sh %{perl booktt/commontex/tt2.pl} | |
end | |
require 'rake/clean' | |
CLEANLIST = [ "#{MAINNAME}.ps", '*.toc', '*.log', '*.dvi', '*.aux', '*.bbl', '*.blg', 'tmp'] | |
CLEAN.include(CLEANLIST) | |
task :clean do | |
sh "rm -fR #{MAINNAME}/" | |
end | |
desc "Build the HTML from the latex sources" | |
file "#{MAINNAME}/index.html" => "#{MAINNAME}.pdf" do | |
sh %Q{ | |
latex2html #{LATEX2HTMLOPTIONS} #{MAINNAME} | |
cp mystyle.css #{MAINNAME}/ | |
} | |
end | |
desc "Publish the HTML files into the remote server" | |
task :publichtml => [ :html, "#{ENV['HOME']}/public_html/#{MAINNAME}/index.html" ] | |
file "#{ENV['HOME']}/public_html/#{MAINNAME}/index.html" => "#{MAINNAME}/index.html" do | |
sh %Q{rsync -aue ssh #{MAINNAME}/ lpp:public_html/#{MAINNAME}/} | |
end | |
desc "Build the HTML from the latex sources" | |
task :html => "#{MAINNAME}/index.html" | |
desc "Builds a zip file" | |
task :dist do | |
sh "zip -r #{ZIPFILE}.zip #{MAINNAME}" | |
end | |
desc "Copy images into #{MAINNAME}/" | |
task :images do | |
sh %Q{ | |
test -d #{MAINNAME} || mkdir -p #{MAINNAME}/ | |
cp images/* #{MAINNAME}/ | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment