From 1716ccd079dc399190804ede2b2b08bf19c0a3b3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 May 2014 21:38:34 -0400 Subject: v6: texpdf, (internal coding) use symbols to identify page orientation --- lib/sisu/v6/texpdf.rb | 16 ++++++++-------- lib/sisu/v6/texpdf_format.rb | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v6/texpdf.rb b/lib/sisu/v6/texpdf.rb index 97961701..b3636154 100644 --- a/lib/sisu/v6/texpdf.rb +++ b/lib/sisu/v6/texpdf.rb @@ -746,12 +746,12 @@ module SiSU_TeX title=@md.title.full.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex @md.papersize_array.each do |ps| if @md.opt.act[:pdf_p][:set]==:on - txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'portrait' } + txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: :portrait } orient_portrait=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation(@codeblock_box) end if @md.opt.act[:pdf_l][:set]==:on - txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'landscape' } + txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: :landscape } orient_landscape=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj) @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box) end @@ -843,30 +843,30 @@ module SiSU_TeX \\renewcommand{\\contentsname}{#{@translate.contents}} \\tableofcontents WOK - toc_pb={ l: @tex_ml.newpage('landscape'), p: @tex_ml.newpage('portrait') } + toc_pb={ l: @tex_ml.newpage(:landscape), p: @tex_ml.newpage(:portrait) } else toc='' toc_pb={ l: '', p: '' } end if @md.opt.act[:pdf_l][:set]==:on x[:l] =<<-WOK -#{@tex_ml.newpage('landscape')} +#{@tex_ml.newpage(:landscape)} \\pagestyle{fancy} #{toc}#{toc_pb[:l]} \\pagenumbering{arabic} #{@tex_ml.paraskip_normal} -#{@tex_ml.newpage('landscape')} +#{@tex_ml.newpage(:landscape)} WOK end if @md.opt.act[:pdf_p][:set]==:on x[:p] =<<-WOK -#{@tex_ml.newpage('portrait')} +#{@tex_ml.newpage(:portrait)} \\pagestyle{fancy} #{toc}#{toc_pb[:p]} -#{@tex_ml.newpage('portrait')} +#{@tex_ml.newpage(:portrait)} \\pagenumbering{arabic} #{@tex_ml.paraskip_normal} -#{@tex_ml.newpage('portrait')} +#{@tex_ml.newpage(:portrait)} WOK end @tex_file << x diff --git a/lib/sisu/v6/texpdf_format.rb b/lib/sisu/v6/texpdf_format.rb index c1bd0f1c..ea5f383f 100644 --- a/lib/sisu/v6/texpdf_format.rb +++ b/lib/sisu/v6/texpdf_format.rb @@ -920,7 +920,7 @@ module SiSU_TeX_Pdf def tex_head_paper_dimensions d={} case @layout - when /portrait/ + when :portrait d[:papertype],d[:fontsize]='a4paper','11pt' d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='0mm','0mm','-12pt' d[:headheight],d[:headsep],d[:columnsep]='12pt','35pt','' @@ -950,7 +950,7 @@ module SiSU_TeX_Pdf d[:papertype],d[:fontsize]='a4paper','12pt' d[:textheight],d[:textwidth]=@tx.a4.portrait.h,@tx.a4.portrait.w end - when /landscape/ + when :landscape d[:papertype],d[:fontsize]='a4paper','11pt' d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='6mm','6mm','-12mm' d[:headheight],d[:headsep],d[:columnsep]='12pt','20pt','40pt' @@ -980,22 +980,22 @@ module SiSU_TeX_Pdf end def tex_head_paper case @layout - when /portrait/ + when :portrait tex_head_paper_portrait(tex_head_paper_dimensions) - when /landscape/ + when :landscape tex_head_paper_landscape(tex_head_paper_dimensions) end end def tex_head_pdftex_dvi color=case @layout - when /portrait/ + when :portrait <<-WOK colorlinks=true, urlcolor=myblack, filecolor=myblack, linkcolor=myblack, WOK - when /landscape/ + when :landscape <<-WOK colorlinks=true, urlcolor=myblue, % \\href{...}{...} external url @@ -1003,8 +1003,9 @@ module SiSU_TeX_Pdf linkcolor=myred, % \\href{...} and \\pageref{...} WOK end - if @layout =~/portrait|landscape/ - <<-WOK + if @layout == :portrait \ + or @layout == :landscape + <<-WOK \\usepackage{alltt} \\usepackage{thumbpdf} \\usepackage[#{@tex2pdf}, @@ -1484,11 +1485,11 @@ module SiSU_TeX_Pdf #BOOK standard dimensions - 229x156 def newpage(orientation) case orientation - when /landscape/ # using longtable latex package + when :landscape # using longtable latex package <<-WOK \\clearpage WOK - when /portrait/ + when :portrait <<-WOK \\newpage WOK -- cgit v1.2.3