From d51373320c72c6addbe2db704510d12b491dfd93 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 2 Dec 2011 03:36:42 -0500 Subject: v3: texpdf, use boites for box round codeblocks * use and adapt 'boitecoloriee' (found in boites_examples.sty) * in boitebox as setup normal tex hardspaces at start of line are removed, hack required to fix --- data/doc/sisu/CHANGELOG_v3 | 11 +++++++++-- lib/sisu/v3/texpdf.rb | 25 +++++++++++++++++++++++-- lib/sisu/v3/texpdf_format.rb | 1 + 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index bf2f5ac4..6153ae16 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -24,8 +24,15 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.6.orig.tar.xz * dal, codeblocks, start flush left (no buffer spaces at start of line) to allow cut & paste [requested by chals irc.oftc] (fixed issue, numbering of (flush left) codeblocks; preliminary tests suggest this should be ok), need - distinguishing marks for plaintext, and ideally to fix grey background in - xetex/pdfs + distinguishing marks for plaintext (& fix grey background in xetex/pdfs) + + * texpdf, use boites for box round codeblocks, use and adapt 'boitecoloriee' + (found in boites_examples.sty) + * in boitebox as setup normal tex hardspaces at start of line are removed, + hack required to fix + * [attempt to reconfigure boitebox: as setup normal tex hardspaces at start + of line are removed;backround color not set (incompatible);keep box once + background color is set?;remove first line indent of paragraph?] * require iconv (depreciated), use String#encode instead * removed iconv, required a number of places without being used, watch diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 96e51ed9..d36344cd 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -446,7 +446,8 @@ module SiSU_TeX when /code/ sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp,dob.is) dob.tmp=sp_char.special_characters_safe - dob.tmp.gsub!(/#{Mx[:nbsp]}/,'{~}') #dob.tmp.gsub!(/#{Mx[:nbsp]}\s*/,'{~}') + dob.tmp.gsub!(/(#{Mx[:nbsp]})/m,'{\color{mywhite}\1}') + #dob.tmp.gsub!(/#{Mx[:nbsp]}/m,'{~}') # dob.tmp.gsub!(/#{Mx[:nbsp]}\s*/m,'{~}') dob.tmp.gsub!(/#{Mx[:vline]}/m,'\vline') dob.tmp.gsub!(/ \\( |#{Mx[:br_nl]})/,' {\textbackslash}\1') dob.tmp.gsub!(/#{Mx[:br_nl]}\s*\Z/m,'') @@ -457,8 +458,10 @@ module SiSU_TeX dob.tmp = ocn \ + @tex_ml.paraskip_small \ + '\begin{Codeblock}' \ + + '\begin{codeblockboitebox} \hardspace \newline ' \ + dob.tmp \ - + ' \end{Codeblock}' \ + + '\end{codeblockboitebox}' \ + + '\end{Codeblock}' \ + "\n" \ + @tex_ml.paraskip_normal dob @@ -595,6 +598,24 @@ module SiSU_TeX \\newcommand{\\slash}{{/}} \\newcommand{\\underscore}{\\_} \\newcommand{\\exclaim}{\\Verbatim{!}} +\\def\\codeblockboitebox{% + \\def\\bkvz@before@breakbox{\\ifhmode\\par\\fi\\vskip\\breakboxskip\\relax}% + \\def\\bkvz@set@linewidth{\\advance\\linewidth -2\\fboxrule + \\advance\\linewidth -2\\fboxsep} % + \\def\\bk@line{\\hbox to \\linewidth{% + \\ifbkcount\\smash{\\llap{\\the\\bk@lcnt\\ }}\\fi + \\psframebox*[framesep=0pt,linewidth=0pt]{% + \\vrule\\@width\\fboxrule \\hskip\\fboxsep + \\box\\bk@bxa + \\hskip\\fboxsep \\vrule\\@width\\fboxrule + }% + }}% + %\\def\\bkvz@top{\\hrule\\@height\\fboxrule} + \\def\\bkvz@top{\\hrule height .6pt}% + \\def\\bkvz@bottom{\\hrule\\@height\\fboxrule}% + \\breakbox} +\\def\\endcodeblockboitebox{\\endbreakbox} + % (tilde hash amp affected by http) % \\sloppy \\begin{document} diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index 71a8c989..e65f9729 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -1048,6 +1048,7 @@ WOK \\usepackage{textcomp} \\usepackage[parfill]{parskip} \\usepackage[normalem]{ulem} +\\usepackage{boites} \\usepackage{soul} \\usepackage{longtable} \\usepackage{graphicx} -- cgit v1.2.3