-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
56 lines (42 loc) · 1.25 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
require "rake/clean"
task :default => [:evince]
SRC = "srug1.tex"
RUBY_SRC = FileList["*.rb"]
ERB_SRC = FileList["*.rhtml"]
HTML_SRC = FileList["*.html"]
SVG_IMG = FileList["*.svg"]
CLEAN.include(%w(*.toc *.aux *.log *.lof *.bib *.bbl *.blg *.out *.snm *.vrb *.nav),
RUBY_SRC.ext("tex"),
HTML_SRC.ext("tex"),
SVG_IMG.ext("png"),
ERB_SRC.ext("tex"))
CLOBBER.include(%w(pdf dvi ps).collect { |e| SRC.ext(e) })
def pdflatex(source)
sh "pdflatex -interaction=nonstopmode #{source}"
end
rule ".png" => ".svg" do |t|
sh "inkscape -e #{t.name} #{t.source}"
end
rule ".tex" => ".rb" do |t|
sh "pygmentize -f latex -o #{t.name} #{t.source}"
end
rule ".tex" => ".rhtml" do |t|
sh "pygmentize -f latex -o #{t.name} #{t.source}"
end
rule ".tex" => ".html" do |t|
sh "pygmentize -f latex -o #{t.name} #{t.source}"
end
rule ".pdf" => ".tex" do |t|
pdflatex(t.source)
end
file SRC.ext("pdf") => [SRC] + RUBY_SRC.ext("tex") + HTML_SRC.ext("tex") + SVG_IMG.ext("png") + ERB_SRC.ext("tex")
desc "Compile PDF"
task :pdf => SRC.ext("pdf")
desc "Show compiled PDF in Evince."
task :evince => :pdf do
sh "evince #{SRC.ext("pdf")}"
end
desc "Debug compilation"
task :debug => [RUBY_SRC.ext("tex")] do |t|
latex SRC
end