diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/upzhkinsoku/upzhkinsoku.sty |
Initial commit
Diffstat (limited to 'macros/generic/upzhkinsoku/upzhkinsoku.sty')
-rw-r--r-- | macros/generic/upzhkinsoku/upzhkinsoku.sty | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/macros/generic/upzhkinsoku/upzhkinsoku.sty b/macros/generic/upzhkinsoku/upzhkinsoku.sty new file mode 100644 index 0000000000..9f14e317b6 --- /dev/null +++ b/macros/generic/upzhkinsoku/upzhkinsoku.sty @@ -0,0 +1,168 @@ + + +% upzhkinsoku.sty +% Copyright 2017--2018 Yue ZHANG +% License: Knuth License (https://ctan.org/license/knuth) + +\csname ENDINPUTUPZHKINSOKUDOTSTY\endcsname + +\let\ENDINPUTUPZHKINSOKUDOTSTY=\endinput + +\begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname ProvidesPackage\endcsname\relax + \else + \ProvidesPackage{upzhkinsoku}[2018/04/07 v0.5 + Supplementary Chinese kinsoku for Unicode *pTeX]% + \fi + +\edef\UPZHKINSOKUDOTSTYRESTORECATCODE{% + \catcode`\noexpand\@=\the\catcode`\@\relax} + +\catcode`\@=11\relax + +\def\upzhkinsoku@ifprimitive#1{% + \begingroup + \edef\upzhkinsoku@temp@meaning{\meaning#1}% + \edef\upzhkinsoku@temp@string{\string#1}% + \expandafter + \endgroup + \ifx\upzhkinsoku@temp@meaning\upzhkinsoku@temp@string} + +\upzhkinsoku@ifprimitive\ucs +\else + \errmessage{upTeX / e-upTeX / ApTeX is required}% + \UPZHKINSOKUDOTSTYRESTORECATCODE + \expandafter\endinput +\fi + +\ifnum\ucs"3000="3000\relax +\else + \errmessage{Unicode upTeX / Unicode e-upTeX / ApTeX is required}% + \UPZHKINSOKUDOTSTYRESTORECATCODE + \expandafter\endinput +\fi + +\def\upzhkinsoku@setpenalties{% + \postbreakpenalty"23=10000\relax % # +% \postbreakpenalty"24=10000\relax % $ (variable slot) + \prebreakpenalty"25=10000\relax % % + \prebreakpenalty"26=10000\relax % & + \prebreakpenalty"2A=10000\relax % * + \prebreakpenalty"2B=10000\relax % + (\+ is \outer in plain.tex) + \prebreakpenalty"2F=10000\relax % / + \prebreakpenalty"3D=10000\relax % = + \postbreakpenalty"40=10000\relax % @ + \prebreakpenalty"5E=10000\relax % ^ + \prebreakpenalty"7E=10000\relax % ~ + \prebreakpenalty\ucs"301E=10000\relax % 〞 + \postbreakpenalty\ucs"2329=10000\relax % 〈 + \prebreakpenalty\ucs"232A=10000\relax % 〉 + \postbreakpenalty\ucs"301A=10000\relax % 〚 + \prebreakpenalty\ucs"301B=10000\relax % 〛 + \prebreakpenalty\ucs"00B7=10000\relax % · + \prebreakpenalty\ucs"2022=10000\relax % • + \prebreakpenalty\ucs"2027=10000\relax % ‧ + \prebreakpenalty\ucs"2010=10000\relax % ‐ + \prebreakpenalty\ucs"2013=10000\relax % – + \prebreakpenalty\ucs"FF0D=10000\relax % - + \prebreakpenalty\ucs"2026=0\relax % … + \prebreakpenalty\ucs"2025=0\relax % ‥ + \prebreakpenalty\ucs"FF0F=10000\relax % / + \prebreakpenalty\ucs"FF5E=10000\relax % ~ + \prebreakpenalty\ucs"301C=10000\relax % 〜 +} +\def\upzhkinsoku@setxspcodes{% + \xspcode"21=2\relax % ! + \xspcode"23=1\relax % # +% \xspcode"24=1\relax % $ (variable slot) + \xspcode"25=2\relax % % + \xspcode"26=3\relax % & + \xspcode"3A=2\relax % : + \xspcode"3F=2\relax % ? + \xspcode"40=1\relax % @ +} +\def\upzhkinsoku@setinhibitxspcodes{% + \inhibitxspcode\ucs"301E=1\relax % 〞 + \inhibitxspcode\ucs"2329=2\relax % 〈 + \inhibitxspcode\ucs"232A=1\relax % 〉 + \inhibitxspcode\ucs"301A=2\relax % 〚 + \inhibitxspcode\ucs"301B=1\relax % 〛 + \inhibitxspcode\ucs"00B7=0\relax % · + \inhibitxspcode\ucs"2022=0\relax % • + \inhibitxspcode\ucs"2027=0\relax % ‧ + \inhibitxspcode\ucs"30FB=0\relax % ・ + \inhibitxspcode\ucs"FF1A=1\relax % : + \inhibitxspcode\ucs"FF01=1\relax % ! + \inhibitxspcode\ucs"2010=0\relax % ‐ + \inhibitxspcode\ucs"2013=0\relax % – + \inhibitxspcode\ucs"2E3A=0\relax % ⸺ + \inhibitxspcode\ucs"FF0D=0\relax % - + \inhibitxspcode\ucs"2025=0\relax % ‥ + \inhibitxspcode\ucs"FF0F=0\relax % / +} + +\def\upzhkinsoku@setwith@ascii{% variable slots + \prebreakpenalty"22=0\relax % " + \prebreakpenalty"3C=10000\relax % < + \prebreakpenalty"3E=10000\relax % > + \prebreakpenalty"5C=10000\relax % \ + \prebreakpenalty"5F=10000\relax % _ + \postbreakpenalty"7B=10000\relax % { + \prebreakpenalty"7C=10000\relax % | + \prebreakpenalty"7D=10000\relax % } + \xspcode"22=0\relax % " + \xspcode"3C=0\relax % < + \xspcode"3E=0\relax % > + \xspcode"5C=0\relax % \ + \xspcode"7B=1\relax % { + \xspcode"7D=2\relax % } +} +\def\upzhkinsoku@setwith@otlatin{% variable slots + \prebreakpenalty"22=10000\relax % ” + \postbreakpenalty"3C=10000\relax % ¡ + \postbreakpenalty"3E=10000\relax % ¿ + \postbreakpenalty"5C=10000\relax % “ + \prebreakpenalty"5F=0\relax % ˙ + \prebreakpenalty"7B=10000\relax % – + \prebreakpenalty"7C=0\relax % — + \prebreakpenalty"7D=0\relax % ˝ + \xspcode"22=2\relax % ” + \xspcode"3C=1\relax % ¡ + \xspcode"3E=1\relax % ¿ + \xspcode"5C=1\relax % “ + \xspcode"7B=0\relax % – + \xspcode"7D=0\relax % ˝ +} + +\def\DisableOTLatinVariableSlotsKinsoku{\upzhkinsoku@setwith@ascii} +\def\EnableOTLatinVariableSlotsKinsoku{\upzhkinsoku@setwith@otlatin} + +\def\upzhkinsoku@otone{OT1} +\def\upzhkinsoku@otfour{OT4} + +\def\setupzhkinsokuwith#1{% +% \input ukinsoku.tex\relax + \upzhkinsoku@setpenalties + \upzhkinsoku@setxspcodes + \upzhkinsoku@setinhibitxspcodes + \edef\upzhkinsoku@defaultfontenc{#1}% + \ifx\upzhkinsoku@defaultfontenc\upzhkinsoku@otone + \upzhkinsoku@setwith@otlatin + \else + \ifx\upzhkinsoku@defaultfontenc\upzhkinsoku@otfour + \upzhkinsoku@setwith@otlatin + \else + \upzhkinsoku@setwith@ascii + \fi + \fi} + +\begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname encodingdefault\endcsname\relax + \setupzhkinsokuwith{\upzhkinsoku@otone}% + \else + \AtBeginDocument{\setupzhkinsokuwith{\encodingdefault}}% + \fi + +\UPZHKINSOKUDOTSTYRESTORECATCODE + +\endinput |