From 14ddc81aa7323d9b8c6a131e2148d88c56533912 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 24 Oct 2023 11:37:45 -0400 Subject: texpdf papersize & papermargins --- lib/sisu/shared_metadata.rb | 2 +- lib/sisu/texpdf_format.rb | 44 ++++++++++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/sisu/shared_metadata.rb b/lib/sisu/shared_metadata.rb index 69a3e099..6d5597bf 100644 --- a/lib/sisu/shared_metadata.rb +++ b/lib/sisu/shared_metadata.rb @@ -881,7 +881,7 @@ WOK #{Ax[:tab]*2}#{inf_xml} #{Ax[:tab]} #{Ax[:tab]} -
+
WOK end def metadata diff --git a/lib/sisu/texpdf_format.rb b/lib/sisu/texpdf_format.rb index 80f2652c..80fe301e 100644 --- a/lib/sisu/texpdf_format.rb +++ b/lib/sisu/texpdf_format.rb @@ -719,7 +719,15 @@ module SiSU_TeX_Pdf # fc-list :lang=ja case @tex2pdf when /xe/ - if (tex_head_lang[:mainlang] == "english" \ + if @md.opt.lng =~/(?:zh|ja|ko)/ + <<-WOK +\\setmainlanguage{#{tex_head_lang[:mainlang]}} +\\setotherlanguage{english} +\\setmainfont{#{texpdf_fontface_cjk}} +\\setotherfont{#{texpdf_fontface}} +\\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}} + WOK + elsif (tex_head_lang[:mainlang] == "english" \ && (tex_head_lang[:otherlang] == "english" \ || tex_head_lang[:otherlang] == "" \ || tex_head_lang[:otherlang].length == 0)) @@ -775,7 +783,7 @@ module SiSU_TeX_Pdf \\usepackage{alltt} \\usepackage[ unicode=true, - pdfusetitle, + pdfusetitle, pdfsubject={}, pdfkeywords={}, % keywords list {} {} {}, pdftoolbar=true, @@ -1033,12 +1041,12 @@ module SiSU_TeX_Pdf \\documentclass[11pt,a4paper,titlepage,makeidx]{scrartcl} \\usepackage{geometry} \\geometry{ - a4paper, + #{d[:papertype]}, portrait, - left=30mm, - right=20mm, - top=30mm, - bottom=30mm, + left=#{d[:left]}, + right=#{d[:right]}, + top=#{d[:top]}, + bottom=#{d[:bottom]}, } % \\ProvidesPackage{./sty/spineShared} \\usepackage{multicol} @@ -1056,12 +1064,12 @@ module SiSU_TeX_Pdf \\documentclass[11pt,a4paper,landscape,titlepage,twocolumn,makeidx]{scrartcl} \\usepackage{geometry} \\geometry{ - a4paper, + #{d[:papertype]}, landscape, - left=30mm, - right=20mm, - top=30mm, - bottom=30mm, + left=#{d[:left]}, + right=#{d[:right]}, + top=#{d[:top]}, + bottom=#{d[:bottom]}, } \\usepackage{multicol} \\setlength{\\marginparsep}{#{d[:marginparsep]}} @@ -1094,6 +1102,8 @@ module SiSU_TeX_Pdf when :portrait fontsize=(fontsize_set==:na) ? '11pt' : (fontsize_set + 'pt') d[:papertype],d[:fontsize]='a4paper',fontsize + d[:left],d[:right]='30mm','20mm' + d[:top],d[:bottom]='30mm','30mm' d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='0mm','0mm','-12pt' d[:headheight],d[:headsep],d[:columnsep]='12pt','35pt','' d[:marginparsep],d[:marginparwidth]='4mm','8mm' @@ -1113,12 +1123,16 @@ module SiSU_TeX_Pdf when /book|b5/i #book default - larger fontsize=(fontsize_set==:na) ? '11pt' : (fontsize_set + 'pt') d[:papertype],d[:fontsize]='b5paper',fontsize + d[:left],d[:right]='20mm','20mm' + d[:top],d[:bottom]='20mm','20mm' d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='-4mm','-4mm','-36pt' d[:headheight],d[:headsep],d[:columnsep]='12pt','20pt','' d[:textheight],d[:textwidth]=@tx.b5.portrait.h,@tx.b5.portrait.w when /a5/i fontsize=(fontsize_set==:na) ? '11pt' : (fontsize_set + 'pt') d[:papertype],d[:fontsize]='a5paper',fontsize + d[:left],d[:right]='20mm','20mm' + d[:top],d[:bottom]='20mm','20mm' d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='-4mm','-4mm','-36pt' d[:headheight],d[:headsep],d[:columnsep]='11pt','12pt','' d[:marginparsep],d[:marginparwidth]='4mm','6mm' @@ -1131,6 +1145,8 @@ module SiSU_TeX_Pdf when :landscape fontsize=(fontsize_set==:na) ? '11pt' : (fontsize_set + 'pt') d[:papertype],d[:fontsize]='a4paper',fontsize + d[:left],d[:right]='30mm','20mm' + d[:top],d[:bottom]='30mm','30mm' d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='6mm','6mm','-12mm' d[:headheight],d[:headsep],d[:columnsep]='12pt','20pt','40pt' d[:marginparsep],d[:marginparwidth]='4mm','8mm' @@ -1150,10 +1166,14 @@ module SiSU_TeX_Pdf when /book|b5/i #book default - larger fontsize=(fontsize_set==:na) ? '11pt' : (fontsize_set + 'pt') d[:papertype],d[:fontsize],d[:columnsep]='b5paper',fontsize,'35pt' + d[:left],d[:right]='25mm','25mm' + d[:top],d[:bottom]='20mm','20mm' d[:textheight],d[:textwidth]=@tx.b5.landscape.h,@tx.b5.landscape.w when /a5/i fontsize=(fontsize_set==:na) ? '10pt' : (fontsize_set + 'pt') d[:papertype],d[:fontsize],d[:columnsep]='a5paper',fontsize,'32pt' + d[:left],d[:right]='25mm','25mm' + d[:top],d[:bottom]='20mm','20mm' d[:textheight],d[:textwidth]=@tx.a5.landscape.h,@tx.a5.landscape.w else #default currently A4 fontsize=(fontsize_set==:na) ? '12pt' : (fontsize_set + 'pt') -- cgit v1.2.3