From 16f02bbc1863609a1fa114bc9272d6a2a6f2e047 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 12 Feb 2016 00:19:25 +0000 Subject: zhspacing (11feb16) git-svn-id: svn://tug.org/texlive/trunk@39670 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/xetex/zhspacing/README | 2 +- .../texmf-dist/doc/xetex/zhspacing/t-zhspacing.tex | 117 +++ .../zhspacing/test/zhspacing-context-test.tex | 45 -- Master/texmf-dist/doc/xetex/zhspacing/zhs-man.pdf | Bin 151236 -> 167095 bytes Master/texmf-dist/doc/xetex/zhspacing/zhs-man.tex | 37 +- .../doc/xetex/zhspacing/zhspacing-context-test.tex | 45 ++ .../tex/xetex/zhspacing/context/t-zhspacing.tex | 117 --- .../tex/xetex/zhspacing/generic/zhmath.sty | 156 ---- .../tex/xetex/zhspacing/generic/zhsmyclass.sty | 152 ---- .../tex/xetex/zhspacing/generic/zhspacing.sty | 819 -------------------- .../xetex/zhspacing/generic/zhsusefulmacros.sty | 98 --- .../tex/xetex/zhspacing/latex/zhfont.sty | 140 ---- .../tex/xetex/zhspacing/latex/zhulem.sty | 18 - Master/texmf-dist/tex/xetex/zhspacing/zhfont.sty | 140 ++++ Master/texmf-dist/tex/xetex/zhspacing/zhmath.sty | 169 ++++ .../texmf-dist/tex/xetex/zhspacing/zhsmyclass.sty | 151 ++++ .../texmf-dist/tex/xetex/zhspacing/zhspacing.sty | 853 +++++++++++++++++++++ .../tex/xetex/zhspacing/zhsusefulmacros.sty | 97 +++ Master/texmf-dist/tex/xetex/zhspacing/zhulem.sty | 18 + 19 files changed, 1613 insertions(+), 1561 deletions(-) create mode 100644 Master/texmf-dist/doc/xetex/zhspacing/t-zhspacing.tex delete mode 100644 Master/texmf-dist/doc/xetex/zhspacing/test/zhspacing-context-test.tex create mode 100644 Master/texmf-dist/doc/xetex/zhspacing/zhspacing-context-test.tex delete mode 100644 Master/texmf-dist/tex/xetex/zhspacing/context/t-zhspacing.tex delete mode 100644 Master/texmf-dist/tex/xetex/zhspacing/generic/zhmath.sty delete mode 100644 Master/texmf-dist/tex/xetex/zhspacing/generic/zhsmyclass.sty delete mode 100644 Master/texmf-dist/tex/xetex/zhspacing/generic/zhspacing.sty delete mode 100644 Master/texmf-dist/tex/xetex/zhspacing/generic/zhsusefulmacros.sty delete mode 100644 Master/texmf-dist/tex/xetex/zhspacing/latex/zhfont.sty delete mode 100644 Master/texmf-dist/tex/xetex/zhspacing/latex/zhulem.sty create mode 100644 Master/texmf-dist/tex/xetex/zhspacing/zhfont.sty create mode 100644 Master/texmf-dist/tex/xetex/zhspacing/zhmath.sty create mode 100644 Master/texmf-dist/tex/xetex/zhspacing/zhsmyclass.sty create mode 100644 Master/texmf-dist/tex/xetex/zhspacing/zhspacing.sty create mode 100644 Master/texmf-dist/tex/xetex/zhspacing/zhsusefulmacros.sty create mode 100644 Master/texmf-dist/tex/xetex/zhspacing/zhulem.sty (limited to 'Master') diff --git a/Master/texmf-dist/doc/xetex/zhspacing/README b/Master/texmf-dist/doc/xetex/zhspacing/README index be0359202ab..b5b4223d953 100644 --- a/Master/texmf-dist/doc/xetex/zhspacing/README +++ b/Master/texmf-dist/doc/xetex/zhspacing/README @@ -6,6 +6,6 @@ This package is licensed in LPPL. If you are interested in the process of development you may observe - http://code.google.com/p/ctex-kit/updates/list + https://github.com/CTeX-org/ctex-kit/ - Yin Dian (yindian@gmail.com) diff --git a/Master/texmf-dist/doc/xetex/zhspacing/t-zhspacing.tex b/Master/texmf-dist/doc/xetex/zhspacing/t-zhspacing.tex new file mode 100644 index 00000000000..ce91f7ab9af --- /dev/null +++ b/Master/texmf-dist/doc/xetex/zhspacing/t-zhspacing.tex @@ -0,0 +1,117 @@ +%D \module +%D [ file=t-zhspacing, +%D version=2009.05.11, +%D title=\CONTEXT\ User Module, +%D subtitle=Zh-Spacing, +%D author=Yue Wang, +%D date=\currentdate, +%D copyright=Yue Wang +%D email=yuleopen@gmail.com, +%D license=BSD] + +\writestatus{loading}{Context User Module / Zh-Spacing} +\unprotect + +%D Macro package \type{zhspacing} was written by Yin Dian in order to +%D typeset Simplified Chinese in \XeTeX. The macro package uses \XeTeX's +%D inter-char token mechanism in order to support the basic Chinese +%D typesetting rules. This macro aims to port \type{zhspacing} to Hans +%D Hagen's \ConTeXt\ format. + +%D \ConTeXt\ MKII does not load unicode-letters.tex automatically +%D when the format is dumped. What's worse, standard \ConTeXt\ +%D distribution does not have unicode-letters.tex included. +%D So in order to define all the default \XeTeX\ character classes +%D as in plain \TeX\ and \LaTeX, we striped the related macros +%D from unicode-letters.tex to \type{zhspacing-unicode}. + + +\def\ID #1 #2 {\set{#1}{#2}{\global\XeTeXcharclass\n=1 \global\catcode\n=11 }} +\countdef\n=255 +\def\set#1#2#3{\n="#1 \loop #3 \ifnum\n<"#2 \advance\n by 1 \repeat} +\def\loop#1\repeat{\def\body{#1}\iterate} +\def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next} +\let\repeat=\fi \ID 3400 4DB5 \ID 4E00 9FC3 \ID 20000 2A6D6 + +%D \ConTeXt\ does not have the right catcode for zhspacing.sty defined. +%D So we should define the catcode correctly in order to load it. + +\catcode`\!=12 +\catcode`\@=11 +\catcode`\?=12 + + +%D zhspacing uses \TeX\ commands \type{\lq} and \type{\rq} in plain TeX. +%D However, these are not defined in \ConTeXt. So we define the two macros. + +\def\lq{`} \def\rq{'} + +%D And now we can load \type{zhspacing.sty} safely. + +\input zhspacing.sty + + +%D Last thing: we define the typescript for Adobe Chinese fonts. + +\starttypescript [serif] [myzhfont] + \definefontsynonym [Serif] [ZhSerif] + \definefontsynonym [SerifBold] [ZhSerifBold] + \definefontsynonym [SerifItalic] [ZhSerifItalic] + \definefontsynonym [SerifBoldItalic] [ZhSerifBoldItalic] +\stoptypescript + +\starttypescript [serif] [myzhfont] + \definefontsynonym [ZhSerif] [name:AdobeSongStd-Light] + \definefontsynonym [ZhSerifBold] [name:AdobeHeitiStd-Regular] + \definefontsynonym [ZhSerifItalic] [name:AdobeKaitiStd-Regular] + \definefontsynonym [ZhSerifBoldItalic] [name:AdobeHeitiStd-Regular] +\stoptypescript + +\starttypescript [sans] [myzhfont] + \definefontsynonym [Sans] [ZhSans] + \definefontsynonym [SansBold] [ZhSansBold] + \definefontsynonym [SansItalic] [ZhSansItalic] + \definefontsynonym [SansBoldItalic] [ZhSansBoldItalic] +\stoptypescript + +\starttypescript [sans] [myzhfont] + \definefontsynonym [ZhSans] [name:AdobeKaitiStd-Regular] + \definefontsynonym [ZhSansBold] [name:AdobeHeitiStd-Regular] + \definefontsynonym [ZhSansItalic] [name:AdobeKaitiStd-Regular] + \definefontsynonym [ZhSansBoldItalic] [name:AdobeHeitiStd-Regular] +\stoptypescript + +\starttypescript [mono] [myzhfont] + \definefontsynonym [Mono] [ZhMono] + \definefontsynonym [MonoBold] [ZhMonoBold] + \definefontsynonym [MonoItalic] [ZhMonoItalic] + \definefontsynonym [MonoBoldItalic] [ZhMonoBoldItalic] +\stoptypescript + +\starttypescript [mono] [myzhfont] + \definefontsynonym [ZhMono] [name:AdobeFangsongStd-Regular] + \definefontsynonym [ZhMonoBold] [name:AdobeHeitiStd-Regular] + \definefontsynonym [ZhMonoItalic] [name:AdobeFangsongStd-Regular] + \definefontsynonym [ZhMonoBoldItalic] [name:AdobeHeitiStd-Regular] +\stoptypescript + + +\starttypescript[myzhfont] + \definetypeface [myzhfont] [rm] [serif] [myzhfont] [default] + \definetypeface [myzhfont] [ss] [sans] [myzhfont] [default] + \definetypeface [myzhfont] [tt] [mono] [myzhfont] [default] +\stoptypescript + +\usetypescript[myzhfont] + +%D We set all the \type{zhxxxfont} used in \type{zhspacing.sty}. + +\zhspacing +\def\zhongwen{\pushcurrentfont\myzhfont\popcurrentfont} +\def\zhfont{\zhongwen} +\def\zhpunctfont{\zhongwen} +\def\zhcjkextafont{\zhongwen} +\def\zhcjkextbfont{\zhongwen} + + +\protect \ No newline at end of file diff --git a/Master/texmf-dist/doc/xetex/zhspacing/test/zhspacing-context-test.tex b/Master/texmf-dist/doc/xetex/zhspacing/test/zhspacing-context-test.tex deleted file mode 100644 index 1f6c528d25c..00000000000 --- a/Master/texmf-dist/doc/xetex/zhspacing/test/zhspacing-context-test.tex +++ /dev/null @@ -1,45 +0,0 @@ -\usemodule[zhspacing] - - -这是中文测试。中文和English的混排。中 -文和$E=mc^2$的混排。 - -九齿钉耙学名上宝沁晶耙,是俺的武器。九齿钉耙并非普通的农具,而是由 -太上老君\footnote{太上老君,三清之第三位。又称“道德天尊”、 -“混元老君”、“降生天尊”、“太清大帝”等。}用神冰铁亲自锤炼,借五方五 -帝、六丁六甲之力锻造而成,有诗为证: - -九齿钉耙学名上宝沁晶耙,是俺的武器。九齿钉耙并非普通的农具,而是由 -太上老君\footnote{太上老君,三清之第三位。又称“道德天尊”、 -“混元老君”、“降生天尊”、“太清大帝”等。}用神冰铁亲自锤炼,借五方五 -帝、六丁六甲之力锻造而成,有诗为证: - -\rm\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps - -\ss\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps - -\tt\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps - -\blank - -\rm\tf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par -\rm\it 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par -\rm\bf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par -\rm\bi 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par - -\blank - -\ss\tf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par -\ss\it 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par -\ss\bf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par -\ss\bi 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par - -\blank - -\tt\tf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par -\tt\it 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par -\tt\bf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par -\tt\bi 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par - - -\bye \ No newline at end of file diff --git a/Master/texmf-dist/doc/xetex/zhspacing/zhs-man.pdf b/Master/texmf-dist/doc/xetex/zhspacing/zhs-man.pdf index 30a336d2ddc..e2539e11888 100644 Binary files a/Master/texmf-dist/doc/xetex/zhspacing/zhs-man.pdf and b/Master/texmf-dist/doc/xetex/zhspacing/zhs-man.pdf differ diff --git a/Master/texmf-dist/doc/xetex/zhspacing/zhs-man.tex b/Master/texmf-dist/doc/xetex/zhspacing/zhs-man.tex index 6959a38d641..e4d16a710e6 100644 --- a/Master/texmf-dist/doc/xetex/zhspacing/zhs-man.tex +++ b/Master/texmf-dist/doc/xetex/zhspacing/zhs-man.tex @@ -4,7 +4,10 @@ %\usepackage[margin=1.5in]{geometry} \usepackage{fontspec} \defaultfontfeatures{Mapping=tex-text} -\usepackage[no-sscript]{xltxtra} +\usepackage{hologo} +\def\eTeX{\hologo{eTeX}} +\def\XeTeX{\hologo{XeTeX}} +\def\XeLaTeX{\hologo{XeLaTeX}} \usepackage{zhspacing} \usepackage[fakebold]{zhfont} \usepackage[noactive]{zhmath} @@ -29,7 +32,7 @@ manual\thanks{Revision: \zhspacingrevision.}} \author{\textsc{Yin} Dian\footnote{Lab.\ of Network Comm. System \& Control, Univ.\ of Sci.\ \& Tech.\ of China.}} -\date{2012/03/14} +\date{2016/02/10} \maketitle \tableofcontents \newpage @@ -56,7 +59,7 @@ using \XeTeX, the package |zhspacing| is coded, utilizing the new primitive of \section{Getting Started} |zhspacing| can be used in both plain \XeTeX\ or \XeLaTeX. The usage is quite -straightforward. For instance, in plain \XeTeX, +straightforward. For instance, in plain \XeTeX, {\emptyskipscheme \begin{verbatim} \input zhspacing.sty @@ -90,11 +93,11 @@ well as math formulas. In fact, all of the following inputs can produce mixed langauge output with skip automatically inserted between Chinese and English characters, \begin{center} -\emptyskipscheme |中Eng文|,\quad |中 Eng文|,\quad |中Eng 文|\quad and\quad |中 Eng 文|. +\emptyskipscheme |中Eng文|,\quad |中 Eng文|,\quad |中Eng 文|\quad and\quad |中 Eng 文|. \end{center} And their corresponding output is, \begin{center} -中Eng文,\quad 中 Eng文,\quad 中Eng 文\quad and\quad 中 Eng 文. +中Eng文,\quad 中 Eng文,\quad 中Eng 文\quad and\quad 中 Eng 文. \end{center} Look close and you'll find, that the first and second input generates exactly @@ -200,7 +203,7 @@ link}}.}% or Fig.~\ref{fig:kieu}.} \subsection{More on Fonts} Sometimes it may be desirable to use different Chinese fonts for different \NFSS\ font families in \LaTeX. This can be done by changing the definition of -\cs{zhs@savefont} and \cs{zhfont}, without modifying the |zhspacing| source. +\cs{zhs@savefont} and \cs{zhfont}, without modifying the |zhspacing| source. Here is the way to do it.\footnote{See zhfont.sty later for convenient ways.} \begin{verbatim} @@ -287,7 +290,7 @@ All of the skip commands above are defined in the pattern \\ \vadjust{}\hfil |\def\skipxxx{\hskip xxxxx}|. |zhspacing| comes with three pre-defined skip schemes, namely -\cs{simsunskipscheme}, \cs{emptyskipscheme} and \cs{haltskipscheme}. The +\cs{simsunskipscheme}, \cs{emptyskipscheme} and \cs{haltskipscheme}. The first scheme should be suitable for font \fntname{SimSun} and other popular Chinese fonts used in China, which does not support OpenType features of |halt|, and needs negative spaces be inserted before opening punctuations and @@ -300,7 +303,8 @@ customization, of course. Vertical Chinese can be achieved by adding raw feature |vertical| to the specified font. An example could be, \hfil \setbox0=\hbox to 0pt{\vbox{\noindent -\newfontfamily\zhfont[RawFeature={script=hani:language=CHN:vertical:+vert}, +\newfontlanguage{Chinese}{CHN} +\newfontfamily\zhfont[Script=CJK,Language=Chinese,Vertical=RotatedGlyphs, BoldFont=SimHei]{SimSun} \let\zhpunctfont\zhfont \haltskipscheme @@ -312,12 +316,14 @@ specified font. An example could be, \hfil \documentclass[12pt]{article} \usepackage{graphicx} \usepackage{zhspacing} - \zhspacing - \begin{document} + \newfontlanguage{Chinese}{CHN} \newfontfamily\zhfont[ - RawFeature={script=hani:language=CHN:vertical:+vert}]{SimSun} + Script=CJK, Language=Chinese, + Vertical=RotatedGlyphs]{SimSun} \let\zhpunctfont\zhfont \haltskipscheme + \zhspacing + \begin{document} \rotatebox{-90}{我是中国人,我爱自己的祖国。} \end{document} \end{verbatim} @@ -331,7 +337,7 @@ punctuations using some fonts such as \fntname{KaiTi\_GB2312} etc. I've told this bug to \name{jjgod} in May, but it seems that he hasn't solved the problem yet. Moreover, the baseline of vertical Chinese is not correct, so mixed typesetting of Chinese and English in vertical mode generates ugly results, and -thus should be avoided. +thus should be avoided. \subsection{Compatibility} Theoretically, |zhspacing| should be compatible with all macro packages, except those who change the definition of \cs{hskip} and \cs{penalty}, in which case @@ -391,7 +397,8 @@ You can get latest stable version of |zhspacing| on CTAN. |zhspacing| was hosted on an open-source project at googlecode. The old project homepage is \url{http://code.google.com/p/zhspacing/}. -Now |zhspacing| is part of |ctex-kit| project (\url{http://code.google.com/p/ctex-kit/}). You can get the lastest source via SVN. +Now |zhspacing| is part of |ctex-kit| project (\url{https://github.com/CTeX-org/ctex-kit/}). +You can get the lastest source via Git. \goodbreak \part{zhfont.sty} @@ -415,13 +422,13 @@ You can redefine them to customize your fonts. Simply macro to set \cs{zh\{rm/sf/tt\}font} using \cs{newfontfamily}. \mymacro\newfontfamilywithslant -Create a font family with fake slant. Take one argument as the font name. +Create a font family with fake slant. Take one argument as the font name. Example: |\newfontfamilywithslant\zhrmfont{SimSun}| \mymacro\newfontfamilywithslantandbold Create a font family with fake slant, and specify another font for its -boldface. Take two arguments as the font name and bold font name. +boldface. Take two arguments as the font name and bold font name. Example:\\\quad |\newfontfamilywithslantandbold\zhrmfont{SimSun}{SimHei}| \section{Examples} diff --git a/Master/texmf-dist/doc/xetex/zhspacing/zhspacing-context-test.tex b/Master/texmf-dist/doc/xetex/zhspacing/zhspacing-context-test.tex new file mode 100644 index 00000000000..1f6c528d25c --- /dev/null +++ b/Master/texmf-dist/doc/xetex/zhspacing/zhspacing-context-test.tex @@ -0,0 +1,45 @@ +\usemodule[zhspacing] + + +这是中文测试。中文和English的混排。中 +文和$E=mc^2$的混排。 + +九齿钉耙学名上宝沁晶耙,是俺的武器。九齿钉耙并非普通的农具,而是由 +太上老君\footnote{太上老君,三清之第三位。又称“道德天尊”、 +“混元老君”、“降生天尊”、“太清大帝”等。}用神冰铁亲自锤炼,借五方五 +帝、六丁六甲之力锻造而成,有诗为证: + +九齿钉耙学名上宝沁晶耙,是俺的武器。九齿钉耙并非普通的农具,而是由 +太上老君\footnote{太上老君,三清之第三位。又称“道德天尊”、 +“混元老君”、“降生天尊”、“太清大帝”等。}用神冰铁亲自锤炼,借五方五 +帝、六丁六甲之力锻造而成,有诗为证: + +\rm\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps + +\ss\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps + +\tt\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps + +\blank + +\rm\tf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par +\rm\it 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par +\rm\bf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par +\rm\bi 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par + +\blank + +\ss\tf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par +\ss\it 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par +\ss\bf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par +\ss\bi 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par + +\blank + +\tt\tf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par +\tt\it 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par +\tt\bf 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par +\tt\bi 兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財\par + + +\bye \ No newline at end of file diff --git a/Master/texmf-dist/tex/xetex/zhspacing/context/t-zhspacing.tex b/Master/texmf-dist/tex/xetex/zhspacing/context/t-zhspacing.tex deleted file mode 100644 index ce91f7ab9af..00000000000 --- a/Master/texmf-dist/tex/xetex/zhspacing/context/t-zhspacing.tex +++ /dev/null @@ -1,117 +0,0 @@ -%D \module -%D [ file=t-zhspacing, -%D version=2009.05.11, -%D title=\CONTEXT\ User Module, -%D subtitle=Zh-Spacing, -%D author=Yue Wang, -%D date=\currentdate, -%D copyright=Yue Wang -%D email=yuleopen@gmail.com, -%D license=BSD] - -\writestatus{loading}{Context User Module / Zh-Spacing} -\unprotect - -%D Macro package \type{zhspacing} was written by Yin Dian in order to -%D typeset Simplified Chinese in \XeTeX. The macro package uses \XeTeX's -%D inter-char token mechanism in order to support the basic Chinese -%D typesetting rules. This macro aims to port \type{zhspacing} to Hans -%D Hagen's \ConTeXt\ format. - -%D \ConTeXt\ MKII does not load unicode-letters.tex automatically -%D when the format is dumped. What's worse, standard \ConTeXt\ -%D distribution does not have unicode-letters.tex included. -%D So in order to define all the default \XeTeX\ character classes -%D as in plain \TeX\ and \LaTeX, we striped the related macros -%D from unicode-letters.tex to \type{zhspacing-unicode}. - - -\def\ID #1 #2 {\set{#1}{#2}{\global\XeTeXcharclass\n=1 \global\catcode\n=11 }} -\countdef\n=255 -\def\set#1#2#3{\n="#1 \loop #3 \ifnum\n<"#2 \advance\n by 1 \repeat} -\def\loop#1\repeat{\def\body{#1}\iterate} -\def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next} -\let\repeat=\fi \ID 3400 4DB5 \ID 4E00 9FC3 \ID 20000 2A6D6 - -%D \ConTeXt\ does not have the right catcode for zhspacing.sty defined. -%D So we should define the catcode correctly in order to load it. - -\catcode`\!=12 -\catcode`\@=11 -\catcode`\?=12 - - -%D zhspacing uses \TeX\ commands \type{\lq} and \type{\rq} in plain TeX. -%D However, these are not defined in \ConTeXt. So we define the two macros. - -\def\lq{`} \def\rq{'} - -%D And now we can load \type{zhspacing.sty} safely. - -\input zhspacing.sty - - -%D Last thing: we define the typescript for Adobe Chinese fonts. - -\starttypescript [serif] [myzhfont] - \definefontsynonym [Serif] [ZhSerif] - \definefontsynonym [SerifBold] [ZhSerifBold] - \definefontsynonym [SerifItalic] [ZhSerifItalic] - \definefontsynonym [SerifBoldItalic] [ZhSerifBoldItalic] -\stoptypescript - -\starttypescript [serif] [myzhfont] - \definefontsynonym [ZhSerif] [name:AdobeSongStd-Light] - \definefontsynonym [ZhSerifBold] [name:AdobeHeitiStd-Regular] - \definefontsynonym [ZhSerifItalic] [name:AdobeKaitiStd-Regular] - \definefontsynonym [ZhSerifBoldItalic] [name:AdobeHeitiStd-Regular] -\stoptypescript - -\starttypescript [sans] [myzhfont] - \definefontsynonym [Sans] [ZhSans] - \definefontsynonym [SansBold] [ZhSansBold] - \definefontsynonym [SansItalic] [ZhSansItalic] - \definefontsynonym [SansBoldItalic] [ZhSansBoldItalic] -\stoptypescript - -\starttypescript [sans] [myzhfont] - \definefontsynonym [ZhSans] [name:AdobeKaitiStd-Regular] - \definefontsynonym [ZhSansBold] [name:AdobeHeitiStd-Regular] - \definefontsynonym [ZhSansItalic] [name:AdobeKaitiStd-Regular] - \definefontsynonym [ZhSansBoldItalic] [name:AdobeHeitiStd-Regular] -\stoptypescript - -\starttypescript [mono] [myzhfont] - \definefontsynonym [Mono] [ZhMono] - \definefontsynonym [MonoBold] [ZhMonoBold] - \definefontsynonym [MonoItalic] [ZhMonoItalic] - \definefontsynonym [MonoBoldItalic] [ZhMonoBoldItalic] -\stoptypescript - -\starttypescript [mono] [myzhfont] - \definefontsynonym [ZhMono] [name:AdobeFangsongStd-Regular] - \definefontsynonym [ZhMonoBold] [name:AdobeHeitiStd-Regular] - \definefontsynonym [ZhMonoItalic] [name:AdobeFangsongStd-Regular] - \definefontsynonym [ZhMonoBoldItalic] [name:AdobeHeitiStd-Regular] -\stoptypescript - - -\starttypescript[myzhfont] - \definetypeface [myzhfont] [rm] [serif] [myzhfont] [default] - \definetypeface [myzhfont] [ss] [sans] [myzhfont] [default] - \definetypeface [myzhfont] [tt] [mono] [myzhfont] [default] -\stoptypescript - -\usetypescript[myzhfont] - -%D We set all the \type{zhxxxfont} used in \type{zhspacing.sty}. - -\zhspacing -\def\zhongwen{\pushcurrentfont\myzhfont\popcurrentfont} -\def\zhfont{\zhongwen} -\def\zhpunctfont{\zhongwen} -\def\zhcjkextafont{\zhongwen} -\def\zhcjkextbfont{\zhongwen} - - -\protect \ No newline at end of file diff --git a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhmath.sty b/Master/texmf-dist/tex/xetex/zhspacing/generic/zhmath.sty deleted file mode 100644 index 88e69f60d7f..00000000000 --- a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhmath.sty +++ /dev/null @@ -1,156 +0,0 @@ -% zhmath.sty coded by YIN Dian -% Use basic CJK characters in math environment. -% Hist: 071202 First coded. -% 071204 Set \XeTeXinterchartokenstate=0 to avoid a XeTeX bug. -% Added \ProvidesPackage. -% 071210 Added another method to set Chinese math fonts in -% LaTeX, via option noactive. Improved format detection. -% Added ability to set alpha and number fonts. -% 071211 Put \setalphanummathfonts in preamble so that -% \usecustommathfonts can be used in document in LaTeX. -% Changed \hbox to \mbox. Changed default option to -% noactive. -% 071215 Removed \XeTeXinterchartokenstate=0, as the XeTeX bug -% is fixed by JK. Changed \mathcjksizec/d to fit the -% main text size. -% 071229 Added \XeTeXinterchartokenstate=0 again, because not -% everyone has the latest version of XeTeX. Added custom -% and nocustom options. -\catcode`\@=11 -\ifx\zhmath@defined\@undefined -\def\zhmath@defined{\relax} -\def\filedate{2007/12/29} -\ifx\zhspacingrevision\@undefined -\input zhspacing.sty -\fi - -\def\zhmath@setXeTeXmathcodefam#1#2#3{% - % set #1..#2's math family to #3 - \count@=#1% - \loop - \XeTeXmathcode\count@=7 #3 \count@ - \unless\ifnum\count@>#2% - \advance\count@ by 1 - \repeat -} - -\def\zhmath@setactivemathchar#1#2#3#4#5#6{% - % set #1..#2 to active math chars, executing \mathchoice #3 #4 #5 #6. - \count@=#1% - \loop - \mathcode\count@="8000 - {\catcode\count@=\active\lccode`\~=\count@ - \lowercase{\xdef~{{\mathchoice{\noexpand#3{\number\count@}}% - {\noexpand#4{\number\count@}}{\noexpand#5{\number\count@}} - {\noexpand#6{\number\count@}}}}}% - }% - \unless\ifnum\count@>#2% - \advance\count@ by 1 - \repeat -} -\newif\ifzhmath@active -\newif\ifzhmath@custom - -\ifLaTeX@e % in LaTeX, similar to mathcjk - -\ProvidesPackage{zhmath}[\filedate] -\DeclareOption{active}{\zhmath@activetrue} -\DeclareOption{noactive}{\zhmath@activefalse} -\DeclareOption{custom}{\zhmath@customtrue} -\DeclareOption{nocustom}{\zhmath@customfalse} -\zhmath@activefalse -\zhmath@customtrue -\ProcessOptions\relax - -\def\mathcjksizea{} -\def\mathcjksizeb{} -\def\mathcjksizec{\dimen@=\dimexpr\f@size pt*6/10\relax\fontsize{\dimen@}{\dimen@}} -\def\mathcjksized{\dimen@=\dimexpr\f@size pt*5/10\relax\fontsize{\dimen@}{\dimen@}} - -\@ifundefined{zhmathfont}{\newfontfamily\zhmathfont{SimSun}}{} - -\ifzhmath@active - \def\zhmath@zhfont@disp#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksizea\char#1\relax}}} - \def\zhmath@zhfont@text#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksizeb\char#1\relax}}} - \def\zhmath@zhfont@scrp#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksizec\char#1\relax}}} - \def\zhmath@zhfont@subs#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksized\char#1\relax}}} - - \zhmath@setactivemathchar{"2E80}{"9FFF}{\zhmath@zhfont@disp}% - {\zhmath@zhfont@text}{\zhmath@zhfont@scrp}{\zhmath@zhfont@subs} - - \def\setzhmathfont#1{\let\zhmathfont=#1} -\else - \def\setzhmathfont#1{% - \let\zhmathfont=#1% - \begingroup - \normalfont - \zhmathfont - \xdef\zhmath@fenc{\f@encoding}% - \xdef\zhmath@ffam{\f@family}% - \endgroup - \DeclareSymbolFont{hanzi}{\zhmath@fenc}{\zhmath@ffam}{m}{n}% - } - \setzhmathfont\zhmathfont - \zhmath@setXeTeXmathcodefam{"2E80}{"9FFF}{\symhanzi} -\fi - -\ifzhmath@custom -\def\setalphanummathfonts#1{% - \let\zhmathalphanumfont=#1% - \begingroup - \normalfont - \zhmathalphanumfont - \xdef\zhmath@@fenc{\f@encoding}% - \xdef\zhmath@@ffam{\f@family}% - \endgroup - \DeclareSymbolFont{@letter}{\zhmath@@fenc}{\zhmath@@ffam}{m}{it}% - \DeclareSymbolFont{@number}{\zhmath@@fenc}{\zhmath@@ffam}{m}{n}% - \SetSymbolFont{@letter}{bold}{\zhmath@@fenc}{\zhmath@@ffam}{bx}{it}% - \SetSymbolFont{@number}{bold}{\zhmath@@fenc}{\zhmath@@ffam}{bx}{n}% -} -\@ifundefined{zhmathalphanumfont}{\newfontfamily\zhmathalphanumfont{Times New Roman}}{} -\setalphanummathfonts\zhmathalphanumfont -\def\usecustommathfonts{% - \zhmath@setXeTeXmathcodefam{`\0}{`\9}{\sym@number} - \zhmath@setXeTeXmathcodefam{`\a}{`\z}{\sym@letter} - \zhmath@setXeTeXmathcodefam{`\A}{`\Z}{\sym@letter} -} -\fi - -\else %in plain TeX - -\@ifundefined{zhmathfont}{\font\zhmathfont="SimSun" at 10pt}{} -\newfam\zhmath@fam -\newfam\zhmath@letterfam -\newfam\zhmath@numberfam - -\def\@setzhmathfonts#1#2{% - \edef\zhmath@font{\fontname#1 }% - \font\zhmath@tenfont=\zhmath@font at 10pt - \font\zhmath@sevenfont=\zhmath@font at 7pt - \font\zhmath@fivefont=\zhmath@font at 5pt\relax - \textfont#2=\zhmath@tenfont - \scriptfont#2=\zhmath@sevenfont - \scriptscriptfont#2=\zhmath@fivefont -} -\def\setzhmathfont#1{\@setzhmathfonts{#1}\zhmath@fam} -\setzhmathfont\zhmathfont - -\def\setalphanummathfonts#1#2{% #1: alpha, #2, num - \@setzhmathfonts{#1}\zhmath@letterfam - \@setzhmathfonts{#2}\zhmath@numberfam -} - -\zhmath@setXeTeXmathcodefam{"2E80}{"9FFF}{\zhmath@fam} - -\def\usecustommathfonts{% - \@ifundefined{zhmathletterfont}{\font\zhmathletterfont="Times New Roman/I" at 10pt}{} - \@ifundefined{zhmathnumberfont}{\font\zhmathnumberfont="Times New Roman" at 10pt}{} - \setalphanummathfonts\zhmathletterfont\zhmathnumberfont - \zhmath@setXeTeXmathcodefam{`\0}{`\9}{\zhmath@numberfam} - \zhmath@setXeTeXmathcodefam{`\a}{`\z}{\zhmath@letterfam} - \zhmath@setXeTeXmathcodefam{`\A}{`\Z}{\zhmath@letterfam} -} - -\fi % end if LaTeX -\fi diff --git a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsmyclass.sty b/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsmyclass.sty deleted file mode 100644 index 3f336c54e42..00000000000 --- a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsmyclass.sty +++ /dev/null @@ -1,152 +0,0 @@ -% zhsmyclass.sty coded by YIN Dian -% Implement easy inter-class token definition with inheritance -% Hist: 070807 First usable version coded. \newclass, \{set,get,prepend,append}interclasstoks -% The tricky part is prepending stuffs to a token register, see TeX by Topics. -% 070808 Added \setclassnum and \registerXeTeXclasstoks -% 070809 Removed unnecessary \global's. -% 070810 Only register non-empty tokens. -% 071019 Added \getclassnum -% 071210 Changed \@foreach to \@for. -\catcode`\@=11 -\ifx\@myclass@defined\@undefined\else - \expandafter\endinput -\fi -\def\@myclass@defined{\relax} -\input zhsusefulmacros.sty -\catcode`\@=11 -\def\@class@list{} -\def\newclass{\@ifnextchar[{\@newclass@param}{\@newclass}} -\def\@newclass@param[#1]#2{% - \if!#1! - \errmessage{Base class name shouldn't be empty.}% - \fi - \if!#2! - \errmessage{Class name shouldn't be empty.}% - \fi - \@ifundefined{@@classname@#1}{% - \errmessage{Base class not defined yet.}% - }{}% - \@ifundefined{@@classname@#2}{% if - \@namedef{@@classname@#2}{\relax}% - \@namedef{@@baseclass@#2}{#1}% - \@for\@@class:=\@class@list\do{% for - \if!\@@class! - \else - \@newinterclasstoks{#2}{\@@class}% - \@newinterclasstoks{\@@class}{#2}% - %\setinterclasstoks{#2}{\@@class}{\getinterclasstoks{#1}{\@@class}}% - %\setinterclasstoks{\@@class}{#2}{\getinterclasstoks{\@@class}{#1}}% - \copyinterclasstoks{#2}{\@@class}{#1}{\@@class}% - \copyinterclasstoks{\@@class}{#2}{\@@class}{#1}% - \fi - }% end for - \@newinterclasstoks{#2}{#2}% - \edef\@class@list{\@class@list,#2}% - }{% else - \errmessage{Class already defined.}% - }% end if -} -\def\@newclass#1{% - \if!#1! - \errmessage{Class name shouldn't be empty.}% - \fi - \@ifundefined{@@classname@#1}{% if - \@namedef{@@classname@#1}{\relax}% - \@for\@@class:=\@class@list\do{% for - \if!\@@class! - \else - \@newinterclasstoks{#1}{\@@class}% - \@newinterclasstoks{\@@class}{#1}% - \fi - }% end for - \@newinterclasstoks{#1}{#1}% - \edef\@class@list{\@class@list,#1}% - }{% else - \errmessage{Class already defined.}% - }% end if -} -\def\getbaseclass#1#2{% - \@ifundefined{@@baseclass@#1}{\def#2{}}{\edef#2{\csname @@baseclass@#1\endcsname}}% -} -\def\@newinterclasstoks#1#2{% - \expandafter\newtoks\csname @@interclasstoks@#1@#2\endcsname - \csname @@interclasstoks@#1@#2\endcsname={}%\meaning #1, \meaning #2}% - %%\expandafter\gdef\csname @@interclasstoks@#1@#2\endcsname{}% -} -\def\setinterclasstoks#1#2#3{% - \csname @@interclasstoks@#1@#2\endcsname={#3}% - %%\expandafter\edef\csname @@interclasstoks@#1@#2\endcsname{#3}% -} -\def\getinterclasstoks#1#2{% - \expandafter\the\csname @@interclasstoks@#1@#2\endcsname - %%\csname @@interclasstoks@#1@#2\endcsname -} -\def\copyinterclasstoks#1#2#3#4{% (#1, #2) <- (#3, #4) - \expandafter\csname @@interclasstoks@#1@#2\endcsname\expandafter{\expandafter\the\csname @@interclasstoks@#3@#4\endcsname}% -} -\def\prependinterclasstoks#1#2#3{% - \toks0={#3}% - \edef\@@prepend@act{\csname @@interclasstoks@#1@#2\endcsname={\the\toks0 - \expandafter\the\csname @@interclasstoks@#1@#2\endcsname}}% - \@@prepend@act - %%\expandafter\edef\csname @@interclasstoks@#1@#2\endcsname{#3\csname @@interclasstoks@#1@#2\endcsname}% -} -\def\appendinterclasstoks#1#2#3{% - \expandafter\csname @@interclasstoks@#1@#2\endcsname\expandafter{\the\csname @@interclasstoks@#1@#2\endcsname #3}% - %%\global\expandafter\edef\csname @@interclasstoks@#1@#2\endcsname{\csname @@interclasstoks@#1@#2\endcsname #3}% -} -\def\showallinterclasstoks{% - \par - \begingroup - \@for\class:=\@class@list\do{% - \if!\class! - \else - \@for\anotherclass:=\@class@list\do{% - \if!\anotherclass! - \else - [\class, \anotherclass]: %\csname @@interclasstoks@\class @\anotherclass\endcsname - \expandafter\the\csname @@interclasstoks@\class @\anotherclass\endcsname - \hfil\break - \fi - }% - \fi - }% - \endgroup -} -\newlinechar`\^^J -\def\setclassnum#1#2{% - \expandafter\chardef\csname @@classnum@#1\endcsname=#2\relax -} -\def\getclassnum#1{% - \csname @@classnum@#1\endcsname -} -\def\mydbgmessag@#1{} -\def\registerXeTeXclasstoks{% - \@for\class:=\@class@list\do{% - \@ifundefined{@@classnum@\class}{}{% - \@for\anotherclass:=\@class@list\do{% - \@ifundefined{@@classnum@\anotherclass}{}{% - \edef\@@temp@macro{\the\csname @@interclasstoks@\class @\anotherclass\endcsname}% - \ifx\@@temp@macro\empty - \else - \edef\@@temp@macro{\@@temp@macro}% - \ifx\@@temp@macro\empty - \else - \edef\@@register@act{\noexpand\XeTeXinterchartoks\csname @@classnum@\class\endcsname - \csname @@classnum@\anotherclass\endcsname\noexpand{\expandafter\the\csname - @@interclasstoks@\class @\anotherclass\endcsname\noexpand}}% - \@@register@act - \edef\@@register@act{\noexpand\mydbgmessag@\noexpand{Registered (\expandafter\number - \csname @@classnum@\class\endcsname, \expandafter\number - \csname @@classnum@\anotherclass\endcsname)\noexpand}}% - \@@register@act - \mydbgmessag@{Registered (\class, \anotherclass) token: \expandafter\the\csname - @@interclasstoks@\class @\anotherclass\endcsname ^^J}% - \fi - \fi - }% - }% - }% - }% -} - diff --git a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhspacing.sty b/Master/texmf-dist/tex/xetex/zhspacing/generic/zhspacing.sty deleted file mode 100644 index 7202dbcf494..00000000000 --- a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhspacing.sty +++ /dev/null @@ -1,819 +0,0 @@ -% zhspacing.sty version 3.5 -% Simple macro for typesetting mixed Chinese documents in XeTeX -% with punctuation space adjustment and prohibitions -% coded by YIN Dian (yindian@ustc) -% Licensed under GPL -% History: 070804 First usable version. -% 070805 Several line breaking bug fixes. -% 070807 \zhinteropenskip changed to 0.6em. \enfont -% TODO list written. -% 070808 Use macros instead of skips to fit different font size. -% 070809 Tried to use myclass to manage classes, but failed. -% Then I found it works when \relax is added. -% 070810 Changed skip parameters. Removed \relax, only register -% non-empty tokens instead. Now it seems to work right. -% Several bugs fixed. CJK Ext-A/B support added. -% Added three skip schemes. -% 070812 Fixed font switch bug between CJK Ext-A and Ext-B chars. -% Obsoleted the use of \enfont. -% 070822 Fixed bug of unbalanced group when using ulem? Cleared -% XeTeX's pre-defined inter-char tokens. Use seperate -% font for punctuations. -% Deprecated the use of begin/end-groups in LaTeX, in -% order to work properly with ulem. Coded zhulem.sty. -% 070823 Use more flexible way to save font. Changed space -% ignoring mechanism after hanzi to allow \skipenzh added -% between hanzi and boundary if the next non-space token -% is a char and is not fullwidth nor in PUA. -% 070824 Enabled automatic skip between math formulas and CJK -% chars. Changed skip schemes. Added \zhspacingrevision. -% 071008 Fixed bug of missing \skipzh when hanzi next to space. -% Found bug of \zhs@skipspaces --- \iffalse error. -% Found bug?? in 10pt article: -% \fbox{\vbox{\hsize=12.2001pt\scriptsize \parindent=0pt -% \parskip=0pt《口口》口:“}} -% 071014 Found bug introduced by the last bug fix, which breaks -% the punctuation prohibitions. (Fixed on 071020) -% 071015 Fixed bug of not changing punctuation font after space. -% 071019 Fixed the \iffalse bug. Use \the\XeTeXcharclass -% instead of ifcjkchar. -% Defined token patterns to simplify settings, haha. -% 071020 Added ability to deal with space seperated characters. -% Added XeTeX existence test. More intelligent parindent -% setting. Fixed bug of English font change through not -% using \getinterclasstoks, hmmm. -% Seperated fullstop and halfstop skips. They were both -% treated as judou before. Added \halthalfskipscheme. -% 071027 Fixed bug of \halthalfskipscheme. Added class setting -% for some punctuations. -% 071103 Fixed bug of no \skipzh between CJK Ext-A/B chars. -% However, due to the current bug of XeTeX, CJK Ext-B -% chars may not have a correct \meaning, so having them -% after spaces may result in a compiling failure. -% 071117 Use \ifzhs@isvalidchar to avoid the XeTeX \meaning -% bug. Added \ProvidesPackage when under LaTeX. -% 071202 Fixed bug of wrong \ProvidesPackage in plain TeX. -% 071210 Changed usefulmacros.sty. Removed \@foreach because I -% find they are redundant --- \@for already has -% \expandafter #2. Improved LaTeX detecting. -% 071211 Minor change on \simsunskipscheme. -% 071229 Added a few punctuation classification settings. -% Refined code. Added active hanzi hook. Removed some -% debug code for compiling speed. Not thoroughly tested. -% 071231 Use \zhs@@a to reduce memory usage. Removed -% \zhs@active@alphabound because it's not effective. -% Use \lastnodetype and \spacefactor to determine whether -% or not to insert \skipenzh. Added a few punctuation -% classification settings. -% 080102 No \enableactivehanzi by default. Changed \zhhanzihook. -% Use hex number to represent hanzi. Added \zhs@font. -% Added ambiwide and ambinarrow options. Made active -% hanzi protected. -% 090720 Rename usefulmacros.sty and myclass.sty to -% zhsusefulmacros.sty and zhsmyclass.sty. -% 2012/03/14 Fix bug for Plain format. -% Note: 1. Catcode test requires letter 'a' to be in category 11, and '!' -% to be in category 12. So don't change the default catcodes. -% 2. To speed up processing long Chinese documents, set \skipzh to -% empty and \XeTeXinterchartoks 1 1={}. This can save 1/4 time. -% 3. \zhspacing will generate a few spaces. Using it in horizontal -% mode will produce unwanted skips. -\catcode`\@=11 -\ifx\XeTeXrevision\@undefined - \errmessage{XeTeX required to use zhspacing}% -\fi -\ifx\XeTeXinterchartokenstate\@undefined - \errmessage{XeTeX 0.997 or above required to use zhspacing}% -\fi -\ifx\zhspacingrevision\@undefined -\def\zhspacingrevision{2012/03/14} -\input zhsusefulmacros.sty -\newif\ifzhs@ambiwide -\zhs@ambiwidetrue -\ifLaTeX@e - \ProvidesPackage{zhspacing}[\zhspacingrevision] - \DeclareOption{ambiwide}{\zhs@ambiwidetrue} - \DeclareOption{ambinarrow}{\zhs@ambiwidefalse} - \ProcessOptions\relax -\fi -\XeTeXlinebreaklocale="zh" -\XeTeXlinebreakskip=0pt plus 0.2em minus 0.1em -\def\zhnobreak{\nobreak} -\def\simsunskipscheme{% should be fit for sim-xxx fonts - % my skip - \def\skipzh{\hskip 0em plus 0.2em minus 0.1em} - \def\skipenzh{\hskip 0.25em plus 0.15em minus 0.05em} - \def\skipzhopen{\hskip -0.0em plus 0.0em minus 0.3em} - \def\skipzhinteropen{\hskip -0.3em plus 0.1em minus 0.1em} - \def\skipzhlinestartopen{\hskip -0.35em} - \def\skipzhclose{\hskip -0.0em plus 0.0em minus 0.3em} - \def\skipzhinterclose{\hskip -0.3em plus 0.1em minus 0.1em} - \def\skipzhlineendclose{\hskip -0.35em} - \def\skipzhhalfstop{\hskip -0.0em plus 0.0em minus 0.5em} - \def\skipzhinterhalfstop{\hskip -0.3em plus 0.1em minus 0.1em} - \def\skipzhlineendhalfstop{\hskip -0.6em} - \def\skipzhfullstop{\hskip -0.0em plus 0.0em minus 0.5em} - \def\skipzhinterfullstop{\hskip -0.3em plus 0.1em minus 0.1em} - \def\skipzhlineendfullstop{\hskip -0.575em} - % neg - \def\skipnegzhlinestartopen{\hskip 0.35em} - \def\skipnegzhlineendclose{\hskip 0.35em} - \def\skipnegzhlineendhalfstop{\hskip 0.6em} - \def\skipnegzhlineendfullstop{\hskip 0.575em} -} -\def\emptyskipscheme{% just for test use - % my skip - \def\skipzh{\hskip 0em plus 0.1em} - \def\skipenzh{\hskip 0em plus 0.2em} - \def\skipzhopen{\hskip 0pt} - \def\skipzhinteropen{\hskip 0pt} - \def\skipzhlinestartopen{\hskip 0pt} - \def\skipzhclose{\hskip 0pt} - \def\skipzhinterclose{\hskip 0pt} - \def\skipzhlineendclose{\hskip 0pt} - \def\skipzhhalfstop{\hskip 0pt} - \def\skipzhinterhalfstop{\hskip 0pt} - \def\skipzhlineendhalfstop{\hskip 0pt} - \def\skipzhfullstop{\hskip 0pt} - \def\skipzhinterfullstop{\hskip 0pt} - \def\skipzhlineendfullstop{\hskip 0pt} - % neg - \def\skipnegzhlinestartopen{\hskip 0pt} - \def\skipnegzhlineendclose{\hskip 0pt} - \def\skipnegzhlineendhalfstop{\hskip 0pt} - \def\skipnegzhlineendfullstop{\hskip 0pt} -} -\def\haltfullskipscheme{% should be fit for Adobe opentype fonts with halfwidth alternative enabled - % my skip - \def\skipzh{\hskip 0em plus 0.2em minus 0.1em} - \def\skipenzh{\hskip 0.25em plus 0.15em minus 0.05em} - \def\skipzhopen{\hskip 0.3em minus 0.3em} - \def\skipzhinteropen{\hskip 0em plus 0.1em } - \def\skipzhlinestartopen{\hskip 0em} - \def\skipzhclose{\hskip 0.3em minus 0.3em} - \def\skipzhinterclose{\hskip 0em plus 0.1em} - \def\skipzhlineendclose{\hskip 0em} - \def\skipzhhalfstop{\hskip 0.4em minus 0.4em} - \def\skipzhinterhalfstop{\hskip 0em plus 0.1em} - \def\skipzhlineendhalfstop{\hskip 0em} - \def\skipzhfullstop{\hskip 0.4em minus 0.4em} - \def\skipzhinterfullstop{\hskip 0em plus 0.1em} - \def\skipzhlineendfullstop{\hskip 0em} - % neg - \def\skipnegzhlinestartopen{\hskip 0em} - \def\skipnegzhlineendclose{\hskip 0em} - \def\skipnegzhlineendhalfstop{\hskip 0em} - \def\skipnegzhlineendfullstop{\hskip 0em} -} -\let\haltskipscheme\haltfullskipscheme % for backward compatibility -\def\halthalfskipscheme{% should be fit for Adobe opentype fonts with halfwidth alternative enabled - % my skip - \def\skipzh{\hskip 0em plus 0.2em minus 0.1em} - \def\skipenzh{\hskip 0.25em plus 0.15em minus 0.05em} - \def\skipzhopen{\hskip 0.0em plus 0.3em} - \def\skipzhinteropen{\hskip 0em plus 0.1em } - \def\skipzhlinestartopen{\hskip 0em} - \def\skipzhclose{\hskip 0.0em plus 0.3em} - \def\skipzhinterclose{\hskip 0em plus 0.1em} - \def\skipzhlineendclose{\hskip 0em} - \def\skipzhhalfstop{\hskip 0.0em plus 0.4em} - \def\skipzhinterhalfstop{\hskip 0em plus 0.1em} - \def\skipzhlineendhalfstop{\hskip -0.15em} - \def\skipzhfullstop{\hskip 0.0em plus 0.4em} - \def\skipzhinterfullstop{\hskip 0em plus 0.1em} - \def\skipzhlineendfullstop{\hskip -0.15em} - % neg - \def\skipnegzhlinestartopen{\hskip 0em} - \def\skipnegzhlineendclose{\hskip 0em} - \def\skipnegzhlineendhalfstop{\hskip 0.15em} - \def\skipnegzhlineendfullstop{\hskip 0.15em} -} -\simsunskipscheme -%\let\mydbgmessage\message -\def\mydbgmessage#1{} - -% font save and restore -\def\zhs@oldf@encoding{} -\def\zhs@oldf@family{} -\def\zhs@oldf@series{} -\def\zhs@oldf@shape{} -\def\zhs@oldf@size{} -\def\zhs@savef@nt#1{% - \expandafter\xdef\csname zhs@#1f@encoding\endcsname{\f@encoding}% - \expandafter\xdef\csname zhs@#1f@family\endcsname{\f@family}% - \expandafter\xdef\csname zhs@#1f@series\endcsname{\f@series}% - \expandafter\xdef\csname zhs@#1f@shape\endcsname{\f@shape}% - \expandafter\xdef\csname zhs@#1f@size\endcsname{\f@size}% -} -\def\zhs@restoref@nt#1{% - \edef\f@encoding{\csname zhs@#1f@encoding\endcsname}% - \edef\f@family{\csname zhs@#1f@family\endcsname}% - \edef\f@series{\csname zhs@#1f@series\endcsname}% - \edef\f@shape{\csname zhs@#1f@shape\endcsname}% - \edef\f@size{\csname zhs@#1f@size\endcsname}% - \selectfont -} -\def\zhs@printf@nt#1{% - \immediate\write16{Font #1 is: \csname zhs@#1f@encoding\endcsname/\csname zhs@#1f@family\endcsname/\csname - zhs@#1f@series\endcsname/\csname zhs@#1f@shape\endcsname/\csname zhs@#1f@size\endcsname}% -} -\def\zhgroupsavefont{% - \let\zhs@savefont=\begingroup - \let\zhs@restorefont=\endgroup -} -\def\zhnfsssavefont{% - \def\zhs@savefont{\zhs@savef@nt{old}} - \def\zhs@restorefont{\zhs@restoref@nt{old}} -} -\ifLaTeX@e - \zhnfsssavefont -\else - \zhgroupsavefont -\fi - -% test CJK char -\def\chartonum#1#2{% #1: an explicit or implicit char; #2: return macro - \ifcat#1a% - \edef#2{\expandafter\@lettertonum\meaning #1\@end}% - \edef#2{\expandafter\number\expandafter\lq #2}% - \else - \ifcat#1!% - \edef#2{\expandafter\@chartonum\meaning #1\@end}% - \edef#2{\expandafter\number\expandafter\lq #2}% - \else - \errmessage{In \string\chartonum, parameter not a letter, nor a character}% - \fi - \fi -} -{\escapechar=-1 - \expandafter\expandafter\expandafter\gdef - \expandafter\expandafter\expandafter\@lettertonum - \expandafter\string\csname the letter \endcsname#1\@end{#1} - \expandafter\expandafter\expandafter\gdef - \expandafter\expandafter\expandafter\@chartonum - \expandafter\string\csname the character \endcsname#1\@end{#1} -} -\let\zhs@tmpchar\relax -\def\zhs@skipspaces{\futurenonspacelet\zhs@tmpchar\zhs@skipsp@ces} -\def\zhs@skipsp@ces{% - %\expandafter\mydbgmessage\expandafter{\meaning\zhs@tmpchar}% - \ifcat a\noexpand\zhs@tmpchar % catcode 11 - \zhs@testskipenzh - \else - \ifcat !\noexpand\zhs@tmpchar % catcode 12 - \zhs@testskipenzh - \else - \ifcat $\noexpand\zhs@tmpchar % catcode 3 - \skipenzh\relax - \fi - \fi - \fi -} -\def\zhs@tmpnum{-1} -\def\ifzhs@isvalidchar#1??#2\ok{\if!#2!} -\def\zhs@testskipenzh{% - \chartonum\zhs@tmpchar\zhs@tmpnum - \expandafter\ifzhs@isvalidchar\zhs@tmpnum??\ok - \edef\zhs@tmpnum{\the\XeTeXcharclass\zhs@tmpnum}% - \else - \edef\zhs@tmpnum{\getclassnum{cjkextb}}% - \fi - \ifnum\zhs@tmpnum = \getclassnum{alphanum}% - \skipenzh\relax - \else - \ifnum\zhs@tmpnum = \getclassnum{hanzi}% - \skipzh\relax - \else - \ifnum\zhs@tmpnum = \getclassnum{closefw}% - %\getinterclasstoks{hanzi}{closefw}% - \zhnobreak - \else - \ifnum\zhs@tmpnum = \getclassnum{halfstop}% - %\getinterclasstoks{hanzi}{halfstop}% - \zhnobreak - \else - \ifnum\zhs@tmpnum = \getclassnum{fullstop}% - \zhnobreak - \else - \ifnum\zhs@tmpnum = \getclassnum{openfw}% - \zhnobreak\skipnegzhlinestartopen\relax % compensate - \else - \ifnum\zhs@tmpnum = \getclassnum{cjkexta}% - \skipzh\relax - \else - \ifnum\zhs@tmpnum = \getclassnum{cjkextb}% - \skipzh\relax - \fi - \fi - \fi - \fi - \fi - \fi - \fi - \fi -} -\def\zhs@aftermathskip{% - \ifnum\lastnodetype=10 % math node - \skipenzh\relax - \fi -} -% Character class settings. -\input zhsmyclass.sty -% three base classes: boundary, halfwidth and fullwidth -\newclass{boundary} -\setclassnum{boundary}{255} -\newclass{halfwidth} -\newclass{fullwidth} -\setinterclasstoks{boundary}{fullwidth}{\mydbgmessage{^^JZ}\zhs@savefont\zhfont} -\setinterclasstoks{fullwidth}{boundary}{\mydbgmessage{^^Jz}\zhs@restorefont\ignorespaces} -\setinterclasstoks{halfwidth}{fullwidth}{\mydbgmessage{^^JP}\zhs@savefont\zhfont} -\setinterclasstoks{fullwidth}{halfwidth}{\mydbgmessage{^^Jp}\zhs@restorefont} -% derived class alphanum and hanzi -\newclass[halfwidth]{alphanum} -\setclassnum{alphanum}{0} -\newclass[fullwidth]{hanzi} -\setclassnum{hanzi}{1} -\setinterclasstoks{hanzi}{hanzi}{\skipzh\relax} -%\appendinterclasstoks{alphanum}{hanzi}{\mydbgmessage{^^JQ}\skipenzh\relax} -%\prependinterclasstoks{hanzi}{alphanum}{\mydbgmessage{^^Jq}\skipenzh\relax} -\setinterclasstoks{alphanum}{hanzi}{\mydbgmessage{^^JQ}\skipenzh\relax\zhs@savefont\zhfont} -\setinterclasstoks{hanzi}{alphanum}{\mydbgmessage{^^Jq}\zhs@restorefont\skipenzh\relax} -\setinterclasstoks{hanzi}{boundary}{\mydbgmessage{^^Ji}\zhs@restorefont\zhs@skipspaces} -\setinterclasstoks{boundary}{hanzi}{\mydbgmessage{^^JI}\zhs@aftermathskip\zhs@savefont\zhfont} -% derived class from fullwidth -\newclass[fullwidth]{openfw} % ‘, (, etc -\setclassnum{openfw}{2} -\newclass[fullwidth]{closefw} % ’, ), etc -\setclassnum{closefw}{3} -\newclass[fullwidth]{halfstop} % ,, , etc -\setclassnum{halfstop}{4} -\newclass[fullwidth]{fullstop} % 。 etc -\setclassnum{fullstop}{10} -\newclass[fullwidth]{fwpunct} % extra fullwidth punctuations -\setclassnum{fwpunct}{7} -% patterns -\def\zhs@punct@inter#1{% - \zhnobreak\csname skipzhinter#1\endcsname\relax -} -\def\zhs@leftpunct@after#1{% - \allowbreak\csname skipzh#1\endcsname\nobreak\csname skipnegzhlinestart#1\endcsname\vadjust{}\zhnobreak\csname skipzhlinestart#1\endcsname\relax -} -\def\zhs@leftpunct@after@boundary#1{% - \zhnobreak\csname skipzhlinestart#1\endcsname\relax -} -\let\zhs@tmp\relax -\def\zhs@leftpunct@before@boundary#1{\def\zhs@tmp{#1}\futurenonspacelet\zhs@tmpchar\zhs@leftpunct@before@boundary@} -\def\zhs@leftpunct@before@boundary@{% - %\mydbgmessage{left punct before boundary}% - %\expandafter\mydbgmessage\expandafter{\meaning\zhs@tmpchar}% - \ifcat a\noexpand\zhs@tmpchar % catcode 11 - \zhs@leftpunct@before@boundary@@ - \else - \ifcat !\noexpand\zhs@tmpchar % catcode 12 - \zhs@leftpunct@before@boundary@@ - \fi - \fi -} -\def\zhs@leftpunct@before@boundary@@{% - \chartonum\zhs@tmpchar\zhs@tmpnum - \expandafter\ifzhs@isvalidchar\zhs@tmpnum??\ok - \edef\zhs@tmpnum{\the\XeTeXcharclass\zhs@tmpnum}% - \else - \edef\zhs@tmpnum{\getclassnum{cjkextb}}% - \fi - \zhs@tmp -} -\def\zhs@leftpunct@after@right#1#2{% - \zhnobreak\csname skipzhlineend#2\endcsname\allowbreak\csname skipnegzhlineend#2\endcsname\csname skipzhinter#2\endcsname\csname skipzhinter#1\endcsname\csname skipnegzhlinestart#1\endcsname\vadjust{}\zhnobreak\csname skipzhlinestart#1\endcsname\relax -} -\def\zhs@rightpunct@before#1{% - \zhnobreak\csname skipzhlineend#1\endcsname\allowbreak\csname skipnegzhlineend#1\endcsname\csname skipzh#1\endcsname\relax -} -\def\zhs@rightpunct@before@boundary#1{\def\zhs@tmp{#1}\futurenonspacelet\zhs@tmpchar\zhs@rightpunct@before@boundary@} -\def\zhs@rightpunct@before@boundary@{% - %\mydbgmessage{right punct before boundary}% - %\expandafter\mydbgmessage\expandafter{\meaning\zhs@tmpchar}% - \ifcat a\noexpand\zhs@tmpchar % catcode 11 - \zhs@rightpunct@before@boundary@@ - \else - \ifcat !\noexpand\zhs@tmpchar % catcode 12 - \zhs@rightpunct@before@boundary@@ - \fi - \fi -} -\def\zhs@rightpunct@before@boundary@@{% - \chartonum\zhs@tmpchar\zhs@tmpnum - \expandafter\ifzhs@isvalidchar\zhs@tmpnum??\ok - \edef\zhs@tmpnum{\the\XeTeXcharclass\zhs@tmpnum}% - \else - \edef\zhs@tmpnum{\getclassnum{cjkextb}}% - \fi - \zhs@tmp -} -% open fullwidth punctuation after other characters -\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth}\do{%,boundary - \prependinterclasstoks{\zhs@class}{openfw}{\mydbgmessage{^^JA1}\zhs@leftpunct@after{open}} -} -\setinterclasstoks{openfw}{openfw}{\mydbgmessage{^^JA2}\zhs@punct@inter{open}} -\setinterclasstoks{closefw}{openfw}{\mydbgmessage{^^JA3}\zhs@leftpunct@after@right{open}{close}} -\setinterclasstoks{halfstop}{openfw}{\mydbgmessage{^^JA4}\zhs@leftpunct@after@right{open}{halfstop}} -\setinterclasstoks{fullstop}{openfw}{\mydbgmessage{^^JA4}\zhs@leftpunct@after@right{open}{fullstop}} -% close fullwidth punctuation before other characters -\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth}\do{%,boundary - \prependinterclasstoks{closefw}{\zhs@class}{\mydbgmessage{^^JB1}\zhs@rightpunct@before{close}} -} -\setinterclasstoks{closefw}{closefw}{\mydbgmessage{^^JB2}\zhs@punct@inter{close}} -\setinterclasstoks{closefw}{halfstop}{\mydbgmessage{^^JB3}\zhs@punct@inter{close}} -\setinterclasstoks{closefw}{fullstop}{\mydbgmessage{^^JB3}\zhs@punct@inter{close}} -% halfstop punctuation before other characters -\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth}\do{%,boundary - \prependinterclasstoks{halfstop}{\zhs@class}{\mydbgmessage{^^JC1}\zhs@rightpunct@before{halfstop}} -} -\setinterclasstoks{halfstop}{closefw}{\mydbgmessage{^^Jb2}\zhs@punct@inter{halfstop}} -\setinterclasstoks{halfstop}{halfstop}{\mydbgmessage{^^JC2}\zhs@punct@inter{halfstop}} -\setinterclasstoks{halfstop}{fullstop}{\mydbgmessage{^^JC2}\zhs@punct@inter{halfstop}} -% fullstop punctuation before other characters -\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth}\do{%,boundary - \prependinterclasstoks{fullstop}{\zhs@class}{\mydbgmessage{^^JC1}\zhs@rightpunct@before{fullstop}} -} -\setinterclasstoks{fullstop}{closefw}{\mydbgmessage{^^Jb2}\zhs@punct@inter{fullstop}} -\setinterclasstoks{fullstop}{halfstop}{\mydbgmessage{^^JC2}\zhs@punct@inter{fullstop}} -\setinterclasstoks{fullstop}{fullstop}{\mydbgmessage{^^JC2}\zhs@punct@inter{fullstop}} -% open fullwidth punctuation before other characters -\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth,closefw,halfstop,fullstop}\do{%,boundary - \prependinterclasstoks{openfw}{\zhs@class}{\mydbgmessage{^^Ja}\zhnobreak} -} -% close fullwidth punctuation after other characters -\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth,boundary}\do{% - \prependinterclasstoks{\zhs@class}{closefw}{\mydbgmessage{^^Jb}\zhnobreak} -} -% halfstop punctuation after other characters -\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth,boundary}\do{% - \prependinterclasstoks{\zhs@class}{halfstop}{\mydbgmessage{^^Jc}\zhnobreak} -} -% fullstop punctuation after other characters -\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth,boundary}\do{% - \prependinterclasstoks{\zhs@class}{fullstop}{\mydbgmessage{^^Jc}\zhnobreak} -} -% boundary special treat -\prependinterclasstoks{boundary}{openfw}{\mydbgmessage{^^JA0}\zhs@leftpunct@after@boundary{open}} -\appendinterclasstoks{closefw}{boundary}{\mydbgmessage{^^JB0}\zhs@rightpunct@before@boundary{% - \ifnum\zhs@tmpnum = \getclassnum{closefw}% - %\getinterclasstoks{closefw}{closefw}% - \zhs@punct@inter{close}% - \else - \ifnum\zhs@tmpnum = \getclassnum{halfstop}% - %\getinterclasstoks{closefw}{halfstop}% - \zhs@punct@inter{close}% - \else - \ifnum\zhs@tmpnum = \getclassnum{fullstop}% - \zhs@punct@inter{close}% - \else - \ifnum\zhs@tmpnum = \getclassnum{openfw}% - %\getinterclasstoks{closefw}{openfw}% - \zhs@leftpunct@after@right{open}{close}% - \zhnobreak\skipnegzhlinestartopen\relax % compensate - \else - \zhs@rightpunct@before{close}% - \fi - \fi - \fi - \fi -}} -\appendinterclasstoks{halfstop}{boundary}{\mydbgmessage{^^JC0}\zhs@rightpunct@before@boundary{% - \ifnum\zhs@tmpnum = \getclassnum{closefw}% - %\getinterclasstoks{halfstop}{closefw}% - \zhs@punct@inter{halfstop}% - \else - \ifnum\zhs@tmpnum = \getclassnum{halfstop}% - %\getinterclasstoks{halfstop}{halfstop}% - \zhs@punct@inter{halfstop}% - \else - \ifnum\zhs@tmpnum = \getclassnum{fullstop}% - \zhs@punct@inter{halfstop}% - \else - \ifnum\zhs@tmpnum = \getclassnum{openfw}% - %\getinterclasstoks{halfstop}{openfw}% - \zhs@leftpunct@after@right{open}{halfstop}% - \zhnobreak\skipnegzhlinestartopen\relax % compensate - \else - \zhs@rightpunct@before{halfstop}% - \fi - \fi - \fi - \fi -}} -\appendinterclasstoks{fullstop}{boundary}{\mydbgmessage{^^JC0}\zhs@rightpunct@before@boundary{% - \ifnum\zhs@tmpnum = \getclassnum{closefw}% - \zhs@punct@inter{fullstop}% - \else - \ifnum\zhs@tmpnum = \getclassnum{halfstop}% - \zhs@punct@inter{fullstop}% - \else - \ifnum\zhs@tmpnum = \getclassnum{fullstop}% - \zhs@punct@inter{fullstop}% - \else - \ifnum\zhs@tmpnum = \getclassnum{openfw}% - \zhs@leftpunct@after@right{open}{fullstop}% - \zhnobreak\skipnegzhlinestartopen\relax % compensate - \else - \zhs@rightpunct@before{fullstop}% - \fi - \fi - \fi - \fi -}} -\appendinterclasstoks{openfw}{boundary}{\mydbgmessage{^^Ja0}\zhs@leftpunct@before@boundary{% - \ifnum\zhs@tmpnum = \getclassnum{openfw}% - %\getinterclasstoks{openfw}{openfw}% - \zhs@punct@inter{open}% - \zhnobreak\skipnegzhlinestartopen\relax % compensate - \fi -}} -% punctuation font change -\@for\zhs@class:={openfw,closefw,halfstop,fullstop,fwpunct}\do{% - \appendinterclasstoks{hanzi}{\zhs@class}{\zhpunctfont} - \appendinterclasstoks{\zhs@class}{hanzi}{\zhfont} - \appendinterclasstoks{boundary}{\zhs@class}{\zhpunctfont} - \appendinterclasstoks{halfwidth}{\zhs@class}{\zhpunctfont} -} -% CJK Ext-A/B support -\newclass[hanzi]{cjkexta} -\setclassnum{cjkexta}{8} -\newclass[hanzi]{cjkextb} -\setclassnum{cjkextb}{9} -\@for\zhs@class:={hanzi,fwpunct,openfw,closefw,halfstop,fullstop,alphanum,halfwidth,boundary}\do{% - \appendinterclasstoks{\zhs@class}{cjkexta}{\zhcjkextafont} - \appendinterclasstoks{\zhs@class}{cjkextb}{\zhcjkextbfont} - \prependinterclasstoks{cjkexta}{\zhs@class}{\zhfont} - \prependinterclasstoks{cjkextb}{\zhs@class}{\zhfont} -} -\setinterclasstoks{cjkexta}{cjkexta}{\skipzh\relax} -\setinterclasstoks{cjkexta}{cjkextb}{\zhcjkextbfont\skipzh\relax} -\setinterclasstoks{cjkextb}{cjkexta}{\zhcjkextafont\skipzh\relax} -\setinterclasstoks{cjkextb}{cjkextb}{\skipzh\relax} -{ -\newcount\n -\n="3400 \loop \ifnum\n<"4E00 \global\XeTeXcharclass\n=8 \advance\n by 1\repeat -\n="20000\loop \ifnum\n<"30000 \global\XeTeXcharclass\n=9 \advance\n by 1\repeat -} -% long fullwidth punctuations -\newclass[fwpunct]{longpunct} % … etc -\setclassnum{longpunct}{5} -\setinterclasstoks{longpunct}{longpunct}{\zhnobreak} -% derived class from halfwidth -\newclass[halfwidth]{hwpunct} % (, ., etc -\setclassnum{hwpunct}{6} - -% Font settings -\ifLaTeX@e - \RequirePackage{fontspec} - \@ifundefined{zhfont}{\newfontfamily\zhfont[BoldFont=SimHei]{SimSun}}{} - \@ifundefined{zhpunctfont}{\newfontfamily\zhpunctfont{SimSun}}{} - \@ifundefined{zhcjkextafont}{\def\zhcjkextafont{\message{CJK Ext-A}}}{} - \@ifundefined{zhcjkextbfont}{\def\zhcjkextbfont{\message{CJK Ext-B}}}{} -\else - \@ifundefined{zhfont}{\font\zhfont="SimSun" at 10pt}{} - \@ifundefined{zhpunctfont}{\font\zhpunctfont="SimSun" at 10pt}{} - \@ifundefined{zhcjkextafont}{\def\zhcjkextafont{\message{CJK Ext-A}}}{} - \@ifundefined{zhcjkextbfont}{\def\zhcjkextbfont{\message{CJK Ext-B}}}{} -\fi - -% code range utils -\newif\ifzhs@result -\newcount\zhs@tmpcnt -\def\@ifnuminrange#1#2#3#4{% #1: num, #2: range with format a->b,c->d - % #3: true block, #4: false block - \zhs@resultfalse - \@for\zhs@range:=#2\do{% - \expandafter\@ifrangecontains\expandafter[\zhs@range]{#1}{\zhs@resulttrue}{}% - }% - \ifzhs@result #3\else #4\fi -} - -\def\@ifrangecontains[#1->#2]#3#4#5{% - \ifnum#3<#1\relax - #5% - \else - \ifnum#3>#2\relax - #5% - \else - #4% - \fi - \fi -} - -\def\@fornuminrange#1:=#2\do#3{% #1: count register, #2: range - \@for\zhs@range:=#2\do{% - \expandafter\@@fornuminrange\expandafter[\zhs@range]{#1}{#3}% - }% -} -\def\@@fornuminrange[#1->#2]#3#4{% - #3=#1% - \loop - \unless\ifnum#3>#2\relax - #4\relax - \advance #3by 1% - \repeat -} - -\def\zhs@hanzirange{% data from unicodeletters.tex - "2E80->"2E99, - "2E9B->"2EF3, - "2F00->"2FD5, - "2FF0->"2FFB, - "3000->"3000, - "3003->"3004, - "3006->"3007, - "3012->"3013, - "3020->"3029, - "3030->"303A, - "303D->"303F, - "3042->"3042, - "3044->"3044, - "3046->"3046, - "3048->"3048, - "304A->"3062, - "3064->"3082, - "3084->"3084, - "3086->"3086, - "3088->"308D, - "308F->"3094, - "309F->"309F, - "30A2->"30A2, - "30A4->"30A4, - "30A6->"30A6, - "30A8->"30A8, - "30AA->"30C2, - "30C4->"30E2, - "30E4->"30E4, - "30E6->"30E6, - "30E8->"30ED, - "30EF->"30F4, - "30F7->"30FA, - "30FF->"30FF, - "3105->"312C, - "3131->"318E, - "3190->"31B7, - "31C0->"31CF, - "3200->"321E, - "3220->"3243, - "3250->"32FE, - "3300->"33FF, - "3400->"4DB5, - "4E00->"9FBB, - "A000->"A014, - "A016->"A48C, - "A490->"A4C6, - "F900->"FA2D, - "FA30->"FA6A, - "FA70->"FAD9, - "FE30->"FE34, - "FE45->"FE46, - "FE49->"FE4F, - "FE51->"FE51, - "FE58->"FE58, - "FE5F->"FE66, - "FE68->"FE68, - "FE6B->"FE6B, - "FF02->"FF03, - "FF06->"FF07, - "FF0A->"FF0B, - "FF0D->"FF0D, - "FF0F->"FF19, - "FF1C->"FF1E, - "FF20->"FF3A, - "FF3C->"FF3C, - "FF3E->"FF5A, - "FF5C->"FF5C, - "FF5E->"FF5E, - "FFE2->"FFE4, - "20000->"2A6D6, - "2F800->"2FA1D -} -\def\zhs@extarange{"3400->"4DB5} -\def\zhs@extbrange{"20000->"2FA1D} - -% set active hanzi for hooking -\def\makehanziglobalactive{% - \@fornuminrange\zhs@tmpcnt:=\zhs@hanzirange\do{% - \global\catcode\zhs@tmpcnt=\active}% -} - -\def\makehanzigloballetter{% - \@fornuminrange\zhs@tmpcnt:=\zhs@hanzirange\do{% - \global\catcode\zhs@tmpcnt=11}% -} - -\def\zhhanzihook#1{{\XeTeXinterchartokenstate=0\zhs@font #1}} - -\def\zhs@h@x#1{\ifcase#1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or - 9\or A\or B\or C\or D\or E\or F\fi} -\def\zhs@hex#1{\if!#1!\else\ifnum#1<16 \zhs@h@x{#1}\else - \expandafter\zhs@hex\expandafter{\number\numexpr(#1-8)/16}% - \expandafter\zhs@h@x\expandafter{\number\numexpr#1-(#1-8)/16*16}\fi\fi} - -\let\zhs@font\zhfont -\def\enableactivehanzi{% - \def\zhs@@a##1{\zhs@afteralphamathskip - \expandafter\@ifrangecontains\expandafter[\zhs@extarange]{"##1}{\global - \let\zhs@font\zhcjkextafont}{\expandafter\@ifrangecontains - \expandafter[\zhs@extbrange]{"##1}{\global\let\zhs@font\zhcjkextbfont - }{\global\let\zhs@font\zhfont}}% - \zhhanzihook{\char"##1}\zhs@active@lookafter}% - \@fornuminrange\zhs@tmpcnt:=\zhs@hanzirange\do{% - \lccode`\~=\zhs@tmpcnt - \lowercase{\protected\xdef~{\noexpand\zhs@@a{\expandafter\zhs@hex - \expandafter{\number\zhs@tmpcnt}}}}% - }% -} - -\def\zhs@afteralphamathskip{% - \ifhmode - \ifnum\lastnodetype=10 % math node - \skipenzh\relax - \else\ifnum\lastnodetype=0 - \ifnum\spacefactor=999 - \skipenzh - \else\ifnum\spacefactor=1000 - \skipenzh - \fi\fi - \fi\fi - \fi -} - -{\escapechar=-1 - \xdef\zhs@active@ident{\string\zhs@@a} -} -\expandafter\def\expandafter\ifzhs@notactivehanzi\expandafter#\expandafter1% - \zhs@active@ident#2\ok{\if!#2!} -\def\zhs@active@lookafter{\futurenonspacelet\zhs@tmpchar\zhs@active@look@fter} -\def\zhs@active@look@fter{% - %\expandafter\mydbgmessage\expandafter{\meaning\zhs@tmpchar}% - \if\relax\noexpand\zhs@tmpchar % control sequence - \zhs@beforeactivehanziskip - \else - \ifcat a\noexpand\zhs@tmpchar % catcode 11 - \zhs@testskipenzh - \else - \ifcat !\noexpand\zhs@tmpchar % catcode 12 - \zhs@testskipenzh - \else - \ifcat $\noexpand\zhs@tmpchar % catcode 3 - \skipenzh\relax - \fi - \fi - \fi - \fi -} - -\def\zhs@beforeactivehanziskip{% - %\let\zhs@tmp\iffalse % for \if match - \edef\zhs@tmp{\meaning\zhs@tmpchar}% - \expandafter\expandafter\expandafter\ifzhs@notactivehanzi - \expandafter\zhs@tmp\zhs@active@ident\ok - \else - \skipzh\relax - \fi -} - -\def\zhspacing{% - \@for\zhs@char:={`:,`,,`、}\do{\XeTeXcharclass\zhs@char=4} - \@for\zhs@char:={`。,`.,`;}\do{\XeTeXcharclass\zhs@char=10} - \ifzhs@ambiwide - \@for\zhs@char:={`“,`‘}\do{\XeTeXcharclass\zhs@char=2} - \@for\zhs@char:={`”,`’}\do{\XeTeXcharclass\zhs@char=3} - \@for\zhs@char:={`—,`…}\do{\XeTeXcharclass\zhs@char=5} - \else - \@for\zhs@char:={`“,`‘,`”,`’,`—,`…}\do{\XeTeXcharclass\zhs@char=6} - \fi - \@for\zhs@char:={`\!,`\",`\',`\(,`\),`\,,`\-,`\.,`\:,`\;,`\<,`\>,`\?,`\[,`\],`\`,`\{,`\},`\\,`\/}\do{\XeTeXcharclass\zhs@char=6} - \@for\zhs@char:={`℃,`·,`$,`%}\do{\XeTeXcharclass\zhs@char=7} - % clear XeTeX pre-defined toks - \XeTeXinterchartoks 0 1 = {} - \XeTeXinterchartoks 0 2 = {} - \XeTeXinterchartoks 0 3 = {} - \XeTeXinterchartoks 1 0 = {} - \XeTeXinterchartoks 2 0 = {} - \XeTeXinterchartoks 3 0 = {} - \XeTeXinterchartoks 1 1 = {} - \XeTeXinterchartoks 1 2 = {} - \XeTeXinterchartoks 1 3 = {} - \XeTeXinterchartoks 2 1 = {} - \XeTeXinterchartoks 2 2 = {} - \XeTeXinterchartoks 2 3 = {} - \XeTeXinterchartoks 3 1 = {} - \XeTeXinterchartoks 3 2 = {} - \XeTeXinterchartoks 3 3 = {} - \registerXeTeXclasstoks - \XeTeXinterchartokenstate=1\relax - \ifLaTeX@e - \setbox0=\hbox{\normalsize\def\zhs@tmp{\kern 2em}\zhs@tmp}% - \parindent=\wd0 - \else - \parindent=2em\relax - \fi - \message{zhspacing installed.^^J} -} - -\fi diff --git a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsusefulmacros.sty b/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsusefulmacros.sty deleted file mode 100644 index d42a3efcf6f..00000000000 --- a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsusefulmacros.sty +++ /dev/null @@ -1,98 +0,0 @@ -% zhsusefulmacros.sty -% This file provides several useful LaTeX macros as well as \ifLaTeX@e, -% and \futurenonspacelet. -% Licensed under LPPL. -\catcode`\@=11 -\ifx\@usefulmacros@defined\@undefined\else - \expandafter\endinput -\fi -\def\@usefulmacros@defined{\relax} -\def\@usefulmacros@LaTeX@e{LaTeX2e} -\def\ifLaTeX@e{\ifx\fmtname\@usefulmacros@LaTeX@e} -\ifLaTeX@e\else -\def\newtoks{\alloc@5\toks\toksdef\@cclvi} -\def\@nnil{\@nil}% -\def\@empty{}% -\def\@fornoop#1\@@#2#3{}% -\long\def\@for#1:=#2\do#3{% - \expandafter\def\expandafter\@fortmp\expandafter{#2}% - \ifx\@fortmp\@empty \else - \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi}% -\long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else - #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi}% -\long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil - \expandafter\@fornoop \else - #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}}% -\def\@tfor#1:={\@tf@r#1 }% -\long\def\@tf@r#1#2\do#3{\def\@fortmp{#2}\ifx\@fortmp\space\else - \@tforloop#2\@nil\@nil\@@#1{#3}\fi}% -\long\def\@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil - \expandafter\@fornoop \else - #4\relax\expandafter\@tforloop\fi#2\@@#3{#4}}% -\long\def\@ifnextchar#1#2#3{% - \let\reserved@d=#1% - \def\reserved@a{#2}% - \def\reserved@b{#3}% - \futurelet\@let@token\@ifnch} -\def\@ifnch{% - \ifx\@let@token\@sptoken - \let\reserved@c\@xifnch - \else - \ifx\@let@token\reserved@d - \let\reserved@c\reserved@a - \else - \let\reserved@c\reserved@b - \fi - \fi - \reserved@c} -\def\:{\let\@sptoken= } \: % this makes \@sptoken a space token -\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch} -% -\long\def\@firstoftwo#1#2{#1} -\long\def\@secondoftwo#1#2{#2} -\expandafter\ifx\csname ifcsname\endcsname\relax -\def\@ifundefined#1{% - \expandafter\ifx\csname#1\endcsname\relax - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} -\else -\def\@ifundefined#1{% - \unless\ifcsname#1\endcsname - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} -\fi -% -\def\@namedef#1{\expandafter\def\csname #1\endcsname} -% -\fi % end of \ifLaTeX@e\else - -\def\@BTcs{} -\let\nexttoken\relax -\let\next\relax -\def\futurenonspacelet#1{\def\@BTcs{#1}% - \afterassignment\@BTfnslone\let\nexttoken= } -\def\@BTfnslone{\expandafter\futurelet\@BTcs\@BTfnsltwo} -\def\@BTfnsltwo{\expandafter\ifx\@BTcs\@sptoken\let\next=\@BTfnslthree - \else\let\next=\nexttoken\fi \next} -\def\@BTfnslthree{\afterassignment\@BTfnslone\let\next= } - -\ifx\fbox\@undefined -\newbox\fbox@tmpbox -\newdimen\fbox@linewidth -\newdimen\fbox@tmpdim -\fbox@linewidth=0.4pt -\long\def\fbox#1{% - \setbox\fbox@tmpbox=\hbox{#1}% - \fbox@tmpdim=2\fbox@linewidth - \advance\fbox@tmpdim\wd\fbox@tmpbox - \leavevmode\hbox{\vbox{\hrule height \fbox@linewidth width \fbox@tmpdim - \hbox{\vrule width \fbox@linewidth height \ht\fbox@tmpbox - #1\vrule width \fbox@linewidth height \ht\fbox@tmpbox}% - \hrule height \fbox@linewidth width \fbox@tmpdim - }}% -} -\fi diff --git a/Master/texmf-dist/tex/xetex/zhspacing/latex/zhfont.sty b/Master/texmf-dist/tex/xetex/zhspacing/latex/zhfont.sty deleted file mode 100644 index cc3f98d382b..00000000000 --- a/Master/texmf-dist/tex/xetex/zhspacing/latex/zhfont.sty +++ /dev/null @@ -1,140 +0,0 @@ -% zhfont.sty coded by YIN Dian -% Simplify setting various font effects -% Hist: 071204 First coded. -% 071210 Improved. Added \newfontfamilywithslant and -% \newfontfamilywithslantandbold to simplify setting. -% 071211 Added fake bold support. -% 071231 Added underdot support. -% 080102 Minor changes on underdot. Don's use \scantokens. -% Fixed bug of \zhfont in ulem. Added font family -% selection and fake bold support in active hanzi. -\NeedsTeXFormat{LaTeX2e}[1996/12/01] -\def\filedate{2008/01/02} -\ProvidesPackage{zhfont}[\filedate] -\RequirePackage{zhspacing} -\RequirePackage{zhulem} -\newif\ifzhfont@fakebold -\zhfont@fakeboldfalse -\DeclareOption{fakebold}{\zhfont@fakeboldtrue} -\ProcessOptions\relax - -\def\zhs@tmpmacro{} -\def\zhs@curr@fam{-1} - -\zhnfsssavefont -\g@addto@macro\zhs@savefont{% - \long\edef\zhs@tmpmacro{\f@family}% - \def\zhs@curr@fam{0}% - \ifx\zhs@tmpmacro\sfdefault - \def\zhs@curr@fam{1}% - \else\ifx\zhs@tmpmacro\ttdefault - \def\zhs@curr@fam{2}% - \fi\fi - \edef\zhs@tmpmacro{\f@family}% - \ifx\zhs@tmpmacro\sfdefault - \def\zhs@curr@fam{1}% - \else\ifx\zhs@tmpmacro\ttdefault - \def\zhs@curr@fam{2}% - \fi\fi -} -\ifzhfont@fakebold -\def\zhfont@bx{bx} -\g@addto@macro\zhs@savefont{% - \ifx\f@series\zhfont@bx - \special{pdf: literal direct q 0.3 w 2 Tr}% - \fi -} -\g@addto@macro\zhs@restorefont{% - \ifx\f@series\zhfont@bx - \special{pdf: literal direct 0 Tr}% - \fi -} -\fi - -\def\newfontfamilywithslant#1#2{% - \newfontfamily#1[ItalicFont=#2,ItalicFeatures={RawFeature={slant=0.17}},BoldItalicFont=#2,BoldItalicFeatures={RawFeature={slant=0.17}}]{#2}% -} -\def\newfontfamilywithslantandbold#1#2#3{% - \newfontfamily#1[BoldFont=#3,ItalicFont=#2,ItalicFeatures={RawFeature={slant=0.17}},BoldItalicFont=#3,BoldItalicFeatures={RawFeature={slant=0.17}}]{#2}% -} - -\ifzhfont@fakebold - \newfontfamilywithslant\zhrmfont{SimSun} - \newfontfamilywithslant\zhsffont{SimHei} - \newfontfamilywithslant\zhttfont{[simfang.ttf]} -\else - \newfontfamilywithslantandbold\zhrmfont{SimSun}{SimHei} - \newfontfamilywithslant\zhsffont{SimHei} - \newfontfamilywithslantandbold\zhttfont{[simfang.ttf]}{[simkai.ttf]} -\fi -\def\zhfont{\ifcase\zhs@curr@fam\zhrmfont\or\zhsffont\or\zhttfont\else\zhrmfont\fi} - -\def\setzhmainfont{\newfontfamily\zhrmfont} -\def\setzhsansfont{\newfontfamily\zhsffont} -\def\setzhmonofont{\newfontfamily\zhttfont} - -\enableactivehanzi -\def\zhhanzihook#1{% - % select family - \long\edef\zhs@tmpmacro{\f@family}% - \def\zhs@curr@fam{0}% - \ifx\zhs@tmpmacro\sfdefault - \def\zhs@curr@fam{1}% - \else\ifx\zhs@tmpmacro\ttdefault - \def\zhs@curr@fam{2}% - \fi\fi - \edef\zhs@tmpmacro{\f@family}% - \ifx\zhs@tmpmacro\sfdefault - \def\zhs@curr@fam{1}% - \else\ifx\zhs@tmpmacro\ttdefault - \def\zhs@curr@fam{2}% - \fi\fi - \ifzhfont@fakebold\ifx\f@series\zhfont@bx - \special{pdf: literal direct q 0.3 w 2 Tr}% - \fi\fi - {\XeTeXinterchartokenstate=0\zhs@font #1}% - \ifzhfont@fakebold\ifx\f@series\zhfont@bx - \special{pdf: literal direct 0 Tr}% - \fi\fi -} - -\def\underdot@dot{\XeTeXinterchartokenstate=0\zhpunctfont \vbox to 0.5em{\vss\hbox{·}\vss}} -%\def\underdot@dot{\vbox to 0.5em{\vss\hbox{\bf .}\vss}} -\newskip\underdot@skip -\underdot@skip=2.5pt -\def\underdot{% - \begingroup - \makehanziglobalactive - \def\zhhanzihook##1{% - \setbox0=\hbox{\underdot@dot}% - \leavevmode\vtop{\baselineskip=\underdot@skip\lineskiplimit=-\maxdimen - \advance\baselineskip\ht0 - % select family - \long\edef\zhs@tmpmacro{\f@family}% - \def\zhs@curr@fam{0}% - \ifx\zhs@tmpmacro\sfdefault - \def\zhs@curr@fam{1}% - \else\ifx\zhs@tmpmacro\ttdefault - \def\zhs@curr@fam{2}% - \fi\fi - \edef\zhs@tmpmacro{\f@family}% - \ifx\zhs@tmpmacro\sfdefault - \def\zhs@curr@fam{1}% - \else\ifx\zhs@tmpmacro\ttdefault - \def\zhs@curr@fam{2}% - \fi\fi - \ialign{####\cr\XeTeXinterchartokenstate=0\zhs@font - \ifzhfont@fakebold\ifx\f@series\zhfont@bx - \special{pdf: literal direct q 0.3 w 2 Tr}##1% - \special{pdf: literal direct 0 Tr}\else ##1\fi\else ##1\fi - \cr\hidewidth\box0\hidewidth\cr}}% - }% - \underd@t -} -\def\underd@t#1{% - #1% - \makehanzigloballetter - \endgroup -} - -\endinput diff --git a/Master/texmf-dist/tex/xetex/zhspacing/latex/zhulem.sty b/Master/texmf-dist/tex/xetex/zhspacing/latex/zhulem.sty deleted file mode 100644 index 86365e380ab..00000000000 --- a/Master/texmf-dist/tex/xetex/zhspacing/latex/zhulem.sty +++ /dev/null @@ -1,18 +0,0 @@ -% zhulem.sty coded by YIN Dian -% Fix compatibility problem with ulem -% Hist: 070822 Changed \UL@reskip and \UL@@penalty, able to work. -\NeedsTeXFormat{LaTeX2e}[1996/12/01] -\def\fileversion{0.4} -\def\filedate{2007/08/22} -\ProvidesPackage{zhulem}[\filedate\space\fileversion] -\RequirePackage{ulem}[2000/05/26] -%\let\zhulem@printfont\zhs@printf@nt -\def\zhulem@printfont#1{} -\def\UL@reskip{\zhs@savef@nt{tmp}\UL@stop \zhulem@printfont{tmp}\UL@leaders - \UL@start\zhs@restoref@nt{tmp}} -\def\UL@@penalty{\LA@penalty \ifnum\count@=\z@ - \@ne \else \count@ \fi % zero penalty => no penalty, so use 1 instead. - \zhs@savef@nt{tmp}\UL@stop \zhulem@printfont{tmp}\UL@start - \zhs@restoref@nt{tmp}} - -\endinput diff --git a/Master/texmf-dist/tex/xetex/zhspacing/zhfont.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhfont.sty new file mode 100644 index 00000000000..cc3f98d382b --- /dev/null +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhfont.sty @@ -0,0 +1,140 @@ +% zhfont.sty coded by YIN Dian +% Simplify setting various font effects +% Hist: 071204 First coded. +% 071210 Improved. Added \newfontfamilywithslant and +% \newfontfamilywithslantandbold to simplify setting. +% 071211 Added fake bold support. +% 071231 Added underdot support. +% 080102 Minor changes on underdot. Don's use \scantokens. +% Fixed bug of \zhfont in ulem. Added font family +% selection and fake bold support in active hanzi. +\NeedsTeXFormat{LaTeX2e}[1996/12/01] +\def\filedate{2008/01/02} +\ProvidesPackage{zhfont}[\filedate] +\RequirePackage{zhspacing} +\RequirePackage{zhulem} +\newif\ifzhfont@fakebold +\zhfont@fakeboldfalse +\DeclareOption{fakebold}{\zhfont@fakeboldtrue} +\ProcessOptions\relax + +\def\zhs@tmpmacro{} +\def\zhs@curr@fam{-1} + +\zhnfsssavefont +\g@addto@macro\zhs@savefont{% + \long\edef\zhs@tmpmacro{\f@family}% + \def\zhs@curr@fam{0}% + \ifx\zhs@tmpmacro\sfdefault + \def\zhs@curr@fam{1}% + \else\ifx\zhs@tmpmacro\ttdefault + \def\zhs@curr@fam{2}% + \fi\fi + \edef\zhs@tmpmacro{\f@family}% + \ifx\zhs@tmpmacro\sfdefault + \def\zhs@curr@fam{1}% + \else\ifx\zhs@tmpmacro\ttdefault + \def\zhs@curr@fam{2}% + \fi\fi +} +\ifzhfont@fakebold +\def\zhfont@bx{bx} +\g@addto@macro\zhs@savefont{% + \ifx\f@series\zhfont@bx + \special{pdf: literal direct q 0.3 w 2 Tr}% + \fi +} +\g@addto@macro\zhs@restorefont{% + \ifx\f@series\zhfont@bx + \special{pdf: literal direct 0 Tr}% + \fi +} +\fi + +\def\newfontfamilywithslant#1#2{% + \newfontfamily#1[ItalicFont=#2,ItalicFeatures={RawFeature={slant=0.17}},BoldItalicFont=#2,BoldItalicFeatures={RawFeature={slant=0.17}}]{#2}% +} +\def\newfontfamilywithslantandbold#1#2#3{% + \newfontfamily#1[BoldFont=#3,ItalicFont=#2,ItalicFeatures={RawFeature={slant=0.17}},BoldItalicFont=#3,BoldItalicFeatures={RawFeature={slant=0.17}}]{#2}% +} + +\ifzhfont@fakebold + \newfontfamilywithslant\zhrmfont{SimSun} + \newfontfamilywithslant\zhsffont{SimHei} + \newfontfamilywithslant\zhttfont{[simfang.ttf]} +\else + \newfontfamilywithslantandbold\zhrmfont{SimSun}{SimHei} + \newfontfamilywithslant\zhsffont{SimHei} + \newfontfamilywithslantandbold\zhttfont{[simfang.ttf]}{[simkai.ttf]} +\fi +\def\zhfont{\ifcase\zhs@curr@fam\zhrmfont\or\zhsffont\or\zhttfont\else\zhrmfont\fi} + +\def\setzhmainfont{\newfontfamily\zhrmfont} +\def\setzhsansfont{\newfontfamily\zhsffont} +\def\setzhmonofont{\newfontfamily\zhttfont} + +\enableactivehanzi +\def\zhhanzihook#1{% + % select family + \long\edef\zhs@tmpmacro{\f@family}% + \def\zhs@curr@fam{0}% + \ifx\zhs@tmpmacro\sfdefault + \def\zhs@curr@fam{1}% + \else\ifx\zhs@tmpmacro\ttdefault + \def\zhs@curr@fam{2}% + \fi\fi + \edef\zhs@tmpmacro{\f@family}% + \ifx\zhs@tmpmacro\sfdefault + \def\zhs@curr@fam{1}% + \else\ifx\zhs@tmpmacro\ttdefault + \def\zhs@curr@fam{2}% + \fi\fi + \ifzhfont@fakebold\ifx\f@series\zhfont@bx + \special{pdf: literal direct q 0.3 w 2 Tr}% + \fi\fi + {\XeTeXinterchartokenstate=0\zhs@font #1}% + \ifzhfont@fakebold\ifx\f@series\zhfont@bx + \special{pdf: literal direct 0 Tr}% + \fi\fi +} + +\def\underdot@dot{\XeTeXinterchartokenstate=0\zhpunctfont \vbox to 0.5em{\vss\hbox{·}\vss}} +%\def\underdot@dot{\vbox to 0.5em{\vss\hbox{\bf .}\vss}} +\newskip\underdot@skip +\underdot@skip=2.5pt +\def\underdot{% + \begingroup + \makehanziglobalactive + \def\zhhanzihook##1{% + \setbox0=\hbox{\underdot@dot}% + \leavevmode\vtop{\baselineskip=\underdot@skip\lineskiplimit=-\maxdimen + \advance\baselineskip\ht0 + % select family + \long\edef\zhs@tmpmacro{\f@family}% + \def\zhs@curr@fam{0}% + \ifx\zhs@tmpmacro\sfdefault + \def\zhs@curr@fam{1}% + \else\ifx\zhs@tmpmacro\ttdefault + \def\zhs@curr@fam{2}% + \fi\fi + \edef\zhs@tmpmacro{\f@family}% + \ifx\zhs@tmpmacro\sfdefault + \def\zhs@curr@fam{1}% + \else\ifx\zhs@tmpmacro\ttdefault + \def\zhs@curr@fam{2}% + \fi\fi + \ialign{####\cr\XeTeXinterchartokenstate=0\zhs@font + \ifzhfont@fakebold\ifx\f@series\zhfont@bx + \special{pdf: literal direct q 0.3 w 2 Tr}##1% + \special{pdf: literal direct 0 Tr}\else ##1\fi\else ##1\fi + \cr\hidewidth\box0\hidewidth\cr}}% + }% + \underd@t +} +\def\underd@t#1{% + #1% + \makehanzigloballetter + \endgroup +} + +\endinput diff --git a/Master/texmf-dist/tex/xetex/zhspacing/zhmath.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhmath.sty new file mode 100644 index 00000000000..80a090dd84e --- /dev/null +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhmath.sty @@ -0,0 +1,169 @@ +% zhmath.sty coded by YIN Dian +% Use basic CJK characters in math environment. +% Hist: 071202 First coded. +% 071204 Set \XeTeXinterchartokenstate=0 to avoid a XeTeX bug. +% Added \ProvidesPackage. +% 071210 Added another method to set Chinese math fonts in +% LaTeX, via option noactive. Improved format detection. +% Added ability to set alpha and number fonts. +% 071211 Put \setalphanummathfonts in preamble so that +% \usecustommathfonts can be used in document in LaTeX. +% Changed \hbox to \mbox. Changed default option to +% noactive. +% 071215 Removed \XeTeXinterchartokenstate=0, as the XeTeX bug +% is fixed by JK. Changed \mathcjksizec/d to fit the +% main text size. +% 071229 Added \XeTeXinterchartokenstate=0 again, because not +% everyone has the latest version of XeTeX. Added custom +% and nocustom options. +% 2016/02/10 Improved \@setzhmathfonts. +\catcode`\@=11 +\ifx\zhmath@defined\@undefined +\def\zhmath@defined{\relax} +\def\filedate{2007/12/29} +\ifx\zhspacingrevision\@undefined +\input zhspacing.sty +\fi + +\def\zhmath@setXeTeXmathcodefam#1#2#3{% + % set #1..#2's math family to #3 + \count@=#1% + \loop + \XeTeXmathcode\count@=7 #3 \count@ + \unless\ifnum\count@>#2% + \advance\count@ by 1 + \repeat +} + +\def\zhmath@setactivemathchar#1#2#3#4#5#6{% + % set #1..#2 to active math chars, executing \mathchoice #3 #4 #5 #6. + \count@=#1% + \loop + \mathcode\count@="8000 + {\catcode\count@=\active\lccode`\~=\count@ + \lowercase{\xdef~{{\mathchoice{\noexpand#3{\number\count@}}% + {\noexpand#4{\number\count@}}{\noexpand#5{\number\count@}} + {\noexpand#6{\number\count@}}}}}% + }% + \unless\ifnum\count@>#2% + \advance\count@ by 1 + \repeat +} +\newif\ifzhmath@active +\newif\ifzhmath@custom + +\ifLaTeX@e % in LaTeX, similar to mathcjk + +\ProvidesPackage{zhmath}[\filedate] +\DeclareOption{active}{\zhmath@activetrue} +\DeclareOption{noactive}{\zhmath@activefalse} +\DeclareOption{custom}{\zhmath@customtrue} +\DeclareOption{nocustom}{\zhmath@customfalse} +\zhmath@activefalse +\zhmath@customtrue +\ProcessOptions\relax + +\def\mathcjksizea{} +\def\mathcjksizeb{} +\def\mathcjksizec{\dimen@=\dimexpr\f@size pt*6/10\relax\fontsize{\dimen@}{\dimen@}} +\def\mathcjksized{\dimen@=\dimexpr\f@size pt*5/10\relax\fontsize{\dimen@}{\dimen@}} + +\@ifundefined{zhmathfont}{\newfontfamily\zhmathfont{SimSun}}{} + +\ifzhmath@active + \def\zhmath@zhfont@disp#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksizea\char#1\relax}}} + \def\zhmath@zhfont@text#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksizeb\char#1\relax}}} + \def\zhmath@zhfont@scrp#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksizec\char#1\relax}}} + \def\zhmath@zhfont@subs#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksized\char#1\relax}}} + + \zhmath@setactivemathchar{"2E80}{"9FFF}{\zhmath@zhfont@disp}% + {\zhmath@zhfont@text}{\zhmath@zhfont@scrp}{\zhmath@zhfont@subs} + + \def\setzhmathfont#1{\let\zhmathfont=#1} +\else + \def\setzhmathfont#1{% + \let\zhmathfont=#1% + \begingroup + \normalfont + \zhmathfont + \xdef\zhmath@fenc{\f@encoding}% + \xdef\zhmath@ffam{\f@family}% + \endgroup + \DeclareSymbolFont{hanzi}{\zhmath@fenc}{\zhmath@ffam}{m}{n}% + } + \setzhmathfont\zhmathfont + \zhmath@setXeTeXmathcodefam{"2E80}{"9FFF}{\symhanzi} +\fi + +\ifzhmath@custom +\def\setalphanummathfonts#1{% + \let\zhmathalphanumfont=#1% + \begingroup + \normalfont + \zhmathalphanumfont + \xdef\zhmath@@fenc{\f@encoding}% + \xdef\zhmath@@ffam{\f@family}% + \endgroup + \DeclareSymbolFont{@letter}{\zhmath@@fenc}{\zhmath@@ffam}{m}{it}% + \DeclareSymbolFont{@number}{\zhmath@@fenc}{\zhmath@@ffam}{m}{n}% + \SetSymbolFont{@letter}{bold}{\zhmath@@fenc}{\zhmath@@ffam}{bx}{it}% + \SetSymbolFont{@number}{bold}{\zhmath@@fenc}{\zhmath@@ffam}{bx}{n}% +} +\@ifundefined{zhmathalphanumfont}{\newfontfamily\zhmathalphanumfont{Times New Roman}}{} +\setalphanummathfonts\zhmathalphanumfont +\def\usecustommathfonts{% + \zhmath@setXeTeXmathcodefam{`\0}{`\9}{\sym@number} + \zhmath@setXeTeXmathcodefam{`\a}{`\z}{\sym@letter} + \zhmath@setXeTeXmathcodefam{`\A}{`\Z}{\sym@letter} +} +\fi + +\else %in plain TeX + +\@ifundefined{zhmathfont}{\font\zhmathfont="SimSun" at 10pt}{} +\newfam\zhmath@fam +\newfam\zhmath@letterfam +\newfam\zhmath@numberfam + +\begingroup + \catcode`\A=12 % + \catcode`\P=12 % + \catcode`\T=12 % +\lowercase{\endgroup + \def\@setzhmathfonts#1#2{% + \expandafter\@setzhmathfonts@auxi\fontname#1 AT PT\relax#2} + \def\@setzhmathfonts@auxi #1 AT #2PT#3\relax#4{% + \ifx\relax#2\relax + \@setzhmathfonts@auxii#4{#1}{10pt}% + \else + \@setzhmathfonts@auxii#4{#1}{#2pt}% + \fi}% +} +\def\@setzhmathfonts@auxii#1#2#3{% + \font\zhmath@textfont=#2 at #3 \relax + \font\zhmath@scriptfont=#2 at .7\dimexpr#3\relax\relax + \font\zhmath@scriptscriptfont=#2 at .5\dimexpr#3\relax\relax + \textfont#1=\zhmath@textfont + \scriptfont#1=\zhmath@scriptfont + \scriptscriptfont#1=\zhmath@scriptscriptfont} +\def\setzhmathfont#1{\@setzhmathfonts{#1}\zhmath@fam} +\setzhmathfont\zhmathfont + +\def\setalphanummathfonts#1#2{% #1: alpha, #2, num + \@setzhmathfonts{#1}\zhmath@letterfam + \@setzhmathfonts{#2}\zhmath@numberfam +} + +\zhmath@setXeTeXmathcodefam{"2E80}{"9FFF}{\zhmath@fam} + +\def\usecustommathfonts{% + \@ifundefined{zhmathletterfont}{\font\zhmathletterfont="Times New Roman/I" at 10pt}{} + \@ifundefined{zhmathnumberfont}{\font\zhmathnumberfont="Times New Roman" at 10pt}{} + \setalphanummathfonts\zhmathletterfont\zhmathnumberfont + \zhmath@setXeTeXmathcodefam{`\0}{`\9}{\zhmath@numberfam} + \zhmath@setXeTeXmathcodefam{`\a}{`\z}{\zhmath@letterfam} + \zhmath@setXeTeXmathcodefam{`\A}{`\Z}{\zhmath@letterfam} +} + +\fi % end if LaTeX +\fi diff --git a/Master/texmf-dist/tex/xetex/zhspacing/zhsmyclass.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhsmyclass.sty new file mode 100644 index 00000000000..4633ee10596 --- /dev/null +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhsmyclass.sty @@ -0,0 +1,151 @@ +% zhsmyclass.sty coded by YIN Dian +% Implement easy inter-class token definition with inheritance +% Hist: 070807 First usable version coded. \newclass, \{set,get,prepend,append}interclasstoks +% The tricky part is prepending stuffs to a token register, see TeX by Topics. +% 070808 Added \setclassnum and \registerXeTeXclasstoks +% 070809 Removed unnecessary \global's. +% 070810 Only register non-empty tokens. +% 071019 Added \getclassnum +% 071210 Changed \@foreach to \@for. +\catcode`\@=11 +\ifx\@myclass@defined\@undefined\else + \expandafter\endinput +\fi +\def\@myclass@defined{\relax} +\input zhsusefulmacros.sty +\catcode`\@=11 +\def\@class@list{} +\def\newclass{\@ifnextchar[{\@newclass@param}{\@newclass}} +\def\@newclass@param[#1]#2{% + \if!#1! + \errmessage{Base class name shouldn't be empty.}% + \fi + \if!#2! + \errmessage{Class name shouldn't be empty.}% + \fi + \@ifundefined{@@classname@#1}{% + \errmessage{Base class not defined yet.}% + }{}% + \@ifundefined{@@classname@#2}{% if + \@namedef{@@classname@#2}{\relax}% + \@namedef{@@baseclass@#2}{#1}% + \@for\@@class:=\@class@list\do{% for + \if!\@@class! + \else + \@newinterclasstoks{#2}{\@@class}% + \@newinterclasstoks{\@@class}{#2}% + %\setinterclasstoks{#2}{\@@class}{\getinterclasstoks{#1}{\@@class}}% + %\setinterclasstoks{\@@class}{#2}{\getinterclasstoks{\@@class}{#1}}% + \copyinterclasstoks{#2}{\@@class}{#1}{\@@class}% + \copyinterclasstoks{\@@class}{#2}{\@@class}{#1}% + \fi + }% end for + \@newinterclasstoks{#2}{#2}% + \edef\@class@list{\@class@list,#2}% + }{% else + \errmessage{Class already defined.}% + }% end if +} +\def\@newclass#1{% + \if!#1! + \errmessage{Class name shouldn't be empty.}% + \fi + \@ifundefined{@@classname@#1}{% if + \@namedef{@@classname@#1}{\relax}% + \@for\@@class:=\@class@list\do{% for + \if!\@@class! + \else + \@newinterclasstoks{#1}{\@@class}% + \@newinterclasstoks{\@@class}{#1}% + \fi + }% end for + \@newinterclasstoks{#1}{#1}% + \edef\@class@list{\@class@list,#1}% + }{% else + \errmessage{Class already defined.}% + }% end if +} +\def\getbaseclass#1#2{% + \@ifundefined{@@baseclass@#1}{\def#2{}}{\edef#2{\csname @@baseclass@#1\endcsname}}% +} +\def\@newinterclasstoks#1#2{% + \csname newtoks\expandafter\endcsname\csname @@interclasstoks@#1@#2\endcsname + \csname @@interclasstoks@#1@#2\endcsname={}%\meaning #1, \meaning #2}% + %%\expandafter\gdef\csname @@interclasstoks@#1@#2\endcsname{}% +} +\def\setinterclasstoks#1#2#3{% + \csname @@interclasstoks@#1@#2\endcsname={#3}% + %%\expandafter\edef\csname @@interclasstoks@#1@#2\endcsname{#3}% +} +\def\getinterclasstoks#1#2{% + \expandafter\the\csname @@interclasstoks@#1@#2\endcsname + %%\csname @@interclasstoks@#1@#2\endcsname +} +\def\copyinterclasstoks#1#2#3#4{% (#1, #2) <- (#3, #4) + \expandafter\csname @@interclasstoks@#1@#2\endcsname\expandafter{\expandafter\the\csname @@interclasstoks@#3@#4\endcsname}% +} +\def\prependinterclasstoks#1#2#3{% + \toks0={#3}% + \edef\@@prepend@act{\csname @@interclasstoks@#1@#2\endcsname={\the\toks0 + \expandafter\the\csname @@interclasstoks@#1@#2\endcsname}}% + \@@prepend@act + %%\expandafter\edef\csname @@interclasstoks@#1@#2\endcsname{#3\csname @@interclasstoks@#1@#2\endcsname}% +} +\def\appendinterclasstoks#1#2#3{% + \expandafter\csname @@interclasstoks@#1@#2\endcsname\expandafter{\the\csname @@interclasstoks@#1@#2\endcsname #3}% + %%\global\expandafter\edef\csname @@interclasstoks@#1@#2\endcsname{\csname @@interclasstoks@#1@#2\endcsname #3}% +} +\def\showallinterclasstoks{% + \par + \begingroup + \@for\class:=\@class@list\do{% + \if!\class! + \else + \@for\anotherclass:=\@class@list\do{% + \if!\anotherclass! + \else + [\class, \anotherclass]: %\csname @@interclasstoks@\class @\anotherclass\endcsname + \expandafter\the\csname @@interclasstoks@\class @\anotherclass\endcsname + \hfil\break + \fi + }% + \fi + }% + \endgroup +} +\newlinechar`\^^J +\def\setclassnum#1#2{% + \expandafter\chardef\csname @@classnum@#1\endcsname=#2\relax +} +\def\getclassnum#1{% + \csname @@classnum@#1\endcsname +} +\def\mydbgmessag@#1{} +\def\registerXeTeXclasstoks{% + \@for\class:=\@class@list\do{% + \@ifundefined{@@classnum@\class}{}{% + \@for\anotherclass:=\@class@list\do{% + \@ifundefined{@@classnum@\anotherclass}{}{% + \edef\@@temp@macro{\the\csname @@interclasstoks@\class @\anotherclass\endcsname}% + \ifx\@@temp@macro\empty + \else + \edef\@@temp@macro{\@@temp@macro}% + \ifx\@@temp@macro\empty + \else + \edef\@@register@act{\noexpand\XeTeXinterchartoks\csname @@classnum@\class\endcsname + \csname @@classnum@\anotherclass\endcsname\noexpand{\expandafter\the\csname + @@interclasstoks@\class @\anotherclass\endcsname\noexpand}}% + \@@register@act + \edef\@@register@act{\noexpand\mydbgmessag@\noexpand{Registered (\expandafter\number + \csname @@classnum@\class\endcsname, \expandafter\number + \csname @@classnum@\anotherclass\endcsname)\noexpand}}% + \@@register@act + \mydbgmessag@{Registered (\class, \anotherclass) token: \expandafter\the\csname + @@interclasstoks@\class @\anotherclass\endcsname ^^J}% + \fi + \fi + }% + }% + }% + }% +} diff --git a/Master/texmf-dist/tex/xetex/zhspacing/zhspacing.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhspacing.sty new file mode 100644 index 00000000000..71eb6aac262 --- /dev/null +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhspacing.sty @@ -0,0 +1,853 @@ +% zhspacing.sty version 3.5 +% Simple macro for typesetting mixed Chinese documents in XeTeX +% with punctuation space adjustment and prohibitions +% coded by YIN Dian (yindian@ustc) +% Licensed under GPL +% History: 070804 First usable version. +% 070805 Several line breaking bug fixes. +% 070807 \zhinteropenskip changed to 0.6em. \enfont +% TODO list written. +% 070808 Use macros instead of skips to fit different font size. +% 070809 Tried to use myclass to manage classes, but failed. +% Then I found it works when \relax is added. +% 070810 Changed skip parameters. Removed \relax, only register +% non-empty tokens instead. Now it seems to work right. +% Several bugs fixed. CJK Ext-A/B support added. +% Added three skip schemes. +% 070812 Fixed font switch bug between CJK Ext-A and Ext-B chars. +% Obsoleted the use of \enfont. +% 070822 Fixed bug of unbalanced group when using ulem? Cleared +% XeTeX's pre-defined inter-char tokens. Use seperate +% font for punctuations. +% Deprecated the use of begin/end-groups in LaTeX, in +% order to work properly with ulem. Coded zhulem.sty. +% 070823 Use more flexible way to save font. Changed space +% ignoring mechanism after hanzi to allow \skipenzh added +% between hanzi and boundary if the next non-space token +% is a char and is not fullwidth nor in PUA. +% 070824 Enabled automatic skip between math formulas and CJK +% chars. Changed skip schemes. Added \zhspacingrevision. +% 071008 Fixed bug of missing \skipzh when hanzi next to space. +% Found bug of \zhs@skipspaces --- \iffalse error. +% Found bug?? in 10pt article: +% \fbox{\vbox{\hsize=12.2001pt\scriptsize \parindent=0pt +% \parskip=0pt《口口》口:“}} +% 071014 Found bug introduced by the last bug fix, which breaks +% the punctuation prohibitions. (Fixed on 071020) +% 071015 Fixed bug of not changing punctuation font after space. +% 071019 Fixed the \iffalse bug. Use \the\XeTeXcharclass +% instead of ifcjkchar. +% Defined token patterns to simplify settings, haha. +% 071020 Added ability to deal with space seperated characters. +% Added XeTeX existence test. More intelligent parindent +% setting. Fixed bug of English font change through not +% using \getinterclasstoks, hmmm. +% Seperated fullstop and halfstop skips. They were both +% treated as judou before. Added \halthalfskipscheme. +% 071027 Fixed bug of \halthalfskipscheme. Added class setting +% for some punctuations. +% 071103 Fixed bug of no \skipzh between CJK Ext-A/B chars. +% However, due to the current bug of XeTeX, CJK Ext-B +% chars may not have a correct \meaning, so having them +% after spaces may result in a compiling failure. +% 071117 Use \ifzhs@isvalidchar to avoid the XeTeX \meaning +% bug. Added \ProvidesPackage when under LaTeX. +% 071202 Fixed bug of wrong \ProvidesPackage in plain TeX. +% 071210 Changed usefulmacros.sty. Removed \@foreach because I +% find they are redundant --- \@for already has +% \expandafter #2. Improved LaTeX detecting. +% 071211 Minor change on \simsunskipscheme. +% 071229 Added a few punctuation classification settings. +% Refined code. Added active hanzi hook. Removed some +% debug code for compiling speed. Not thoroughly tested. +% 071231 Use \zhs@@a to reduce memory usage. Removed +% \zhs@active@alphabound because it's not effective. +% Use \lastnodetype and \spacefactor to determine whether +% or not to insert \skipenzh. Added a few punctuation +% classification settings. +% 080102 No \enableactivehanzi by default. Changed \zhhanzihook. +% Use hex number to represent hanzi. Added \zhs@font. +% Added ambiwide and ambinarrow options. Made active +% hanzi protected. +% 090720 Rename usefulmacros.sty and myclass.sty to +% zhsusefulmacros.sty and zhsmyclass.sty. +% 2012/03/14 Fix bug for Plain format. +% 2016/02/20 Compatible with LaTeX2e 2016/02/01. +% 2016/02/10 The boundary class is changed from 255 to 4095 +% since XeTeX 0.99994. +% Note: 1. Catcode test requires letter 'a' to be in category 11, and '!' +% to be in category 12. So don't change the default catcodes. +% 2. To speed up processing long Chinese documents, set \skipzh to +% empty and \XeTeXinterchartoks 1 1={}. This can save 1/4 time. +% 3. \zhspacing will generate a few spaces. Using it in horizontal +% mode will produce unwanted skips. +\catcode`\@=11 +\ifx\XeTeXrevision\@undefined + \errmessage{XeTeX required to use zhspacing}% +\fi +\ifx\XeTeXinterchartokenstate\@undefined + \errmessage{XeTeX 0.997 or above required to use zhspacing}% +\fi +\ifx\zhspacingrevision\@undefined +\def\zhspacingrevision{2016/02/10} +\input zhsusefulmacros.sty +\newif\ifzhs@ambiwide +\zhs@ambiwidetrue +\ifLaTeX@e + \ProvidesPackage{zhspacing}[\zhspacingrevision] + \DeclareOption{ambiwide}{\zhs@ambiwidetrue} + \DeclareOption{ambinarrow}{\zhs@ambiwidefalse} + \ProcessOptions\relax +\fi +\XeTeXlinebreaklocale="zh" +\XeTeXlinebreakskip=0pt plus 0.2em minus 0.1em +\def\zhnobreak{\nobreak} +\def\simsunskipscheme{% should be fit for sim-xxx fonts + % my skip + \def\skipzh{\hskip 0em plus 0.2em minus 0.1em} + \def\skipenzh{\hskip 0.25em plus 0.15em minus 0.05em} + \def\skipzhopen{\hskip -0.0em plus 0.0em minus 0.3em} + \def\skipzhinteropen{\hskip -0.3em plus 0.1em minus 0.1em} + \def\skipzhlinestartopen{\hskip -0.35em} + \def\skipzhclose{\hskip -0.0em plus 0.0em minus 0.3em} + \def\skipzhinterclose{\hskip -0.3em plus 0.1em minus 0.1em} + \def\skipzhlineendclose{\hskip -0.35em} + \def\skipzhhalfstop{\hskip -0.0em plus 0.0em minus 0.5em} + \def\skipzhinterhalfstop{\hskip -0.3em plus 0.1em minus 0.1em} + \def\skipzhlineendhalfstop{\hskip -0.6em} + \def\skipzhfullstop{\hskip -0.0em plus 0.0em minus 0.5em} + \def\skipzhinterfullstop{\hskip -0.3em plus 0.1em minus 0.1em} + \def\skipzhlineendfullstop{\hskip -0.575em} + % neg + \def\skipnegzhlinestartopen{\hskip 0.35em} + \def\skipnegzhlineendclose{\hskip 0.35em} + \def\skipnegzhlineendhalfstop{\hskip 0.6em} + \def\skipnegzhlineendfullstop{\hskip 0.575em} +} +\def\emptyskipscheme{% just for test use + % my skip + \def\skipzh{\hskip 0em plus 0.1em} + \def\skipenzh{\hskip 0em plus 0.2em} + \def\skipzhopen{\hskip 0pt} + \def\skipzhinteropen{\hskip 0pt} + \def\skipzhlinestartopen{\hskip 0pt} + \def\skipzhclose{\hskip 0pt} + \def\skipzhinterclose{\hskip 0pt} + \def\skipzhlineendclose{\hskip 0pt} + \def\skipzhhalfstop{\hskip 0pt} + \def\skipzhinterhalfstop{\hskip 0pt} + \def\skipzhlineendhalfstop{\hskip 0pt} + \def\skipzhfullstop{\hskip 0pt} + \def\skipzhinterfullstop{\hskip 0pt} + \def\skipzhlineendfullstop{\hskip 0pt} + % neg + \def\skipnegzhlinestartopen{\hskip 0pt} + \def\skipnegzhlineendclose{\hskip 0pt} + \def\skipnegzhlineendhalfstop{\hskip 0pt} + \def\skipnegzhlineendfullstop{\hskip 0pt} +} +\def\haltfullskipscheme{% should be fit for Adobe opentype fonts with halfwidth alternative enabled + % my skip + \def\skipzh{\hskip 0em plus 0.2em minus 0.1em} + \def\skipenzh{\hskip 0.25em plus 0.15em minus 0.05em} + \def\skipzhopen{\hskip 0.3em minus 0.3em} + \def\skipzhinteropen{\hskip 0em plus 0.1em } + \def\skipzhlinestartopen{\hskip 0em} + \def\skipzhclose{\hskip 0.3em minus 0.3em} + \def\skipzhinterclose{\hskip 0em plus 0.1em} + \def\skipzhlineendclose{\hskip 0em} + \def\skipzhhalfstop{\hskip 0.4em minus 0.4em} + \def\skipzhinterhalfstop{\hskip 0em plus 0.1em} + \def\skipzhlineendhalfstop{\hskip 0em} + \def\skipzhfullstop{\hskip 0.4em minus 0.4em} + \def\skipzhinterfullstop{\hskip 0em plus 0.1em} + \def\skipzhlineendfullstop{\hskip 0em} + % neg + \def\skipnegzhlinestartopen{\hskip 0em} + \def\skipnegzhlineendclose{\hskip 0em} + \def\skipnegzhlineendhalfstop{\hskip 0em} + \def\skipnegzhlineendfullstop{\hskip 0em} +} +\let\haltskipscheme\haltfullskipscheme % for backward compatibility +\def\halthalfskipscheme{% should be fit for Adobe opentype fonts with halfwidth alternative enabled + % my skip + \def\skipzh{\hskip 0em plus 0.2em minus 0.1em} + \def\skipenzh{\hskip 0.25em plus 0.15em minus 0.05em} + \def\skipzhopen{\hskip 0.0em plus 0.3em} + \def\skipzhinteropen{\hskip 0em plus 0.1em } + \def\skipzhlinestartopen{\hskip 0em} + \def\skipzhclose{\hskip 0.0em plus 0.3em} + \def\skipzhinterclose{\hskip 0em plus 0.1em} + \def\skipzhlineendclose{\hskip 0em} + \def\skipzhhalfstop{\hskip 0.0em plus 0.4em} + \def\skipzhinterhalfstop{\hskip 0em plus 0.1em} + \def\skipzhlineendhalfstop{\hskip -0.15em} + \def\skipzhfullstop{\hskip 0.0em plus 0.4em} + \def\skipzhinterfullstop{\hskip 0em plus 0.1em} + \def\skipzhlineendfullstop{\hskip -0.15em} + % neg + \def\skipnegzhlinestartopen{\hskip 0em} + \def\skipnegzhlineendclose{\hskip 0em} + \def\skipnegzhlineendhalfstop{\hskip 0.15em} + \def\skipnegzhlineendfullstop{\hskip 0.15em} +} +\simsunskipscheme +%\let\mydbgmessage\message +\def\mydbgmessage#1{} + +% font save and restore +\def\zhs@oldf@encoding{} +\def\zhs@oldf@family{} +\def\zhs@oldf@series{} +\def\zhs@oldf@shape{} +\def\zhs@oldf@size{} +\def\zhs@savef@nt#1{% + \expandafter\xdef\csname zhs@#1f@encoding\endcsname{\f@encoding}% + \expandafter\xdef\csname zhs@#1f@family\endcsname{\f@family}% + \expandafter\xdef\csname zhs@#1f@series\endcsname{\f@series}% + \expandafter\xdef\csname zhs@#1f@shape\endcsname{\f@shape}% + \expandafter\xdef\csname zhs@#1f@size\endcsname{\f@size}% +} +\def\zhs@restoref@nt#1{% + \edef\f@encoding{\csname zhs@#1f@encoding\endcsname}% + \edef\f@family{\csname zhs@#1f@family\endcsname}% + \edef\f@series{\csname zhs@#1f@series\endcsname}% + \edef\f@shape{\csname zhs@#1f@shape\endcsname}% + \edef\f@size{\csname zhs@#1f@size\endcsname}% + \selectfont +} +\def\zhs@printf@nt#1{% + \immediate\write16{Font #1 is: \csname zhs@#1f@encoding\endcsname/\csname zhs@#1f@family\endcsname/\csname + zhs@#1f@series\endcsname/\csname zhs@#1f@shape\endcsname/\csname zhs@#1f@size\endcsname}% +} +\def\zhgroupsavefont{% + \let\zhs@savefont=\begingroup + \let\zhs@restorefont=\endgroup +} +\def\zhnfsssavefont{% + \def\zhs@savefont{\zhs@savef@nt{old}} + \def\zhs@restorefont{\zhs@restoref@nt{old}} +} +\ifLaTeX@e + \zhnfsssavefont +\else + \zhgroupsavefont +\fi + +% test CJK char +\def\chartonum#1#2{% #1: an explicit or implicit char; #2: return macro + \ifcat#1a% + \edef#2{\expandafter\@lettertonum\meaning #1\@end}% + \edef#2{\expandafter\number\expandafter\lq #2}% + \else + \ifcat#1!% + \edef#2{\expandafter\@chartonum\meaning #1\@end}% + \edef#2{\expandafter\number\expandafter\lq #2}% + \else + \errmessage{In \string\chartonum, parameter not a letter, nor a character}% + \fi + \fi +} +{\escapechar=-1 + \expandafter\expandafter\expandafter\gdef + \expandafter\expandafter\expandafter\@lettertonum + \expandafter\string\csname the letter \endcsname#1\@end{#1} + \expandafter\expandafter\expandafter\gdef + \expandafter\expandafter\expandafter\@chartonum + \expandafter\string\csname the character \endcsname#1\@end{#1} +} +\let\zhs@tmpchar\relax +\def\zhs@skipspaces{\futurenonspacelet\zhs@tmpchar\zhs@skipsp@ces} +\def\zhs@skipsp@ces{% + %\expandafter\mydbgmessage\expandafter{\meaning\zhs@tmpchar}% + \ifcat a\noexpand\zhs@tmpchar % catcode 11 + \zhs@testskipenzh + \else + \ifcat !\noexpand\zhs@tmpchar % catcode 12 + \zhs@testskipenzh + \else + \ifcat $\noexpand\zhs@tmpchar % catcode 3 + \skipenzh\relax + \fi + \fi + \fi +} +\def\zhs@tmpnum{-1} +\def\ifzhs@isvalidchar#1??#2\ok{\if!#2!} +\def\zhs@testskipenzh{% + \chartonum\zhs@tmpchar\zhs@tmpnum + \expandafter\ifzhs@isvalidchar\zhs@tmpnum??\ok + \edef\zhs@tmpnum{\the\XeTeXcharclass\zhs@tmpnum}% + \else + \edef\zhs@tmpnum{\getclassnum{cjkextb}}% + \fi + \ifnum\zhs@tmpnum = \getclassnum{alphanum}% + \skipenzh\relax + \else + \ifnum\zhs@tmpnum = \getclassnum{hanzi}% + \skipzh\relax + \else + \ifnum\zhs@tmpnum = \getclassnum{closefw}% + %\getinterclasstoks{hanzi}{closefw}% + \zhnobreak + \else + \ifnum\zhs@tmpnum = \getclassnum{halfstop}% + %\getinterclasstoks{hanzi}{halfstop}% + \zhnobreak + \else + \ifnum\zhs@tmpnum = \getclassnum{fullstop}% + \zhnobreak + \else + \ifnum\zhs@tmpnum = \getclassnum{openfw}% + \zhnobreak\skipnegzhlinestartopen\relax % compensate + \else + \ifnum\zhs@tmpnum = \getclassnum{cjkexta}% + \skipzh\relax + \else + \ifnum\zhs@tmpnum = \getclassnum{cjkextb}% + \skipzh\relax + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} +\def\zhs@aftermathskip{% + \ifnum\lastnodetype=10 % math node + \skipenzh\relax + \fi +} +% Character class settings. +\input zhsmyclass.sty +% three base classes: boundary, halfwidth and fullwidth +\newclass{boundary} + +\ifnum\strcmp{\number\XeTeXversion\XeTeXrevision}{0.99993} > 0 % + \chardef\zhs@boundaryclassnum = 4095 % +\else + \chardef\zhs@boundaryclassnum = 255 % +\fi +\setclassnum{boundary}{\zhs@boundaryclassnum} +\newclass{halfwidth} +\newclass{fullwidth} +\setinterclasstoks{boundary}{fullwidth}{\mydbgmessage{^^JZ}\zhs@savefont\zhfont} +\setinterclasstoks{fullwidth}{boundary}{\mydbgmessage{^^Jz}\zhs@restorefont\ignorespaces} +\setinterclasstoks{halfwidth}{fullwidth}{\mydbgmessage{^^JP}\zhs@savefont\zhfont} +\setinterclasstoks{fullwidth}{halfwidth}{\mydbgmessage{^^Jp}\zhs@restorefont} +% derived class alphanum and hanzi +\newclass[halfwidth]{alphanum} +\setclassnum{alphanum}{0} +\newclass[fullwidth]{hanzi} +\setclassnum{hanzi}{1} +\setinterclasstoks{hanzi}{hanzi}{\skipzh\relax} +%\appendinterclasstoks{alphanum}{hanzi}{\mydbgmessage{^^JQ}\skipenzh\relax} +%\prependinterclasstoks{hanzi}{alphanum}{\mydbgmessage{^^Jq}\skipenzh\relax} +\setinterclasstoks{alphanum}{hanzi}{\mydbgmessage{^^JQ}\skipenzh\relax\zhs@savefont\zhfont} +\setinterclasstoks{hanzi}{alphanum}{\mydbgmessage{^^Jq}\zhs@restorefont\skipenzh\relax} +\setinterclasstoks{hanzi}{boundary}{\mydbgmessage{^^Ji}\zhs@restorefont\zhs@skipspaces} +\setinterclasstoks{boundary}{hanzi}{\mydbgmessage{^^JI}\zhs@aftermathskip\zhs@savefont\zhfont} +% derived class from fullwidth +\newclass[fullwidth]{openfw} % ‘, (, etc +\setclassnum{openfw}{2} +\newclass[fullwidth]{closefw} % ’, ), etc +\setclassnum{closefw}{3} +\newclass[fullwidth]{halfstop} % ,, , etc +\setclassnum{halfstop}{4} +\newclass[fullwidth]{fullstop} % 。 etc +\setclassnum{fullstop}{10} +\newclass[fullwidth]{fwpunct} % extra fullwidth punctuations +\setclassnum{fwpunct}{7} +% patterns +\def\zhs@punct@inter#1{% + \zhnobreak\csname skipzhinter#1\endcsname\relax +} +\def\zhs@leftpunct@after#1{% + \allowbreak\csname skipzh#1\endcsname\nobreak\csname skipnegzhlinestart#1\endcsname\vadjust{}\zhnobreak\csname skipzhlinestart#1\endcsname\relax +} +\def\zhs@leftpunct@after@boundary#1{% + \zhnobreak\csname skipzhlinestart#1\endcsname\relax +} +\let\zhs@tmp\relax +\def\zhs@leftpunct@before@boundary#1{\def\zhs@tmp{#1}\futurenonspacelet\zhs@tmpchar\zhs@leftpunct@before@boundary@} +\def\zhs@leftpunct@before@boundary@{% + %\mydbgmessage{left punct before boundary}% + %\expandafter\mydbgmessage\expandafter{\meaning\zhs@tmpchar}% + \ifcat a\noexpand\zhs@tmpchar % catcode 11 + \zhs@leftpunct@before@boundary@@ + \else + \ifcat !\noexpand\zhs@tmpchar % catcode 12 + \zhs@leftpunct@before@boundary@@ + \fi + \fi +} +\def\zhs@leftpunct@before@boundary@@{% + \chartonum\zhs@tmpchar\zhs@tmpnum + \expandafter\ifzhs@isvalidchar\zhs@tmpnum??\ok + \edef\zhs@tmpnum{\the\XeTeXcharclass\zhs@tmpnum}% + \else + \edef\zhs@tmpnum{\getclassnum{cjkextb}}% + \fi + \zhs@tmp +} +\def\zhs@leftpunct@after@right#1#2{% + \zhnobreak\csname skipzhlineend#2\endcsname\allowbreak\csname skipnegzhlineend#2\endcsname\csname skipzhinter#2\endcsname\csname skipzhinter#1\endcsname\csname skipnegzhlinestart#1\endcsname\vadjust{}\zhnobreak\csname skipzhlinestart#1\endcsname\relax +} +\def\zhs@rightpunct@before#1{% + \zhnobreak\csname skipzhlineend#1\endcsname\allowbreak\csname skipnegzhlineend#1\endcsname\csname skipzh#1\endcsname\relax +} +\def\zhs@rightpunct@before@boundary#1{\def\zhs@tmp{#1}\futurenonspacelet\zhs@tmpchar\zhs@rightpunct@before@boundary@} +\def\zhs@rightpunct@before@boundary@{% + %\mydbgmessage{right punct before boundary}% + %\expandafter\mydbgmessage\expandafter{\meaning\zhs@tmpchar}% + \ifcat a\noexpand\zhs@tmpchar % catcode 11 + \zhs@rightpunct@before@boundary@@ + \else + \ifcat !\noexpand\zhs@tmpchar % catcode 12 + \zhs@rightpunct@before@boundary@@ + \fi + \fi +} +\def\zhs@rightpunct@before@boundary@@{% + \chartonum\zhs@tmpchar\zhs@tmpnum + \expandafter\ifzhs@isvalidchar\zhs@tmpnum??\ok + \edef\zhs@tmpnum{\the\XeTeXcharclass\zhs@tmpnum}% + \else + \edef\zhs@tmpnum{\getclassnum{cjkextb}}% + \fi + \zhs@tmp +} +% open fullwidth punctuation after other characters +\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth}\do{%,boundary + \prependinterclasstoks{\zhs@class}{openfw}{\mydbgmessage{^^JA1}\zhs@leftpunct@after{open}} +} +\setinterclasstoks{openfw}{openfw}{\mydbgmessage{^^JA2}\zhs@punct@inter{open}} +\setinterclasstoks{closefw}{openfw}{\mydbgmessage{^^JA3}\zhs@leftpunct@after@right{open}{close}} +\setinterclasstoks{halfstop}{openfw}{\mydbgmessage{^^JA4}\zhs@leftpunct@after@right{open}{halfstop}} +\setinterclasstoks{fullstop}{openfw}{\mydbgmessage{^^JA4}\zhs@leftpunct@after@right{open}{fullstop}} +% close fullwidth punctuation before other characters +\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth}\do{%,boundary + \prependinterclasstoks{closefw}{\zhs@class}{\mydbgmessage{^^JB1}\zhs@rightpunct@before{close}} +} +\setinterclasstoks{closefw}{closefw}{\mydbgmessage{^^JB2}\zhs@punct@inter{close}} +\setinterclasstoks{closefw}{halfstop}{\mydbgmessage{^^JB3}\zhs@punct@inter{close}} +\setinterclasstoks{closefw}{fullstop}{\mydbgmessage{^^JB3}\zhs@punct@inter{close}} +% halfstop punctuation before other characters +\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth}\do{%,boundary + \prependinterclasstoks{halfstop}{\zhs@class}{\mydbgmessage{^^JC1}\zhs@rightpunct@before{halfstop}} +} +\setinterclasstoks{halfstop}{closefw}{\mydbgmessage{^^Jb2}\zhs@punct@inter{halfstop}} +\setinterclasstoks{halfstop}{halfstop}{\mydbgmessage{^^JC2}\zhs@punct@inter{halfstop}} +\setinterclasstoks{halfstop}{fullstop}{\mydbgmessage{^^JC2}\zhs@punct@inter{halfstop}} +% fullstop punctuation before other characters +\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth}\do{%,boundary + \prependinterclasstoks{fullstop}{\zhs@class}{\mydbgmessage{^^JC1}\zhs@rightpunct@before{fullstop}} +} +\setinterclasstoks{fullstop}{closefw}{\mydbgmessage{^^Jb2}\zhs@punct@inter{fullstop}} +\setinterclasstoks{fullstop}{halfstop}{\mydbgmessage{^^JC2}\zhs@punct@inter{fullstop}} +\setinterclasstoks{fullstop}{fullstop}{\mydbgmessage{^^JC2}\zhs@punct@inter{fullstop}} +% open fullwidth punctuation before other characters +\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth,closefw,halfstop,fullstop}\do{%,boundary + \prependinterclasstoks{openfw}{\zhs@class}{\mydbgmessage{^^Ja}\zhnobreak} +} +% close fullwidth punctuation after other characters +\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth,boundary}\do{% + \prependinterclasstoks{\zhs@class}{closefw}{\mydbgmessage{^^Jb}\zhnobreak} +} +% halfstop punctuation after other characters +\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth,boundary}\do{% + \prependinterclasstoks{\zhs@class}{halfstop}{\mydbgmessage{^^Jc}\zhnobreak} +} +% fullstop punctuation after other characters +\@for\zhs@class:={hanzi,fwpunct,alphanum,halfwidth,boundary}\do{% + \prependinterclasstoks{\zhs@class}{fullstop}{\mydbgmessage{^^Jc}\zhnobreak} +} +% boundary special treat +\prependinterclasstoks{boundary}{openfw}{\mydbgmessage{^^JA0}\zhs@leftpunct@after@boundary{open}} +\appendinterclasstoks{closefw}{boundary}{\mydbgmessage{^^JB0}\zhs@rightpunct@before@boundary{% + \ifnum\zhs@tmpnum = \getclassnum{closefw}% + %\getinterclasstoks{closefw}{closefw}% + \zhs@punct@inter{close}% + \else + \ifnum\zhs@tmpnum = \getclassnum{halfstop}% + %\getinterclasstoks{closefw}{halfstop}% + \zhs@punct@inter{close}% + \else + \ifnum\zhs@tmpnum = \getclassnum{fullstop}% + \zhs@punct@inter{close}% + \else + \ifnum\zhs@tmpnum = \getclassnum{openfw}% + %\getinterclasstoks{closefw}{openfw}% + \zhs@leftpunct@after@right{open}{close}% + \zhnobreak\skipnegzhlinestartopen\relax % compensate + \else + \zhs@rightpunct@before{close}% + \fi + \fi + \fi + \fi +}} +\appendinterclasstoks{halfstop}{boundary}{\mydbgmessage{^^JC0}\zhs@rightpunct@before@boundary{% + \ifnum\zhs@tmpnum = \getclassnum{closefw}% + %\getinterclasstoks{halfstop}{closefw}% + \zhs@punct@inter{halfstop}% + \else + \ifnum\zhs@tmpnum = \getclassnum{halfstop}% + %\getinterclasstoks{halfstop}{halfstop}% + \zhs@punct@inter{halfstop}% + \else + \ifnum\zhs@tmpnum = \getclassnum{fullstop}% + \zhs@punct@inter{halfstop}% + \else + \ifnum\zhs@tmpnum = \getclassnum{openfw}% + %\getinterclasstoks{halfstop}{openfw}% + \zhs@leftpunct@after@right{open}{halfstop}% + \zhnobreak\skipnegzhlinestartopen\relax % compensate + \else + \zhs@rightpunct@before{halfstop}% + \fi + \fi + \fi + \fi +}} +\appendinterclasstoks{fullstop}{boundary}{\mydbgmessage{^^JC0}\zhs@rightpunct@before@boundary{% + \ifnum\zhs@tmpnum = \getclassnum{closefw}% + \zhs@punct@inter{fullstop}% + \else + \ifnum\zhs@tmpnum = \getclassnum{halfstop}% + \zhs@punct@inter{fullstop}% + \else + \ifnum\zhs@tmpnum = \getclassnum{fullstop}% + \zhs@punct@inter{fullstop}% + \else + \ifnum\zhs@tmpnum = \getclassnum{openfw}% + \zhs@leftpunct@after@right{open}{fullstop}% + \zhnobreak\skipnegzhlinestartopen\relax % compensate + \else + \zhs@rightpunct@before{fullstop}% + \fi + \fi + \fi + \fi +}} +\appendinterclasstoks{openfw}{boundary}{\mydbgmessage{^^Ja0}\zhs@leftpunct@before@boundary{% + \ifnum\zhs@tmpnum = \getclassnum{openfw}% + %\getinterclasstoks{openfw}{openfw}% + \zhs@punct@inter{open}% + \zhnobreak\skipnegzhlinestartopen\relax % compensate + \fi +}} +% punctuation font change +\@for\zhs@class:={openfw,closefw,halfstop,fullstop,fwpunct}\do{% + \appendinterclasstoks{hanzi}{\zhs@class}{\zhpunctfont} + \appendinterclasstoks{\zhs@class}{hanzi}{\zhfont} + \appendinterclasstoks{boundary}{\zhs@class}{\zhpunctfont} + \appendinterclasstoks{halfwidth}{\zhs@class}{\zhpunctfont} +} +% CJK Ext-A/B support +\newclass[hanzi]{cjkexta} +\setclassnum{cjkexta}{8} +\newclass[hanzi]{cjkextb} +\setclassnum{cjkextb}{9} +\@for\zhs@class:={hanzi,fwpunct,openfw,closefw,halfstop,fullstop,alphanum,halfwidth,boundary}\do{% + \appendinterclasstoks{\zhs@class}{cjkexta}{\zhcjkextafont} + \appendinterclasstoks{\zhs@class}{cjkextb}{\zhcjkextbfont} + \prependinterclasstoks{cjkexta}{\zhs@class}{\zhfont} + \prependinterclasstoks{cjkextb}{\zhs@class}{\zhfont} +} +\setinterclasstoks{cjkexta}{cjkexta}{\skipzh\relax} +\setinterclasstoks{cjkexta}{cjkextb}{\zhcjkextbfont\skipzh\relax} +\setinterclasstoks{cjkextb}{cjkexta}{\zhcjkextafont\skipzh\relax} +\setinterclasstoks{cjkextb}{cjkextb}{\skipzh\relax} + +% long fullwidth punctuations +\newclass[fwpunct]{longpunct} % … etc +\setclassnum{longpunct}{5} +\setinterclasstoks{longpunct}{longpunct}{\zhnobreak} +% derived class from halfwidth +\newclass[halfwidth]{hwpunct} % (, ., etc +\setclassnum{hwpunct}{6} + +% Font settings +\ifLaTeX@e + \RequirePackage{fontspec} + \@ifundefined{zhfont}{\newfontfamily\zhfont[BoldFont=SimHei]{SimSun}}{} + \@ifundefined{zhpunctfont}{\newfontfamily\zhpunctfont{SimSun}}{} + \@ifundefined{zhcjkextafont}{\def\zhcjkextafont{\message{CJK Ext-A}}}{} + \@ifundefined{zhcjkextbfont}{\def\zhcjkextbfont{\message{CJK Ext-B}}}{} +\else + \@ifundefined{zhfont}{\font\zhfont="SimSun" at 10pt}{} + \@ifundefined{zhpunctfont}{\font\zhpunctfont="SimSun" at 10pt}{} + \@ifundefined{zhcjkextafont}{\def\zhcjkextafont{\message{CJK Ext-A}}}{} + \@ifundefined{zhcjkextbfont}{\def\zhcjkextbfont{\message{CJK Ext-B}}}{} +\fi + +% code range utils +\newif\ifzhs@result +\newcount\zhs@tmpcnt +\def\@ifnuminrange#1#2#3#4{% #1: num, #2: range with format a->b,c->d + % #3: true block, #4: false block + \zhs@resultfalse + \@for\zhs@range:=#2\do{% + \expandafter\@ifrangecontains\expandafter[\zhs@range]{#1}{\zhs@resulttrue}{}% + }% + \ifzhs@result #3\else #4\fi +} + +\def\@ifrangecontains[#1->#2]#3#4#5{% + \ifnum#3<#1\relax + #5% + \else + \ifnum#3>#2\relax + #5% + \else + #4% + \fi + \fi +} + +\def\@fornuminrange#1:=#2\do#3{% #1: count register, #2: range + \@for\zhs@range:=#2\do{% + \expandafter\@@fornuminrange\expandafter[\zhs@range]{#1}{#3}% + }% +} +\def\@@fornuminrange[#1->#2]#3#4{% + #3=#1% + \loop + \unless\ifnum#3>#2\relax + #4\relax + \advance #3by 1% + \repeat +} + +\def\zhs@hanzirange{% data from unicodeletters.tex + "2E80->"2E99, + "2E9B->"2EF3, + "2F00->"2FD5, + "2FF0->"2FFB, + "3000->"3000, + "3003->"3004, + "3006->"3007, + "3012->"3013, + "3020->"3029, + "3030->"303A, + "303D->"303F, + "3042->"3042, + "3044->"3044, + "3046->"3046, + "3048->"3048, + "304A->"3062, + "3064->"3082, + "3084->"3084, + "3086->"3086, + "3088->"308D, + "308F->"3094, + "309F->"309F, + "30A2->"30A2, + "30A4->"30A4, + "30A6->"30A6, + "30A8->"30A8, + "30AA->"30C2, + "30C4->"30E2, + "30E4->"30E4, + "30E6->"30E6, + "30E8->"30ED, + "30EF->"30F4, + "30F7->"30FA, + "30FF->"30FF, + "3105->"312C, + "3131->"318E, + "3190->"31B7, + "31C0->"31CF, + "3200->"321E, + "3220->"3243, + "3250->"32FE, + "3300->"33FF, + "3400->"4DB5, + "4E00->"9FBB, + "A000->"A014, + "A016->"A48C, + "A490->"A4C6, + "F900->"FA2D, + "FA30->"FA6A, + "FA70->"FAD9, + "FE30->"FE34, + "FE45->"FE46, + "FE49->"FE4F, + "FE51->"FE51, + "FE58->"FE58, + "FE5F->"FE66, + "FE68->"FE68, + "FE6B->"FE6B, + "FF02->"FF03, + "FF06->"FF07, + "FF0A->"FF0B, + "FF0D->"FF0D, + "FF0F->"FF19, + "FF1C->"FF1E, + "FF20->"FF3A, + "FF3C->"FF3C, + "FF3E->"FF5A, + "FF5C->"FF5C, + "FF5E->"FF5E, + "FFE2->"FFE4, + "20000->"2A6D6, + "2F800->"2FA1D +} +\def\zhs@extarange{"3400->"4DB5} +\def\zhs@extbrange{"20000->"2FA1D} + +% set active hanzi for hooking +\def\makehanziglobalactive{% + \@fornuminrange\zhs@tmpcnt:=\zhs@hanzirange\do{% + \global\catcode\zhs@tmpcnt=\active}% +} + +\def\makehanzigloballetter{% + \@fornuminrange\zhs@tmpcnt:=\zhs@hanzirange\do{% + \global\catcode\zhs@tmpcnt=11}% +} + +\def\zhhanzihook#1{{\XeTeXinterchartokenstate=0\zhs@font #1}} + +\def\zhs@h@x#1{\ifcase#1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or + 9\or A\or B\or C\or D\or E\or F\fi} +\def\zhs@hex#1{\if!#1!\else\ifnum#1<16 \zhs@h@x{#1}\else + \expandafter\zhs@hex\expandafter{\number\numexpr(#1-8)/16}% + \expandafter\zhs@h@x\expandafter{\number\numexpr#1-(#1-8)/16*16}\fi\fi} + +\let\zhs@font\zhfont +\def\enableactivehanzi{% + \def\zhs@@a##1{\zhs@afteralphamathskip + \expandafter\@ifrangecontains\expandafter[\zhs@extarange]{"##1}{\global + \let\zhs@font\zhcjkextafont}{\expandafter\@ifrangecontains + \expandafter[\zhs@extbrange]{"##1}{\global\let\zhs@font\zhcjkextbfont + }{\global\let\zhs@font\zhfont}}% + \zhhanzihook{\char"##1}\zhs@active@lookafter}% + \@fornuminrange\zhs@tmpcnt:=\zhs@hanzirange\do{% + \lccode`\~=\zhs@tmpcnt + \lowercase{\protected\xdef~{\noexpand\zhs@@a{\expandafter\zhs@hex + \expandafter{\number\zhs@tmpcnt}}}}% + }% +} + +\def\zhs@afteralphamathskip{% + \ifhmode + \ifnum\lastnodetype=10 % math node + \skipenzh\relax + \else\ifnum\lastnodetype=0 + \ifnum\spacefactor=999 + \skipenzh + \else\ifnum\spacefactor=1000 + \skipenzh + \fi\fi + \fi\fi + \fi +} + +{\escapechar=-1 + \xdef\zhs@active@ident{\string\zhs@@a} +} +\expandafter\def\expandafter\ifzhs@notactivehanzi\expandafter#\expandafter1% + \zhs@active@ident#2\ok{\if!#2!} +\def\zhs@active@lookafter{\futurenonspacelet\zhs@tmpchar\zhs@active@look@fter} +\def\zhs@active@look@fter{% + %\expandafter\mydbgmessage\expandafter{\meaning\zhs@tmpchar}% + \if\relax\noexpand\zhs@tmpchar % control sequence + \zhs@beforeactivehanziskip + \else + \ifcat a\noexpand\zhs@tmpchar % catcode 11 + \zhs@testskipenzh + \else + \ifcat !\noexpand\zhs@tmpchar % catcode 12 + \zhs@testskipenzh + \else + \ifcat $\noexpand\zhs@tmpchar % catcode 3 + \skipenzh\relax + \fi + \fi + \fi + \fi +} + +\def\zhs@beforeactivehanziskip{% + %\let\zhs@tmp\iffalse % for \if match + \edef\zhs@tmp{\meaning\zhs@tmpchar}% + \expandafter\expandafter\expandafter\ifzhs@notactivehanzi + \expandafter\zhs@tmp\zhs@active@ident\ok + \else + \skipzh\relax + \fi +} + +\def\zhs@loadxetexclasses{% + \chardef\XeTeXcharclassID = 1 % + \chardef\XeTeXcharclassOP = 2 % + \chardef\XeTeXcharclassCL = 3 % + \chardef\XeTeXcharclassEX = 3 % + \chardef\XeTeXcharclassIS = 3 % + \chardef\XeTeXcharclassNS = 3 % + \chardef\XeTeXcharclassCM = \numexpr \zhs@boundaryclassnum + 1 \relax + \input load-unicode-xetex-classes % +} + +\def\zhspacing{% + \ifnum\XeTeXcharclass"4E00 = 1 % + % clear XeTeX pre-defined toks + \XeTeXinterchartoks 0 1 = {} + \XeTeXinterchartoks 0 2 = {} + \XeTeXinterchartoks 0 3 = {} + \XeTeXinterchartoks 1 0 = {} + \XeTeXinterchartoks 2 0 = {} + \XeTeXinterchartoks 3 0 = {} + \XeTeXinterchartoks 1 1 = {} + \XeTeXinterchartoks 1 2 = {} + \XeTeXinterchartoks 1 3 = {} + \XeTeXinterchartoks 2 1 = {} + \XeTeXinterchartoks 2 2 = {} + \XeTeXinterchartoks 2 3 = {} + \XeTeXinterchartoks 3 1 = {} + \XeTeXinterchartoks 3 2 = {} + \XeTeXinterchartoks 3 3 = {} + \else + \expandafter\zhs@loadxetexclasses % + \fi + \zhs@tmpcnt "3400 % + \chardef\zhs@tmpnum = \getclassnum{cjkexta}% + \loop + \ifnum\zhs@tmpcnt < "4E00 % + \XeTeXcharclass\zhs@tmpcnt = \zhs@tmpnum + \advance\zhs@tmpcnt by 1 % + \repeat + \zhs@tmpcnt "20000 % + \chardef\zhs@tmpnum = \getclassnum{cjkextb}% + \loop + \ifnum\zhs@tmpcnt < "30000 % + \XeTeXcharclass\zhs@tmpcnt = \zhs@tmpnum + \advance\zhs@tmpcnt by 1 % + \repeat + \@for\zhs@char:={`:,`,,`、}\do{\XeTeXcharclass\zhs@char=4} + \@for\zhs@char:={`。,`.,`;}\do{\XeTeXcharclass\zhs@char=10} + \ifzhs@ambiwide + \@for\zhs@char:={`“,`‘}\do{\XeTeXcharclass\zhs@char=2} + \@for\zhs@char:={`”,`’}\do{\XeTeXcharclass\zhs@char=3} + \@for\zhs@char:={`—,`…}\do{\XeTeXcharclass\zhs@char=5} + \else + \@for\zhs@char:={`“,`‘,`”,`’,`—,`…}\do{\XeTeXcharclass\zhs@char=6} + \fi + \@for\zhs@char:={`\!,`\",`\',`\(,`\),`\,,`\-,`\.,`\:,`\;,`\<,`\>,`\?,`\[,`\],`\`,`\{,`\},`\\,`\/}\do{\XeTeXcharclass\zhs@char=6} + \@for\zhs@char:={`℃,`·,`$,`%}\do{\XeTeXcharclass\zhs@char=7} + \registerXeTeXclasstoks + \XeTeXinterchartokenstate=1\relax + \ifLaTeX@e + \setbox0=\hbox{\normalsize\def\zhs@tmp{\kern 2em}\zhs@tmp}% + \parindent=\wd0 + \else + \parindent=2em\relax + \fi + \message{zhspacing installed.^^J} +} + +\fi diff --git a/Master/texmf-dist/tex/xetex/zhspacing/zhsusefulmacros.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhsusefulmacros.sty new file mode 100644 index 00000000000..d6c5fec5b8a --- /dev/null +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhsusefulmacros.sty @@ -0,0 +1,97 @@ +% zhsusefulmacros.sty +% This file provides several useful LaTeX macros as well as \ifLaTeX@e, +% and \futurenonspacelet. +% Licensed under LPPL. +\catcode`\@=11 +\ifx\@usefulmacros@defined\@undefined\else + \expandafter\endinput +\fi +\def\@usefulmacros@defined{\relax} +\def\@usefulmacros@LaTeX@e{LaTeX2e} +\def\ifLaTeX@e{\ifx\fmtname\@usefulmacros@LaTeX@e} +\ifLaTeX@e\else +\def\@nnil{\@nil}% +\def\@empty{}% +\def\@fornoop#1\@@#2#3{}% +\long\def\@for#1:=#2\do#3{% + \expandafter\def\expandafter\@fortmp\expandafter{#2}% + \ifx\@fortmp\@empty \else + \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi}% +\long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else + #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi}% +\long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil + \expandafter\@fornoop \else + #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}}% +\def\@tfor#1:={\@tf@r#1 }% +\long\def\@tf@r#1#2\do#3{\def\@fortmp{#2}\ifx\@fortmp\space\else + \@tforloop#2\@nil\@nil\@@#1{#3}\fi}% +\long\def\@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil + \expandafter\@fornoop \else + #4\relax\expandafter\@tforloop\fi#2\@@#3{#4}}% +\long\def\@ifnextchar#1#2#3{% + \let\reserved@d=#1% + \def\reserved@a{#2}% + \def\reserved@b{#3}% + \futurelet\@let@token\@ifnch} +\def\@ifnch{% + \ifx\@let@token\@sptoken + \let\reserved@c\@xifnch + \else + \ifx\@let@token\reserved@d + \let\reserved@c\reserved@a + \else + \let\reserved@c\reserved@b + \fi + \fi + \reserved@c} +\def\:{\let\@sptoken= } \: % this makes \@sptoken a space token +\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch} +% +\long\def\@firstoftwo#1#2{#1} +\long\def\@secondoftwo#1#2{#2} +\expandafter\ifx\csname ifcsname\endcsname\relax +\def\@ifundefined#1{% + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\else +\def\@ifundefined#1{% + \unless\ifcsname#1\endcsname + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\fi +% +\def\@namedef#1{\expandafter\def\csname #1\endcsname} +% +\fi % end of \ifLaTeX@e\else + +\def\@BTcs{} +\let\nexttoken\relax +\let\next\relax +\def\futurenonspacelet#1{\def\@BTcs{#1}% + \afterassignment\@BTfnslone\let\nexttoken= } +\def\@BTfnslone{\expandafter\futurelet\@BTcs\@BTfnsltwo} +\def\@BTfnsltwo{\expandafter\ifx\@BTcs\@sptoken\let\next=\@BTfnslthree + \else\let\next=\nexttoken\fi \next} +\def\@BTfnslthree{\afterassignment\@BTfnslone\let\next= } + +\ifx\fbox\@undefined +\newbox\fbox@tmpbox +\newdimen\fbox@linewidth +\newdimen\fbox@tmpdim +\fbox@linewidth=0.4pt +\long\def\fbox#1{% + \setbox\fbox@tmpbox=\hbox{#1}% + \fbox@tmpdim=2\fbox@linewidth + \advance\fbox@tmpdim\wd\fbox@tmpbox + \leavevmode\hbox{\vbox{\hrule height \fbox@linewidth width \fbox@tmpdim + \hbox{\vrule width \fbox@linewidth height \ht\fbox@tmpbox + #1\vrule width \fbox@linewidth height \ht\fbox@tmpbox}% + \hrule height \fbox@linewidth width \fbox@tmpdim + }}% +} +\fi diff --git a/Master/texmf-dist/tex/xetex/zhspacing/zhulem.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhulem.sty new file mode 100644 index 00000000000..86365e380ab --- /dev/null +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhulem.sty @@ -0,0 +1,18 @@ +% zhulem.sty coded by YIN Dian +% Fix compatibility problem with ulem +% Hist: 070822 Changed \UL@reskip and \UL@@penalty, able to work. +\NeedsTeXFormat{LaTeX2e}[1996/12/01] +\def\fileversion{0.4} +\def\filedate{2007/08/22} +\ProvidesPackage{zhulem}[\filedate\space\fileversion] +\RequirePackage{ulem}[2000/05/26] +%\let\zhulem@printfont\zhs@printf@nt +\def\zhulem@printfont#1{} +\def\UL@reskip{\zhs@savef@nt{tmp}\UL@stop \zhulem@printfont{tmp}\UL@leaders + \UL@start\zhs@restoref@nt{tmp}} +\def\UL@@penalty{\LA@penalty \ifnum\count@=\z@ + \@ne \else \count@ \fi % zero penalty => no penalty, so use 1 instead. + \zhs@savef@nt{tmp}\UL@stop \zhulem@printfont{tmp}\UL@start + \zhs@restoref@nt{tmp}} + +\endinput -- cgit v1.2.3