From 1f20600f772b6006b8a87a7883a098d258bb2277 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 14 Oct 2010 14:56:47 -0400 Subject: texpdf, bullet text, hanging indent, fix (works for regular text (not grouped text) (requested fix, Ben Armstrong) --- lib/sisu/v2/texpdf.rb | 10 ++++------ lib/sisu/v2/texpdf_format.rb | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/texpdf.rb b/lib/sisu/v2/texpdf.rb index 92f8e0ba..363cfc8c 100644 --- a/lib/sisu/v2/texpdf.rb +++ b/lib/sisu/v2/texpdf.rb @@ -341,10 +341,6 @@ module SiSU_TeX if dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ dob.tmp=SiSU_TeX_Pdf::Format_text_object.new(@md,dob.tmp).url_str_internal(dob.tmp) end - if dob.is=='para' \ - and dob.bullet_ - dob.tmp='$\txtbullet$\hspace{\enspace}' + dob.tmp - end elsif dob.is =='break' if dob.obj==Mx[:br_page]; dob.tmp='\newpage' elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage' @@ -406,7 +402,7 @@ module SiSU_TeX @lineone=case dob.is when /alt|group|verse/ dob.tmp.gsub!(/#{Mx[:nbsp]}/m,'{~}') - dob.tmp.gsub!(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}') + dob.tmp.gsub!(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}') #Bullet environment not used for grouped text, ∴ no hanging indent here dob.tmp.gsub!(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway ocn=SiSU_TeX_Pdf::Format_text_object.new(@md).ocn_display(dob) dob.tmp=if dob.is=='group' \ @@ -506,7 +502,9 @@ module SiSU_TeX else dob.tmp='' # dob.tmp={:l =>'',:p =>''} end when 'para' - if dob.indent \ + if dob.bullet_ + dob.tmp=tst.bullet + elsif dob.indent \ and dob.indent =~/[1-9]/ dob.tmp=tst.indent else diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 36366c9b..9ebef9dc 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -295,7 +295,27 @@ module SiSU_TeX_Pdf when /8/; '70mm' when /9/; '80mm' end - "\\begin{ParagraphIndent}{#{indent}}#{@dob.tmp} \\end{ParagraphIndent}}" #"\\begin{ParagraphIndent}{#{indent}}#{@dob.tmp}\\end{ParagraphIndent}}" + "\\begin{ParagraphIndent}{#{indent}}#{@dob.tmp} \\end{ParagraphIndent}}" + end + def bullet + blt=if @dob.indent + indent=case @dob.indent + when /1/; '0em' + when /2/; '1.0em' + when /3/; '2.0em' + when /4/; '3.0em' + when /5/; '4.0em' + when /6/; '5.0em' + when /7/; '6.0em' + when /8/; '7.0em' + when /9/; '8.0em' + else '-1.0em' + end + "\\begin{Bullet}{#{indent}}$\\txtbullet$\\hspace{\\enspace}#{@dob.tmp}\\end{Bullet}" + else + "\\begin{Bullet}{-5mm}$\\txtbullet$\\hspace{\\enspace}#{@dob.tmp}\\end{Bullet}" + end + blt end def symbol_graphic dir=SiSU_Env::Info_env.new(@md.fns) @@ -918,6 +938,17 @@ WOK \\item[] } {\\end{list}} +\\newenvironment{Bullet}[1]% +{ +\\begin{list}{}{% +\\setlength\\topsep{0pt}% +\\addtolength{\\leftmargin}{#1} +\\itemindent=-1em +\\setlength\\parsep{0pt plus 1pt}% +} +\\item[] +} +{\\end{list}} \\usepackage{fancyhdr} \\lhead{} \\renewcommand{\\part}{\\\@startsection -- cgit v1.2.3