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 --- lib/sisu/v3/texpdf.rb | 25 +++++++++++++++++++++++-- lib/sisu/v3/texpdf_format.rb | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'lib') 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