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
57
58
59
60
61
62
|
# File 'lib/omgtex/options.rb', line 6
def self.parse!
options = {:latexOptions => [ ]}
options[:typesetter] = "pdflatex"
optparse = OptionParser.new do|opts|
opts.banner = "Usage: omgtex [options] file.tex"
options[:openpdf] = false
opts.on('-o', '--open', 'Open PDF file after rendering') do
options[:openpdf] = true
end
options[:bibtex] = false
opts.on('-b', '--bibtex', 'Run BibTeX as well') do
options[:bibtex] = true
end
options[:glossary] = false
opts.on('-g', '--glossary', 'Generate glossary file') do
options[:glossary] = true
end
opts.on('-e', '--shell-escape', 'Shell escape-ish') do
options[:latexOptions].push("-shell-escape")
end
opts.on('-x', '--xelatex', 'Use XeLaTeX instead of pdflatex') do
options[:typesetter] = "xelatex"
end
opts.on('-t TYPESETTER', '--typesetter', 'Use this executable for typesetting LaTeX') do |l|
options[:typesetter] = l
end
opts.on('-n', '--dry-run') do
options[:dryrun] = true
end
opts.on('-d', '--dont-clean') do
options[:dontclean] = true
end
opts.on('-h', '--help', 'Display this message') do
puts opts
exit
end
opts.on('-l COMMAND', '--latex', 'Command to be passed to LateX command') do |l|
options[:latexOptions].push(l)
end
end
optparse.parse!
options
end
|