From c93c52d5574c2b0f48bb005e5c972e66a5d5dba4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 30 Oct 2023 13:31:43 -0400 Subject: texpdf, cjk issues not resolved - ctex preferable to xeCJK? (if/when it works) - note: the current round of texpdf changes relate to a bug report on the old live-manual for debian-live to wit: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1052693 - apparently sisu-pdf does not produce latex suitable for the latest texlive (texlive-2023) - some of the latex output changes here are from sisu:spine, the dlang version of sisu --- flake.nix | 1 + lib/sisu/texpdf_format.rb | 70 +++++++++++++++++++++++++++-------------------- org/config_nix.org | 1 + org/texpdf.org | 70 +++++++++++++++++++++++++++-------------------- 4 files changed, 82 insertions(+), 60 deletions(-) diff --git a/flake.nix b/flake.nix index 45cb2305..5e207308 100644 --- a/flake.nix +++ b/flake.nix @@ -156,6 +156,7 @@ texlive.combined.scheme-full noto-fonts noto-fonts-cjk-sans + takao jq #git ]; diff --git a/lib/sisu/texpdf_format.rb b/lib/sisu/texpdf_format.rb index 9b250944..7c238b71 100644 --- a/lib/sisu/texpdf_format.rb +++ b/lib/sisu/texpdf_format.rb @@ -722,7 +722,6 @@ module SiSU_TeX_Pdf if @md.opt.lng =~/(?:zh|ja|ko)/ if @md.opt.lng =~/zh/ <<-WOK -\\usepackage{xeCJK} \\setCJKmainfont{Noto} \\setCJKmainfont{Noto Sans CJK TC} \\setCJKsansfont{Noto Sans CJK TC} @@ -736,11 +735,12 @@ module SiSU_TeX_Pdf 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} +\\setCJKmainfont{TakaoMincho} +\\setCJKsansfont{TakaoMincho Sans} +\\setCJKmonofont{TakaoMincho Sans Mono CJK JP} +%\\setCJKmainfont{Noto Serif CJK JP} +%\\setCJKsansfont{Noto Sans CJK JP} +%\\setCJKmonofont{Noto Sans Mono CJK JP} \\setmainlanguage{#{tex_head_lang[:mainlang]}} \\setotherlanguage{english} % \\setmainfont{#{texpdf_fontface_cjk}} @@ -750,7 +750,6 @@ module SiSU_TeX_Pdf WOK elsif @md.opt.lng =~/ko/ <<-WOK -\\usepackage{xeCJK} \\setCJKmainfont{Noto} \\setCJKmainfont{Noto Sans CJK KR} \\setCJKsansfont{Noto Sans CJK KR} @@ -782,18 +781,11 @@ module SiSU_TeX_Pdf WOK end when /pdf/ - if @md.file_encoding =~ /iso-?8859/i #% iso8859 - <<-WOK -% \\usepackage[latin1]{inputenc} -\\usepackage{fontspec} - WOK - else #% utf-8 assumed <<-WOK -\\usepackage{babel} +\\usepackage[#{tex_head_lang[:mainlang]},#{tex_head_lang[:otherlang]}]{babel} \\usepackage{ucs} -\\usepackage[utf8x]{inputenc} - WOK - end +\\usepackage[utf8x]{inputenc} % + WOK end end def tex_head_info @@ -809,16 +801,31 @@ module SiSU_TeX_Pdf %% SiSU https://git.sisudoc.org/ WOK end - def tex_head_paper_part - <<-WOK + def tex_head_paper_characters + if @md.opt.lng =~/(?:zh|ja|ko)/ + <<-WOK +\\renewcommand*\\familydefault{\\sfdefault} +\\usepackage[UTF8, fontset=TakaoMincho]{ctex} +%\\usepackage[UTF8, fontset=Takao明朝]{ctex} +%\\usepackage[UTF8, fontset=none]{ctex} +\\usepackage{ctexhook} +\\usepackage[T1]{fontenc} +\\usepackage{newunicodechar} +\\usepackage[utf8]{inputenc} + WOK + else + <<-WOK % \\usepackage[scaled]{dejavu} \\renewcommand*\\familydefault{\\sfdefault} %\\usepackage{inconsolata} \\usepackage[T1]{fontenc} \\usepackage{newunicodechar} \\usepackage[utf8]{inputenc} -\\usepackage{xeCJK} -\\usepackage{noto} + WOK + end + end + def tex_head_paper_shared + <<-WOK \\usepackage{alltt} \\usepackage[ unicode=true, @@ -879,7 +886,7 @@ module SiSU_TeX_Pdf \\definecolor{Light}{gray}{.92} \\definecolor{listinggray}{gray}{0.9} \\definecolor{lbcolor}{rgb}{0.9,0.9,0.9} -\\lstset{ +\\lstset{% backgroundcolor=\\color{lbcolor}, tabsize=4, rulecolor=, @@ -907,6 +914,7 @@ module SiSU_TeX_Pdf \\DeclareTOCStyleEntry[numwidth+=3pt]{section}{subsection} \\DeclareTOCStyleEntries[indent+=4pt]{section}{section,subsection,subsubsection} \\DeclareTOCStyleEntries[numwidth+=3pt]{section}{paragraph,subparagraph} +\\usepackage{ltxcmds} WOK end def tex_head_paper_newenv_newcmd @@ -1034,7 +1042,7 @@ module SiSU_TeX_Pdf } WOK end - def tex_head_paper_part_specific(orientation) + def tex_head_paper_orient(orientation) colorlinks = <<-WOK colorlinks=true, % myblack urlcolor=myblue, % \\href{...}{...} external url @@ -1079,9 +1087,9 @@ module SiSU_TeX_Pdf #{tex_head_info} \\documentclass[11pt,a4paper,titlepage,makeidx]{scrartcl} \\usepackage{fontspec} -\\usepackage{lmodern} +% \\usepackage{lmodern} %%issue remove for now (consider later) \\usepackage{geometry} -\\geometry{ +\\geometry{% #{d[:papertype]}, portrait, left=#{d[:left]}, @@ -1093,9 +1101,10 @@ module SiSU_TeX_Pdf \\usepackage{multicol} \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} -#{tex_head_paper_part} +#{tex_head_paper_characters} +#{tex_head_paper_shared} #{tex_head_paper_newenv_newcmd} -#{tex_head_paper_part_specific("portrait")} +#{tex_head_paper_orient("portrait")} #{multicol} WOK end @@ -1104,7 +1113,7 @@ module SiSU_TeX_Pdf #{tex_head_info} \\documentclass[11pt,a4paper,landscape,titlepage,twocolumn,makeidx]{scrartcl} \\usepackage{geometry} -\\geometry{ +\\geometry{% #{d[:papertype]}, landscape, left=#{d[:left]}, @@ -1115,9 +1124,10 @@ module SiSU_TeX_Pdf \\usepackage{multicol} \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} -#{tex_head_paper_part} +#{tex_head_paper_characters} +#{tex_head_paper_shared} #{tex_head_paper_newenv_newcmd} -#{tex_head_paper_part_specific("landscape")} +#{tex_head_paper_orient("landscape")} WOK end def tex_head_paper_portrait_dvi(d) diff --git a/org/config_nix.org b/org/config_nix.org index c9e54794..b7f3248e 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -283,6 +283,7 @@ export RUBYLIB+=`pwd`/lib texlive.combined.scheme-full noto-fonts noto-fonts-cjk-sans + takao jq #git ]; diff --git a/org/texpdf.org b/org/texpdf.org index ee91e112..58f9130a 100644 --- a/org/texpdf.org +++ b/org/texpdf.org @@ -1919,7 +1919,6 @@ module SiSU_TeX_Pdf if @md.opt.lng =~/(?:zh|ja|ko)/ if @md.opt.lng =~/zh/ <<-WOK -\\usepackage{xeCJK} \\setCJKmainfont{Noto} \\setCJKmainfont{Noto Sans CJK TC} \\setCJKsansfont{Noto Sans CJK TC} @@ -1933,11 +1932,12 @@ module SiSU_TeX_Pdf 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} +\\setCJKmainfont{TakaoMincho} +\\setCJKsansfont{TakaoMincho Sans} +\\setCJKmonofont{TakaoMincho Sans Mono CJK JP} +%\\setCJKmainfont{Noto Serif CJK JP} +%\\setCJKsansfont{Noto Sans CJK JP} +%\\setCJKmonofont{Noto Sans Mono CJK JP} \\setmainlanguage{#{tex_head_lang[:mainlang]}} \\setotherlanguage{english} % \\setmainfont{#{texpdf_fontface_cjk}} @@ -1947,7 +1947,6 @@ module SiSU_TeX_Pdf WOK elsif @md.opt.lng =~/ko/ <<-WOK -\\usepackage{xeCJK} \\setCJKmainfont{Noto} \\setCJKmainfont{Noto Sans CJK KR} \\setCJKsansfont{Noto Sans CJK KR} @@ -1979,18 +1978,11 @@ module SiSU_TeX_Pdf WOK end when /pdf/ - if @md.file_encoding =~ /iso-?8859/i #% iso8859 - <<-WOK -% \\usepackage[latin1]{inputenc} -\\usepackage{fontspec} - WOK - else #% utf-8 assumed <<-WOK -\\usepackage{babel} +\\usepackage[#{tex_head_lang[:mainlang]},#{tex_head_lang[:otherlang]}]{babel} \\usepackage{ucs} -\\usepackage[utf8x]{inputenc} - WOK - end +\\usepackage[utf8x]{inputenc} % + WOK end end def tex_head_info @@ -2006,16 +1998,31 @@ module SiSU_TeX_Pdf %% SiSU https://git.sisudoc.org/ WOK end - def tex_head_paper_part - <<-WOK + def tex_head_paper_characters + if @md.opt.lng =~/(?:zh|ja|ko)/ + <<-WOK +\\renewcommand*\\familydefault{\\sfdefault} +\\usepackage[UTF8, fontset=TakaoMincho]{ctex} +%\\usepackage[UTF8, fontset=Takao明朝]{ctex} +%\\usepackage[UTF8, fontset=none]{ctex} +\\usepackage{ctexhook} +\\usepackage[T1]{fontenc} +\\usepackage{newunicodechar} +\\usepackage[utf8]{inputenc} + WOK + else + <<-WOK % \\usepackage[scaled]{dejavu} \\renewcommand*\\familydefault{\\sfdefault} %\\usepackage{inconsolata} \\usepackage[T1]{fontenc} \\usepackage{newunicodechar} \\usepackage[utf8]{inputenc} -\\usepackage{xeCJK} -\\usepackage{noto} + WOK + end + end + def tex_head_paper_shared + <<-WOK \\usepackage{alltt} \\usepackage[ unicode=true, @@ -2076,7 +2083,7 @@ module SiSU_TeX_Pdf \\definecolor{Light}{gray}{.92} \\definecolor{listinggray}{gray}{0.9} \\definecolor{lbcolor}{rgb}{0.9,0.9,0.9} -\\lstset{ +\\lstset{% backgroundcolor=\\color{lbcolor}, tabsize=4, rulecolor=, @@ -2104,6 +2111,7 @@ module SiSU_TeX_Pdf \\DeclareTOCStyleEntry[numwidth+=3pt]{section}{subsection} \\DeclareTOCStyleEntries[indent+=4pt]{section}{section,subsection,subsubsection} \\DeclareTOCStyleEntries[numwidth+=3pt]{section}{paragraph,subparagraph} +\\usepackage{ltxcmds} WOK end def tex_head_paper_newenv_newcmd @@ -2231,7 +2239,7 @@ module SiSU_TeX_Pdf } WOK end - def tex_head_paper_part_specific(orientation) + def tex_head_paper_orient(orientation) colorlinks = <<-WOK colorlinks=true, % myblack urlcolor=myblue, % \\href{...}{...} external url @@ -2276,9 +2284,9 @@ module SiSU_TeX_Pdf #{tex_head_info} \\documentclass[11pt,a4paper,titlepage,makeidx]{scrartcl} \\usepackage{fontspec} -\\usepackage{lmodern} +% \\usepackage{lmodern} %%issue remove for now (consider later) \\usepackage{geometry} -\\geometry{ +\\geometry{% #{d[:papertype]}, portrait, left=#{d[:left]}, @@ -2290,9 +2298,10 @@ module SiSU_TeX_Pdf \\usepackage{multicol} \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} -#{tex_head_paper_part} +#{tex_head_paper_characters} +#{tex_head_paper_shared} #{tex_head_paper_newenv_newcmd} -#{tex_head_paper_part_specific("portrait")} +#{tex_head_paper_orient("portrait")} #{multicol} WOK end @@ -2301,7 +2310,7 @@ module SiSU_TeX_Pdf #{tex_head_info} \\documentclass[11pt,a4paper,landscape,titlepage,twocolumn,makeidx]{scrartcl} \\usepackage{geometry} -\\geometry{ +\\geometry{% #{d[:papertype]}, landscape, left=#{d[:left]}, @@ -2312,9 +2321,10 @@ module SiSU_TeX_Pdf \\usepackage{multicol} \\setlength{\\marginparsep}{#{d[:marginparsep]}} \\setlength{\\marginparwidth}{#{d[:marginparwidth]}} -#{tex_head_paper_part} +#{tex_head_paper_characters} +#{tex_head_paper_shared} #{tex_head_paper_newenv_newcmd} -#{tex_head_paper_part_specific("landscape")} +#{tex_head_paper_orient("landscape")} WOK end def tex_head_paper_portrait_dvi(d) -- cgit v1.2.3