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 ++++++++++++++++++++++++++++++++------------ org/shared.org | 2 +- org/texpdf.org | 44 ++++++++++++++++++++++++++++++++------------ 4 files changed, 66 insertions(+), 26 deletions(-) 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') diff --git a/org/shared.org b/org/shared.org index b9a82014..cc13ea34 100644 --- a/org/shared.org +++ b/org/shared.org @@ -1335,7 +1335,7 @@ WOK #{Ax[:tab]*2}#{inf_xml} #{Ax[:tab]} #{Ax[:tab]} -
+
WOK end def metadata diff --git a/org/texpdf.org b/org/texpdf.org index 798c7dd4..cf8067ba 100644 --- a/org/texpdf.org +++ b/org/texpdf.org @@ -1976,7 +1976,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)) @@ -2032,7 +2040,7 @@ module SiSU_TeX_Pdf \\usepackage{alltt} \\usepackage[ unicode=true, - pdfusetitle, + pdfusetitle, pdfsubject={}, pdfkeywords={}, % keywords list {} {} {}, pdftoolbar=true, @@ -2290,12 +2298,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} @@ -2313,12 +2321,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]}} @@ -2351,6 +2359,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' @@ -2370,12 +2380,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' @@ -2388,6 +2402,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' @@ -2407,10 +2423,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