texpdf, indent values, use formula (to replace table)
[software/sisu] / lib / sisu / texpdf_format.rb
index 5549a24534b813dc9cd7864c250192a94b29f8e5..5c9d2c9d3f65d3962da838f929d0866c2c0cc597 100644 (file)
@@ -318,138 +318,9 @@ module SiSU_TeX_Pdf
       heading_sublevels(@dob)
     end
     def hang
-      case @dob.indent
-      when /0/
-        case @dob.hang
-        when /0/ then indent,hang='0mm', '0mm'
-        when /1/ then indent,hang='0mm','10mm'
-        when /2/ then indent,hang='0mm','20mm'
-        when /3/ then indent,hang='0mm','30mm'
-        when /4/ then indent,hang='0mm','40mm'
-        when /5/ then indent,hang='0mm','50mm'
-        when /6/ then indent,hang='0mm','60mm'
-        when /7/ then indent,hang='0mm','70mm'
-        when /8/ then indent,hang='0mm','80mm'
-        when /9/ then indent,hang='0mm','90mm'
-        end
-      when /1/
-        case @dob.hang
-        when /0/ then indent,hang='10mm','-10mm'
-        when /1/ then indent,hang='10mm',  '0mm'
-        when /2/ then indent,hang='10mm', '10mm'
-        when /3/ then indent,hang='10mm', '20mm'
-        when /4/ then indent,hang='10mm', '30mm'
-        when /5/ then indent,hang='10mm', '40mm'
-        when /6/ then indent,hang='10mm', '50mm'
-        when /7/ then indent,hang='10mm', '60mm'
-        when /8/ then indent,hang='10mm', '70mm'
-        when /9/ then indent,hang='10mm', '80mm'
-        end
-      when /2/
-        case @dob.hang
-        when /0/ then indent,hang='20mm','-20mm'
-        when /1/ then indent,hang='20mm','-10mm'
-        when /2/ then indent,hang='20mm',  '0mm'
-        when /3/ then indent,hang='20mm', '10mm'
-        when /4/ then indent,hang='20mm', '20mm'
-        when /5/ then indent,hang='20mm', '30mm'
-        when /6/ then indent,hang='20mm', '40mm'
-        when /7/ then indent,hang='20mm', '50mm'
-        when /8/ then indent,hang='20mm', '60mm'
-        when /9/ then indent,hang='20mm', '70mm'
-        end
-      when /3/
-        case @dob.hang
-        when /0/ then indent,hang='30mm','-30mm'
-        when /1/ then indent,hang='30mm','-20mm'
-        when /2/ then indent,hang='30mm','-10mm'
-        when /3/ then indent,hang='30mm',  '0mm'
-        when /4/ then indent,hang='30mm', '10mm'
-        when /5/ then indent,hang='30mm', '20mm'
-        when /6/ then indent,hang='30mm', '30mm'
-        when /7/ then indent,hang='30mm', '40mm'
-        when /8/ then indent,hang='30mm', '50mm'
-        when /9/ then indent,hang='30mm', '60mm'
-        end
-      when /4/
-        case @dob.hang
-        when /0/ then indent,hang='40mm','-40mm'
-        when /1/ then indent,hang='40mm','-30mm'
-        when /2/ then indent,hang='40mm','-20mm'
-        when /3/ then indent,hang='40mm','-10mm'
-        when /4/ then indent,hang='40mm',  '0mm'
-        when /5/ then indent,hang='40mm', '10mm'
-        when /6/ then indent,hang='40mm', '20mm'
-        when /7/ then indent,hang='40mm', '30mm'
-        when /8/ then indent,hang='40mm', '40mm'
-        when /9/ then indent,hang='40mm', '50mm'
-        end
-      when /5/
-        case @dob.hang
-        when /0/ then indent,hang='50mm','-50mm'
-        when /1/ then indent,hang='50mm','-40mm'
-        when /2/ then indent,hang='50mm','-30mm'
-        when /3/ then indent,hang='50mm','-20mm'
-        when /4/ then indent,hang='50mm','-10mm'
-        when /5/ then indent,hang='50mm',  '0mm'
-        when /6/ then indent,hang='50mm', '10mm'
-        when /7/ then indent,hang='50mm', '20mm'
-        when /8/ then indent,hang='50mm', '30mm'
-        when /9/ then indent,hang='50mm', '40mm'
-        end
-      when /6/
-        case @dob.hang
-        when /0/ then indent,hang='60mm','-60mm'
-        when /1/ then indent,hang='60mm','-50mm'
-        when /2/ then indent,hang='60mm','-40mm'
-        when /3/ then indent,hang='60mm','-30mm'
-        when /4/ then indent,hang='60mm','-20mm'
-        when /5/ then indent,hang='60mm','-10mm'
-        when /6/ then indent,hang='60mm',  '0mm'
-        when /7/ then indent,hang='60mm', '10mm'
-        when /8/ then indent,hang='60mm', '20mm'
-        when /9/ then indent,hang='60mm', '30mm'
-        end
-      when /7/
-        case @dob.hang
-        when /0/ then indent,hang='70mm','-70mm'
-        when /1/ then indent,hang='70mm','-60mm'
-        when /2/ then indent,hang='70mm','-50mm'
-        when /3/ then indent,hang='70mm','-40mm'
-        when /4/ then indent,hang='70mm','-30mm'
-        when /5/ then indent,hang='70mm','-20mm'
-        when /6/ then indent,hang='70mm','-10mm'
-        when /7/ then indent,hang='70mm',  '0mm'
-        when /8/ then indent,hang='70mm', '10mm'
-        when /9/ then indent,hang='70mm', '20mm'
-        end
-      when /8/
-        case @dob.hang
-        when /0/ then indent,hang='80mm','-80mm'
-        when /1/ then indent,hang='80mm','-70mm'
-        when /2/ then indent,hang='80mm','-60mm'
-        when /3/ then indent,hang='80mm','-50mm'
-        when /4/ then indent,hang='80mm','-40mm'
-        when /5/ then indent,hang='80mm','-30mm'
-        when /6/ then indent,hang='80mm','-20mm'
-        when /7/ then indent,hang='80mm','-10mm'
-        when /8/ then indent,hang='80mm',  '0mm'
-        when /9/ then indent,hang='80mm', '10mm'
-        end
-      when /9/
-        case @dob.hang
-        when /0/ then indent,hang='90mm','-90mm'
-        when /1/ then indent,hang='90mm','-80mm'
-        when /2/ then indent,hang='90mm','-70mm'
-        when /3/ then indent,hang='90mm','-60mm'
-        when /4/ then indent,hang='90mm','-50mm'
-        when /5/ then indent,hang='90mm','-40mm'
-        when /6/ then indent,hang='90mm','-30mm'
-        when /7/ then indent,hang='90mm','-20mm'
-        when /8/ then indent,hang='90mm','-10mm'
-        when /9/ then indent,hang='90mm',  '0mm'
-        end
-      end
+      _idt=10
+      indent = "#{_idt*(@dob.indent.to_i-1)}mm"
+      hang =  "#{_idt*(@dob.hang.to_i - @dob.indent.to_i)}mm"
       "\\begin{ParagraphHang}{#{indent}}{#{hang}}#{@dob.tmp} \\end{ParagraphHang}}"
     end
     def indent