From f0bfa230b5547307448075d3be9b51aa5f1278ee Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 2 Jul 2008 22:06:39 -0400 Subject: sysenv/texpdf, xetex landscape pdf fix --- lib/sisu/v0/sysenv.rb | 22 ++++++++++++---------- lib/sisu/v0/texpdf.rb | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 5e8dbaba..3f23b7e5 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -665,9 +665,14 @@ module SiSU_Env end @texpdf end - def latex2pdf #convert from latex to pdf - tell=if @cmd =~/[MVv]/; '' - else '> /dev/null' + def latex2pdf(md=nil) #convert from latex to pdf + tell=((@cmd =~/[MVv]/) ? '' : '> /dev/null' ) + papersize='a4' + if md and defined? @md.papersize and md.papersize.empty? + papersize=if @md.papersize =~/(?:a4|letter|legal|book|a5|b5)\b/ + md.papersize + else papersize + end end mode='batchmode' #mode='nonstopmode' @@ -676,17 +681,14 @@ module SiSU_Env if @pdfetex_flag; texpdf_cmd=case texpdf when /xetex/ - if @input =~/landscape/ - #xetex -fmt=xelatex -papersize="a4 -l" icc.arbitration.rules.1998.sst.landscape.tex - #FIX get papersize - %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="a4 -l" #@input #{tell}\n} + if @input =~/landscape\.tex$/ + %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #@input #{tell}\n} else "#{texpdf} -interaction=#{mode} -fmt=xelatex #@input #{tell}\n" end when /xelatex/ - if @input =~/landscape/ - #xelatex -output-driver=xdvipdfmx -papersize="a4 -l" #where landscape.tex - %{#{texpdf} -interaction=#{mode} -papersize="a4 -l" #@input #{tell}\n} + if @input =~/landscape\.tex$/ + %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #@input #{tell}\n} else "#{texpdf} -interaction=#{mode} #@input #{tell}\n" end diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index a17033c8..1d37b588 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -169,13 +169,13 @@ module SiSU_TeX cmd=SiSU_Env::System_call.new("#{tex_fn_base}.tex",'',@md.cmd) tell=SiSU_Screen::Ansi.new(@md.cmd) tell.grey_open unless @md.cmd =~/q/ - 2.times { |i| cmd.latex2pdf unless ("#{tex_fn_base}.tex" !~/\w+/) } + 2.times { |i| cmd.latex2pdf(@md) unless ("#{tex_fn_base}.tex" !~/\w+/) } tell.p_off unless @md.cmd =~/q/ tell=SiSU_Screen::Ansi.new(@md.cmd,'landscape ->') tell.dark_grey_title_hi if @md.cmd =~/[MVv]/ cmd=SiSU_Env::System_call.new("#{tex_fn_base}.landscape.tex",'',@md.cmd) tell.grey_open - 2.times { |i| cmd.latex2pdf unless ("#{tex_fn_base}.landscape.tex" !~/\w+/) } + 2.times { |i| cmd.latex2pdf(@md) unless ("#{tex_fn_base}.landscape.tex" !~/\w+/) } tell.p_off unless @md.cmd =~/q/ pwd=Dir.pwd portrait_pdf="#{pwd}/#{tex_fn_base}.pdf" -- cgit v1.2.3