From 602a7b497284baa85bac466ba5c4e28ec9e7c554 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Wed, 27 Aug 2008 23:38:37 -0400
Subject: texpdf: landscape tables in two column text fixed; footnote margin
 increased

---
 CHANGELOG                    |  1 +
 lib/sisu/v0/texpdf_format.rb | 16 ++++++----------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index e6d12f84..9f6603d3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -27,6 +27,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz
     * url and urlbreaks line breaking fix
     * better representation of tilde
     * removal of a maths package gives back typeface changes like bold
+    * landscape output, tables fixed
 
   * middle layer, url representation changed, downstream code affected
 
diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb
index 58dca26e..b193a345 100644
--- a/lib/sisu/v0/texpdf_format.rb
+++ b/lib/sisu/v0/texpdf_format.rb
@@ -124,7 +124,6 @@ module SiSU_TeX_Pdf
         @@tableheader[@ps][:l]=1 if @txt =~/#{Mx[:gr_o]}Th/
         w=cols_width.split(/;\s*/)
         @@number_of_cols=no_of_cols ||=@@number_of_cols
-        #@@number_of_cols=0 unless @@number_of_cols.to_i > 0
         @colW=[]
         @colW << '{'
         w.each  do |x|
@@ -137,7 +136,7 @@ module SiSU_TeX_Pdf
         @colW=@colW.join
         @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +
           "\\begin{tiny}\n\\begin{longtable}#@colW\n"
-        @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,@start_table)
+        @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,"#@start_table")
       end
       if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
         @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}")
@@ -151,11 +150,10 @@ module SiSU_TeX_Pdf
           @txt.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break")
           @txt="#@txt \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
           @@tableheader[@ps][:l]=0
-          #@@tableheader[@ps][:l],@@number_of_cols=0,0
         end
       else
         if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u
-          @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,'\1&')
+          @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\1&')
           @txt.gsub!(/&\s*$/," #@row_break")
         end
       end
@@ -184,8 +182,7 @@ module SiSU_TeX_Pdf
         @colW << '{'
         w.each  do |x|
           x.strip!
-          x=(x.to_i * textwidth)/100
-          #x=(x.to_i/100.0 * 160)
+          x=(x.to_i * textwidth)/100 #x=(x.to_i/100.0 * 160)
           col_w=x.to_s # x.gsub(/.+/,'l\|') #unless x.nil?
           @colW << "p{#{col_w}mm}" if col_w
         end
@@ -193,21 +190,20 @@ module SiSU_TeX_Pdf
         @colW=@colW.join
         @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +
           "\\begin{tiny}\n\\begin{longtable}#@colW\n"
-        @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,"#@start_table")
+        @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,@start_table)
       end
       if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
         @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}")
       end
       @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
       if @@tableheader[@ps][:p] == 1
-        if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
+        if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u
           tablefoot=@txt[/\<!f(.+?)!\>/,1]
           @txt.gsub!(/\<!f(.+?)!\>/,'')
           @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&')
           @txt.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break")
           @txt="#@txt \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
           @@tableheader[@ps][:p]=0
-          #@@tableheader[@ps][:p],@@number_of_cols=0,0
         end
       else
         if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u
@@ -904,7 +900,7 @@ WOK
 \\makeatletter
 #{endnotes}
 \\usepackage[multiple,marginal]{footmisc}
-% \\setlength\\footnotemargin{40pt}
+\\setlength\\footnotemargin{-20pt}
 \\usepackage[para]{manyfoot}
 \\DeclareNewFootnote{A}
 %\\DeclareNewFootnote[para]{A}
-- 
cgit v1.2.3