【发布时间】:2011-06-08 15:44:31
【问题描述】:
我有一个使用 erb 模板生成 Latex 文档的 Ruby 脚本。生成 .tex 文件后,我想进行系统调用以使用pdflatex 编译文档。以下是脚本的主要内容:
class Book
# initialize the class, query a database to get attributes, create the book, etc.
end
my_book = Book.new
tex_file = File.open("/path/to/raw/tex/template")
template = ERB.new(tex_file.read)
f = File.new("/path/to/tex/output.tex")
f.puts template.result
system "pdflatex /path/to/tex/output.tex"
system 行让我进入交互式 tex 输入模式,就好像文档是空的一样。如果我删除呼叫,文档将正常生成。如何确保在生成文档之前不会进行系统调用?与此同时,我只是使用一个调用 ruby 脚本的 bash 脚本,然后使用pdflatex 来解决这个问题。
【问题讨论】: