erbtex 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6aa6baa55cd84b872ced3ccdd4a2935e5805ae29
4
+ data.tar.gz: d5c069096815028c9eb786d1cd3920ad5fbe6116
5
+ SHA512:
6
+ metadata.gz: eab55ecc60a34f11a6bdcd93d70ae8daf6a1c75443534e1913a7ac7495f45a80bed2291dacc8f4129ceef40349c9c7b6291f35d33ed9c8dd77d6ef942f81ca00
7
+ data.tar.gz: 65c04c3b86a0a694e2e064716844908271b7ad569a0a067d4bfc9c853da367d1d81a20edc58ee273b7ee0fd438eec5563401c8288c249df244074a646edc1311
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ *.aux
2
+ *.log
3
+ *.etx
4
+ *.out
5
+ *.pdf
6
+ *.gem
7
+ etc
8
+ auto
9
+ /.bundle/config
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,25 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ erbtex (0.2.0)
5
+ erubis
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ byebug (3.1.2)
11
+ columnize (~> 0.8)
12
+ debugger-linecache (~> 1.2)
13
+ columnize (0.8.9)
14
+ debugger-linecache (1.2.0)
15
+ erubis (2.7.0)
16
+ rake (10.3.2)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ bundler
23
+ byebug
24
+ erbtex!
25
+ rake
data/LICENCE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Daniel E. Doherty
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,127 @@
1
+ ErbTeX: Ruby pre-processing for TeX and LaTeX Documents
2
+ ==========
3
+
4
+ # Description
5
+
6
+ erbtex is a ruby gem that provides a command line program the
7
+ pre-processes TeX and LaTeX source files with ruby's erubis and then
8
+ passes the resulting file along to a real TeX program.
9
+
10
+ # Installation
11
+
12
+ Install it with:
13
+
14
+ gem install erbtex
15
+
16
+ # Usage
17
+
18
+ After the gem is installed, erbtex is placed in your PATH in front of
19
+ the real TeX and LaTeX programs, along with links to erbtex having the
20
+ names pdftex, pdflatex, luatex, and several other TeX processing
21
+ programs. Thus, invoking, for example, `pdflatex` runs `erbtex`
22
+ instead of the real `pdflatex` program.
23
+
24
+ It will then read the input file and execute any ruby code between the special
25
+ markers markers `{:` and `:}` and then find the real program further along
26
+ your path and run it on the pre-processed output. The result is that you can
27
+ use the ruby programming language to greatly increase the computational
28
+ capabilities of a normal TeX or LaTeX file.
29
+
30
+ erbtex simply uses the `erubis` program to pre-process the input, except that
31
+ it uses the `{: :}` delimiters instead of the erubis default of `<% %>`. The
32
+ brace-colon form of delimiters is less disruptive of syntax highlighting than
33
+ the default delimiters, which get confused with TeX and LaTeX comments.
34
+
35
+ If the opening delimiter has an `=` appended to it, the contained expression
36
+ is converted into a string and inserted in-place into the TeX manuscript at
37
+ that point. Without the `=` the code is simply executed. Loops started in
38
+ one ruby fragment can be continued or terminated in a later fragment, and
39
+ variables defined in one fragment in one fragment are visible in later
40
+ fragments according to Ruby's usual scoping rules.
41
+
42
+ # Example
43
+
44
+ For example, the following LaTeX file will produce a table of square
45
+ roots when run through erbtex. It uses a ruby iterator to supply the
46
+ rows of the table, a feat that would tedious at best with bare TeX or
47
+ LaTeX.
48
+
49
+ \documentclass{article}
50
+ \usepackage[mathbf]{euler}
51
+ \usepackage{longtable}
52
+
53
+ \begin{document}
54
+ \begin{longtable}[c]{r|r}
55
+ \hline\hline
56
+ \multicolumn{1}{c|}{\mathversion{bold}$x$}&
57
+ \multicolumn{1}{c}{\mathversion{bold}\rule{0pt}{12pt}$\sqrt{x}$}\\
58
+ \hline\hline
59
+ \endhead
60
+ \hline\hline
61
+ \endfoot
62
+ % The following line starts a ruby enumerator loop but does not
63
+ % produce any output, since the delimiters are {: :}.
64
+ {: 0.upto(100).each do |x| :}
65
+ % But the following two lines produce output since the opening
66
+ % delimiter is '{:='. Both call the sprintf method in ruby via the
67
+ % percent operator, and the second line calls ruby's Math module to
68
+ % compute the square root.
69
+ {:= "\\mathversion{bold}$%0.4f$" % x :}&
70
+ {:= "$%0.8f$" % Math.sqrt(x) :}\\
71
+ {: end :}
72
+ \end{longtable}
73
+ \end{document}
74
+
75
+ With the above in file `roots.tex`, running `$ pdflatex roots.tex` at
76
+ the command line will generate a `PDF` file with a nicely typeset
77
+ table of square roots.
78
+
79
+ As a by-product, the pre-processed file `roots.etx` is left in the
80
+ same directory, so you can see what the effect of the erbtex fragments
81
+ were. This is often very handy when you are trying to debug the
82
+ document; otherwise, it can be deleted. Here, for example is a
83
+ portion of the `roots.etx` file generated by the foregoing:
84
+
85
+ \begin{document}
86
+ \begin{longtable}[c]{r|r}
87
+ \hline\hline
88
+ \multicolumn{1}{c|}{\mathversion{bold}$x$}&
89
+ \multicolumn{1}{c}{\mathversion{bold}\rule{0pt}{12pt}$\sqrt{x}$}\\
90
+ \hline\hline
91
+ \endhead
92
+ \hline\hline
93
+ \endfoot
94
+ \mathversion{bold}$0.0000$&
95
+ $0.00000000$\\
96
+ \mathversion{bold}$1.0000$&
97
+ $1.00000000$\\
98
+ \mathversion{bold}$2.0000$&
99
+ $1.41421356$\\
100
+ \mathversion{bold}$3.0000$&
101
+ $1.73205081$\\
102
+ \mathversion{bold}$4.0000$&
103
+ $2.00000000$\\
104
+ \mathversion{bold}$5.0000$&
105
+ $2.23606798$\\
106
+ \mathversion{bold}$6.0000$&
107
+ $2.44948974$\\
108
+ \mathversion{bold}$7.0000$&
109
+ $2.64575131$\\
110
+ \mathversion{bold}$8.0000$&
111
+ $2.82842712$\\
112
+ \mathversion{bold}$9.0000$&
113
+ $3.00000000$\\
114
+ \mathversion{bold}$10.0000$&
115
+ $3.16227766$\\
116
+ \mathversion{bold}$11.0000$&
117
+ $3.31662479$\\
118
+ \mathversion{bold}$12.0000$&
119
+ $3.46410162$\\
120
+ \mathversion{bold}$13.0000$&
121
+ $3.60555128$\\
122
+ \mathversion{bold}$14.0000$&
123
+
124
+ And many more lines like it.
125
+
126
+ The examples directory installed with the erbtex gem has a few more
127
+ examples.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'rake/testtask'
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ task :default => :test
7
+ desc "Run all the unit tests"
8
+ task :test do
9
+ Dir.foreach('test') do |t|
10
+ next if t == 'test_helper.rb'
11
+ next if t =~ /^\.\.?/
12
+ cmd = "ruby -I 'test' -C 'test' #{t}"
13
+ system cmd
14
+ end
15
+ end
data/bin/erbtex ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ verbose = true
4
+
5
+ # This adds our lib subdirectory to the ruby load path
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ # This adds our RUBYLIB env to ruby load path
9
+ if ENV['RUBYLIB']
10
+ STDERR.puts "ENV['RUBYLIB']:" if verbose
11
+ ENV['RUBYLIB'].split(':').each do |p|
12
+ $LOAD_PATH.unshift p
13
+ STDERR.puts "\t#{p}" if verbose
14
+ end
15
+ else
16
+ STDERR.puts "ENV['RUBYLIB'] is EMPTY" if verbose
17
+ end
18
+
19
+ require 'erbtex'
20
+
21
+ progname = File.basename($0)
22
+ commandline = progname
23
+ ARGV.each do |a|
24
+ if a =~ /\s/
25
+ a = "'" + a + "'"
26
+ end
27
+ commandline += " #{a}"
28
+ end
29
+
30
+ if verbose
31
+ STDERR.puts "Program name: #{progname}"
32
+ STDERR.puts "Command line: #{commandline}"
33
+ STDERR.puts "Ruby Load path:"
34
+ $:.each do |p|
35
+ STDERR.puts "\t#{p}"
36
+ end
37
+ STDERR.puts 'ARGV:'
38
+ ARGV.each do |a|
39
+ STDERR.puts "\t#{a}"
40
+ end
41
+ STDERR.puts 'PATH:'
42
+ ENV['PATH'].split(':').each do |p|
43
+ STDERR.puts "\t#{p}"
44
+ end
45
+ STDERR.puts "Executable: "
46
+ STDERR.puts ErbTeX.find_executable($0)
47
+ end
48
+
49
+ ErbTeX.run(commandline)
data/bin/etex ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ verbose = true
4
+
5
+ # This adds our lib subdirectory to the ruby load path
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ # This adds our RUBYLIB env to ruby load path
9
+ if ENV['RUBYLIB']
10
+ STDERR.puts "ENV['RUBYLIB']:" if verbose
11
+ ENV['RUBYLIB'].split(':').each do |p|
12
+ $LOAD_PATH.unshift p
13
+ STDERR.puts "\t#{p}" if verbose
14
+ end
15
+ else
16
+ STDERR.puts "ENV['RUBYLIB'] is EMPTY" if verbose
17
+ end
18
+
19
+ require 'erbtex'
20
+
21
+ progname = File.basename($0)
22
+ commandline = progname
23
+ ARGV.each do |a|
24
+ if a =~ /\s/
25
+ a = "'" + a + "'"
26
+ end
27
+ commandline += " #{a}"
28
+ end
29
+
30
+ if verbose
31
+ STDERR.puts "Program name: #{progname}"
32
+ STDERR.puts "Command line: #{commandline}"
33
+ STDERR.puts "Ruby Load path:"
34
+ $:.each do |p|
35
+ STDERR.puts "\t#{p}"
36
+ end
37
+ STDERR.puts 'ARGV:'
38
+ ARGV.each do |a|
39
+ STDERR.puts "\t#{a}"
40
+ end
41
+ STDERR.puts 'PATH:'
42
+ ENV['PATH'].split(':').each do |p|
43
+ STDERR.puts "\t#{p}"
44
+ end
45
+ STDERR.puts "Executable: "
46
+ STDERR.puts ErbTeX.find_executable($0)
47
+ end
48
+
49
+ ErbTeX.run(commandline)
data/bin/latex ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ verbose = true
4
+
5
+ # This adds our lib subdirectory to the ruby load path
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ # This adds our RUBYLIB env to ruby load path
9
+ if ENV['RUBYLIB']
10
+ STDERR.puts "ENV['RUBYLIB']:" if verbose
11
+ ENV['RUBYLIB'].split(':').each do |p|
12
+ $LOAD_PATH.unshift p
13
+ STDERR.puts "\t#{p}" if verbose
14
+ end
15
+ else
16
+ STDERR.puts "ENV['RUBYLIB'] is EMPTY" if verbose
17
+ end
18
+
19
+ require 'erbtex'
20
+
21
+ progname = File.basename($0)
22
+ commandline = progname
23
+ ARGV.each do |a|
24
+ if a =~ /\s/
25
+ a = "'" + a + "'"
26
+ end
27
+ commandline += " #{a}"
28
+ end
29
+
30
+ if verbose
31
+ STDERR.puts "Program name: #{progname}"
32
+ STDERR.puts "Command line: #{commandline}"
33
+ STDERR.puts "Ruby Load path:"
34
+ $:.each do |p|
35
+ STDERR.puts "\t#{p}"
36
+ end
37
+ STDERR.puts 'ARGV:'
38
+ ARGV.each do |a|
39
+ STDERR.puts "\t#{a}"
40
+ end
41
+ STDERR.puts 'PATH:'
42
+ ENV['PATH'].split(':').each do |p|
43
+ STDERR.puts "\t#{p}"
44
+ end
45
+ STDERR.puts "Executable: "
46
+ STDERR.puts ErbTeX.find_executable($0)
47
+ end
48
+
49
+ ErbTeX.run(commandline)
data/bin/lualatex ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ verbose = true
4
+
5
+ # This adds our lib subdirectory to the ruby load path
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ # This adds our RUBYLIB env to ruby load path
9
+ if ENV['RUBYLIB']
10
+ STDERR.puts "ENV['RUBYLIB']:" if verbose
11
+ ENV['RUBYLIB'].split(':').each do |p|
12
+ $LOAD_PATH.unshift p
13
+ STDERR.puts "\t#{p}" if verbose
14
+ end
15
+ else
16
+ STDERR.puts "ENV['RUBYLIB'] is EMPTY" if verbose
17
+ end
18
+
19
+ require 'erbtex'
20
+
21
+ progname = File.basename($0)
22
+ commandline = progname
23
+ ARGV.each do |a|
24
+ if a =~ /\s/
25
+ a = "'" + a + "'"
26
+ end
27
+ commandline += " #{a}"
28
+ end
29
+
30
+ if verbose
31
+ STDERR.puts "Program name: #{progname}"
32
+ STDERR.puts "Command line: #{commandline}"
33
+ STDERR.puts "Ruby Load path:"
34
+ $:.each do |p|
35
+ STDERR.puts "\t#{p}"
36
+ end
37
+ STDERR.puts 'ARGV:'
38
+ ARGV.each do |a|
39
+ STDERR.puts "\t#{a}"
40
+ end
41
+ STDERR.puts 'PATH:'
42
+ ENV['PATH'].split(':').each do |p|
43
+ STDERR.puts "\t#{p}"
44
+ end
45
+ STDERR.puts "Executable: "
46
+ STDERR.puts ErbTeX.find_executable($0)
47
+ end
48
+
49
+ ErbTeX.run(commandline)
data/bin/luatex ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ verbose = true
4
+
5
+ # This adds our lib subdirectory to the ruby load path
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ # This adds our RUBYLIB env to ruby load path
9
+ if ENV['RUBYLIB']
10
+ STDERR.puts "ENV['RUBYLIB']:" if verbose
11
+ ENV['RUBYLIB'].split(':').each do |p|
12
+ $LOAD_PATH.unshift p
13
+ STDERR.puts "\t#{p}" if verbose
14
+ end
15
+ else
16
+ STDERR.puts "ENV['RUBYLIB'] is EMPTY" if verbose
17
+ end
18
+
19
+ require 'erbtex'
20
+
21
+ progname = File.basename($0)
22
+ commandline = progname
23
+ ARGV.each do |a|
24
+ if a =~ /\s/
25
+ a = "'" + a + "'"
26
+ end
27
+ commandline += " #{a}"
28
+ end
29
+
30
+ if verbose
31
+ STDERR.puts "Program name: #{progname}"
32
+ STDERR.puts "Command line: #{commandline}"
33
+ STDERR.puts "Ruby Load path:"
34
+ $:.each do |p|
35
+ STDERR.puts "\t#{p}"
36
+ end
37
+ STDERR.puts 'ARGV:'
38
+ ARGV.each do |a|
39
+ STDERR.puts "\t#{a}"
40
+ end
41
+ STDERR.puts 'PATH:'
42
+ ENV['PATH'].split(':').each do |p|
43
+ STDERR.puts "\t#{p}"
44
+ end
45
+ STDERR.puts "Executable: "
46
+ STDERR.puts ErbTeX.find_executable($0)
47
+ end
48
+
49
+ ErbTeX.run(commandline)
data/bin/pdfetex ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ verbose = true
4
+
5
+ # This adds our lib subdirectory to the ruby load path
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ # This adds our RUBYLIB env to ruby load path
9
+ if ENV['RUBYLIB']
10
+ STDERR.puts "ENV['RUBYLIB']:" if verbose
11
+ ENV['RUBYLIB'].split(':').each do |p|
12
+ $LOAD_PATH.unshift p
13
+ STDERR.puts "\t#{p}" if verbose
14
+ end
15
+ else
16
+ STDERR.puts "ENV['RUBYLIB'] is EMPTY" if verbose
17
+ end
18
+
19
+ require 'erbtex'
20
+
21
+ progname = File.basename($0)
22
+ commandline = progname
23
+ ARGV.each do |a|
24
+ if a =~ /\s/
25
+ a = "'" + a + "'"
26
+ end
27
+ commandline += " #{a}"
28
+ end
29
+
30
+ if verbose
31
+ STDERR.puts "Program name: #{progname}"
32
+ STDERR.puts "Command line: #{commandline}"
33
+ STDERR.puts "Ruby Load path:"
34
+ $:.each do |p|
35
+ STDERR.puts "\t#{p}"
36
+ end
37
+ STDERR.puts 'ARGV:'
38
+ ARGV.each do |a|
39
+ STDERR.puts "\t#{a}"
40
+ end
41
+ STDERR.puts 'PATH:'
42
+ ENV['PATH'].split(':').each do |p|
43
+ STDERR.puts "\t#{p}"
44
+ end
45
+ STDERR.puts "Executable: "
46
+ STDERR.puts ErbTeX.find_executable($0)
47
+ end
48
+
49
+ ErbTeX.run(commandline)
data/bin/pdflatex ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ verbose = true
4
+
5
+ # This adds our lib subdirectory to the ruby load path
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ # This adds our RUBYLIB env to ruby load path
9
+ if ENV['RUBYLIB']
10
+ STDERR.puts "ENV['RUBYLIB']:" if verbose
11
+ ENV['RUBYLIB'].split(':').each do |p|
12
+ $LOAD_PATH.unshift p
13
+ STDERR.puts "\t#{p}" if verbose
14
+ end
15
+ else
16
+ STDERR.puts "ENV['RUBYLIB'] is EMPTY" if verbose
17
+ end
18
+
19
+ require 'erbtex'
20
+
21
+ progname = File.basename($0)
22
+ commandline = progname
23
+ ARGV.each do |a|
24
+ if a =~ /\s/
25
+ a = "'" + a + "'"
26
+ end
27
+ commandline += " #{a}"
28
+ end
29
+
30
+ if verbose
31
+ STDERR.puts "Program name: #{progname}"
32
+ STDERR.puts "Command line: #{commandline}"
33
+ STDERR.puts "Ruby Load path:"
34
+ $:.each do |p|
35
+ STDERR.puts "\t#{p}"
36
+ end
37
+ STDERR.puts 'ARGV:'
38
+ ARGV.each do |a|
39
+ STDERR.puts "\t#{a}"
40
+ end
41
+ STDERR.puts 'PATH:'
42
+ ENV['PATH'].split(':').each do |p|
43
+ STDERR.puts "\t#{p}"
44
+ end
45
+ STDERR.puts "Executable: "
46
+ STDERR.puts ErbTeX.find_executable($0)
47
+ end
48
+
49
+ ErbTeX.run(commandline)
data/bin/pdftex ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ verbose = true
4
+
5
+ # This adds our lib subdirectory to the ruby load path
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ # This adds our RUBYLIB env to ruby load path
9
+ if ENV['RUBYLIB']
10
+ STDERR.puts "ENV['RUBYLIB']:" if verbose
11
+ ENV['RUBYLIB'].split(':').each do |p|
12
+ $LOAD_PATH.unshift p
13
+ STDERR.puts "\t#{p}" if verbose
14
+ end
15
+ else
16
+ STDERR.puts "ENV['RUBYLIB'] is EMPTY" if verbose
17
+ end
18
+
19
+ require 'erbtex'
20
+
21
+ progname = File.basename($0)
22
+ commandline = progname
23
+ ARGV.each do |a|
24
+ if a =~ /\s/
25
+ a = "'" + a + "'"
26
+ end
27
+ commandline += " #{a}"
28
+ end
29
+
30
+ if verbose
31
+ STDERR.puts "Program name: #{progname}"
32
+ STDERR.puts "Command line: #{commandline}"
33
+ STDERR.puts "Ruby Load path:"
34
+ $:.each do |p|
35
+ STDERR.puts "\t#{p}"
36
+ end
37
+ STDERR.puts 'ARGV:'
38
+ ARGV.each do |a|
39
+ STDERR.puts "\t#{a}"
40
+ end
41
+ STDERR.puts 'PATH:'
42
+ ENV['PATH'].split(':').each do |p|
43
+ STDERR.puts "\t#{p}"
44
+ end
45
+ STDERR.puts "Executable: "
46
+ STDERR.puts ErbTeX.find_executable($0)
47
+ end
48
+
49
+ ErbTeX.run(commandline)
data/bin/pslatex ADDED
@@ -0,0 +1,49 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ verbose = true
4
+
5
+ # This adds our lib subdirectory to the ruby load path
6
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
7
+
8
+ # This adds our RUBYLIB env to ruby load path
9
+ if ENV['RUBYLIB']
10
+ STDERR.puts "ENV['RUBYLIB']:" if verbose
11
+ ENV['RUBYLIB'].split(':').each do |p|
12
+ $LOAD_PATH.unshift p
13
+ STDERR.puts "\t#{p}" if verbose
14
+ end
15
+ else
16
+ STDERR.puts "ENV['RUBYLIB'] is EMPTY" if verbose
17
+ end
18
+
19
+ require 'erbtex'
20
+
21
+ progname = File.basename($0)
22
+ commandline = progname
23
+ ARGV.each do |a|
24
+ if a =~ /\s/
25
+ a = "'" + a + "'"
26
+ end
27
+ commandline += " #{a}"
28
+ end
29
+
30
+ if verbose
31
+ STDERR.puts "Program name: #{progname}"
32
+ STDERR.puts "Command line: #{commandline}"
33
+ STDERR.puts "Ruby Load path:"
34
+ $:.each do |p|
35
+ STDERR.puts "\t#{p}"
36
+ end
37
+ STDERR.puts 'ARGV:'
38
+ ARGV.each do |a|
39
+ STDERR.puts "\t#{a}"
40
+ end
41
+ STDERR.puts 'PATH:'
42
+ ENV['PATH'].split(':').each do |p|
43
+ STDERR.puts "\t#{p}"
44
+ end
45
+ STDERR.puts "Executable: "
46
+ STDERR.puts ErbTeX.find_executable($0)
47
+ end
48
+
49
+ ErbTeX.run(commandline)