diff options
12 files changed, 787 insertions, 280 deletions
diff --git a/Master/texmf-dist/doc/xelatex/xecjk/README b/Master/texmf-dist/doc/xelatex/xecjk/README index e0f5d1182cc..126933d2dfe 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/README +++ b/Master/texmf-dist/doc/xelatex/xecjk/README @@ -9,8 +9,18 @@ CJK scripts easily. This package is licensed in LPPL. -If you are interested in the process of development you -may observe +This package consists of the file xeCJK.dtx + and the derived files xeCJK.pdf, + xeCJK.sty, + xeCJK.ins, + xeCJK-example-autofake.tex, + xeCJK-example-fallback.tex, + xeCJK-example-subCJKblock.tex, + xeCJK-example-CJKecglue.tex, + xeCJK-example-checksingle.tex and + README.txt (this file). + +If you are interested in the process of development you may observe http://code.google.com/p/ctex-kit/updates/list @@ -20,3 +30,20 @@ may observe Leo Liu <leoliu.pku@gmail.com> Qing Lee <sobenlee@gmail.com> +Installation +------------ +The package is supplied in dtx format and as a pre-extracted zip file, +xecjk.tds.zip. The later is most convenient for most users: simply +unzip this in your local texmf directory and run texhash to update the +database of file locations. If you want to unpack the dtx yourself, +running "xetex xeCJK.dtx" will extract the package whereas +"xelatex xeCJK.dtx" will extract it and also typeset the documentation. + +The package requires LaTeX3 support as provided in the l3kernel and +l3packages bundles and the fontspec package. All of these are available +on CTAN as ready-to-install zip files. Suitable versions are available +in the latest version of MiKTeX and TeX Live (updating the relevant +packages online may be necessary). + +To compile the documentation without error, you will need some specific +CJK scripts fonts (TrueType or OpenType). diff --git a/Master/texmf-dist/doc/xelatex/xecjk/README.txt b/Master/texmf-dist/doc/xelatex/xecjk/README.txt deleted file mode 100644 index e0f5d1182cc..00000000000 --- a/Master/texmf-dist/doc/xelatex/xecjk/README.txt +++ /dev/null @@ -1,22 +0,0 @@ - -xeCJK is a package written for XeLaTeX which allows users to typeset -CJK scripts easily. - - - different default fonts for CJK and other characters; - - spaces automatically ignored between CJK characters; - - special effects on full-width CJK punctuation; and - - automatic adjustment of the space between CJK and other characters. - -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 - - Author: - Wenchang Sun <sunwch@nankai.edu.cn> - Current Maintainers: - Leo Liu <leoliu.pku@gmail.com> - Qing Lee <sobenlee@gmail.com> - diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex new file mode 100644 index 00000000000..477049325d2 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex @@ -0,0 +1,61 @@ +%% +%% This is file `xeCJK-example-CJKecglue.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xeCJK.dtx (with options: `ex-ecglue') +%% +%% $Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ +%% ----------------------------------------------------------------- +%% Author: +%% Wenchang Sun <sunwch@nankai.edu.cn> +%% Current Maintainers: +%% Leo Liu <leoliu.pku@gmail.com> +%% Qing Lee <sobenlee@gmail.com> +%% +%% Copyright (C) 2007--2012 Wenchang Sun +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% The Current Maintainer of this work are Leo Liu and Qing Lee. +%% ----------------------------------------------------------------- +%% +\documentclass{minimal} +\usepackage{xeCJK} +\setCJKmainfont[BoldFont=SimHei]{SimSun} +\long\def\showtext{% + 这是 English 中文 {\itshape Chinese} 中文 \TeX\ + 间隔 \textit{Italic} 中文\textbf{字体} a 数学 $b$ 数学 $c$ $d$\par + 这是English中文{\itshape Chinese}中文\TeX\ + 间隔\textit{Italic}中文\textbf{字体}a数学$b$数学$c$ $d$\par +This is an example. 这是一个例子} +\begin{document} +\showtext + +\hrulefill\bigskip + +\xeCJKsetup{xCJKecglue=\quad} +\showtext +\end{document} +%% +%% This package consists of the file xeCJK.dtx +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.ins, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex and +%% README.txt. +%% +%% End of file `xeCJK-example-CJKecglue.tex'. diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example-autofake.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex index 818b8eb9e0f..472546bd3b1 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/example-autofake.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex @@ -1,12 +1,13 @@ %% -%% This is file `example-autofake.tex', +%% This is file `xeCJK-example-autofake.tex', %% generated with the docstrip utility. %% %% The original source files were: %% %% xeCJK.dtx (with options: `ex-autofake') %% -%% Version 3.0.5 (19-May-2012) +%% $Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: %% Wenchang Sun <sunwch@nankai.edu.cn> @@ -77,5 +78,15 @@ \end{tabular} \end{document} %% +%% This package consists of the file xeCJK.dtx +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.ins, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex and +%% README.txt. %% -%% End of file `example-autofake.tex'. +%% End of file `xeCJK-example-autofake.tex'. diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex new file mode 100644 index 00000000000..d1e6be31b2c --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex @@ -0,0 +1,67 @@ +%% +%% This is file `xeCJK-example-checksingle.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xeCJK.dtx (with options: `ex-single') +%% +%% $Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ +%% ----------------------------------------------------------------- +%% Author: +%% Wenchang Sun <sunwch@nankai.edu.cn> +%% Current Maintainers: +%% Leo Liu <leoliu.pku@gmail.com> +%% Qing Lee <sobenlee@gmail.com> +%% +%% Copyright (C) 2007--2012 Wenchang Sun +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% The Current Maintainer of this work are Leo Liu and Qing Lee. +%% ----------------------------------------------------------------- +%% +\documentclass{minimal} +\usepackage{xeCJK} +\setCJKmainfont{SimSun} +\catcode`\。=\active +\def。{.} +\def\foo{一} +\long\def\showtext{一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十。 +$$x^2+y^2$$ +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十\foo +\begin{equation} +x^2+y^2 +\end{equation} +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十。} +\begin{document} +\hsize=30em +\parindent=0pt +\showtext + +\hrulefill\bigskip + +\xeCJKsetup{CheckSingle} +\showtext +\end{document} +%% +%% This package consists of the file xeCJK.dtx +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.ins, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex and +%% README.txt. +%% +%% End of file `xeCJK-example-checksingle.tex'. diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example-fallback.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex index cfd88fd9c64..3e612d908e1 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/example-fallback.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex @@ -1,12 +1,13 @@ %% -%% This is file `example-fallback.tex', +%% This is file `xeCJK-example-fallback.tex', %% generated with the docstrip utility. %% %% The original source files were: %% %% xeCJK.dtx (with options: `ex-fallback') %% -%% Version 3.0.5 (19-May-2012) +%% $Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: %% Wenchang Sun <sunwch@nankai.edu.cn> @@ -68,5 +69,15 @@ \end{table} \end{document} %% +%% This package consists of the file xeCJK.dtx +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.ins, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex and +%% README.txt. %% -%% End of file `example-fallback.tex'. +%% End of file `xeCJK-example-fallback.tex'. diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example-subCJKblock.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex index df2d9f5d3c2..fb086d93b84 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/example-subCJKblock.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex @@ -1,12 +1,13 @@ %% -%% This is file `example-subCJKblock.tex', +%% This is file `xeCJK-example-subCJKblock.tex', %% generated with the docstrip utility. %% %% The original source files were: %% %% xeCJK.dtx (with options: `ex-block') %% -%% Version 3.0.5 (19-May-2012) +%% $Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: %% Wenchang Sun <sunwch@nankai.edu.cn> @@ -84,5 +85,15 @@ CJK統合漢字(シージェーケーとうごうかんじ、CJK Unified Ideog \end{table} \end{document} %% +%% This package consists of the file xeCJK.dtx +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.ins, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex and +%% README.txt. %% -%% End of file `example-subCJKblock.tex'. +%% End of file `xeCJK-example-subCJKblock.tex'. diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.cmds b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.cmds deleted file mode 100644 index e69de29bb2d..00000000000 --- a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.cmds +++ /dev/null diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf Binary files differindex a61f3f51bff..935d6460b9a 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf +++ b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx index 62314d105a4..479609c2674 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx @@ -1,4 +1,5 @@ % \iffalse meta-comment +% !TEX program = XeLaTeX %<*internal> \iffalse %</internal> @@ -16,8 +17,18 @@ CJK scripts easily. This package is licensed in LPPL. -If you are interested in the process of development you -may observe +This package consists of the file xeCJK.dtx + and the derived files xeCJK.pdf, + xeCJK.sty, + xeCJK.ins, + xeCJK-example-autofake.tex, + xeCJK-example-fallback.tex, + xeCJK-example-subCJKblock.tex, + xeCJK-example-CJKecglue.tex, + xeCJK-example-checksingle.tex and + README.txt (this file). + +If you are interested in the process of development you may observe http://code.google.com/p/ctex-kit/updates/list @@ -27,20 +38,40 @@ may observe Leo Liu <leoliu.pku@gmail.com> Qing Lee <sobenlee@gmail.com> + +Installation +------------ +The package is supplied in dtx format and as a pre-extracted zip file, +xecjk.tds.zip. The later is most convenient for most users: simply +unzip this in your local texmf directory and run texhash to update the +database of file locations. If you want to unpack the dtx yourself, +running "xetex xeCJK.dtx" will extract the package whereas +"xelatex xeCJK.dtx" will extract it and also typeset the documentation. + +The package requires LaTeX3 support as provided in the l3kernel and +l3packages bundles and the fontspec package. All of these are available +on CTAN as ready-to-install zip files. Suitable versions are available +in the latest version of MiKTeX and TeX Live (updating the relevant +packages online may be necessary). + +To compile the documentation without error, you will need some specific +CJK scripts fonts (TrueType or OpenType). %</readme> %<*internal> \fi -%</internal> -% -%<*internal> -\begingroup +\ifnum\strcmp{\fmtname}{plain}=0 \else + \expandafter\begingroup +\fi %</internal> %<*batchfile> + \input docstrip.tex \keepsilent +\askforoverwritefalse \preamble - Version 3.0.5 (19-May-2012) +$Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ +$URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ ----------------------------------------------------------------- Author: Wenchang Sun <sunwch@nankai.edu.cn> @@ -64,24 +95,47 @@ may observe \endpreamble \postamble + + This package consists of the file xeCJK.dtx + and the derived files xeCJK.pdf, + xeCJK.sty, + xeCJK.ins, + xeCJK-example-autofake.tex, + xeCJK-example-fallback.tex, + xeCJK-example-subCJKblock.tex, + xeCJK-example-CJKecglue.tex, + xeCJK-example-checksingle.tex and + README.txt. \endpostamble -\askforoverwritefalse +\usedir{tex/xelatex/xecjk} \generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}} -\generate{\file{example-autofake.tex}{\from{\jobname.dtx}{ex-autofake}}} -\generate{\file{example-fallback.tex}{\from{\jobname.dtx}{ex-fallback}}} -\generate{\file{example-subCJKblock.tex}{\from{\jobname.dtx}{ex-block}}} +\usedir{doc/xelatex/xecjk/example} +\generate{ + \file{\jobname-example-autofake.tex}{\from{\jobname.dtx}{ex-autofake}} + \file{\jobname-example-fallback.tex}{\from{\jobname.dtx}{ex-fallback}} + \file{\jobname-example-subCJKblock.tex}{\from{\jobname.dtx}{ex-block}} + \file{\jobname-example-CJKecglue.tex}{\from{\jobname.dtx}{ex-ecglue}} + \file{\jobname-example-checksingle.tex}{\from{\jobname.dtx}{ex-single}}} %</batchfile> %<batchfile>\endbatchfile %<*internal> +\usedir{source/xelatex/xecjk} \generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}} \nopreamble\nopostamble +\usedir{doc/xelatex/xecjk} \generate{\file{README.txt}{\from{\jobname.dtx}{readme}}} -\endgroup +\ifnum\strcmp{\fmtname}{plain}=0 + \expandafter\endbatchfile +\else + \expandafter\endgroup +\fi %</internal> % -%<*driver> -\ProvidesFile{xeCJK.dtx} -%</driver> +%<*driver|package> +\NeedsTeXFormat{LaTeX2e} +%<driver>\ProvidesFile{xeCJK.dtx} +\RequirePackage{expl3} +%</driver|package> % %<*driver> \documentclass{l3doc} @@ -105,11 +159,13 @@ may observe \def\MacroFont{\small\normalfont\ttfamily\punctstyle{plain}} \parindent=2em \AtBeginDocument{\DeleteShortVerb{\"}\MakeShortVerb{\|}} +\def\contentsname{目录} +\def\email#1{\href{mailto:#1}{\path{#1}}} \addtolength{\voffset}{-5\baselineskip} \addtolength\textheight{8\baselineskip} \makeatletter \let\orig@meta\meta -\def\meta#1{\orig@meta{\mbox{\normalfont\itshape\punctstyle{plain}\CJKsetecglue{}#1}}} +\def\meta#1{\orig@meta{\mbox{\normalfont\itshape\CJKfixedspacing#1}}} \def\TF{true\orvar{}false} \def\TTF{\defaultvar{true}\orvar{}false} \def\TFF{true\orvar\defaultvar{false}} @@ -119,6 +175,12 @@ may observe \@addtoreset{CodelineNo}{section} \def\tokslink#1{\hyperlink{#1}{\ding{51}}} \makeatother +%</driver> +%<*driver|package> +\GetIdInfo$Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ + {package for typesetting CJK scripts with XeLaTeX} +%</driver|package> +%<*driver> \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -131,7 +193,7 @@ may observe % \author{\texttt{ctex.org}\thanks{\url{http://www.ctex.org}}} % \date{\filedate\qquad\fileversion} % \maketitle -% +% % \tableofcontents % % \begin{documentation} @@ -148,14 +210,15 @@ may observe % \end{enumerate} % % \pkg{xeCJK} 使用了 \XeTeX 的一些最新特性,需要 \XeTeX{} |0.9995.0 [2009/06/29]| 以 -% 后的版本。\pkg{xeCJK} 的依赖 \LaTeX~3 项目的 \pkg{expl3} 宏包,并依赖 -% \pkg{fontspec}\footnote{\url{http://mirrors.ctan.org/macros/latex/contrib/fontspec}} +% 后的版本。\pkg{xeCJK} 的依赖 \LaTeX~3 项目的 \pkg{expl3},\pkg{xparse} 和 +% \pkg{l3keys2e} 宏包,并依赖 \pkg{fontspec}^^A +% \footnote{\url{http://mirrors.ctan.org/macros/latex/contrib/fontspec}} % 宏包来调用系统字体。个别兼容性功能需要 \pkg{CJK} 宏包的支持。 % % \pkg{xeCJK} 的原始作者是孙文昌,2009 年 5 月起宏包被收入 -% \texttt{ctex-kit}\footnote{\url{http://code.google.com/p/ctex-kit/}}项目进行 -% 维护,目前主要维护者是刘海洋\footnote{\nolinkurl{leoliu.pku@gmail.com}} 和 -% 李清\footnote{\nolinkurl{sobenlee@gmail.com}}。 +% \texttt{ctex-kit}\footnote{\url{http://code.google.com/p/ctex-kit/}} 项目进行 +% 维护,目前主要维护者是刘海洋\footnote{\email{leoliu.pku@gmail.com}} 和 +% 李清\footnote{\email{sobenlee@gmail.com}}。 % % \section{基本用法} % @@ -181,8 +244,8 @@ may observe % % \pkg{xeCJK} 只提供了字体和标点控制等基本 CJK 语言支持。对于中文文档,可以使 % 用更为高层的 \pkg{ctex} 宏包或文档类,它将自动调用 \pkg{xeCJK} 并设置好中文 -% 字体,同时提供了进一步的本地化支持。详细内容参看 \pkg{ctex} 宏包\footnote{% -% \url{http://mirrors.ctan.org/language/chinese/ctex/}}的说明。 +% 字体,同时提供了进一步的本地化支持。详细内容参看 \pkg{ctex} 宏包^^A +% \footnote{\url{http://mirrors.ctan.org/language/chinese/ctex/}}的说明。 % % \pkg{xeCJK} 提供了大量选项,可以在宏包调用时作为宏包选项或用 |\xeCJKsetup| % 命令进行设置,详见 \ref{subsec:opts}~节。除了 |\setCJKmainfont| 命令, @@ -283,7 +346,7 @@ may observe % % \begin{function}{xCJKecglue} % \begin{syntax} -% xCJKecglue = \meta{\TFF\orvar{}glue} +% xCJKecglue = \marg{\TFF\orvar{}glue} % \end{syntax} % 缺省状态下,\pkg{xeCJK} 不对源文件中直接输入的 CJK 文字与西文之间的空格进行调整,如 % 果需要调整,请使用这个选项。如果使用这个选项,将使用 |CJKecglue| 替换源文件中直接输 @@ -316,7 +379,7 @@ may observe % % \begin{function}[rEXP]{AutoFakeBold} % \begin{syntax} -% AutoFakeBold = \meta{\TFF\orvar{}数字} +% AutoFakeBold = \marg{\TFF\orvar{}数字} % \end{syntax} % 全局设定当没有声明对应的粗体时,是否使用\textbf{\CJKfontspec[AutoFakeBold]{Adobe Song Std}伪粗体}; % 当输入的是数字时,将使用伪粗体,并将使用输入的数字作为伪粗体的默认粗细程度。 @@ -324,7 +387,7 @@ may observe % % \begin{function}[rEXP]{AutoFakeSlant} % \begin{syntax} -% AutoFakeSlant = \meta{\TFF\orvar{}数字} +% AutoFakeSlant = \marg{\TFF\orvar{}数字} % \end{syntax} % 全局设定当没有声明对应的斜体时,是否使用\textit{\CJKfontspec[AutoFakeSlant]{Adobe Song Std}伪斜体}; % 当输入的是数字时,将使用伪斜体,并将使用输入的数字作为伪斜体的默认倾斜程度。 @@ -332,21 +395,21 @@ may observe % % \begin{function}[rEXP]{EmboldenFactor} % \begin{syntax} -% EmboldenFactor = \meta{数字\orvar\defaultvar{4}} +% EmboldenFactor = \marg{数字\orvar\defaultvar{4}} % \end{syntax} % 设置伪粗体的默认粗细程度。 % \end{function} % % \begin{function}[rEXP]{SlantFactor} % \begin{syntax} -% SlantFactor = \meta{数字\orvar\defaultvar{0.167}} +% SlantFactor = \marg{数字\orvar\defaultvar{0.167}} % \end{syntax} % 设置伪斜体的粗细程度,范围是 $-0.999 \sim 0.999$。 % \end{function} % % \begin{function}{PunctStyle} % \begin{syntax} -% PunctStyle = \meta{\defaultvar{quanjiao}\orvar{}banjiao\orvar{}kaiming\orvar{}hangmobanjiao\orvar{}CCT\orvar{}plain} +% PunctStyle = \marg{\defaultvar{quanjiao}\orvar{}banjiao\orvar{}kaiming\orvar{}hangmobanjiao\orvar{}CCT\orvar{}plain} % \end{syntax} % 设置标点处理格式,有效值分别为 % \begin{itemize}[font=\ttfamily,labelsep=1em] @@ -361,7 +424,7 @@ may observe % % \begin{function}[EXP]{KaiMingPunct,KaiMingPunct+,KaiMingPunct-} % \begin{syntax} -% KaiMingPunct = \meta{\defaultvar{ . 。? !}} +% KaiMingPunct = \marg{\defaultvar{ . 。? !}} % \end{syntax} % 设置开明(|kaiming|)标点处理格式时的句末点号,|KaiMingPunct| 后带的 |+| 与 |-| % 分别表示从已有的开明句末点号中增加或减少标点。 @@ -369,7 +432,7 @@ may observe % % \begin{function}[EXP]{LongPunct,LongPunct+,LongPunct-} % \begin{syntax} -% LongPunct = \meta{\defaultvar{ — ‥ … ─ }} +% LongPunct = \marg{\defaultvar{ — ‥ … ─ }} % \end{syntax} % 设置长标点,例如破折号“——”与省略号“……”,允许在长标点前后 % 断行,但是禁止在它们之间断行。 @@ -377,7 +440,7 @@ may observe % % \begin{function}[EXP]{MiddlePunct,MiddlePunct+,MiddlePunct-} % \begin{syntax} -% MiddlePunct = \meta{\defaultvar{ · · ・ }} +% MiddlePunct = \marg{\defaultvar{ · · ・ }} % \end{syntax} % 设置居中显示的标点,例如间隔号“\textbf{·}”。对于在 CJK 文字之间的居中标点, % \pkg{xeCJK} 会根据不同的标点处理格式,调整居中标点与前后文字之间的空白,保证 @@ -421,8 +484,8 @@ may observe % % \begin{function}{AutoFakeBold,AutoFakeSlant} % \begin{syntax} -% AutoFakeBold = \meta{\TF\orvar{}数字} -% AutoFakeSlant = \meta{\TF\orvar{}数字} +% AutoFakeBold = \marg{\TF\orvar{}数字} +% AutoFakeSlant = \marg{\TF\orvar{}数字} % \end{syntax} % 局部设置当前字体族的伪粗和伪斜属性。如果没有在局部给出这些选项,将使用全局设定。 % \end{function} @@ -613,7 +676,7 @@ may observe % 之后,就设置了 |SimSun| 是 |KaiTi_GB2312| 的备用字体,而 |SimSun-ExtB| 是 % |SimSun| 的备用字体。 % \end{function} -% +% % \subsubsection{\texorpdfstring{\XeTeX}{XeTeX} 的字体名查找} % \label{subsubsec:fontsearch} % @@ -627,7 +690,7 @@ may observe % fc-list > fontlist.txt % \end{verbatim} % 可以将系统中所有安装的字体列表存入 \file{fontlist.txt} 文件中(可能很长)。 -% +% % |fc-list| 命令列出的信息很多,而且在安装字体较多的 Windows 系统上的输出将非 % 常庞大,如其中可能包含: % \begin{verbatim}[formatcom=\fontspec{CMU Typewriter Text}\CJKfixedspacing] @@ -714,18 +777,20 @@ may observe % 就声明了 |SPUA| 和 |Ext-B| 这两个个子分区。同时在 \ref{subsec:fontset} 节介绍的 % CJK 字体设置命令的 \meta{font features} 里新建了 |SPUA| 和 |Ext-B| 这两个选项。 % 新建的这两个选项的使用方法跟 \ref{subsec:fontset} 介绍的 |FallBack| 类似。可以 -% 通过它们来设置字体。例如,使用 +% 通过它们来设置字体。\strut +% \end{function} +% +% 例如,可以使用 % \begin{verbatim} % \setCJKmainfont[SPUA=SunmanPUA,Ext-B=SimSun-ExtB]{SimSun} % \end{verbatim} -% 就设置了文档的主字体是 |SimSun|,|SPUA| 分区的字体是 |SunmanPUA|,而 |Ext-B| 分区 +% 设置文档的主字体是 |SimSun|,|SPUA| 分区的字体是 |SunmanPUA|,而 |Ext-B| 分区 % 的字体是 |SimSun-ExtB|。 % % |\xeCJKDeclareSubCJKBlock| 应该在声明所有的 CJK 字体族之前使用。如果有某个 CJK 字 % 体族没有设置 \meta{block} 选项,将使用 |\CJKfamilydefault| 的 \meta{block} 选项 % 作为该 CJK 字体族的 \meta{block} 选项。如果希望在使用某 CJK 字体族时,不在 CJK 主 % 分区与 \meta{block} 之间切换字体,可以使用 \meta{block}|=*| 选项。 -% \end{function} % % \begin{function}{\xeCJKCancelSubCJKBlock} % \begin{syntax} @@ -796,15 +861,6 @@ may observe % % \section{已知问题和兼容性} % -% 新版本的 \pkg{xeCJK} 完全使用 \LaTeX3 的语法来编写,受限于目前 |expl3| 宏包的相关 -% 工具的实现方式,在 CJK 文字后面使用 |\outer| 宏时会出现类似 -% \begin{verbatim} -% ! Forbidden control sequence found while scanning use of \token_if_eq_meaning:NNTF -% \end{verbatim} -% 的错误,在 |\outer| 宏前面加上 |\relax| 可以暂时避免这个错误。目前已知的有 \pkg{cprotect} -% 宏包提供的 |\cprotect|,这时你也可以暂时用 |\icprotect| 代替 |\cprotect|。 -% \footnote{\url{http://code.google.com/p/ctex-kit/issues/detail?id=87}} -% % 为了与 \pkg{CJKnumb} 和 \pkg{CJKulem} 宏包兼容,\pkg{xeCJK} 使用并重新定义了 % \pkg{CJK} 宏包的部分宏命令,如 |\CJKfamily|、|\CJKsymbol| 和 |\CJKpunctsymbol| 等。 % 需要指出,\pkg{xeCJK} 不需要 \pkg{CJK} 的支持,并且 \pkg{xeCJK} 自动禁止在它之后载入 @@ -816,8 +872,6 @@ may observe % \pkg{polyglossia})会存在大小不一的冲突。\pkg{xeCJK} 虽然为此作了一些处理,但与它们 % 共同使用时应该小心。 % -% \clearpage -% %\end{documentation} % % @@ -830,10 +884,7 @@ may observe % \end{macrocode} % % \begin{macrocode} -\RequirePackage{xparse} -\RequirePackage{l3keys2e} -\ProvidesExplPackage {xeCJK} {2012/05/19} {3.0.5} - {package for typesetting CJK scripts with XeLaTeX} +\ProvidesExplPackage{\ExplFileName}{\ExplFileDate}{3.0.6}{\ExplFileDescription} % \end{macrocode} % % \begin{macro}[aux] @@ -853,7 +904,7 @@ may observe % % \pkg{xeCJK} 必须使用 \XeTeX 引擎的支持。 % \begin{macrocode} -\msg_new:nnn {xeCJK} { Require-XeTeX } +\xeCJK_msg_new:nn { Require-XeTeX } { The~xeCJK~package~requires~XeTeX~to~function.\\\\ You~must~change~your~typesetting~engine~to~"xelatex" \\ @@ -862,6 +913,22 @@ may observe \xetex_if_engine:F { \msg_critical:nn { xeCJK } { Require-XeTeX } } % \end{macrocode} % +% \begin{macrocode} +\xeCJK_msg_new:nn { l3-too-old } + { + Support~package~'expl3'~too~old. \\\\ + Please~update~an~up~to~date~version~of~the~bundles\\\\ + 'l3kernel'~and~'l3packages'\\\\ + using~your~TeX~package~manager~or~from~CTAN. + } +\@ifpackagelater { expl3 } { 2012/02/19 } { } { \xeCJK_error:n { l3-too-old } } +% \end{macrocode} +% +% \begin{macrocode} +\RequirePackage{xparse} +\RequirePackage{l3keys2e} +% \end{macrocode} +% % |\XeTeXglyphbouds| 可以得到一个字符的左右边距,用于标点压缩。 % \begin{macrocode} \xeCJK_msg_new:nn { XeTeX-too-old } @@ -1439,8 +1506,25 @@ may observe { \xeCJK_inter_class_toks:nnn { Boundary } {#1} { - \int_compare:nNnTF \tex_lastkern:D = \c_one { \CJKecglue } - { \int_compare:nNnT \tex_lastkern:D = \c_two \xeCJK_space_or_xecglue: } + \bool_if:nTF + { + \l_xeCJK_xecglue_bool && + \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven && + \skip_if_eq_p:nn \tex_lastskip:D \l_xeCJK_space_glue_tl + } + { + \tex_unskip:D + \bool_if:nTF + { + \int_compare_p:nNn \tex_lastkern:D = \c_one || + \int_compare_p:nNn \tex_lastkern:D = \c_two + } + { \CJKecglue } { \c_space_token } + } + { + \int_compare:nNnTF \tex_lastkern:D = \c_one { \CJKecglue } + { \int_compare:nNnT \tex_lastkern:D = \c_two \xeCJK_space_or_xecglue: } + } } \str_if_eq:xxF {#1} { NormalSpace } { \xeCJK_app_inter_class_toks:nnn { CJK } {#1} { \CJKecglue } } @@ -1844,11 +1928,21 @@ may observe { \tex_unkern:D \tex_unkern:D { \xeCJK_CJK_space_kern: } } \peek_catcode_ignore_spaces:NTF \c_math_toggle_token { \xeCJK_space_or_xecglue: } - { \bool_if:nT { \token_if_cs_p:N \l_peek_token } \xeCJK_space_or_xecglue: } + { + \bool_if:nT + { + \xeCJK_if_outer_macro_p:c { l_peek_token } || + \token_if_cs_p:c { l_peek_token } + } + { \xeCJK_space_or_xecglue: } + } } { - \token_if_math_toggle:NTF \l_peek_token \CJKecglue - { \cs_if_exist:NF \l_peek_token \exp_not:N } + \xeCJK_if_outer_macro:cF { l_peek_token } + { + \token_if_math_toggle:cTF { l_peek_token } \CJKecglue + { \cs_if_exist:cF { l_peek_token } \exp_not:N } + } } } \cs_new_nopar:Nn \xeCJK_peek_math: @@ -1860,8 +1954,11 @@ may observe \peek_catcode_ignore_spaces:NF \c_space_token { \xeCJK_space_or_xecglue: } } { - \token_if_math_toggle:NTF \l_peek_token \CJKecglue - { \cs_if_exist:NF \l_peek_token \exp_not:N } + \xeCJK_if_outer_macro:cF { l_peek_token } + { + \token_if_math_toggle:cTF { l_peek_token } \CJKecglue + { \cs_if_exist:cF { l_peek_token } \exp_not:N } + } } } % \end{macrocode} @@ -1922,9 +2019,10 @@ may observe { \bool_if:nTF { - \tl_if_empty_p:x { \token_get_arg_spec:N \l_peek_token } && - \exp_args:No \tl_if_single_token_p:n \l_peek_token && - \exp_after:wN \token_if_other_p:N \l_peek_token + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && + \tl_if_empty_p:x { \token_get_arg_spec:c { l_peek_token } } && + \exp_args:NNc \exp_args:No \tl_if_single_token_p:n { l_peek_token } && + \exp_args:NNc \exp_after:wN \token_if_other_p:N { l_peek_token } } { \xeCJK_checksingle:NN {#1} } { \xeCJK_checksingle_save_CJKsymbol:N {#1} } @@ -1937,20 +2035,22 @@ may observe { \bool_if:nTF { - \token_if_space_p:N \l_peek_token || - \token_if_math_toggle_p:N \l_peek_token || - \token_if_cs_p:N \l_peek_token + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && + ( \token_if_space_p:c { l_peek_token } || + \token_if_math_toggle_p:c { l_peek_token } || + \token_if_cs_p:c { l_peek_token } ) } { - \bool_if:nTF { \token_if_space_p:N \l_peek_token } + \bool_if:nTF { \token_if_space_p:c { l_peek_token } } { \peek_catcode_ignore_spaces:NTF \c_catcode_other_token { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token } { \bool_if:nTF { - \token_if_math_toggle_p:N \l_peek_token || - \token_if_cs_p:N \l_peek_token + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && + ( \token_if_math_toggle_p:c { l_peek_token } || + \token_if_cs_p:c { l_peek_token } ) } { \xeCJK_checksingle:NNN {#1} {#2} \c_space_token } { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token } @@ -2004,12 +2104,6 @@ may observe % \end{macrocode} % \end{macro} % -% \begin{macro}[internal,var]{\g_xeCJK_inline_env_clist} -% \begin{macrocode} -\clist_new:N \g_xeCJK_inline_env_clist -% \end{macrocode} -% \end{macro} -% % \begin{macro}{InlineEnv,InlineEnv+,InlineEnv-} % \begin{macrocode} \keys_define:nn { xeCJK / options } @@ -2029,6 +2123,62 @@ may observe % \end{macrocode} % \end{macro} % +% \begin{macrocode} +\cs_generate_variant:Nn \token_if_cs_p:N { c } +\cs_generate_variant:Nn \token_if_space_p:N { c } +\cs_generate_variant:Nn \token_get_arg_spec:N { c } +\cs_generate_variant:Nn \token_if_math_toggle_p:N { c } +\cs_generate_variant:Nn \token_if_math_toggle:NTF { c } +% \end{macrocode} +% +% \begin{macro}[pTF,internal]{\xeCJK_if_outer_macro:c} +% 判断是否是 |\outer| 宏,输入的是控制序列的名字。 +% \begin{macrocode} +\group_begin: +\char_set_lccode:nn { `\; } { `\: } +\char_set_lccode:nn { `\Z } { `\t } +\char_set_lccode:nn { `\Y } { `\c } +\char_set_lccode:nn { `\T } { `\T } +\char_set_lccode:nn { `\F } { `\F } +\tl_map_function:nN { O U Z E R M A Y R ; } \char_set_catcode_other:N +\tl_to_lowercase:n + { + \group_end: + \prg_new_conditional:Nnn \xeCJK_if_outer_macro:c { p, T , F , TF } + { + \exp_last_unbraced:Nf \xeCJK_if_outer_macro_aux:w + \cs_meaning:c {#1} OUZER ~ MAYRO ; \q_stop + } + \cs_new_nopar:Npn \xeCJK_if_outer_macro_aux:w #1 OUZER ~ MAYRO ; #2 \q_stop + { + \prg_case_str:xxn { #1 ~ } + { + { \token_to_str:N \ } { \prg_return_true: } + { \token_to_str:N \long \token_to_str:N \ } { \prg_return_true: } + { \token_to_str:N \protected \token_to_str:N \ } { \prg_return_true: } + { \token_to_str:N \protected \token_to_str:N \long \token_to_str:N \ } + { \prg_return_true: } + } + { \prg_return_false: } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[pTF,internal]{\xeCJK_if_eq_meaning:cN} +% 对 \pkg{l3token} 打的补丁,使 |\peek_catcode_ignore_spaces:NTF| 等可用于 |\outer| 宏。 +% \begin{macrocode} +\tl_replace_once:Nnn \peek_ignore_spaces_execute_branches: + { \token_if_eq_meaning:NNTF \l_peek_token } + { \xeCJK_if_eq_meaning:cNTF { l_peek_token } } +\prg_new_conditional:Nnn \xeCJK_if_eq_meaning:cN { p , T , F , TF } + { + \exp_args:Nc \if_meaning:w {#1} #2 + \prg_return_true: \else: \prg_return_false: \fi: + } +% \end{macrocode} +% \end{macro} +% % \subsection{增加 CJK 子分区} % % \begin{macro}[internal]{\xeCJK_UL_subclass_patch_tl,\g_xeCJK_CJK_subclass_clist} @@ -2907,12 +3057,15 @@ may observe }, AutoFakeSlant .default:n = { \g_xeCJK_SlantFactor_fp }, Mono .choice:, - Mono / Exspace .code:n = { \xeCJK_set_monoexspace: }, + Mono / Exspace .code:n = + { + \xeCJK_set_monoexspace: + \tl_clear:N \l_xeCJK_monoscale_tl + }, Mono / Scale .code:n = { \xeCJK_set_monoscale: - \tl_set:Nx \l_xeCJK_monoscale_tl - { Scale = { \fp_use:N \g_xeCJK_monoscale_fp } } + \tl_set:Nx \l_xeCJK_monoscale_tl { Scale = { \fp_use:N \g_xeCJK_monoscale_fp } } } } % \end{macrocode} @@ -2955,12 +3108,11 @@ may observe \tl_set:Nx \l_xeCJK_family_tl {#1} \clist_set:Nx \l_xeCJK_fontoptions_clist {#2} \tl_set:Nx \l_xeCJK_fontname_tl {#3} - \prop_gpop:NVNT \g_xeCJK_family_name_prop \l_xeCJK_family_tl \l_tmpa_tl - { \xeCJK_warning:nxx { CJKfamily-redef } \l_xeCJK_family_tl \l_tmpa_tl } \keys_set_known:nxN { xeCJK / features } { \g_xeCJK_default_features_clist, #2 } \l_xeCJK_pass_features_clist \xeCJK_parse_features: \xeCJK_pass_features: + \xeCJK_check_family:V \l_xeCJK_family_tl \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_family_tl } { \exp_not:n { \fontspec_set_family:Nnn \l_xeCJK_fontspec_family_tl } @@ -2980,6 +3132,20 @@ may observe \group_end: } \cs_generate_variant:Nn \xeCJK_set_family:nnn { ncc } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xeCJK_check_family:n} +% \begin{macrocode} +\cs_new_nopar:Nn \xeCJK_check_family:n + { + \prop_get:NnNT \g_xeCJK_family_prop {#1} \l_tmpa_tl + { + \prop_gpop:NnNT \g_xeCJK_family_name_prop {#1} \l_tmpa_tl { } + \xeCJK_warning:nxx { CJKfamily-redef } {#1} \l_tmpa_tl + } + } +\cs_generate_variant:Nn \xeCJK_check_family:n { V } \xeCJK_msg_new:nn { CJKfamily-redef } { Redefining~CJKfamily~`#1'~(#2). } % \end{macrocode} % \end{macro} @@ -3002,11 +3168,9 @@ may observe % \end{macro} % % \begin{macrocode} -\cs_generate_variant:Nn \prop_gpop:NnNT { NV } \cs_generate_variant:Nn \prop_put:Nnn { Nxx } \cs_generate_variant:Nn \prop_get:Nn { NV } \cs_generate_variant:Nn \prop_get:NnNF { Nx } -\cs_generate_variant:Nn \prop_get:NnNTF { Nx } \cs_generate_variant:Nn \prop_if_in:NnF { Nx } \cs_generate_variant:Nn \prop_put_if_new:Nnn { Nxx } % \end{macrocode} @@ -3170,10 +3334,8 @@ may observe \clist_remove_all:Nn \l_xeCJK_fontoptions_clist {##1} \clist_remove_all:Nn \l_xeCJK_fontoptions_clist { ##1 = } } - \prop_gput:NVV \g_xeCJK_family_prop - \l_xeCJK_family_tl \l_xeCJK_fontname_tl - \prop_gput:NVV \g_xeCJK_family_options_prop - \l_xeCJK_family_tl \l_xeCJK_fontoptions_clist + \prop_gput:NVV \g_xeCJK_family_prop \l_xeCJK_family_tl \l_xeCJK_fontname_tl + \prop_gput:NVV \g_xeCJK_family_options_prop \l_xeCJK_family_tl \l_xeCJK_fontoptions_clist \group_end: } % \end{macrocode} @@ -3186,29 +3348,27 @@ may observe \clist_remove_duplicates:N \l_xeCJK_sub_key_clist \clist_map_inline:Nn \l_xeCJK_sub_key_clist { - \tl_set:Nx \l_tmpa_tl { \l_xeCJK_family_tl/##1 } + \tl_set:Nx \l_xeCJK_sub_family_tl { \l_xeCJK_family_tl/##1 } \bool_if:cT { l_xeCJK_copy_##1_bool } { - \tl_map_inline:nn { \g_xeCJK_family_prop \g_xeCJK_family_options_prop } - { - \prop_get:NVNT ####1 \l_xeCJK_family_tl \l_tmpb_tl - { \prop_gput:NVV ####1 \l_tmpa_tl \l_tmpb_tl } - } - \prop_get:NVNT \g_xeCJK_family_options_prop \l_tmpa_tl \l_tmpa_clist + \xeCJK_check_family:V \l_xeCJK_sub_family_tl + \prop_get:NVNT \g_xeCJK_family_prop \l_xeCJK_family_tl \l_tmpa_tl + { \prop_gput:NVV \g_xeCJK_family_prop \l_xeCJK_sub_family_tl \l_tmpa_tl } + \prop_get:NVNT \g_xeCJK_family_options_prop \l_xeCJK_family_tl \l_tmpa_clist { \clist_remove_all:Nn \l_tmpa_clist { ##1 = * } - \prop_gput:NVV \g_xeCJK_family_options_prop \l_tmpa_tl \l_tmpa_clist + \prop_gput:NVV \g_xeCJK_family_options_prop \l_xeCJK_sub_family_tl \l_tmpa_clist } - \cs_gset_protected_nopar:cpx { xeCJK/family/\l_tmpa_tl } + \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_sub_family_tl } { - \exp_not:N \xeCJK_family_if_exist:nT { \l_xeCJK_family_tl } + \xeCJK_family_if_exist:nT { \l_xeCJK_family_tl } { \prop_get:NnNT \exp_not:N \g_xeCJK_family_name_prop { \l_xeCJK_family_tl } \exp_not:N \l_tmpa_tl { \prop_gput:NnV \exp_not:N \g_xeCJK_family_name_prop - { \l_tmpa_tl } \exp_not:N \l_tmpa_tl - \cs_gset_protected_nopar:cpx { xeCJK/family/\l_tmpa_tl } + { \l_xeCJK_sub_family_tl } \exp_not:N \l_tmpa_tl + \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_sub_family_tl } \exp_not:n { { \exp_not:N \fontencoding { \g_fontspec_encoding_tl } @@ -3221,7 +3381,7 @@ may observe } \bool_if:cT { l_xeCJK_add_##1_bool } { - \xeCJK_set_family:ncc \l_tmpa_tl + \xeCJK_set_family:ncc \l_xeCJK_sub_family_tl { l_xeCJK_##1_fontfeat_clist } { l_xeCJK_##1_fontname_tl } } } @@ -3287,12 +3447,11 @@ may observe % % \begin{macro}[TF,internal]{\xeCJK_family_if_exist:n} % \begin{macrocode} -\prg_new_conditional:Nnn \xeCJK_family_if_exist:n { T, F, TF } +\prg_new_protected_conditional:Nnn \xeCJK_family_if_exist:n { T, F, TF } { \cs_if_free:cTF { xeCJK/family/#1 } \prg_return_false: { - \prop_if_in:NxF - \g_xeCJK_family_name_prop {#1} { \use:c { xeCJK/family/#1 } } + \prop_if_in:NxF \g_xeCJK_family_name_prop {#1} { \use:c { xeCJK/family/#1 } } \prg_return_true: } } @@ -3313,6 +3472,7 @@ may observe \tl_new:c { xeCJK_warned_aux_#1 } } } + \tex_ignorespaces:D } \xeCJK_msg_new:nn { CJKfamily-Unknown } { @@ -3341,8 +3501,7 @@ may observe { \tl_set:Nx \l_xeCJK_family_tl { \cs_to_str:N #2 } } { \tl_set:Nx \l_xeCJK_family_tl {#1} } \xeCJK_set_family:nnn \l_xeCJK_family_tl {#3} {#4} - \cs_new_protected_nopar:Npx #2 - { \exp_not:N \CJKfamily { \l_xeCJK_family_tl } } + \cs_new_protected_nopar:Npx #2 { \exp_not:N \CJKfamily { \l_xeCJK_family_tl } } } \int_new:N \g_xeCJK_fontspec_int \int_gdecr:N \g_xeCJK_fontspec_int @@ -3382,8 +3541,7 @@ may observe \clist_if_in:NnT \l_tmpa_clist {##1} { \clist_remove_all:Nn \l_tmpa_clist {##1} - \prop_get:NxNF \g_xeCJK_family_prop - { \xeCJK@family/##1 } \l_tmpb_tl + \prop_get:NxNF \g_xeCJK_family_prop { \xeCJK@family/##1 } \l_tmpb_tl { \prop_get:NxNF \g_xeCJK_family_prop { \CJKfamilydefault/##1 } \l_tmpb_tl @@ -3394,8 +3552,8 @@ may observe \clist_map_break: } } - \prop_get:NVNF \g_xeCJK_family_options_prop \xeCJK@family - \l_tmpb_clist { \clist_clear:N \l_tmpb_clist } + \prop_get:NVNF \g_xeCJK_family_options_prop \xeCJK@family \l_tmpb_clist + { \clist_clear:N \l_tmpb_clist } \clist_clear:N \l_tmpc_clist \clist_map_inline:Nn \l_tmpb_clist { @@ -3412,7 +3570,7 @@ may observe \cs_new_eq:NN \addCJKfontfeature \addCJKfontfeatures \xeCJK_msg_new:nn { addCJKfontfeature-ignored } { - \tl_to_str:N \addCJKfontfeatures (s)~ignored.\\\\ + \tl_to_str:N \addCJKfontfeature (s)~ignored.\\\\ It~cannot~be~used~with~a~font~that~wasn't~selected~by~xeCJK. } % \end{macrocode} @@ -3489,6 +3647,7 @@ may observe \tl_put_left:Nn \document { \group_end: + \normalfont \prop_if_empty:NTF \g_xeCJK_family_prop { \xeCJK_warning:n { no-CJKfamily } } { @@ -3517,7 +3676,6 @@ may observe } } } - \normalfont } \group_begin: } @@ -3544,7 +3702,6 @@ may observe % \begin{macro}[internal,var]{\g_xeCJK_monoscale_fp,\g_xeCJK_exspace_dim} % \begin{macrocode} \fp_new:N \g_xeCJK_monoscale_fp -\fp_gset_eq:NN \g_xeCJK_monoscale_fp \c_one_fp \dim_new:N \g_xeCJK_exspace_dim % \end{macrocode} % \end{macro} @@ -3553,12 +3710,12 @@ may observe % \begin{macrocode} \NewDocumentCommand \setCJKmonoscale { } { + \CJKflexiblespacing \xeCJK_set_monoscale: \addCJKfontfeatures { Scale = \fp_use:N \g_xeCJK_monoscale_fp } } \cs_new_nopar:Nn \xeCJK_set_monoscale: { - \dim_gzero:N \g_xeCJK_exspace_dim \group_begin: \fontfamily \ttdefault \selectfont \fp_gset_from_dim:Nn \g_xeCJK_monoscale_fp @@ -3574,7 +3731,6 @@ may observe \NewDocumentCommand \setCJKmonoexspace { } { \xeCJK_set_monoexspace: } \cs_new_nopar:Nn \xeCJK_set_monoexspace: { - \fp_gset_eq:NN \g_xeCJK_monoscale_fp \c_one_fp \group_begin: \fontfamily \ttdefault \selectfont \dim_gset:Nn \g_xeCJK_exspace_dim @@ -3584,53 +3740,43 @@ may observe % \end{macrocode} % \end{macro} % -% \begin{macro}[internal] -% { \xeCJK_fixed_ecglue:, \xeCJK_fixed_cjkglue:, \xeCJK_flexible_ecglue:, -% \xeCJK_flexible_ecglue:, \xeCJK_flexible_cjkglue: } -% \begin{macrocode} -\cs_new_nopar:Nn \xeCJK_fixed_ecglue: { \skip_horizontal:n { .5\g_xeCJK_exspace_dim } } -\cs_new_nopar:Nn \xeCJK_fixed_cjkglue: { \skip_horizontal:N \g_xeCJK_exspace_dim } -\AtEndOfPackage - { - \tl_set_eq:NN \l_xeCJK_flexible_punctstyle_tl \l_xeCJK_punctstyle_tl - \cs_new_eq:NN \xeCJK_flexible_ecglue: \CJKecglue - \cs_new_eq:NN \xeCJK_flexible_cjkglue: \CJKglue - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\CJKfixedspacing} +% \begin{macro}{\CJKfixedspacing,\CJKflexiblespacing} % \begin{macrocode} \NewDocumentCommand \CJKfixedspacing { } { - \tl_if_eq:NNF \l_xeCJK_punctstyle_tl \c_xeCJK_ps_plain_tl + \bool_if:NF \l_xeCJK_fixed_spacing_bool { + \bool_set_true:N \l_xeCJK_fixed_spacing_bool \tl_set_eq:NN \l_xeCJK_flexible_punctstyle_tl \l_xeCJK_punctstyle_tl - \punctstyle { plain } - } - \cs_if_eq:NNF \CJKecglue \xeCJK_fixed_ecglue: - { - \cs_set_eq:NN \xeCJK_flexible_ecglue: \CJKecglue - \cs_set_eq:NN \CJKecglue \xeCJK_fixed_ecglue: - } - \cs_if_eq:NNF \CJKglue \xeCJK_fixed_cjkglue: - { + \bool_set_eq:NN \l_xeCJK_fixed_xecglue_bool \l_xeCJK_xecglue_bool + \cs_set_eq:NN \xeCJK_flexible_ecglue: \CJKecglue \cs_set_eq:NN \xeCJK_flexible_cjkglue: \CJKglue - \cs_set_eq:NN \CJKglue \xeCJK_fixed_cjkglue: + \xeCJK_set_monoexspace: + \xeCJKsetup + { + PunctStyle = plain , + CJKglue = { \skip_horizontal:N \g_xeCJK_exspace_dim } , + CJKecglue = { \skip_horizontal:n { .5\g_xeCJK_exspace_dim } } , + xCJKecglue = false , + } } } -\AtBeginDocument { \tl_put_right:Nn \verbatim@font \CJKfixedspacing } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\CJKflexiblespacing} -% \begin{macrocode} -\NewDocumentCommand \CJKflexiblespacing { m } +\NewDocumentCommand \CJKflexiblespacing { } { - \cs_set_eq:NN \l_xeCJK_punctstyle_tl \l_xeCJK_flexible_punctstyle_tl - \cs_set_eq:NN \CJKecglue \xeCJK_flexible_ecglue: - \cs_set_eq:NN \CJKglue \xeCJK_flexible_cjkglue: + \bool_if:NT \l_xeCJK_fixed_spacing_bool + { + \bool_set_false:N \l_xeCJK_fixed_spacing_bool + \exp_args:Nx \xeCJKsetup + { + PunctStyle = { \l_xeCJK_flexible_punctstyle_tl } , + CJKglue = { \xeCJK_flexible_cjkglue: } , + CJKecglue = { \xeCJK_flexible_ecglue: } , + xCJKecglue = { \bool_if:NTF \l_xeCJK_fixed_xecglue_bool { true } { false } } , + } + } } +\bool_new:N \l_xeCJK_fixed_spacing_bool +\AtBeginDocument { \tl_put_right:Nn \verbatim@font \CJKfixedspacing } % \end{macrocode} % \end{macro} % @@ -3974,7 +4120,7 @@ may observe % % \section{例子} % -% \subsection{\pkg{example-autofake.tex}} +% \subsection{\pkg{xeCJK-example-autofake.tex}} % % \begin{macrocode} %<*ex-autofake> @@ -4035,7 +4181,7 @@ may observe %</ex-autofake> % \end{macrocode} % -% \subsection{\pkg{example-fallback.tex}} +% \subsection{\pkg{xeCJK-example-fallback.tex}} % % \begin{macrocode} %<*ex-fallback> @@ -4087,7 +4233,7 @@ may observe %</ex-fallback> % \end{macrocode} % -% \subsection{\pkg{example-SubCJKBlock.tex}} +% \subsection{\pkg{xeCJK-example-subCJKblock.tex}} % % \begin{macrocode} %<*ex-block> @@ -4155,6 +4301,74 @@ CJK統合漢字(シージェーケーとうごうかんじ、CJK Unified Ideog %</ex-block> % \end{macrocode} % +% \CJKfixedspacing +% +% \subsection{\pkg{xeCJK-example-CJKecglue.tex}} +% +% \begin{macrocode} +%<*ex-ecglue> +% \end{macrocode} +% +% \begin{macrocode} +\documentclass{minimal} +\usepackage{xeCJK} +\setCJKmainfont[BoldFont=SimHei]{SimSun} +\long\def\showtext{% + 这是 English 中文 {\itshape Chinese} 中文 \TeX\ + 间隔 \textit{Italic} 中文\textbf{字体} a 数学 $b$ 数学 $c$ $d$\par + 这是English中文{\itshape Chinese}中文\TeX\ + 间隔\textit{Italic}中文\textbf{字体}a数学$b$数学$c$ $d$\par +This is an example. 这是一个例子} +\begin{document} +\showtext + +\hrulefill\bigskip + +\xeCJKsetup{xCJKecglue=\quad} +\showtext +\end{document} +% \end{macrocode} +% +% \begin{macrocode} +%</ex-ecglue> +% \end{macrocode} +% +% \subsection{\pkg{xeCJK-example-checksingle.tex}} +% +% \begin{macrocode} +%<*ex-single> +% \end{macrocode} +% +% \begin{macrocode} +\documentclass{minimal} +\usepackage{xeCJK} +\setCJKmainfont{SimSun} +\catcode`\。=\active +\def。{.} +\def\foo{一} +\long\def\showtext{一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十。 +$$x^2+y^2$$ +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十\foo +\begin{equation} +x^2+y^2 +\end{equation} +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十。} +\begin{document} +\hsize=30em +\parindent=0pt +\showtext + +\hrulefill\bigskip + +\xeCJKsetup{CheckSingle} +\showtext +\end{document} +% \end{macrocode} +% +% \begin{macrocode} +%</ex-single> +% \end{macrocode} +% % \end{implementation} % % \Finale diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins index a4b3f02d63f..5953014e7df 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins @@ -6,7 +6,8 @@ %% %% xeCJK.dtx (with options: `batchfile') %% -%% Version 3.0.5 (19-May-2012) +%% $Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: %% Wenchang Sun <sunwch@nankai.edu.cn> @@ -28,11 +29,14 @@ %% The Current Maintainer of this work are Leo Liu and Qing Lee. %% ----------------------------------------------------------------- %% + \input docstrip.tex \keepsilent +\askforoverwritefalse \preamble - Version 3.0.5 (19-May-2012) +$Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ +$URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ ----------------------------------------------------------------- Author: Wenchang Sun <sunwch@nankai.edu.cn> @@ -56,13 +60,38 @@ \endpreamble \postamble + + This package consists of the file xeCJK.dtx + and the derived files xeCJK.pdf, + xeCJK.sty, + xeCJK.ins, + xeCJK-example-autofake.tex, + xeCJK-example-fallback.tex, + xeCJK-example-subCJKblock.tex, + xeCJK-example-CJKecglue.tex, + xeCJK-example-checksingle.tex and + README.txt. \endpostamble -\askforoverwritefalse +\usedir{tex/xelatex/xecjk} \generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}} -\generate{\file{example-autofake.tex}{\from{\jobname.dtx}{ex-autofake}}} -\generate{\file{example-fallback.tex}{\from{\jobname.dtx}{ex-fallback}}} -\generate{\file{example-subCJKblock.tex}{\from{\jobname.dtx}{ex-block}}} +\usedir{doc/xelatex/xecjk/example} +\generate{ + \file{\jobname-example-autofake.tex}{\from{\jobname.dtx}{ex-autofake}} + \file{\jobname-example-fallback.tex}{\from{\jobname.dtx}{ex-fallback}} + \file{\jobname-example-subCJKblock.tex}{\from{\jobname.dtx}{ex-block}} + \file{\jobname-example-CJKecglue.tex}{\from{\jobname.dtx}{ex-ecglue}} + \file{\jobname-example-checksingle.tex}{\from{\jobname.dtx}{ex-single}}} \endbatchfile %% +%% This package consists of the file xeCJK.dtx +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.ins, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex and +%% README.txt. %% %% End of file `xeCJK.ins'. diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index adf0c16231d..90bf31d5444 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty @@ -6,7 +6,8 @@ %% %% xeCJK.dtx (with options: `package') %% -%% Version 3.0.5 (19-May-2012) +%% $Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: %% Wenchang Sun <sunwch@nankai.edu.cn> @@ -28,10 +29,11 @@ %% The Current Maintainer of this work are Leo Liu and Qing Lee. %% ----------------------------------------------------------------- %% -\RequirePackage{xparse} -\RequirePackage{l3keys2e} -\ProvidesExplPackage {xeCJK} {2012/05/19} {3.0.5} - {package for typesetting CJK scripts with XeLaTeX} +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\GetIdInfo$Id: xeCJK.dtx 343 2012-05-21 05:59:17Z sobenlee $ + {package for typesetting CJK scripts with XeLaTeX} +\ProvidesExplPackage{\ExplFileName}{\ExplFileDate}{3.0.6}{\ExplFileDescription} \cs_new_nopar:Npn \xeCJK_msg_new:nn { \msg_new:nnn { xeCJK } } \cs_new_nopar:Npn \xeCJK_error:n { \msg_error:nn { xeCJK } } \cs_new_nopar:Npn \xeCJK_error:nx { \msg_error:nnx { xeCJK } } @@ -40,13 +42,23 @@ \cs_new_nopar:Npn \xeCJK_warning:nxx { \msg_warning:nnxx { xeCJK } } \cs_new_nopar:Npn \xeCJK_info:nx { \msg_info:nnx { xeCJK } } \cs_new_nopar:Npn \xeCJK_info:nxx { \msg_info:nnxx { xeCJK } } -\msg_new:nnn {xeCJK} { Require-XeTeX } +\xeCJK_msg_new:nn { Require-XeTeX } { The~xeCJK~package~requires~XeTeX~to~function.\\\\ You~must~change~your~typesetting~engine~to~"xelatex" \\ instead~of~plain~"latex"~or~"pdflatex"~or~"lualatex". } \xetex_if_engine:F { \msg_critical:nn { xeCJK } { Require-XeTeX } } +\xeCJK_msg_new:nn { l3-too-old } + { + Support~package~'expl3'~too~old. \\\\ + Please~update~an~up~to~date~version~of~the~bundles\\\\ + 'l3kernel'~and~'l3packages'\\\\ + using~your~TeX~package~manager~or~from~CTAN. + } +\@ifpackagelater { expl3 } { 2012/02/19 } { } { \xeCJK_error:n { l3-too-old } } +\RequirePackage{xparse} +\RequirePackage{l3keys2e} \xeCJK_msg_new:nn { XeTeX-too-old } { \token_to_str:N \XeTeXglyphbounds\c_space_tl is~not~defined.\\\\ @@ -284,8 +296,25 @@ { \xeCJK_inter_class_toks:nnn { Boundary } {#1} { - \int_compare:nNnTF \tex_lastkern:D = \c_one { \CJKecglue } - { \int_compare:nNnT \tex_lastkern:D = \c_two \xeCJK_space_or_xecglue: } + \bool_if:nTF + { + \l_xeCJK_xecglue_bool && + \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven && + \skip_if_eq_p:nn \tex_lastskip:D \l_xeCJK_space_glue_tl + } + { + \tex_unskip:D + \bool_if:nTF + { + \int_compare_p:nNn \tex_lastkern:D = \c_one || + \int_compare_p:nNn \tex_lastkern:D = \c_two + } + { \CJKecglue } { \c_space_token } + } + { + \int_compare:nNnTF \tex_lastkern:D = \c_one { \CJKecglue } + { \int_compare:nNnT \tex_lastkern:D = \c_two \xeCJK_space_or_xecglue: } + } } \str_if_eq:xxF {#1} { NormalSpace } { \xeCJK_app_inter_class_toks:nnn { CJK } {#1} { \CJKecglue } } @@ -553,11 +582,21 @@ { \tex_unkern:D \tex_unkern:D { \xeCJK_CJK_space_kern: } } \peek_catcode_ignore_spaces:NTF \c_math_toggle_token { \xeCJK_space_or_xecglue: } - { \bool_if:nT { \token_if_cs_p:N \l_peek_token } \xeCJK_space_or_xecglue: } + { + \bool_if:nT + { + \xeCJK_if_outer_macro_p:c { l_peek_token } || + \token_if_cs_p:c { l_peek_token } + } + { \xeCJK_space_or_xecglue: } + } } { - \token_if_math_toggle:NTF \l_peek_token \CJKecglue - { \cs_if_exist:NF \l_peek_token \exp_not:N } + \xeCJK_if_outer_macro:cF { l_peek_token } + { + \token_if_math_toggle:cTF { l_peek_token } \CJKecglue + { \cs_if_exist:cF { l_peek_token } \exp_not:N } + } } } \cs_new_nopar:Nn \xeCJK_peek_math: @@ -569,8 +608,11 @@ \peek_catcode_ignore_spaces:NF \c_space_token { \xeCJK_space_or_xecglue: } } { - \token_if_math_toggle:NTF \l_peek_token \CJKecglue - { \cs_if_exist:NF \l_peek_token \exp_not:N } + \xeCJK_if_outer_macro:cF { l_peek_token } + { + \token_if_math_toggle:cTF { l_peek_token } \CJKecglue + { \cs_if_exist:cF { l_peek_token } \exp_not:N } + } } } \keys_define:nn { xeCJK / options } @@ -610,9 +652,10 @@ { \bool_if:nTF { - \tl_if_empty_p:x { \token_get_arg_spec:N \l_peek_token } && - \exp_args:No \tl_if_single_token_p:n \l_peek_token && - \exp_after:wN \token_if_other_p:N \l_peek_token + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && + \tl_if_empty_p:x { \token_get_arg_spec:c { l_peek_token } } && + \exp_args:NNc \exp_args:No \tl_if_single_token_p:n { l_peek_token } && + \exp_args:NNc \exp_after:wN \token_if_other_p:N { l_peek_token } } { \xeCJK_checksingle:NN {#1} } { \xeCJK_checksingle_save_CJKsymbol:N {#1} } @@ -625,20 +668,22 @@ { \bool_if:nTF { - \token_if_space_p:N \l_peek_token || - \token_if_math_toggle_p:N \l_peek_token || - \token_if_cs_p:N \l_peek_token + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && + ( \token_if_space_p:c { l_peek_token } || + \token_if_math_toggle_p:c { l_peek_token } || + \token_if_cs_p:c { l_peek_token } ) } { - \bool_if:nTF { \token_if_space_p:N \l_peek_token } + \bool_if:nTF { \token_if_space_p:c { l_peek_token } } { \peek_catcode_ignore_spaces:NTF \c_catcode_other_token { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token } { \bool_if:nTF { - \token_if_math_toggle_p:N \l_peek_token || - \token_if_cs_p:N \l_peek_token + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && + ( \token_if_math_toggle_p:c { l_peek_token } || + \token_if_cs_p:c { l_peek_token } ) } { \xeCJK_checksingle:NNN {#1} {#2} \c_space_token } { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token } @@ -684,7 +729,6 @@ { \CJKsymbol {#1} \nobreak #2 } \scan_stop: #4 {#5} } -\clist_new:N \g_xeCJK_inline_env_clist \keys_define:nn { xeCJK / options } { InlineEnv .clist_gset:N = \g_xeCJK_inline_env_clist , @@ -699,6 +743,47 @@ { \clist_gremove_all:Nn \g_xeCJK_inline_env_clist {##1} } }, } +\cs_generate_variant:Nn \token_if_cs_p:N { c } +\cs_generate_variant:Nn \token_if_space_p:N { c } +\cs_generate_variant:Nn \token_get_arg_spec:N { c } +\cs_generate_variant:Nn \token_if_math_toggle_p:N { c } +\cs_generate_variant:Nn \token_if_math_toggle:NTF { c } +\group_begin: +\char_set_lccode:nn { `\; } { `\: } +\char_set_lccode:nn { `\Z } { `\t } +\char_set_lccode:nn { `\Y } { `\c } +\char_set_lccode:nn { `\T } { `\T } +\char_set_lccode:nn { `\F } { `\F } +\tl_map_function:nN { O U Z E R M A Y R ; } \char_set_catcode_other:N +\tl_to_lowercase:n + { + \group_end: + \prg_new_conditional:Nnn \xeCJK_if_outer_macro:c { p, T , F , TF } + { + \exp_last_unbraced:Nf \xeCJK_if_outer_macro_aux:w + \cs_meaning:c {#1} OUZER ~ MAYRO ; \q_stop + } + \cs_new_nopar:Npn \xeCJK_if_outer_macro_aux:w #1 OUZER ~ MAYRO ; #2 \q_stop + { + \prg_case_str:xxn { #1 ~ } + { + { \token_to_str:N \ } { \prg_return_true: } + { \token_to_str:N \long \token_to_str:N \ } { \prg_return_true: } + { \token_to_str:N \protected \token_to_str:N \ } { \prg_return_true: } + { \token_to_str:N \protected \token_to_str:N \long \token_to_str:N \ } + { \prg_return_true: } + } + { \prg_return_false: } + } + } +\tl_replace_once:Nnn \peek_ignore_spaces_execute_branches: + { \token_if_eq_meaning:NNTF \l_peek_token } + { \xeCJK_if_eq_meaning:cNTF { l_peek_token } } +\prg_new_conditional:Nnn \xeCJK_if_eq_meaning:cN { p , T , F , TF } + { + \exp_args:Nc \if_meaning:w {#1} #2 + \prg_return_true: \else: \prg_return_false: \fi: + } \tl_new:N \xeCJK_UL_subclass_patch_tl \clist_new:N \g_xeCJK_CJK_subclass_clist \cs_new_nopar:Nn \xeCJK_erase_CJKsymbol: @@ -1365,12 +1450,15 @@ }, AutoFakeSlant .default:n = { \g_xeCJK_SlantFactor_fp }, Mono .choice:, - Mono / Exspace .code:n = { \xeCJK_set_monoexspace: }, + Mono / Exspace .code:n = + { + \xeCJK_set_monoexspace: + \tl_clear:N \l_xeCJK_monoscale_tl + }, Mono / Scale .code:n = { \xeCJK_set_monoscale: - \tl_set:Nx \l_xeCJK_monoscale_tl - { Scale = { \fp_use:N \g_xeCJK_monoscale_fp } } + \tl_set:Nx \l_xeCJK_monoscale_tl { Scale = { \fp_use:N \g_xeCJK_monoscale_fp } } } } \cs_new_nopar:Nn \xeCJK_set_init: @@ -1402,12 +1490,11 @@ \tl_set:Nx \l_xeCJK_family_tl {#1} \clist_set:Nx \l_xeCJK_fontoptions_clist {#2} \tl_set:Nx \l_xeCJK_fontname_tl {#3} - \prop_gpop:NVNT \g_xeCJK_family_name_prop \l_xeCJK_family_tl \l_tmpa_tl - { \xeCJK_warning:nxx { CJKfamily-redef } \l_xeCJK_family_tl \l_tmpa_tl } \keys_set_known:nxN { xeCJK / features } { \g_xeCJK_default_features_clist, #2 } \l_xeCJK_pass_features_clist \xeCJK_parse_features: \xeCJK_pass_features: + \xeCJK_check_family:V \l_xeCJK_family_tl \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_family_tl } { \exp_not:n { \fontspec_set_family:Nnn \l_xeCJK_fontspec_family_tl } @@ -1427,6 +1514,15 @@ \group_end: } \cs_generate_variant:Nn \xeCJK_set_family:nnn { ncc } +\cs_new_nopar:Nn \xeCJK_check_family:n + { + \prop_get:NnNT \g_xeCJK_family_prop {#1} \l_tmpa_tl + { + \prop_gpop:NnNT \g_xeCJK_family_name_prop {#1} \l_tmpa_tl { } + \xeCJK_warning:nxx { CJKfamily-redef } {#1} \l_tmpa_tl + } + } +\cs_generate_variant:Nn \xeCJK_check_family:n { V } \xeCJK_msg_new:nn { CJKfamily-redef } { Redefining~CJKfamily~`#1'~(#2). } \cs_new_nopar:Nn \xeCJK_add_font:nn { @@ -1440,11 +1536,9 @@ } \cs_generate_variant:Nn \xeCJK_add_font:nn { nx, nc, nV, nv } \cs_generate_variant:Nn \xeCJK_add_font_if_new:nn { nx, nc, nV, nv } -\cs_generate_variant:Nn \prop_gpop:NnNT { NV } \cs_generate_variant:Nn \prop_put:Nnn { Nxx } \cs_generate_variant:Nn \prop_get:Nn { NV } \cs_generate_variant:Nn \prop_get:NnNF { Nx } -\cs_generate_variant:Nn \prop_get:NnNTF { Nx } \cs_generate_variant:Nn \prop_if_in:NnF { Nx } \cs_generate_variant:Nn \prop_put_if_new:Nnn { Nxx } \cs_new_nopar:Nn \xeCJK_add_fake_bold:n @@ -1558,10 +1652,8 @@ \clist_remove_all:Nn \l_xeCJK_fontoptions_clist {##1} \clist_remove_all:Nn \l_xeCJK_fontoptions_clist { ##1 = } } - \prop_gput:NVV \g_xeCJK_family_prop - \l_xeCJK_family_tl \l_xeCJK_fontname_tl - \prop_gput:NVV \g_xeCJK_family_options_prop - \l_xeCJK_family_tl \l_xeCJK_fontoptions_clist + \prop_gput:NVV \g_xeCJK_family_prop \l_xeCJK_family_tl \l_xeCJK_fontname_tl + \prop_gput:NVV \g_xeCJK_family_options_prop \l_xeCJK_family_tl \l_xeCJK_fontoptions_clist \group_end: } \cs_new_nopar:Nn \xeCJK_add_sub_block: @@ -1569,29 +1661,27 @@ \clist_remove_duplicates:N \l_xeCJK_sub_key_clist \clist_map_inline:Nn \l_xeCJK_sub_key_clist { - \tl_set:Nx \l_tmpa_tl { \l_xeCJK_family_tl/##1 } + \tl_set:Nx \l_xeCJK_sub_family_tl { \l_xeCJK_family_tl/##1 } \bool_if:cT { l_xeCJK_copy_##1_bool } { - \tl_map_inline:nn { \g_xeCJK_family_prop \g_xeCJK_family_options_prop } - { - \prop_get:NVNT ####1 \l_xeCJK_family_tl \l_tmpb_tl - { \prop_gput:NVV ####1 \l_tmpa_tl \l_tmpb_tl } - } - \prop_get:NVNT \g_xeCJK_family_options_prop \l_tmpa_tl \l_tmpa_clist + \xeCJK_check_family:V \l_xeCJK_sub_family_tl + \prop_get:NVNT \g_xeCJK_family_prop \l_xeCJK_family_tl \l_tmpa_tl + { \prop_gput:NVV \g_xeCJK_family_prop \l_xeCJK_sub_family_tl \l_tmpa_tl } + \prop_get:NVNT \g_xeCJK_family_options_prop \l_xeCJK_family_tl \l_tmpa_clist { \clist_remove_all:Nn \l_tmpa_clist { ##1 = * } - \prop_gput:NVV \g_xeCJK_family_options_prop \l_tmpa_tl \l_tmpa_clist + \prop_gput:NVV \g_xeCJK_family_options_prop \l_xeCJK_sub_family_tl \l_tmpa_clist } - \cs_gset_protected_nopar:cpx { xeCJK/family/\l_tmpa_tl } + \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_sub_family_tl } { - \exp_not:N \xeCJK_family_if_exist:nT { \l_xeCJK_family_tl } + \xeCJK_family_if_exist:nT { \l_xeCJK_family_tl } { \prop_get:NnNT \exp_not:N \g_xeCJK_family_name_prop { \l_xeCJK_family_tl } \exp_not:N \l_tmpa_tl { \prop_gput:NnV \exp_not:N \g_xeCJK_family_name_prop - { \l_tmpa_tl } \exp_not:N \l_tmpa_tl - \cs_gset_protected_nopar:cpx { xeCJK/family/\l_tmpa_tl } + { \l_xeCJK_sub_family_tl } \exp_not:N \l_tmpa_tl + \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_sub_family_tl } \exp_not:n { { \exp_not:N \fontencoding { \g_fontspec_encoding_tl } @@ -1604,7 +1694,7 @@ } \bool_if:cT { l_xeCJK_add_##1_bool } { - \xeCJK_set_family:ncc \l_tmpa_tl + \xeCJK_set_family:ncc \l_xeCJK_sub_family_tl { l_xeCJK_##1_fontfeat_clist } { l_xeCJK_##1_fontname_tl } } } @@ -1652,12 +1742,11 @@ \xeCJK_select_font: } \xeCJK_msg_new:nn { CJK-block } { Switch~from~block~'#1'~to~'#2'. } -\prg_new_conditional:Nnn \xeCJK_family_if_exist:n { T, F, TF } +\prg_new_protected_conditional:Nnn \xeCJK_family_if_exist:n { T, F, TF } { \cs_if_free:cTF { xeCJK/family/#1 } \prg_return_false: { - \prop_if_in:NxF - \g_xeCJK_family_name_prop {#1} { \use:c { xeCJK/family/#1 } } + \prop_if_in:NxF \g_xeCJK_family_name_prop {#1} { \use:c { xeCJK/family/#1 } } \prg_return_true: } } @@ -1672,6 +1761,7 @@ \tl_new:c { xeCJK_warned_aux_#1 } } } + \tex_ignorespaces:D } \xeCJK_msg_new:nn { CJKfamily-Unknown } { @@ -1694,8 +1784,7 @@ { \tl_set:Nx \l_xeCJK_family_tl { \cs_to_str:N #2 } } { \tl_set:Nx \l_xeCJK_family_tl {#1} } \xeCJK_set_family:nnn \l_xeCJK_family_tl {#3} {#4} - \cs_new_protected_nopar:Npx #2 - { \exp_not:N \CJKfamily { \l_xeCJK_family_tl } } + \cs_new_protected_nopar:Npx #2 { \exp_not:N \CJKfamily { \l_xeCJK_family_tl } } } \int_new:N \g_xeCJK_fontspec_int \int_gdecr:N \g_xeCJK_fontspec_int @@ -1729,8 +1818,7 @@ \clist_if_in:NnT \l_tmpa_clist {##1} { \clist_remove_all:Nn \l_tmpa_clist {##1} - \prop_get:NxNF \g_xeCJK_family_prop - { \xeCJK@family/##1 } \l_tmpb_tl + \prop_get:NxNF \g_xeCJK_family_prop { \xeCJK@family/##1 } \l_tmpb_tl { \prop_get:NxNF \g_xeCJK_family_prop { \CJKfamilydefault/##1 } \l_tmpb_tl @@ -1741,8 +1829,8 @@ \clist_map_break: } } - \prop_get:NVNF \g_xeCJK_family_options_prop \xeCJK@family - \l_tmpb_clist { \clist_clear:N \l_tmpb_clist } + \prop_get:NVNF \g_xeCJK_family_options_prop \xeCJK@family \l_tmpb_clist + { \clist_clear:N \l_tmpb_clist } \clist_clear:N \l_tmpc_clist \clist_map_inline:Nn \l_tmpb_clist { @@ -1759,7 +1847,7 @@ \cs_new_eq:NN \addCJKfontfeature \addCJKfontfeatures \xeCJK_msg_new:nn { addCJKfontfeature-ignored } { - \tl_to_str:N \addCJKfontfeatures (s)~ignored.\\\\ + \tl_to_str:N \addCJKfontfeature (s)~ignored.\\\\ It~cannot~be~used~with~a~font~that~wasn't~selected~by~xeCJK. } \NewDocumentCommand \setCJKmainfont { O{} m } @@ -1798,6 +1886,7 @@ \tl_put_left:Nn \document { \group_end: + \normalfont \prop_if_empty:NTF \g_xeCJK_family_prop { \xeCJK_warning:n { no-CJKfamily } } { @@ -1826,7 +1915,6 @@ } } } - \normalfont } \group_begin: } @@ -1843,16 +1931,15 @@ \@onlypreamble \setCJKmonofont \@onlypreamble \setCJKromanfont \fp_new:N \g_xeCJK_monoscale_fp -\fp_gset_eq:NN \g_xeCJK_monoscale_fp \c_one_fp \dim_new:N \g_xeCJK_exspace_dim \NewDocumentCommand \setCJKmonoscale { } { + \CJKflexiblespacing \xeCJK_set_monoscale: \addCJKfontfeatures { Scale = \fp_use:N \g_xeCJK_monoscale_fp } } \cs_new_nopar:Nn \xeCJK_set_monoscale: { - \dim_gzero:N \g_xeCJK_exspace_dim \group_begin: \fontfamily \ttdefault \selectfont \fp_gset_from_dim:Nn \g_xeCJK_monoscale_fp @@ -1863,46 +1950,47 @@ \NewDocumentCommand \setCJKmonoexspace { } { \xeCJK_set_monoexspace: } \cs_new_nopar:Nn \xeCJK_set_monoexspace: { - \fp_gset_eq:NN \g_xeCJK_monoscale_fp \c_one_fp \group_begin: \fontfamily \ttdefault \selectfont \dim_gset:Nn \g_xeCJK_exspace_dim { \c_two \tex_fontdimen:D \c_two \tex_font:D - \f@size \p@ } \group_end: } -\cs_new_nopar:Nn \xeCJK_fixed_ecglue: { \skip_horizontal:n { .5\g_xeCJK_exspace_dim } } -\cs_new_nopar:Nn \xeCJK_fixed_cjkglue: { \skip_horizontal:N \g_xeCJK_exspace_dim } -\AtEndOfPackage - { - \tl_set_eq:NN \l_xeCJK_flexible_punctstyle_tl \l_xeCJK_punctstyle_tl - \cs_new_eq:NN \xeCJK_flexible_ecglue: \CJKecglue - \cs_new_eq:NN \xeCJK_flexible_cjkglue: \CJKglue - } \NewDocumentCommand \CJKfixedspacing { } { - \tl_if_eq:NNF \l_xeCJK_punctstyle_tl \c_xeCJK_ps_plain_tl + \bool_if:NF \l_xeCJK_fixed_spacing_bool { + \bool_set_true:N \l_xeCJK_fixed_spacing_bool \tl_set_eq:NN \l_xeCJK_flexible_punctstyle_tl \l_xeCJK_punctstyle_tl - \punctstyle { plain } - } - \cs_if_eq:NNF \CJKecglue \xeCJK_fixed_ecglue: - { - \cs_set_eq:NN \xeCJK_flexible_ecglue: \CJKecglue - \cs_set_eq:NN \CJKecglue \xeCJK_fixed_ecglue: - } - \cs_if_eq:NNF \CJKglue \xeCJK_fixed_cjkglue: - { + \bool_set_eq:NN \l_xeCJK_fixed_xecglue_bool \l_xeCJK_xecglue_bool + \cs_set_eq:NN \xeCJK_flexible_ecglue: \CJKecglue \cs_set_eq:NN \xeCJK_flexible_cjkglue: \CJKglue - \cs_set_eq:NN \CJKglue \xeCJK_fixed_cjkglue: + \xeCJK_set_monoexspace: + \xeCJKsetup + { + PunctStyle = plain , + CJKglue = { \skip_horizontal:N \g_xeCJK_exspace_dim } , + CJKecglue = { \skip_horizontal:n { .5\g_xeCJK_exspace_dim } } , + xCJKecglue = false , + } } } -\AtBeginDocument { \tl_put_right:Nn \verbatim@font \CJKfixedspacing } -\NewDocumentCommand \CJKflexiblespacing { m } +\NewDocumentCommand \CJKflexiblespacing { } { - \cs_set_eq:NN \l_xeCJK_punctstyle_tl \l_xeCJK_flexible_punctstyle_tl - \cs_set_eq:NN \CJKecglue \xeCJK_flexible_ecglue: - \cs_set_eq:NN \CJKglue \xeCJK_flexible_cjkglue: + \bool_if:NT \l_xeCJK_fixed_spacing_bool + { + \bool_set_false:N \l_xeCJK_fixed_spacing_bool + \exp_args:Nx \xeCJKsetup + { + PunctStyle = { \l_xeCJK_flexible_punctstyle_tl } , + CJKglue = { \xeCJK_flexible_cjkglue: } , + CJKecglue = { \xeCJK_flexible_ecglue: } , + xCJKecglue = { \bool_if:NTF \l_xeCJK_fixed_xecglue_bool { true } { false } } , + } + } } +\bool_new:N \l_xeCJK_fixed_spacing_bool +\AtBeginDocument { \tl_put_right:Nn \verbatim@font \CJKfixedspacing } \NewDocumentCommand \setCJKmonofont { s t+ O{} m } { \IfBooleanTF {#1} @@ -2133,5 +2221,15 @@ \tl_set:Nn \CJK@hundredmillion { 亿 } } %% +%% This package consists of the file xeCJK.dtx +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.ins, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex and +%% README.txt. %% %% End of file `xeCJK.sty'. |