aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/texpdf.rb60
-rw-r--r--lib/sisu/texpdf_format.rb75
2 files changed, 58 insertions, 77 deletions
diff --git a/lib/sisu/texpdf.rb b/lib/sisu/texpdf.rb
index be139ff4..9850aeef 100644
--- a/lib/sisu/texpdf.rb
+++ b/lib/sisu/texpdf.rb
@@ -739,65 +739,6 @@ module SiSU_TeX
end
dob
end
- def tex_box_listings
- <<-WOK
-\\definecolor{listinggray}{gray}{0.9}
-\\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
-\\lstset{
- backgroundcolor=\\color{lbcolor},
- tabsize=4,
- rulecolor=,
- language=,
- basicstyle=\\scriptsize,
- upquote=true,
- aboveskip={1.5\\baselineskip},
- columns=fixed,
- showstringspaces=false,
- extendedchars=true,
- breaklines=true,
- prebreak = \\raisebox{0ex}[0ex][0ex]{\\ensuremath{\\hookleftarrow}},
- frame=single,
- showtabs=false,
- showspaces=false,
- showstringspaces=false,
- identifierstyle=\\ttfamily,
- keywordstyle=\\color[rgb]{0,0,1},
- commentstyle=\\color[rgb]{0.133,0.545,0.133},
- stringstyle=\\color[rgb]{0.627,0.126,0.941},
-}
- WOK
- end
- def tex_box_boites
- <<-WOK
-\\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}
- WOK
- end
- def tex_codeblock
- codeblock_box=if @codeblock_box=='listings'
- tex_box_listings
- elsif @codeblock_box=='boites'
- tex_box_boites
- else
- tex_box_boites
- end
- codeblock_box
- end
def markup(data)
@tex_file=[]
home=the_text.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex
@@ -816,7 +757,6 @@ module SiSU_TeX
end
@tex_file << <<-WOK
#{@tex_ml.header}#{@tex_ml.footer}
-#{tex_codeblock}
% (tilde hash amp affected by http)
% \\sloppy
\\begin{document}
diff --git a/lib/sisu/texpdf_format.rb b/lib/sisu/texpdf_format.rb
index 80fe301e..9b250944 100644
--- a/lib/sisu/texpdf_format.rb
+++ b/lib/sisu/texpdf_format.rb
@@ -720,28 +720,65 @@ module SiSU_TeX_Pdf
case @tex2pdf
when /xe/
if @md.opt.lng =~/(?:zh|ja|ko)/
- <<-WOK
+ if @md.opt.lng =~/zh/
+ <<-WOK
+\\usepackage{xeCJK}
+\\setCJKmainfont{Noto}
+\\setCJKmainfont{Noto Sans CJK TC}
+\\setCJKsansfont{Noto Sans CJK TC}
+\\setCJKmonofont{Noto Sans Mono CJK TC}
\\setmainlanguage{#{tex_head_lang[:mainlang]}}
\\setotherlanguage{english}
-\\setmainfont{#{texpdf_fontface_cjk}}
-\\setotherfont{#{texpdf_fontface}}
-\\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}}
- WOK
+% \\setmainfont{#{texpdf_fontface_cjk}}
+% \\setotherfont{#{texpdf_fontface}}
+\\setotherfont{Noto Sans}
+% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}}
+ WOK
+ elsif @md.opt.lng =~/ja/
+ <<-WOK
+\\usepackage{xeCJK}
+\\setCJKmainfont{Noto}
+\\setCJKmainfont{Noto Sans CJK JP}
+\\setCJKsansfont{Noto Sans CJK JP}
+\\setCJKmonofont{Noto Sans Mono CJK JP}
+\\setmainlanguage{#{tex_head_lang[:mainlang]}}
+\\setotherlanguage{english}
+% \\setmainfont{#{texpdf_fontface_cjk}}
+% \\setotherfont{#{texpdf_fontface}}
+\\setotherfont{Noto Sans}
+% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}}
+ WOK
+ elsif @md.opt.lng =~/ko/
+ <<-WOK
+\\usepackage{xeCJK}
+\\setCJKmainfont{Noto}
+\\setCJKmainfont{Noto Sans CJK KR}
+\\setCJKsansfont{Noto Sans CJK KR}
+\\setCJKmonofont{Noto Sans Mono CJK KR}
+\\setmainlanguage{#{tex_head_lang[:mainlang]}}
+\\setotherlanguage{english}
+% \\setmainfont{#{texpdf_fontface_cjk}}
+% \\setotherfont{#{texpdf_fontface}}
+\\setotherfont{Noto Sans}
+% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}}
+ WOK
+ else puts "lang error"
+ end
elsif (tex_head_lang[:mainlang] == "english" \
&& (tex_head_lang[:otherlang] == "english" \
|| tex_head_lang[:otherlang] == "" \
|| tex_head_lang[:otherlang].length == 0))
<<-WOK
-\\setmainlanguage{#{tex_head_lang[:mainlang]}}
-\\setmainfont{#{texpdf_fontface}}
-\\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}}
+% \\setmainlanguage{#{tex_head_lang[:mainlang]}}
+% \\setmainfont{#{texpdf_fontface}}
+% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}}
WOK
else
<<-WOK
-\\setmainlanguage{#{tex_head_lang[:mainlang]}}
-\\setotherlanguage{english}
-\\setmainfont{#{texpdf_fontface}}
-\\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}}
+% \\setmainlanguage{#{tex_head_lang[:mainlang]}}
+% \\setotherlanguage{english}
+% \\setmainfont{#{texpdf_fontface}}
+% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}}
WOK
end
when /pdf/
@@ -779,7 +816,9 @@ module SiSU_TeX_Pdf
%\\usepackage{inconsolata}
\\usepackage[T1]{fontenc}
\\usepackage{newunicodechar}
-% \\usepackage[utf8]{inputenc}
+\\usepackage[utf8]{inputenc}
+\\usepackage{xeCJK}
+\\usepackage{noto}
\\usepackage{alltt}
\\usepackage[
unicode=true,
@@ -1039,6 +1078,8 @@ module SiSU_TeX_Pdf
<<-WOK
#{tex_head_info}
\\documentclass[11pt,a4paper,titlepage,makeidx]{scrartcl}
+\\usepackage{fontspec}
+\\usepackage{lmodern}
\\usepackage{geometry}
\\geometry{
#{d[:papertype]},
@@ -1241,9 +1282,9 @@ module SiSU_TeX_Pdf
def tex_head_codeblock(codeblock_box_type)
codeblock_box=if codeblock_box_type=='listings'
<<-WOK
-\\usepackage{listings}
-\\usepackage{color}
-\\usepackage{textcomp}
+% \\usepackage{listings}
+% \\usepackage{color}
+% \\usepackage{textcomp}
WOK
elsif codeblock_box_type=='boites'
"\\usepackage{boites}"
@@ -1260,7 +1301,7 @@ module SiSU_TeX_Pdf
#{tex_head_encode}
#{tex_head_pdftex}
#{tex_head_codeblock(codeblock_box_type)}
-\\selectlanguage{#{tex_head_lang[:mainlang]}}
+% \\selectlanguage{#{tex_head_lang[:mainlang]}}
WOK
end
def a4generic