% 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