From c90b426f37846af90bc9a8138c42976947b6a899 Mon Sep 17 00:00:00 2001 From: HARIKITsuyoshi Date: Tue, 4 Dec 2012 12:54:27 +0900 Subject: [PATCH] Enable dvipdfmx --- lib/rtex/document.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/rtex/document.rb b/lib/rtex/document.rb index 3b0fc09..a30c73b 100644 --- a/lib/rtex/document.rb +++ b/lib/rtex/document.rb @@ -25,6 +25,8 @@ def self.options :preprocessor => 'latex', :preprocess => false, :processor => 'pdflatex', + :postprocessor => 'dvipdfmx', + :postprocess => false, # :shell_redirect => nil, # Temporary Directory @@ -83,6 +85,10 @@ def preprocessor #:nodoc: @preprocessor ||= check_path_for @options[:preprocessor] end + def postprocessor #:nodoc: + @postprocessor ||= check_path_for @options[:postprocessor] + end + def system_path #:nodoc: ENV['PATH'] end @@ -106,6 +112,7 @@ def process_pdf_from(input, &file_handler) if generating? preprocess! if preprocessing? process! + postprocess! if postprocessing? verify! end if file_handler @@ -128,14 +135,28 @@ def preprocess! end end + def postprocess! + unless `#{postprocessor} #{dvi_file} #{@options[:shell_redirect]}` + raise GenerationError, "Could not postprocess using #{postprocessor}" + end + end + def preprocessing? @options[:preprocess] end + def postprocessing? + @options[:postprocess] + end + def source_file @source_file ||= file(:tex) end + def dvi_file + @dvi_file ||= file(:dvi) + end + def log_file @log_file ||= file(:log) end