texpdf, indent values, use formula (to replace table)
[software/sisu] / lib / sisu / texpdf_format.rb
index 9f938738c4a8b8b9b3081dfcab674944d5c72616..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
@@ -1610,78 +1481,151 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\
   end
 end
 __END__
-#ack usepackage texpdf*
-#ack usepackage texpdf* |ack '\{.+?\}'
-#see sisu_texpdf_usepackage.rb
-  alltt.sty
+ag usepackage texpdf*
+ag usepackage texpdf* | ag '\{.+?\}'
+# texpdf_format.rb
+ag usepackage texpdf* | ag --only-matching '\{.+?\}'
+
+* sort & make unique
+@tex2pdf
+alltt.sty
+amssymb.sty
+babel.sty
+boites.sty
+breakurl.sty
+color.sty
+endnotes.sty
+fancyhdr.sty
+fontspec.sty
+footmisc.sty
+graphicx.sty
+inputenc.sty
+listings.sty
+longtable.sty
+manyfoot.sty
+mathptmx.sty
+multicol.sty
+parskip.sty
+polyglossia.sty
+soul.sty
+textcomp.sty
+thumbpdf.sty
+titlepic.sty
+ucs.sty
+ulem.sty
+url.sty
+xeCJK.sty
+xltxtra.sty
+xunicode.sty
+
+* debian related
+** found in
+
+alltt.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/base/alltt.sty
+amssymb.sty
+  texlive-base: /usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
+babel.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
+boites.sty
+  texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/boites/boites.sty
+breakurl.sty
+  texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/breakurl/breakurl.sty
+color.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
+endnotes.sty
+  texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/endnotes/endnotes.sty
+fancyhdr.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty
+fontspec.sty
+  texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty
+footmisc.sty
+  texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/footmisc/footmisc.sty
+graphicx.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
+inputenc.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
+listings.sty
+  texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/latex/listings/listings.sty
+longtable.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty
+manyfoot.sty
+  texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/ncctools/manyfoot.sty
+mathptmx.sty
+  texlive-font-utils: /usr/share/doc/texlive-doc/fonts/fontinst/examples/mathptmx/mathptmx.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/psnfss/mathptmx.sty
+multicol.sty
+  ptex-jtex: /usr/share/texmf/ajtex/multicol.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/tools/multicol.sty
+parskip.sty
+  texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/latex/parskip/parskip.sty
+polyglossia.sty
+  texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/latex/polyglossia/polyglossia.sty
+soul.sty
+  texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/soul/soul.sty
+textcomp.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty
+thumbpdf.sty
+  texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/generic/thumbpdf/thumbpdf.sty
+titlepic.sty
+  texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/titlepic/titlepic.sty
+ucs.sty
+  texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty
+ulem.sty
+  texlive-plain-generic: /usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty
+url.sty
+  texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/url/url.sty
+xeCJK.sty
+  texlive-xetex: /usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
+xltxtra.sty
+  texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/latex/xltxtra/xltxtra.sty
+xunicode.sty
+  texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty
+
+** belongs to
+
+texlive-base:
   amssymb.sty
+texlive-latex-base:
+  alltt.sty
   babel.sty
-  boites.sty
   color.sty
-  endnotes.sty
   fancyhdr.sty
-  fontspec.sty
-  footmisc.sty
   graphicx.sty
   inputenc.sty
-  listings.sty
   longtable.sty
-  manyfoot.sty
+  mathptmx.sty
   multicol.sty
-  parskip.sty
-  polyglossia.sty
-  soul.sty
   textcomp.sty
-  thumbpdf.sty
+  url.sty
+texlive-latex-extra:
+  boites.sty
+  breakurl.sty
+  endnotes.sty
+  footmisc.sty
+  manyfoot.sty
+  soul.sty
   titlepic.sty
   ucs.sty
-  ulem.sty
-  url.sty
-  xetex.sty
+texlive-latex-recommended:
+  fontspec.sty
+  listings.sty
+  parskip.sty
+  polyglossia.sty
+  thumbpdf.sty
   xltxtra.sty
   xunicode.sty
----
-texlive-latex-base
+texlive-plain-generic:
+  ulem.sty
+texlive-xetex:
+  xeCJK.sty
+
+** all texlive packages used
+
 texlive-base
+texlive-latex-base
 texlive-latex-extra
 texlive-latex-recommended
+texlive-plain-generic
 texlive-xetex
-texlive-generic-recommended
----
-texlive-latex-base:
-    /usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
-    /usr/share/texlive/texmf-dist/tex/latex/base/alltt.sty
-    /usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
-    /usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty
-    /usr/share/texlive/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty
-    /usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
-    /usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
-    /usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty
-    /usr/share/texlive/texmf-dist/tex/latex/tools/multicol.sty
----
-texlive-base:
-    /usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
----
-texlive-latex-extra:
-    /usr/share/texlive/texmf-dist/tex/latex/boites/boites.sty
-    /usr/share/texlive/texmf-dist/tex/latex/endnotes/endnotes.sty
-    /usr/share/texlive/texmf-dist/tex/latex/footmisc/footmisc.sty
-    /usr/share/texlive/texmf-dist/tex/latex/ncctools/manyfoot.sty
-    /usr/share/texlive/texmf-dist/tex/latex/soul/soul.sty
-    /usr/share/texlive/texmf-dist/tex/latex/titlepic/titlepic.sty
-    /usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty
----
-texlive-latex-recommended:
-    /usr/share/texlive/texmf-dist/tex/generic/thumbpdf/thumbpdf.sty
-    /usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty
-    /usr/share/texlive/texmf-dist/tex/latex/listings/listings.sty
-    /usr/share/texlive/texmf-dist/tex/latex/parskip/parskip.sty
-    /usr/share/texlive/texmf-dist/tex/latex/url/url.sty
----
-texlive-xetex:
-    /usr/share/texlive/texmf-dist/tex/latex/xltxtra/xltxtra.sty
-    /usr/share/texlive/texmf-dist/tex/xelatex/polyglossia/polyglossia.sty
-    /usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty
----
-texlive-generic-recommended:
-    /usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty
+