summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-09-03 22:55:17 +0000
committerKarl Berry <karl@freefriends.org>2012-09-03 22:55:17 +0000
commit8028e80de243e75b6cd0bdc9aec5dbed7c6be192 (patch)
treed22fa403d198e6b8d5feba609a1256f5e04705e3
parent60075902f7b24b4f27df8fa26409d3f206c93957 (diff)
xecjk (3sep12)
git-svn-id: svn://tug.org/texlive/trunk@27583 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex2
-rw-r--r--Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex2
-rw-r--r--Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex2
-rw-r--r--Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex2
-rw-r--r--Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex2
-rw-r--r--Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdfbin687322 -> 671894 bytes
-rw-r--r--Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx566
-rw-r--r--Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins4
-rw-r--r--Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty458
9 files changed, 561 insertions, 477 deletions
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
index ef8a3b62299..e143df4c3de 100644
--- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex
+++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex
@@ -6,7 +6,7 @@
%%
%% xeCJK.dtx (with options: `ex-ecglue')
%%
-%% $Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+%% $Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex
index bf52fd28ead..f32cf8c2def 100644
--- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex
+++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex
@@ -6,7 +6,7 @@
%%
%% xeCJK.dtx (with options: `ex-autofake')
%%
-%% $Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+%% $Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
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
index 0c8766ad1e9..b8b2579198e 100644
--- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex
+++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex
@@ -6,7 +6,7 @@
%%
%% xeCJK.dtx (with options: `ex-single')
%%
-%% $Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+%% $Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex
index 8ddc4ea3790..aed165e070c 100644
--- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex
+++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex
@@ -6,7 +6,7 @@
%%
%% xeCJK.dtx (with options: `ex-fallback')
%%
-%% $Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+%% $Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex
index 4bf68423861..3db4f3541e6 100644
--- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex
+++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex
@@ -6,7 +6,7 @@
%%
%% xeCJK.dtx (with options: `ex-block')
%%
-%% $Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+%% $Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf
index d5d1ec0d0a4..1efe0c01809 100644
--- a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf
+++ b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
index 0dff701f6bc..65241928dad 100644
--- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
+++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
@@ -70,7 +70,7 @@ CJK scripts fonts (TrueType or OpenType).
\askforoverwritefalse
\preamble
-$Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+$Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
$URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
-----------------------------------------------------------------
Author:
@@ -133,18 +133,26 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
%<*driver|package>
\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{expl3}
+\GetIdInfo$Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
+ {package for typesetting CJK scripts with XeLaTeX}
%<*driver>
-\ProvidesFile{xeCJK.dtx}
+\ProvidesExplFile
+ {\ExplFileName.\ExplFileExtension}
+%</driver>
+%<package>\ProvidesExplPackage
+%<package> {\ExplFileName}
+ {\ExplFileDate}{3.0.8}{\ExplFileDescription}
+%<*driver>
+\ExplSyntaxOff
%</driver>
-\RequirePackage{expl3}
%</driver|package>
%
%<*driver>
-\documentclass{l3doc}
+\documentclass[full]{l3doc}
\hypersetup{pdfstartview=FitH}
\usepackage{xeCJK}
\fvset{formatcom=\CJKfixedspacing}
-\usepackage{metalogo}
\linespread{1.1}
\setlist{nosep}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
@@ -159,10 +167,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\setCJKmainfont[Hangul]{Adobe Myungjo Std}
\xeCJKsetup{PunctStyle=kaiming,KaiMingPunct+={:;}}
\def\MacroFont{\small\normalfont\ttfamily\punctstyle{plain}}
+\def\XeTeX{\hologo{XeTeX}}
+\def\XeLaTeX{\hologo{XeLaTeX}}
+\def\LaTeX{\hologo{LaTeX}}
\parindent=2em
\AtBeginDocument{\DeleteShortVerb{\"}\MakeShortVerb{\|}}
\def\contentsname{目录}
-\def\email#1{\href{mailto:#1}{\path{#1}}}
+\DeclareUrlCommand\email{\def\UrlLeft##1\UrlRight{\href{mailto:##1}{##1}}}
\addtolength{\voffset}{-5\baselineskip}
\addtolength\textheight{8\baselineskip}
\makeatletter
@@ -183,22 +194,18 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\markboth{\indexname}{\indexname}
斜体的数字表示对应项说明所在的页码,下划线的数字表示定义所在的代码行号,而直立体的
数字表示对应项使用时所在的行号。}
-%</driver>
-%<*driver|package>
-\GetIdInfo$Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
- {package for typesetting CJK scripts with XeLaTeX}
-%</driver|package>
-%<*driver>
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
-% \GetFileInfo{\jobname.sty}
+% \CheckSum{3061}
+% \DoNotIndex{\T,\F,\C,\J,\K,\O,\U,\Z,\E,\R,\M,\A,\Y,\R,\;,\t,\c,\:,\\,\@}
+% \GetFileInfo{\jobname.dtx}
%
% \title{\bfseries\pkg{xeCJK} 宏包}
-% \author{\texttt{ctex.org}\thanks{\url{http://www.ctex.org}}}
+% \author{\href{http://www.ctex.org}{ctex.org}}
% \date{\filedate\qquad\fileversion}
% \maketitle
%
@@ -220,7 +227,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \pkg{xeCJK} 使用了 \XeTeX 的一些最新特性,需要 \XeTeX{} |0.9995.0 [2009/06/29]| 以
% 后的版本。\pkg{xeCJK} 的依赖 \LaTeX~3 项目的 \pkg{expl3},\pkg{xparse} 和
% \pkg{l3keys2e} 宏包,并依赖 \pkg{fontspec}^^A
-% \footnote{\url{http://mirrors.ctan.org/macros/latex/contrib/fontspec}}
+% \footnote{\url{http://mirrors.ctan.org/macros/latex/contrib/fontspec/}}
% 宏包来调用系统字体。个别兼容性功能需要 \pkg{CJK} 宏包的支持。
%
% \pkg{xeCJK} 的原始作者是孙文昌,2009 年 5 月起宏包被收入
@@ -589,7 +596,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{verbatim}
% \defaultCJKfontfeatures{Scale=0.962216}
% \end{verbatim}
-% 可以将全部 CJK 字体缩小为 |0.962216|。
+% 可以将全部 CJK 字体缩小为 |0.962216|。\pkg{xeCJK} 宏包的初始化设置是
+% \begin{verbatim}
+% \defaultCJKfontfeatures{Script=CJK}
+% \end{verbatim}
% \end{function}
%
% \begin{function}{\addCJKfontfeatures}
@@ -685,7 +695,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% |SimSun| 的备用字体。
% \end{function}
%
-% \subsubsection{\texorpdfstring{\XeTeX}{XeTeX} 的字体名查找}
+% \subsubsection{\XeTeX 的字体名查找}
% \label{subsubsec:fontsearch}
%
% 由于在 \pkg{fontspec} 宏包文档中缺少关于如何查看 \XeTeX{} 可用字体名的说明,
@@ -768,7 +778,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{function}[EXP]{\xeCJKDeclareSubCJKBlock}
% \begin{syntax}
-% \cs{xeCJKDeclareSubCJKBlock} \Arg{block} \Arg{block range}
+% \cs{xeCJKDeclareSubCJKBlock} \Arg{block} \Arg{block range}
+% \cs{xeCJKDeclareSubCJKBlock*} \Arg{block} \Arg{block range}
% \end{syntax}
% 其中 \meta{block range} 是逗号列表,可以是 CJK 字符的 |Unicode| 范围,也可以是单个字符
% 的 |Unicode|。例如
@@ -798,39 +809,43 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% |\xeCJKDeclareSubCJKBlock| 应该在声明所有的 CJK 字体族之前使用。如果有某个 CJK 字
% 体族没有设置 \meta{block} 选项,将使用 |\CJKfamilydefault| 的 \meta{block} 选项
% 作为该 CJK 字体族的 \meta{block} 选项。如果希望在使用某 CJK 字体族时,不在 CJK 主
-% 分区与 \meta{block} 之间切换字体,可以使用 \meta{block}|=*| 选项。
+% 分区与 \meta{block} 之间切换字体,可以使用 \meta{block}|=*| 选项。带星号的命令除了
+% 设置 CJK 子分区以外,还重置标点符号所属的字符类。
%
% \begin{function}{\xeCJKCancelSubCJKBlock}
% \begin{syntax}
-% \cs{xeCJKCancelSubCJKBlock} \Arg{block1,block2,...}
+% \cs{xeCJKCancelSubCJKBlock} \Arg{block1,block2,...}
+% \cs{xeCJKCancelSubCJKBlock*} \Arg{block1,block2,...}
% \end{syntax}
-% 在文档中取消对 |CJK| 分区的声明。
+% 在文档中取消对 |CJK| 分区的声明。带星号的命令还重置标点符号所属的字符类。
% \end{function}
%
% \begin{function}{\xeCJKRestoreSubCJKBlock}
% \begin{syntax}
-% \cs{xeCJKRestoreSubCJKBlock} \Arg{block1,block2,...}
+% \cs{xeCJKRestoreSubCJKBlock} \Arg{block1,block2,...}
+% \cs{xeCJKRestoreSubCJKBlock*} \Arg{block1,block2,...}
% \end{syntax}
-% 在文档中恢复对 |CJK| 分区的声明。
+% 在文档中恢复对 |CJK| 分区的声明。带星号的命令还重置标点符号所属的字符类。
% \end{function}
%
% \subsection{设置 CJK 字符范围}
%
% \begin{function}[EXP]{\xeCJKDeclareCharClass}
% \begin{syntax}
-% \cs{xeCJKDeclareCharClass} \Arg{class} \Arg{class range}
+% \cs{xeCJKDeclareCharClass} \Arg{class} \Arg{class range}
+% \cs{xeCJKDeclareCharClass*} \Arg{class} \Arg{class range}
% \end{syntax}
% \meta{class range} 的格式和 \ref{subsec:block} 节的 \meta{block range} 相同。
% \meta{class} 的有效值见源代码(第 \ref{sec:xeCJK-class-set} 节)。\pkg{xeCJK} 已
-% 经支持 |Unicode| 中所有 CJK 文字和标点。一般来说,不要轻易改变字符类别。
+% 经支持 |Unicode| 中所有 CJK 文字和标点。一般来说,不要轻易改变字符类别。带星号的
+% 命令除了设置字符类别以外,为了确保标点处理的正确性,还重置标点符号所属的字符类。
% \end{function}
%
% \begin{function}[EXP]{\xeCJKResetPunctClass}
% \begin{syntax}
% \cs{xeCJKResetPunctClass}
% \end{syntax}
-% 用于重置标点符号所属的字符类。使用 |\xeCJKDeclareCharClass| 更改字符类别之后,为
-% 了确保标点处理的正确性,应该在它之后使用 |\xeCJKResetPunctClass|。
+% 用于重置标点符号所属的字符类。
% \end{function}
%
% \begin{function}{\normalspacedchars}
@@ -883,6 +898,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%\end{documentation}
%
%
+% \StopEventually{}
+%
+%
%\begin{implementation}
%
% \section{\pkg{xeCJK} 代码实现}
@@ -891,10 +909,6 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%<*package>
% \end{macrocode}
%
-% \begin{macrocode}
-\ProvidesExplPackage{\ExplFileName}{\ExplFileDate}{3.0.7}{\ExplFileDescription}
-% \end{macrocode}
-%
% \subsection{运行环境检查}
%
% \pkg{xeCJK} 必须使用 \XeTeX 引擎的支持。
@@ -976,6 +990,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[internal]{\xeCJK_no_break:}
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \xeCJK_no_break: { \tex_penalty:D \c_ten_thousand }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}[internal]
% {\xeCJK_AtEndPreamble:n,\xeCJK_AfterPreamble:n,\xeCJK_AfterEndPreamble:n}
% 在 |\document| 前后加上各种钩子。
@@ -983,11 +1003,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\tl_new:N \g_xeCJK_at_end_preamble_hook
\tl_new:N \g_xeCJK_after_preamble_hook
\tl_new:N \g_xeCJK_after_end_preamble_hook
-\cs_new:Nn \xeCJK_AtEndPreamble:n
+\cs_new_protected:Npn \xeCJK_AtEndPreamble:n #1
{ \tl_gput_right:Nn \g_xeCJK_at_end_preamble_hook {#1} }
-\cs_new:Nn \xeCJK_AfterPreamble:n
+\cs_new_protected:Npn \xeCJK_AfterPreamble:n #1
{ \tl_gput_right:Nn \g_xeCJK_after_preamble_hook {#1} }
-\cs_new:Nn \xeCJK_AfterEndPreamble:n
+\cs_new_protected:Npn \xeCJK_AfterEndPreamble:n #1
{ \tl_gput_right:Nn \g_xeCJK_after_end_preamble_hook {#1} }
\AtBeginDocument { \g_xeCJK_after_preamble_hook }
\tl_put_left:Nn \document { \group_end: \g_xeCJK_at_end_preamble_hook \group_begin: }
@@ -1008,7 +1028,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\tl_to_lowercase:n
{
\group_end:
- \prg_new_conditional:Nnn \xeCJK_if_outer_macro:c { p , T , F , TF }
+ \prg_new_conditional:Npnn \xeCJK_if_outer_macro:c #1 { p , T , F , TF }
{
\exp_last_unbraced:Nf \xeCJK_if_outer_macro_aux:w
{ \cs_meaning:c {#1} } OUZER ~ MAYRO ; \q_stop
@@ -1027,22 +1047,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macro}
%
% \begin{macro}[TF,internal]{\xeCJK_peek_catcode_ignore_spaces:N}
-% 对 \pkg{l3token} 打的补丁,使 |\xeCJK_peek_catcode_ignore_spaces:NTF| 可用于 |\outer| 宏。
+% 对 \pkg{l3token} 打的补丁,使 \cs{xeCJK_peek_catcode_ignore_spaces:NTF} 可
+% 用于 \cs{outer} 宏。
% \begin{macrocode}
\token_new:Nn \l_xeCJK_peek_search_token { ? }
\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NTF #1#2#3
{
\cs_set_eq:NN \l_xeCJK_peek_search_token #1
- \cs_set:Npx \xeCJK_peek_true:w
- {
- \exp_not:N \group_align_safe_end:
- \exp_not:n {#2}
- }
- \cs_set:Npx \xeCJK_peek_false:w
- {
- \exp_not:N \group_align_safe_end:
- \exp_not:n {#3}
- }
+ \tl_set:Nn \xeCJK_peek_true:w { \group_align_safe_end: #2 }
+ \tl_set:Nn \xeCJK_peek_false:w { \group_align_safe_end: #3 }
\group_align_safe_begin:
\peek_after:Nw \xeCJK_peek_ignore_spaces_execute_branches:
}
@@ -1050,7 +1063,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \xeCJK_peek_catcode_ignore_spaces:NTF #1 {#2} { } }
\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NF #1#2
{ \xeCJK_peek_catcode_ignore_spaces:NTF #1 { } {#2} }
-\cs_new_nopar:Nn \xeCJK_peek_ignore_spaces_execute_branches:
+\cs_new_nopar:Npn \xeCJK_peek_ignore_spaces_execute_branches:
{
\if_meaning:w \l_peek_token \c_space_token
\tex_afterassignment:D \xeCJK_peek_ignore_spaces_execute_branches_aux:
@@ -1059,9 +1072,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\exp_after:wN \xeCJK_peek_execute_branches_catcode:
\fi:
}
-\cs_new_protected_nopar:Nn \xeCJK_peek_ignore_spaces_execute_branches_aux:
+\cs_new_protected_nopar:Npn \xeCJK_peek_ignore_spaces_execute_branches_aux:
{ \peek_after:Nw \xeCJK_peek_ignore_spaces_execute_branches: }
-\cs_new_nopar:Nn \xeCJK_peek_execute_branches_catcode:
+\cs_new_nopar:Npn \xeCJK_peek_execute_branches_catcode:
{
\if_catcode:w \exp_not:N \l_peek_token \exp_not:N \l_xeCJK_peek_search_token
\exp_after:wN \xeCJK_peek_true:w
@@ -1072,10 +1085,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[pTF,internal]{\xeCJK_tl_if_blank:x}
+% \begin{macro}[pTF,internal]{\xeCJK_if_blank_x:n}
% 判断是否为空或者仅含一个空格。
% \begin{macrocode}
-\prg_new_conditional:Nnn \xeCJK_tl_if_blank:x { p , T , F , TF }
+\prg_new_conditional:Npnn \xeCJK_if_blank_x:n #1 { p , T , F , TF }
{
\if_int_compare:w \pdftex_strcmp:D { \c_empty_tl } {#1} = \c_zero
\prg_return_true:
@@ -1087,6 +1100,18 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[pTF,internal]{\xeCJK_if_package_loaded:n}
+% 判断宏包是否载入,可用于文档中。
+% \begin{macrocode}
+\prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF }
+ {
+ \tl_if_exist:cTF { ver@ #1 . \c_xeCJK_pkg_extension_tl }
+ { \prg_return_true: } { \prg_return_false: }
+ }
+\tl_const:Nx \c_xeCJK_pkg_extension_tl { \@pkgextension }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}[internal]
% {\xeCJK_msg_new:nn ,\xeCJK_error:n,\xeCJK_error:nx,
% \xeCJK_warning:nx,\xeCJK_info:nx,\xeCJK_info:nxx}
@@ -1166,7 +1191,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_new_class:n,\g_xeCJK_class_seq}
% 新建一个字符类别。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_new_class:n
+\cs_new_protected_nopar:Npn \xeCJK_new_class:n #1
{
\exp_args:Nc \newXeTeXintercharclass { xeCJK_#1_class }
\clist_gclear_new:c { g_xeCJK_#1_range_clist }
@@ -1198,41 +1223,46 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \clist_gclear_new:c { g_xeCJK_#1_range_clist } }
\clist_new:N \g_xeCJK_CJK_class_clist
\prop_new:N \g_xeCJK_CJK_class_prop
-\cs_new_nopar:Nn \xeCJK_save_CJK_class:n
+\cs_new_protected_nopar:Npn \xeCJK_save_CJK_class:n #1
{
\clist_gput_right:Nx \g_xeCJK_CJK_class_clist {#1}
\prop_gput:Nvx \g_xeCJK_CJK_class_prop { xeCJK_#1_class } {#1}
}
\cs_generate_variant:Nn \prop_gput:Nnn { Nvx }
-\clist_map_inline:nn { CJK, FullLeft, FullRight } { \xeCJK_save_CJK_class:n {#1} }
+\clist_map_function:nN { CJK, FullLeft, FullRight } \xeCJK_save_CJK_class:n
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_class_num:n}
% |#1| 为字符类别名称,用于取得字符类别对应的编号。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_class_num:n { \tl_use:c { xeCJK_#1_class } }
+\cs_new_nopar:Npn \xeCJK_class_num:n #1 { \tl_use:c { xeCJK_#1_class } }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xeCJKDeclareCharClass}
-% \begin{macro}[aux]{\xeCJK_setcharclass_aux:Nn}
+% \begin{macro}[aux]{\xeCJK_set_char_class_aux:Nn}
% 用于设置字符所属的类别,|#1| 为类别名称,|#2| 为字符的 |Unicode|,相邻字符用
% 半角逗号隔开,支持类似 |"1100 -> "11FF| 起止范围的使用方式。
% \begin{macrocode}
-\NewDocumentCommand \xeCJKDeclareCharClass { > { \TrimSpaces } m m }
+\NewDocumentCommand \xeCJKDeclareCharClass { s > { \TrimSpaces } m m }
+ {
+ \xeCJK_declare_char_class:nn {#2} {#3}
+ \IfBooleanT {#1} { \xeCJKResetPunctClass }
+ }
+\cs_new_protected_nopar:Npn \xeCJK_declare_char_class:nn #1#2
{
\clist_gput_right:cx { g_xeCJK_#1_range_clist } {#2}
\clist_map_inline:xn {#2}
{
\str_if_eq_x:nnF {##1} { -> }
{
- \xeCJK_setcharclass_aux:Nn \xeCJKsetcharclass {##1}
+ \xeCJK_set_char_class_aux:Nn \xeCJK_set_char_class:nnn {##1}
{ \xeCJK_class_num:n {#1} }
}
}
}
-\NewDocumentCommand \xeCJK_setcharclass_aux:Nn
+\NewDocumentCommand \xeCJK_set_char_class_aux:Nn
{ m > { \SplitArgument { 1 } { -> } } m } { #1 #2 }
\cs_generate_variant:Nn \clist_map_inline:nn { x }
% \end{macrocode}
@@ -1242,15 +1272,18 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJKsetcharclass}
% |#1| 和 |#2| 为字符类别起止的 |Unicode|,|#3| 为类别名称对应编号。
% \begin{macrocode}
-\NewDocumentCommand \xeCJKsetcharclass { m m m }
+\NewDocumentCommand \xeCJKsetcharclass { s m m m }
+ {
+ \xeCJK_set_char_class:nnn {#2} {#3} {#4}
+ \IfBooleanF {#1} { \xeCJKResetPunctClass }
+ }
+\cs_new_protected_nopar:Npn \xeCJK_set_char_class:nnn #1#2#3
{
\xeCJK_check_num_range:nnNN {#1} {#2} \l_xeCJK_tmpa_int \l_xeCJK_tmpb_int
\int_set:Nn \l_xeCJK_tmpc_int {#3}
\prop_if_in:NVTF \g_xeCJK_CJK_class_prop \l_xeCJK_tmpc_int
- { \cs_set_eq:NN \xeCJK_set_catcode:n \char_set_catcode_other:n }
- { \cs_set_eq:NN \xeCJK_set_catcode:n \use_none:n }
- \loop
- \xeCJK_set_catcode:n \l_xeCJK_tmpa_int
+ { \loop \char_set_catcode_other:n \l_xeCJK_tmpa_int }
+ { \loop }
\XeTeXcharclass \l_xeCJK_tmpa_int = \l_xeCJK_tmpc_int
\if_int_compare:w \l_xeCJK_tmpa_int < \l_xeCJK_tmpb_int
\int_incr:N \l_xeCJK_tmpa_int
@@ -1261,11 +1294,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_check_num_range:nnNN}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_check_num_range:nnNN
+\cs_new_protected_nopar:Npn \xeCJK_check_num_range:nnNN #1#2#3#4
{
- \bool_if:nTF { \xeCJK_tl_if_blank_p:x {#1} || \xeCJK_tl_if_blank_p:x {#2} }
+ \bool_if:nTF { \xeCJK_if_blank_x_p:n {#1} || \xeCJK_if_blank_x_p:n {#2} }
{
- \int_set:Nn #3 { \xeCJK_tl_if_blank:xTF {#1} {#2} {#1} }
+ \int_set:Nn #3 { \xeCJK_if_blank_x:nTF {#1} {#2} {#1} }
\int_set_eq:NN #3 #4
}
{
@@ -1281,18 +1314,18 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macrocode}
\NewDocumentCommand \xeCJKResetPunctClass { }
{
- \xeCJKDeclareCharClass { HalfLeft }
+ \xeCJK_declare_char_class:nn { HalfLeft }
{ "28 , "2D , "5B , "60 , "7B }
- \xeCJKDeclareCharClass { HalfRight }
+ \xeCJK_declare_char_class:nn { HalfRight }
{ "21 , "22 , "25 , "27 , "29 , "2C , "2E , "3A , "3B , "3F , "5D , "7D , }
- \xeCJKDeclareCharClass { FullLeft }
+ \xeCJK_declare_char_class:nn { FullLeft }
{
"2018 , "201C , "2116 , "3008 , "300A , "300C , "300E , "3010 , "3012 ,
"3014 , "3016 , "3018 , "301A , "301D , "3036 , "E76C , "FE59 , "FE5B ,
"FE5D , "FE5F , "FE60 , "FE69 , "FE6B , "FF03 , "FF04 , "FF08 , "FF20 ,
"FF3B , "FF5B , "FFE0 , "FFE1 , "FFE5 , "FFE6 ,
}
- \xeCJKDeclareCharClass { FullRight }
+ \xeCJK_declare_char_class:nn { FullRight }
{
"00B7 , "2019 , "201D , "2014 , "2025 , "2026 , "2030 , "2500 , "3001 ,
"3002 , "3005 , "3006 , "3009 , "300B , "300D , "300F , "3011 , "3015 ,
@@ -1311,7 +1344,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \hypertarget{CJKcharclass}{设置 CJK 文字的范围}。
% \begin{macrocode}
-\xeCJKDeclareCharClass { CJK }
+\xeCJK_declare_char_class:nn { CJK }
{
% \end{macrocode}
% \begin{itemize}
@@ -1461,39 +1494,39 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\xeCJK_inter_class_toks:nnn,\xeCJK_inter_class_toks:nnc}
+% \begin{macro}[internal]
+% {\xeCJK_inter_class_toks:nnn,\xeCJK_inter_class_toks:nnc,\xeCJK_inter_class_toks:nnx}
% 在相邻类别之间插入内容。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_inter_class_toks:nnn
+\cs_new_protected_nopar:Npn \xeCJK_inter_class_toks:nnn #1#2#3
{ \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} = {#3} }
-\cs_generate_variant:Nn \xeCJK_inter_class_toks:nnn { nnc }
+\cs_generate_variant:Nn \xeCJK_inter_class_toks:nnn { nnc , nnx }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\xeCJK_get_inter_class_toks:nn}
+% 取出相邻类别之间的内容。
+% \begin{macrocode}
+\cs_new_nopar:Npn \xeCJK_get_inter_class_toks:nn #1#2
+ { \tex_the:D \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_clear_inter_class_toks:nn}
% 清除相邻类别之间的内容。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_clear_inter_class_toks:nn
- {
- \XeTeXinterchartoks
- \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} = { \c_empty_tl }
- }
+\cs_new_protected_nopar:Npn \xeCJK_clear_inter_class_toks:nn #1#2
+ { \xeCJK_inter_class_toks:nnn {#1} {#2} { \c_empty_tl } }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_pre_inter_class_toks:nnn}
% 在相邻类别之间已有的内容前增加内容。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_pre_inter_class_toks:nnn
+\cs_new_protected_nopar:Npn \xeCJK_pre_inter_class_toks:nnn #1#2#3
{
- \use:x
- {
- \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} =
- {
- \exp_not:n {#3} \tex_the:D \XeTeXinterchartoks
- \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2}
- }
- }
+ \xeCJK_inter_class_toks:nnx {#1} {#2}
+ { \exp_not:n {#3} \xeCJK_get_inter_class_toks:nn {#1} {#2} }
}
% \end{macrocode}
% \end{macro}
@@ -1501,39 +1534,22 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_app_inter_class_toks:nnn,\xeCJK_app_inter_class_toks:nnc}
% 在相邻类别之间已有的内容后追加内容。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_app_inter_class_toks:nnn
+\cs_new_protected_nopar:Npn \xeCJK_app_inter_class_toks:nnn #1#2#3
{
- \use:x
- {
- \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} =
- {
- \tex_the:D \XeTeXinterchartoks \xeCJK_class_num:n {#1}
- \xeCJK_class_num:n {#2} \exp_not:n {#3}
- }
- }
+ \xeCJK_inter_class_toks:nnx {#1} {#2}
+ { \xeCJK_get_inter_class_toks:nn {#1} {#2} \exp_not:n {#3} }
}
\cs_generate_variant:Nn \xeCJK_app_inter_class_toks:nnn { nnc }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\xeCJK_get_inter_class_toks:nn}
-% 取出相邻类别之间的内容。
-% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_get_inter_class_toks:nn
- { \tex_the:D \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} }
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}[internal]{\xeCJK_copy_inter_class_toks:nnnn}
% 将 |#3| 和 |#4| 之间的内容复制到 |#1| 和 |#2| 之间。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_copy_inter_class_toks:nnnn
+\cs_new_protected_nopar:Npn \xeCJK_copy_inter_class_toks:nnnn #1#2#3#4
{
- \use:x
- {
- \xeCJK_inter_class_toks:nnn {#1} {#2}
- { \xeCJK_get_inter_class_toks:nn {#3} {#4} }
- }
+ \xeCJK_inter_class_toks:nnx {#1} {#2}
+ { \xeCJK_get_inter_class_toks:nn {#3} {#4} }
}
% \end{macrocode}
% \end{macro}
@@ -1541,7 +1557,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_clear_CJK_toks:}
% 清除边界与 CJK 文字、全角左右标点之间的内容。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_clear_CJK_toks:
+\cs_new_protected_nopar:Npn \xeCJK_clear_CJK_toks:
{
\clist_map_inline:Nn \g_xeCJK_CJK_class_clist
{ \xeCJK_clear_inter_class_toks:nn { Boundary } {##1} }
@@ -1697,7 +1713,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_Boundary_and_CJK:,\xeCJK_check_for_glue:}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_Boundary_and_CJK:
+\cs_new_protected_nopar:Npn \xeCJK_Boundary_and_CJK:
{
{ \xeCJK_check_for_glue: }
\c_group_begin_token
@@ -1705,7 +1721,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\xeCJK_select_font:
\CJKsymbol
}
-\cs_new_nopar:Nn \xeCJK_check_for_glue:
+\cs_new_protected_nopar:Npn \xeCJK_check_for_glue:
{
\bool_if:nTF
{ \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK_space } }
@@ -1775,7 +1791,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_CJK_and_CJK:N}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_CJK_and_CJK:N { \CJKglue \CJKsymbol {#1} }
+\cs_new_protected_nopar:Npn \xeCJK_CJK_and_CJK:N #1 { \CJKglue \CJKsymbol {#1} }
% \end{macrocode}
% \end{macro}
%
@@ -1801,7 +1817,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\bool_if:nF
{ \str_if_eq_x_p:nn {#1} { FullLeft } || \str_if_eq_x_p:nn {#1} { FullRight } }
{
- \xeCJK_pre_inter_class_toks:nnn { FullLeft } {#1} { \nobreak }
+ \xeCJK_pre_inter_class_toks:nnn { FullLeft } {#1} { \xeCJK_no_break: }
\xeCJK_pre_inter_class_toks:nnn { FullRight } {#1} { \xeCJK_after_FullRight: }
}
}
@@ -1819,7 +1835,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_punct_rule:n}
% 用于抹去标点符号的左/右空白。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_punct_rule:n
+\cs_new_protected_nopar:Npn \xeCJK_punct_rule:n #1
{
\tex_vrule:D
\@width \dim_eval:c { \l_xeCJK_punct_coor_tl/rule/#1 }
@@ -1832,7 +1848,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_punct_glue:n}
% 根据所选的标点处理方式在标点符号左/右增加的空白。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_punct_glue:n
+\cs_new_protected_nopar:Npn \xeCJK_punct_glue:n #1
{
\skip_horizontal:n
{
@@ -1847,7 +1863,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_punct_kern:n}
% 相邻两个标点之间的间距。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_punct_kern:n
+\cs_new_protected_nopar:Npn \xeCJK_punct_kern:n #1
{ \tex_kern:D \dim_eval:c { \l_xeCJK_punct_coor_tl/kern/#1 } }
% \end{macrocode}
% \end{macro}
@@ -1860,7 +1876,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_before_FullLeft:N}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_before_FullLeft:N
+\cs_new_protected_nopar:Npn \xeCJK_before_FullLeft:N #1
{
\tl_set:Nx \l_xeCJK_lastpunct_tl {#1}
\xeCJK_punct_rule:n { l/#1 }
@@ -1871,7 +1887,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_after_FullRight:}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_after_FullRight:
+\cs_new_protected_nopar:Npn \xeCJK_after_FullRight:
{
\xeCJK_get_punct_bounds:nV { r } \l_xeCJK_lastpunct_tl
\xeCJK_punct_rule:n { r/\l_xeCJK_lastpunct_tl }
@@ -1882,7 +1898,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_CJK_and_FullLeft:N}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_CJK_and_FullLeft:N
+\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullLeft:N #1
{
\xeCJK_get_punct_bounds:nN { l } {#1}
\int_compare:nNnF \etex_lastnodetype:D = \c_one
@@ -1899,12 +1915,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_CJK_and_FullRight:N}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_CJK_and_FullRight:N
+\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullRight:N #1
{
\xeCJK_get_punct_bounds:nN { r } {#1}
\xeCJK_punct_if_long:NTF {#1} \CJKglue
{
- \nobreak
+ \xeCJK_no_break:
\xeCJK_punct_if_middle:NT {#1}
{
\xeCJK_punct_glue:n { r/#1 }
@@ -1919,9 +1935,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_FullLeft_and_FullLeft:N}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_FullLeft_and_FullLeft:N
+\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullLeft:N #1
{
- \nobreak
+ \xeCJK_no_break:
\xeCJK_get_punct_bounds:nN { l } {#1}
\xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
\xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
@@ -1932,13 +1948,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_FullLeft_and_FullRight:N}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_FullLeft_and_FullRight:N
+\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullRight:N #1
{
- \nobreak
+ \xeCJK_no_break:
\xeCJK_get_punct_bounds:nN { r } {#1}
\xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
\xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
- \nobreak
+ \xeCJK_no_break:
\tl_set:Nx \l_xeCJK_lastpunct_tl {#1}
\CJKpunctsymbol {#1}
}
@@ -1947,7 +1963,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_FullRight_and_FullLeft:N}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_FullRight_and_FullLeft:N
+\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullLeft:N #1
{
\xeCJK_punct_rule:n { r/\l_xeCJK_lastpunct_tl }
\xeCJK_get_punct_bounds:nN { l } {#1}
@@ -1961,13 +1977,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_FullRight_and_FullRight:N}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_FullRight_and_FullRight:N
+\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullRight:N #1
{
\xeCJK_punct_rule:n { r/\l_xeCJK_lastpunct_tl }
\xeCJK_get_punct_bounds:nN { r } {#1}
\xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
\xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
- \nobreak
+ \xeCJK_no_break:
\tl_set:Nx \l_xeCJK_lastpunct_tl {#1}
\CJKpunctsymbol {#1}
}
@@ -1976,7 +1992,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[pTF,internal]{\xeCJK_if_last_node:n}
% \begin{macrocode}
- \prg_new_conditional:Nnn \xeCJK_if_last_node:n { p , T , F , TF }
+ \prg_new_conditional:Npnn \xeCJK_if_last_node:n #1 { p , T , F , TF }
{
\if_dim:w \dim_use:c { c_xeCJK_#1_node_dim } = \tex_lastkern:D
\prg_return_true: \else: \prg_return_false: \fi:
@@ -1987,13 +2003,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_def_node:nn,\xeCJK_make_node:n}
% 用于判断插入的各种 |kern|。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_def_node:nn
+\cs_new_protected_nopar:Npn \xeCJK_def_node:nn #1#2
{
\dim_if_exist:cTF { c_xeCJK_#1_node_dim }
{ \dim_gset:cn } { \dim_const:cn }
{ c_xeCJK_#1_node_dim } {#2}
}
-\cs_new_protected_nopar:Nn \xeCJK_make_node:n
+\cs_new_protected_nopar:Npn \xeCJK_make_node:n #1
{
\tex_kern:D - \dim_use:c { c_xeCJK_#1_node_dim }
\tex_kern:D \dim_use:c { c_xeCJK_#1_node_dim }
@@ -2081,7 +2097,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_ignore_spaces:,\xeCJK_peek_math:}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_ignore_spaces:
+\cs_new_protected_nopar:Npn \xeCJK_ignore_spaces:
{
\peek_catcode:NTF \c_space_token
{
@@ -2106,7 +2122,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
}
}
}
-\cs_new_nopar:Nn \xeCJK_peek_math:
+\cs_new_protected_nopar:Npn \xeCJK_peek_math:
{
\peek_catcode:NTF \c_space_token
{
@@ -2168,7 +2184,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_checksingle:N,\xeCJK_checksingle:NN,\xeCJK_checksingle:NNN}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_checksingle:N
+\cs_new_protected_nopar:Npn \xeCJK_checksingle:N #1
{
\peek_catcode:NTF \c_catcode_other_token
{ \xeCJK_checksingle:NN {#1} }
@@ -2176,15 +2192,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\bool_if:nTF
{
! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) &&
- \tl_if_empty_p:x { \token_get_arg_spec:c { l_peek_token } } &&
+ \xeCJK_if_blank_x_p:n { \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 }
+ \exp_args:NNc \exp_after:wN \token_if_other_p:N { l_peek_token }
}
{ \xeCJK_checksingle:NN {#1} }
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} }
}
}
-\cs_new_nopar:Nn \xeCJK_checksingle:NN
+\cs_new_protected_nopar:Npn \xeCJK_checksingle:NN #1#2
{
\peek_catcode:NTF \c_catcode_other_token
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 }
@@ -2217,14 +2233,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 }
}
}
-\cs_new_nopar:Nn \xeCJK_checksingle:NNN
+\cs_new_protected_nopar:Npn \xeCJK_checksingle:NNN #1#2#3
{
\bool_if:nTF
{
\token_if_eq_meaning_p:NN \l_peek_token \par ||
\token_if_eq_meaning_p:NN \l_peek_token \[ % \]
}
- { \CJKsymbol {#1} \nobreak #2 }
+ { \CJKsymbol {#1} \xeCJK_no_break: #2 }
{ \xeCJK_checksingle_env:NNN {#1} {#2} {#3} }
}
% \end{macrocode}
@@ -2232,12 +2248,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_checksingle_env:NNN,\xeCJK_checksingle_env:NNNNn}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_checksingle_env:NNN
+\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNN #1#2#3
{
\peek_catcode_remove:NTF \c_math_toggle_token
{
\peek_catcode:NTF \c_math_toggle_token
- { \CJKsymbol {#1} \nobreak #2 \c_math_toggle_token }
+ { \CJKsymbol {#1} \xeCJK_no_break: #2 \c_math_toggle_token }
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 \c_math_toggle_token }
}
{
@@ -2250,11 +2266,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
}
}
}
-\cs_new_nopar:Nn \xeCJK_checksingle_env:NNNNn
+\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNNNn #1#2#3#4#5
{
\clist_if_in:NnTF \g_xeCJK_inline_env_clist {#5}
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 }
- { \CJKsymbol {#1} \nobreak #2 }
+ { \CJKsymbol {#1} \xeCJK_no_break: #2 }
\scan_stop: #4 {#5}
}
% \end{macrocode}
@@ -2298,12 +2314,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_erase_CJKsymbol:, \xeCJK_restore_CJKsymbol:}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_erase_CJKsymbol:
+\cs_new_protected_nopar:Npn \xeCJK_erase_CJKsymbol:
{
\cs_gset_eq:NN \CJKsymbol_Block \CJKsymbol
\cs_gset_eq:NN \CJKsymbol \prg_do_nothing:
}
-\cs_new_nopar:Nn \xeCJK_restore_CJKsymbol:
+\cs_new_protected_nopar:Npn \xeCJK_restore_CJKsymbol:
{
\cs_gset_eq:NN \CJKsymbol \CJKsymbol_Block
\CJKsymbol
@@ -2314,8 +2330,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}{\xeCJKDeclareSubCJKBlock}
% 声明 CJK 子区范围,|#1| 为自定义名称,|#2| 为子区的 |Unicode| 范围。
% \begin{macrocode}
-\NewDocumentCommand \xeCJKDeclareSubCJKBlock { m m }
- { \xeCJKDeclareSubCharClass { CJK } {#1} {#2} }
+\NewDocumentCommand \xeCJKDeclareSubCJKBlock { s m m }
+ {
+ \xeCJKDeclareSubCharClass { CJK } {#2} {#3}
+ \IfBooleanT {#1} { \xeCJKResetPunctClass }
+ }
\@onlypreamble \xeCJKDeclareSubCJKBlock
% \end{macrocode}
% \end{macro}
@@ -2324,30 +2343,32 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 取消和恢复对 CJK 子区的声明。
% \begin{macrocode}
\bool_new:N \l_xeCJK_sub_cancel_bool
-\NewDocumentCommand \xeCJKCancelSubCJKBlock { m }
+\NewDocumentCommand \xeCJKCancelSubCJKBlock { s m }
{
\bool_if:NF \l_xeCJK_sub_cancel_bool
{
\bool_set_true:N \l_xeCJK_sub_cancel_bool
- \xeCJK_sub_restore_or_cancel:n {#1}
+ \xeCJK_sub_restore_or_cancel:n {#2}
+ \IfBooleanT {#1} { \xeCJKResetPunctClass }
}
}
-\NewDocumentCommand \xeCJKRestoreSubCJKBlock { m }
+\NewDocumentCommand \xeCJKRestoreSubCJKBlock { s m }
{
\bool_if:NT \l_xeCJK_sub_cancel_bool
{
\bool_set_false:N \l_xeCJK_sub_cancel_bool
- \xeCJK_sub_restore_or_cancel:n {#1}
+ \xeCJK_sub_restore_or_cancel:n {#2}
+ \IfBooleanT {#1} { \xeCJKResetPunctClass }
}
}
-\cs_new_nopar:Nn \xeCJK_sub_restore_or_cancel:n
+\cs_new_protected_nopar:Npn \xeCJK_sub_restore_or_cancel:n #1
{
\clist_map_inline:xn {#1}
{
\cs_if_free:cTF { xeCJK_ CJK/##1 _class }
{ \xeCJK_error:nx { SubBlock-undefined } {##1} }
{
- \xeCJKDeclareCharClass
+ \xeCJK_declare_char_class:nn
{ CJK \bool_if:NF \l_xeCJK_sub_cancel_bool { /##1 } }
{ \tl_use:c { g_xeCJK_CJK/##1_range_clist } }
}
@@ -2374,7 +2395,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\xeCJK_new_sub_key:n {#2}
\xeCJK_UL_subclass_patch:nn {#1} {#2}
}
- \xeCJKDeclareCharClass { #1/#2 } {#3}
+ \xeCJK_declare_char_class:nn { #1/#2 } {#3}
}
\@onlypreamble \xeCJKDeclareSubCharClass
% \end{macrocode}
@@ -2382,7 +2403,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_set_sub_class_toks:nn}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_set_sub_class_toks:nn
+\cs_new_protected_nopar:Npn \xeCJK_set_sub_class_toks:nn #1#2
{
\clist_map_inline:Nn \g_xeCJK_base_class_clist
{
@@ -2426,7 +2447,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_UL_subclass_patch:nn}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_UL_subclass_patch:nn
+\cs_new_protected_nopar:Npn \xeCJK_UL_subclass_patch:nn #1#2
{
\tl_put_right:Nn \xeCJK_UL_subclass_patch_tl
{
@@ -2527,8 +2548,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\NewDocumentCommand \xeCJKallowbreakbetweenpuncts { }
{ \cs_set_eq:NN \xeCJK_punct_nobreak: \xeCJK_zero_glue: }
\NewDocumentCommand \xeCJKnobreakbetweenpuncts { }
- { \cs_set_eq:NN \xeCJK_punct_nobreak: \nobreak }
-\cs_new_protected_nopar:Nn \xeCJK_zero_glue: { \skip_horizontal:N \c_zero_skip }
+ { \cs_set_eq:NN \xeCJK_punct_nobreak: \xeCJK_no_break: }
+\cs_new_protected_nopar:Npn \xeCJK_zero_glue: { \skip_horizontal:N \c_zero_skip }
% \end{macrocode}
% \end{macro}
%
@@ -2542,20 +2563,20 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\tl_new:c { l_xeCJK_#1_punct_tl }
\prop_new:c { l_xeCJK_#1_punct_prop }
}
-\cs_new_nopar:Nn \xeCJK_set_special_punct:nn
+\cs_new_protected_nopar:Npn \xeCJK_set_special_punct:nn #1#2
{
\tl_set:cx { l_xeCJK_#1_punct_tl } {#2}
\prop_clear:c { l_xeCJK_#1_punct_prop }
\tl_map_inline:cn { l_xeCJK_#1_punct_tl }
{ \prop_put:cnn { l_xeCJK_#1_punct_prop } {##1} { } }
}
-\cs_new_nopar:Nn \xeCJK_add_special_punct:nn
+\cs_new_protected_nopar:Npn \xeCJK_add_special_punct:nn #1#2
{
\tl_put_right:cx { l_xeCJK_#1_punct_tl } {#2}
\tl_map_inline:cn { l_xeCJK_#1_punct_tl }
{ \prop_put:cnn { l_xeCJK_#1_punct_prop } {##1} { } }
}
-\cs_new_nopar:Nn \xeCJK_sub_special_punct:nn
+\cs_new_protected_nopar:Npn \xeCJK_sub_special_punct:nn #1#2
{
\tl_map_inline:xn {#2}
{
@@ -2587,7 +2608,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 决定添加的左/右空白。全角方式直接添加标点的实际左/右空白;半角方式添加标点左右空白
% 中的最小值;开明方式与半角相同,只在开明标点再增加实际左/右空白的一半。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_get_punct_bounds:nN
+\cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:nN #1#2
{
\tl_if_exist:cF { \l_xeCJK_punct_coor_tl/rule/#1/#2 }
{
@@ -2614,7 +2635,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\cs_if_exist_use:cF { g_xeCJK_punct_width/#2 }
{
- \xeCJK_tl_if_blank:xTF \g_xeCJK_punct_width_tl
+ \xeCJK_if_blank_x:nTF \g_xeCJK_punct_width_tl
{ \c_zero_dim }
{ \g_xeCJK_punct_width_tl }
}
@@ -2699,12 +2720,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \xeCJK_punct_if_long:N,\xeCJK_punct_if_middle:N,
% \xeCJK_punct_if_mixedwidth:N}
% \begin{macrocode}
-\prg_new_conditional:Nnn \xeCJK_punct_if_right:N { p , T , F , TF }
+\prg_new_conditional:Npnn \xeCJK_punct_if_right:N #1 { p , T , F , TF }
{
\tl_if_exist:cTF { \l_xeCJK_punct_coor_tl/glue/r/#1 }
\prg_return_true: \prg_return_false:
}
-\prg_new_conditional:Nnn \xeCJK_punct_if_both_left_right:NN { p , T , F , TF }
+\prg_new_conditional:Npnn \xeCJK_punct_if_both_left_right:NN #1#2 { p , T , F , TF }
{
\bool_if:nTF
{
@@ -2715,10 +2736,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
}
\prg_return_true: \prg_return_false:
}
-\cs_generate_variant:Nn \prg_new_conditional:Nnn { c }
+\cs_generate_variant:Nn \prg_new_conditional:Npnn { c }
\clist_map_inline:Nn \g_xeCJK_special_ps_clist
{
- \prg_new_conditional:cnn { xeCJK_punct_if_#1:N } { p , T , F , TF }
+ \prg_new_conditional:cpnn { xeCJK_punct_if_#1:N } ##1 { p , T , F , TF }
{
\prop_if_in:cnTF { l_xeCJK_#1_punct_prop } {##1}
\prg_return_true: \prg_return_false:
@@ -2731,7 +2752,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 标点挤压。行末半角方式,相邻标点不挤压;全角方式,相邻两个标点占 1.5 汉字宽度,
% 半角、开明和 CCT 方式相邻标点占一个汉字宽度。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_get_kern:NN
+\cs_new_protected_nopar:Npn \xeCJK_get_kern:NN #1#2
{
\tl_if_exist:cF { \l_xeCJK_punct_coor_tl/kern/#1-#2 }
{
@@ -2745,7 +2766,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\tl_gset:cV { \l_xeCJK_punct_coor_tl/kern/#1-#2 } \l_xeCJK_tmpa_dim
}
}
-\cs_new_nopar:Nn \xeCJK_calc_kern:NN
+\cs_new_protected_nopar:Npn \xeCJK_calc_kern:NN #1#2
{
\tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c_xeCJK_ps_marginkerning_tl
{
@@ -2804,7 +2825,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% |#3| 和 |#4| 为相邻的两个标点,|#2| 为要确定的相邻两个标点总共占的宽度,|#1| 是
% 尺寸寄存器,用于记录根据所占宽度计算得出的相邻两个标点间距。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_calc_kern:NnNN
+\cs_new_protected_nopar:Npn \xeCJK_calc_kern:NnNN #1#2#3#4
{
\dim_set:Nn #1
{
@@ -2825,7 +2846,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_get_punct_dimen:N}
% 返回标点的左右空白和实际尺寸。对于破折号,计算两标点之间的空白,保证它中间不被断开。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_get_punct_dimen:N
+\cs_new_protected_nopar:Npn \xeCJK_get_punct_dimen:N #1
{
\xeCJK_get_glyph_bounds:nNN { left } {#1} \l_xeCJK_tmpa_dim
\tl_gset:cV { \l_xeCJK_punct_coor_tl/bound/l/#1 } \l_xeCJK_tmpa_dim
@@ -2857,7 +2878,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_get_glyph_bounds:nNN}
% 用 |\XeTeXglyphbounds| 计算标点的上下左右空白。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_get_glyph_bounds:nNN
+\cs_new_protected_nopar:Npn \xeCJK_get_glyph_bounds:nNN #1#2#3
{
\dim_set:Nn #3
{
@@ -2925,7 +2946,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_fallback_testsymbol:N}
% 测试当前字体中是否存在当前字符,如存在则直接输出,否则启用后备字体。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_fallback_testsymbol:N
+\cs_new_protected_nopar:Npn \xeCJK_fallback_testsymbol:N #1
{
\font_glyph_if_exist:NnTF \tex_font:D {`#1}
{ \xeCJK_fallback_save_CJKsymbol:N {#1} }
@@ -2960,7 +2981,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \xeCJK_set_family_fallback:nnn {#1} {#2} {#3} }
{ \xeCJK_set_family:nnn { #1/FallBack } {#2} {#3} }
}
-\cs_new_nopar:Nn \xeCJK_set_family_fallback:nnn
+\cs_new_protected_nopar:Npn \xeCJK_set_family_fallback:nnn #1#2#3
{
\group_begin:
\tl_set:Nx \l_xeCJK_family_fb_tl {#1}
@@ -3038,14 +3059,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 用于定义 CJK 子区字体和备用字体的选项。
% \begin{macrocode}
\clist_new:N \g_xeCJK_sub_key_clist
-\cs_new_nopar:Nn \xeCJK_new_sub_key:n
+\cs_new_protected_nopar:Npn \xeCJK_new_sub_key:n #1
{
\clist_gput_right:Nx \g_xeCJK_sub_key_clist {#1}
\keys_define:nn { xeCJK / features }
{
#1 .code:n =
{
- \xeCJK_tl_if_blank:xTF {##1}
+ \xeCJK_if_blank_x:nTF {##1}
{
\bool_set_false:c { l_xeCJK_copy_#1_bool }
\bool_set_false:c { l_xeCJK_add_#1_bool }
@@ -3069,7 +3090,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
}
}
\cs_generate_variant:Nn \xeCJK_new_sub_key:n { x }
-\cs_new_nopar:Nn \xeCJK_get_sub_features:nn
+\cs_new_protected_nopar:Npn \xeCJK_get_sub_features:nn #1#2
{
\tl_set:Nx \l_xeCJK_tmpa_tl {#2}
\clist_clear:N \l_xeCJK_sub_fontfeat_clist
@@ -3077,14 +3098,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\exp_args:No \tl_if_head_eq_charcode:nNTF \l_xeCJK_tmpa_tl [ % ]
{
\exp_after:wN \xeCJK_get_sub_features_aux:n \l_xeCJK_tmpa_tl \c_empty_tl
- \xeCJK_tl_if_blank:xT \l_xeCJK_sub_fontname_tl
+ \xeCJK_if_blank_x:nT \l_xeCJK_sub_fontname_tl
{
\tl_set:Nx \l_xeCJK_sub_fontname_tl \l_xeCJK_tmpa_tl
\clist_clear:N \l_xeCJK_sub_fontfeat_clist
}
}
{ \tl_set:Nx \l_xeCJK_sub_fontname_tl \l_xeCJK_tmpa_tl }
- \xeCJK_tl_if_blank:xTF \l_xeCJK_sub_fontname_tl
+ \xeCJK_if_blank_x:nTF \l_xeCJK_sub_fontname_tl
{ \tl_set:Nx \l_xeCJK_sub_fontname_tl \l_xeCJK_fontname_tl }
{ \tl_replace_all:Nnx \l_xeCJK_sub_fontname_tl * \l_xeCJK_fontname_tl }
\clist_set:cx { l_xeCJK_#1_fontfeat_clist } \l_xeCJK_sub_fontfeat_clist
@@ -3096,15 +3117,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[aux]
% {\xeCJK_gobble_brace:N,\xeCJK_get_sub_features:nn,\xeCJK_get_sub_features_aux:n}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_gobble_brace:N
+\cs_new_protected_nopar:Npn \xeCJK_gobble_brace:N #1
{
- \exp_args:No \tl_if_head_group:nT #1
+ \exp_args:No \tl_if_head_is_group:nT #1
{
\exp_last_unbraced:NNo \tl_set:Nn #1 #1
\xeCJK_gobble_brace:N #1
}
}
-\cs_new_nopar:Npn \xeCJK_get_sub_features_aux:n [#1] #2
+\cs_new_protected_nopar:Npn \xeCJK_get_sub_features_aux:n [#1] #2
{
\clist_set:Nx \l_xeCJK_sub_fontfeat_clist {#1}
\tl_set:Nx \l_xeCJK_sub_fontname_tl {#2}
@@ -3123,8 +3144,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% SlantedFeatures, BoldSlantedFeatures}
% 调用字体的属性声明,同 \pkg{fontspec} 宏包。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_map_features_id:n
- { \prop_get:Nn \g_xeCJK_features_id_prop { #1 } }
+\cs_new_nopar:Npn \xeCJK_map_features_id:n #1
+ { \prop_get:Nn \g_xeCJK_features_id_prop {#1} }
\prop_new:N \g_xeCJK_features_id_prop
\prop_put:Nnn \g_xeCJK_features_id_prop { bf } { Bold }
\prop_put:Nnn \g_xeCJK_features_id_prop { it } { Italic }
@@ -3181,7 +3202,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_set_init:}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_set_init:
+\cs_new_protected_nopar:Npn \xeCJK_set_init:
{
\tl_clear:N \l_xeCJK_monoscale_tl
\int_gincr:N \g_xeCJK_fontspec_int
@@ -3209,7 +3230,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_set_family:nnn}
% 设置一个 CJK 新字体族,与 |\newfontfamily| 类似,增加 |FallBack| 选项。
% \begin{macrocode}
-\cs_new_protected_nopar:Nn \xeCJK_set_family:nnn
+\cs_new_protected_nopar:Npn \xeCJK_set_family:nnn #1#2#3
{
\group_begin:
\xeCJK_set_init:
@@ -3245,7 +3266,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_check_family:n}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_check_family:n
+\cs_new_protected_nopar:Npn \xeCJK_check_family:n #1
{
\prop_get:NnNT \g_xeCJK_family_prop {#1} \l_xeCJK_tmpa_tl
{
@@ -3260,12 +3281,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_add_font:nn,\xeCJK_add_font_if_new:nn}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_add_font:nn
+\cs_new_protected_nopar:Npn \xeCJK_add_font:nn #1#2
{
\prop_put:Nxx \l_xeCJK_add_font_prop
{ \xeCJK_map_features_id:n {#1} Font } {#2}
}
-\cs_new_nopar:Nn \xeCJK_add_font_if_new:nn
+\cs_new_protected_nopar:Npn \xeCJK_add_font_if_new:nn #1#2
{
\prop_put_if_new:Nxx \l_xeCJK_add_font_prop
{ \xeCJK_map_features_id:n {#1} Font } {#2}
@@ -3285,12 +3306,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_add_fake_bold:n,\xeCJK_add_fake_slant:n}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_add_fake_bold:n
+\cs_new_protected_nopar:Npn \xeCJK_add_fake_bold:n #1
{
\clist_put_left:cx { l_xeCJK_fontfeat_#1_clist }
{ FakeBold = { \fp_use:N \l_xeCJK_EmboldenFactor_fp } }
}
-\cs_new_nopar:Nn \xeCJK_add_fake_slant:n
+\cs_new_protected_nopar:Npn \xeCJK_add_fake_slant:n #1
{
\clist_put_left:cx { l_xeCJK_fontfeat_#1_clist }
{ FakeSlant = { \fp_use:N \l_xeCJK_SlantFactor_fp } }
@@ -3300,9 +3321,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_parse_features:,\xeCJK_parse_features:n}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_parse_features:
+\cs_new_protected_nopar:Npn \xeCJK_parse_features:
{ \prop_map_inline:Nn \g_xeCJK_features_id_prop { \xeCJK_parse_features:n {##1} } }
-\cs_new_nopar:Nn \xeCJK_parse_features:n
+\cs_new_protected_nopar:Npn \xeCJK_parse_features:n #1
{
\xeCJK_if_font_select:nTF {#1}
{
@@ -3330,12 +3351,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[pTF,internal]{\xeCJK_if_font_select:n,\xeCJK_if_it_or_sl:n}
% \begin{macrocode}
-\prg_new_conditional:Nnn \xeCJK_if_font_select:n { p, T, F, TF }
+\prg_new_conditional:Npnn \xeCJK_if_font_select:n #1 { p, T, F, TF }
{
- \exp_args:Nc \xeCJK_tl_if_blank:xTF { l_xeCJK_fontname_#1_tl }
+ \exp_args:Nc \xeCJK_if_blank_x:nTF { l_xeCJK_fontname_#1_tl }
\prg_return_false: \prg_return_true:
}
-\prg_new_conditional:Nnn \xeCJK_if_it_or_sl:n { p, T, F, TF }
+\prg_new_conditional:Npnn \xeCJK_if_it_or_sl:n #1 { p, T, F, TF }
{
\bool_if:nTF { \str_if_eq_x_p:nn { it } {#1} || \str_if_eq_x_p:nn { sl } {#1} }
\prg_return_true: \prg_return_false:
@@ -3345,7 +3366,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_set_fake:n}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_set_fake:n
+\cs_new_protected_nopar:Npn \xeCJK_set_fake:n #1
{
\str_if_eq_x:nnTF {#1} { bf }
{ \bool_if:NT \l_xeCJK_AutoFakeBold_bool { \xeCJK_add_fake_bold:n {#1} } }
@@ -3374,7 +3395,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_map_it_sl:n}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_map_it_sl:n
+\cs_new_protected_nopar:Npn \xeCJK_map_it_sl:n #1
{
\xeCJK_if_map_font_select:nT {#1}
{
@@ -3388,16 +3409,16 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_get_map_font:n}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_get_map_font:n
+\cs_new_nopar:Npn \xeCJK_get_map_font:n #1
{ \tl_use:c { l_xeCJK_fontname_\str_if_eq_x:nnTF {#1} {it} {sl} {it} _tl } }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[pTF,internal]{\xeCJK_if_map_font_select:n}
% \begin{macrocode}
-\prg_new_conditional:Nnn \xeCJK_if_map_font_select:n { p, T, F, TF }
+\prg_new_conditional:Npnn \xeCJK_if_map_font_select:n #1 { p, T, F, TF }
{
- \xeCJK_tl_if_blank:xTF { \xeCJK_get_map_font:n {#1} }
+ \xeCJK_if_blank_x:nTF { \xeCJK_get_map_font:n {#1} }
\prg_return_false: \prg_return_true:
}
% \end{macrocode}
@@ -3405,7 +3426,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_pass_features:}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_pass_features:
+\cs_new_protected_nopar:Npn \xeCJK_pass_features:
{
\prop_map_inline:Nn \g_xeCJK_features_id_prop
{
@@ -3417,7 +3438,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
}
\prop_map_inline:Nn \l_xeCJK_add_font_prop
{ \clist_put_right:Nx \l_xeCJK_pass_features_clist { ##1 = { ##2 } } }
- \xeCJK_tl_if_blank:xF \l_xeCJK_monoscale_tl
+ \xeCJK_if_blank_x:nF \l_xeCJK_monoscale_tl
{ \clist_put_right:Nx \l_xeCJK_pass_features_clist \l_xeCJK_monoscale_tl }
}
% \end{macrocode}
@@ -3434,7 +3455,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_save_family_info:}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_save_family_info:
+\cs_new_protected_nopar:Npn \xeCJK_save_family_info:
{
\group_begin:
\clist_map_inline:Nn \g_xeCJK_CJK_subclass_clist
@@ -3451,7 +3472,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_add_sub_block:}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_add_sub_block:
+\cs_new_protected_nopar:Npn \xeCJK_add_sub_block:
{
\clist_remove_duplicates:N \l_xeCJK_sub_key_clist
\clist_map_inline:Nn \l_xeCJK_sub_key_clist
@@ -3499,7 +3520,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_copy_family:nn}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_copy_family:nn
+\cs_new_protected_nopar:Npn \xeCJK_copy_family:nn #1#2
{
\xeCJK_family_if_exist:xT {#2}
{
@@ -3519,17 +3540,19 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 缓存当前字体的原始格式,以加速编译。
% \begin{macrocode}
\tl_set:Nn \l_xeCJK_font_coor_tl { xeCJK/\xeCJK@family/\f@series/\f@shape/\f@size }
-\cs_new_nopar:Nn \xeCJK_select_font:
+\cs_new_protected_nopar:Npn \xeCJK_select_font:
{
- \cs_if_exist_use:cF \l_xeCJK_font_coor_tl
+ \cs_if_exist_use:cF { \l_xeCJK_font_coor_tl }
{
\tl_set:Nx \l_xeCJK_current_coor_tl \l_xeCJK_font_coor_tl
- \cs_if_exist_use:cT { xeCJK/family/\xeCJK@family }
- { \exp_last_unbraced:NNV \cs_gset_eq:cN \l_xeCJK_current_coor_tl \tex_font:D }
+ \xeCJK_family_if_exist:xTF { \xeCJK@family }
+ { \use:c { xeCJK/family/\xeCJK@family } }
+ { \use_none:nnnn }
+ \exp_last_unbraced:NNV \cs_gset_eq:cN \l_xeCJK_current_coor_tl \tex_font:D
}
}
\cs_new_eq:NN \xeCJK@setfont \xeCJK_select_font:
-\cs_new_nopar:Nn \xeCJK_switch_font:nn
+\cs_new_protected_nopar:Npn \xeCJK_switch_font:nn #1#2
{
\str_if_eq_x:nnF {#1} {#2}
{
@@ -3555,14 +3578,17 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[TF,internal]{\xeCJK_family_if_exist:x}
% \begin{macrocode}
-\prg_new_protected_conditional:Nnn \xeCJK_family_if_exist:x { T, F, TF }
+\prg_new_protected_conditional:Npnn \xeCJK_family_if_exist:x #1 { T, F, TF }
{
- \cs_if_free:cTF { xeCJK/family/#1 } \prg_return_false:
+ \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_get:NxNF \g_xeCJK_family_name_prop {#1} \l_xeCJK_family_name_tl
+ { \use:c { xeCJK/family/#1 } }
\prg_return_true:
}
}
+\cs_generate_variant:Nn \prop_get:NnNTF { Nx }
% \end{macrocode}
% \end{macro}
%
@@ -3571,7 +3597,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macrocode}
\NewDocumentCommand \CJKfamily { m }
{
- \xeCJK_family_if_exist:xTF {#1}
+ \cs_if_exist:cTF { xeCJK/family/#1 }
{ \tl_set:Nx \xeCJK@family {#1} }
{
\seq_if_in:NxF \g_xeCJK_unknown_family_seq {#1}
@@ -3637,6 +3663,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\clist_new:N \g_xeCJK_default_features_clist
\NewDocumentCommand \defaultCJKfontfeatures { m }
{ \clist_gset:Nn \g_xeCJK_default_features_clist {#1} }
+\defaultCJKfontfeatures { Script = CJK }
\@onlypreamble \defaultCJKfontfeatures
\NewDocumentCommand \addCJKfontfeatures { m }
{
@@ -3765,7 +3792,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_set_mathfont:}
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_set_mathfont:
+\cs_new_protected_nopar:Npn \xeCJK_set_mathfont:
{
\xeCJK_family_if_exist:xTF \c_xeCJK_math_tl
{ \tl_set:Nx \l_xeCJK_tmpa_tl \c_xeCJK_math_tl }
@@ -3784,7 +3811,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\clist_map_inline:cn { g_xeCJK_##1_range_clist }
{
- \xeCJK_setcharclass_aux:Nn \xeCJKsetmathcode {####1}
+ \xeCJK_set_char_class_aux:Nn \xeCJKsetmathcode {####1}
\mathalpha \c_xeCJK_math_tl
}
}
@@ -3828,7 +3855,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\xeCJK_set_monoscale:
\addCJKfontfeatures { Scale = \fp_use:N \g_xeCJK_monoscale_fp }
}
-\cs_new_nopar:Nn \xeCJK_set_monoscale:
+\cs_new_protected_nopar:Npn \xeCJK_set_monoscale:
{
\group_begin:
\fontfamily \ttdefault \selectfont
@@ -3842,7 +3869,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}{\setCJKmonoexspace}
% \begin{macrocode}
\NewDocumentCommand \setCJKmonoexspace { } { \xeCJK_set_monoexspace: }
-\cs_new_nopar:Nn \xeCJK_set_monoexspace:
+\cs_new_protected_nopar:Npn \xeCJK_set_monoexspace:
{
\group_begin:
\fontfamily \ttdefault \selectfont
@@ -3926,24 +3953,26 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\msg_redirect_module:nnn { xeCJK } { warning } { info }
\msg_redirect_module:nnn { xeCJK } { info } { none }
- \PassOptionsToPackage { quiet } { fontspec }
+ \xeCJK_if_package_loaded:nF { fontspec }
+ { \PassOptionsToPackage { quiet } { fontspec } }
},
silent .code:n =
{
\msg_redirect_module:nnn { xeCJK } { warning } { none }
\msg_redirect_module:nnn { xeCJK } { info } { none }
- \PassOptionsToPackage { silent } { fontspec }
+ \xeCJK_if_package_loaded:nF { fontspec }
+ { \PassOptionsToPackage { silent } { fontspec } }
},
unknown .code:n =
{
- \@ifpackageloaded { fontspec }
+ \xeCJK_if_package_loaded:nTF { fontspec }
{ \xeCJK_error:nx { key-unknown } { \l_keys_key_tl } }
{ \PassOptionsToPackage { \l_keys_key_tl } { fontspec } }
},
}
\xeCJK_msg_new:nn { key-unknown }
{
- Sorry,~but~\l_keys_module_tl\c_space_tl does~not~have~a~key~called~'#1'.\\\\
+ Sorry,~but~\l__keys_module_tl\c_space_tl does~not~have~a~key~called~'#1'.\\\\
The~key~'#1'~is~being~ignored.
}
% \end{macrocode}
@@ -4017,7 +4046,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\punctstyle, \xeCJKplainchr}
% \begin{macrocode}
\NewDocumentCommand \punctstyle { m } { \xeCJKsetup { PunctStyle = {#1} } }
-\cs_new_nopar:Npn \xeCJKplainchr { \punctstyle { plain } }
+\NewDocumentCommand \xeCJKplainchr { } { \punctstyle { plain } }
% \end{macrocode}
% \end{macro}
%
@@ -4033,7 +4062,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_fix_itcorr:}
% 修复倾斜校正。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_fix_itcorr:
+\cs_new_protected_nopar:Npn \xeCJK_fix_itcorr:
{
\scan_stop:
\xeCJK_if_last_node:nTF { default }
@@ -4060,18 +4089,16 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\xeCJK_AfterEndPreamble:n
{
\int_compare:nNnF
- { \c_three + \seq_count:N \g_xeCJK_class_seq } = \xe@alloc@intercharclass
+ { \c_three + ( \seq_count:N \g_xeCJK_class_seq ) } = \xe@alloc@intercharclass
{
- \int_set_eq:NN \l_xeCJK_tmpa_int \c_three
- \int_until_do:nNnn \l_xeCJK_tmpa_int = \xe@alloc@intercharclass
+ \int_step_inline:nnnn \c_four \c_one \xe@alloc@intercharclass
{
- \int_incr:N \l_xeCJK_tmpa_int
- \seq_if_in:NVF \g_xeCJK_class_seq \l_xeCJK_tmpa_int
- { \xeCJK_set_others_toks:n \l_xeCJK_tmpa_int }
+ \seq_if_in:NnF \g_xeCJK_class_seq {#1}
+ { \xeCJK_set_others_toks:n {#1} }
}
}
}
-\cs_new_nopar:Nn \xeCJK_set_others_toks:n
+\cs_new_protected_nopar:Npn \xeCJK_set_others_toks:n #1
{
\int_set:Nn \xeCJK_Others_class {#1}
\clist_map_inline:Nn \g_xeCJK_CJK_class_clist
@@ -4082,12 +4109,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \xeCJK_get_inter_class_toks:nn { Default } { Others } }
\exp_args:Nnnx \xeCJK_pre_inter_class_toks:nnn { Others } {##1}
{ \xeCJK_get_inter_class_toks:nn { Others } { Default } }
- \tl_if_empty:xT { \xeCJK_get_inter_class_toks:nn { Others } { Boundary } }
+ \xeCJK_if_blank_x:nT { \xeCJK_get_inter_class_toks:nn { Others } { Boundary } }
{
\xeCJK_copy_inter_class_toks:nnnn
{ Others } { Boundary } { Default } { Boundary }
}
- \tl_if_empty:xT { \xeCJK_get_inter_class_toks:nn { Boundary } { Others } }
+ \xeCJK_if_blank_x:nT { \xeCJK_get_inter_class_toks:nn { Boundary } { Others } }
{
\xeCJK_copy_inter_class_toks:nnnn
{ Boundary } { Others } { Boundary } { Default }
@@ -4101,7 +4128,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]{\xeCJK_patch:Nnn}
% 给已有宏内容前后附加补丁。
% \begin{macrocode}
-\cs_new_nopar:Nn \xeCJK_patch:Nnn
+\cs_new_protected_nopar:Npn \xeCJK_patch:Nnn #1#2#3
{ \tl_put_left:Nn #1 {#2} \tl_put_right:Nn #1 {#3} }
% \end{macrocode}
% \end{macro}
@@ -4116,18 +4143,45 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\textellipsis \textemdash \textperiodcentered \textcentereddot
\textquoteleft \textquoteright \textquotedblleft \textquotedblright
}
- { \xeCJK_patch:Nnn #1 { \group_begin: \makexeCJKinactive } { \group_end: } }
+ {
+ \xeCJK_patch:Nnn #1
+ { \xeCJK_group_begin: \makexeCJKinactive }
+ { \xeCJK_group_end: }
+ }
\xeCJK_patch:Nnn \tipaencoding { \makexeCJKinactive } { }
\cs_set_eq:NN \xeCJK_aux_r \r
- \cs_set_nopar:Npn \r #1 { { \makexeCJKinactive \xeCJK_aux_r {#1} } }
- \@ifpackageloaded { pifont }
+ \cs_set_protected_nopar:Npn \r #1 { { \makexeCJKinactive \xeCJK_aux_r {#1} } }
+ \xeCJK_if_package_loaded:nT { pifont }
{
\RenewDocumentCommand \Pifont { m }
{
\fontencoding {U} \fontfamily {#1} \fontseries {m} \fontshape {n}
\selectfont \makexeCJKinactive
}
- } { }
+ }
+ }
+\cs_new_eq:NN \xeCJK_group_begin: \group_begin:
+\cs_new_eq:NN \xeCJK_group_end: \group_end:
+% \end{macrocode}
+%
+% 简单处理与 \pkg{hyperref} 宏包的兼容问题。
+% \begin{macrocode}
+\xeCJK_AfterEndPreamble:n
+ {
+ \bool_if:nT
+ {
+ \xeCJK_if_package_loaded_p:n { hyperref } &&
+ \tl_if_exist_p:N \pdfstringdefPreHook
+ }
+ {
+ \tl_put_right:Nn \pdfstringdefPreHook
+ {
+ \cs_set_eq:NN \makexeCJKinactive \prg_do_nothing:
+ \cs_set_eq:NN \xeCJK_group_begin: \prg_do_nothing:
+ \cs_set_eq:NN \xeCJK_group_end: \prg_do_nothing:
+ \cs_set_eq:NN \CJKfamily \use_none:n
+ }
+ }
}
% \end{macrocode}
%
@@ -4144,7 +4198,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\NewDocumentCommand \xeCJKcaption { o m }
{
\IfValueT {#1} { \XeTeXdefaultencoding "#1" }
- \cs_set_nopar:Nx \xeCJK_reset_at_catcode:
+ \cs_set_nopar:Npx \xeCJK_reset_at_catcode:
{
\exp_not:n { \char_set_catcode:nn { `\@ } }
{ \char_value_catcode:n { `\@ } }
@@ -4160,17 +4214,17 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macro}[internal]
% {\xeCJK_ULprepunctchar:n, \xeCJK_ULpostpunctchar:n, \xeCJK_ULroutines:}
% \begin{macrocode}
-\cs_new_protected_nopar:Nn \xeCJK_ULprepunctchar:n
+\cs_new_protected_nopar:Npn \xeCJK_ULprepunctchar:n #1
{
- { \makexeCJKinactive \CJKpunctsymbol {#1} \nobreak }
+ { \makexeCJKinactive \CJKpunctsymbol {#1} \xeCJK_no_break: }
\tex_ignorespaces:D
}
-\cs_new_protected_nopar:Nn \xeCJK_ULpostpunctchar:n
+\cs_new_protected_nopar:Npn \xeCJK_ULpostpunctchar:n #1
{
{ \makexeCJKinactive \CJKpunctsymbol {#1} }
\xeCJK_ignorespaces:
}
-\cs_new_protected_nopar:Nn \xeCJK_ULroutines:
+\cs_new_protected_nopar:Npn \xeCJK_ULroutines:
{
\xeCJK_inter_class_toks:nnn { Default } { CJK } { \CJKecglue \CJKsymbol }
\xeCJK_inter_class_toks:nnn { HalfLeft } { CJK } { \CJKsymbol }
@@ -4196,12 +4250,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\cs_set_eq:NN \xeCJK_UL_CJKsymbol \CJKsymbol
\cs_set_eq:NN \xeCJK_UL_CJKpunctsymbol \CJKpunctsymbol
- \cs_set_nopar:Npn \CJKsymbol #1
+ \cs_set_protected_nopar:Npn \CJKsymbol #1
{
{ \xeCJK_select_font: \xeCJK_UL_CJKsymbol {#1} }
- \xeCJK_make_node:n { CJK } \xeCJK_ignorespaces:
+ { \xeCJK_make_node:n { CJK } } \xeCJK_ignorespaces:
}
- \cs_set_nopar:Npn \CJKpunctsymbol #1
+ \cs_set_protected_nopar:Npn \CJKpunctsymbol #1
{ { \xeCJK_select_font: \xeCJK_UL_CJKpunctsymbol {#1} } }
\xeCJK_ULroutines:
}
@@ -4219,8 +4273,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\bool_if:NT \g_xeCJK_number_bool
{
\tl_set:Nn \CJK@UnicodeEnc { UTF8 }
- \cs_set_nopar:Npn \CJKaddEncHook #1#2 { \cs_set_nopar:cpn { xeCJK_enc_#1 } {#2} }
- \cs_set_nopar:Npn \Unicode #1#2
+ \cs_set_protected_nopar:Npn \CJKaddEncHook #1#2
+ { \cs_set_nopar:cpn { xeCJK_enc_#1 } {#2} }
+ \cs_set_protected_nopar:Npn \Unicode #1#2
{ \tex_char:D \int_eval:n { (#1) * \c_two_hundred_fifty_six + (#2) } }
\RequirePackage { CJKnumb }
\use:c { xeCJK_enc_\CJK@UnicodeEnc }
@@ -4233,6 +4288,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%</package>
% \end{macrocode}
%
+% \makeatletter
+% \let\special@index\@gobble
+% \makeatother
%
% \section{例子}
%
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins
index 09819f516d8..2fa0b0c245c 100644
--- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins
+++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins
@@ -6,7 +6,7 @@
%%
%% xeCJK.dtx (with options: `batchfile')
%%
-%% $Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+%% $Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
@@ -35,7 +35,7 @@
\askforoverwritefalse
\preamble
-$Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+$Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
$URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
-----------------------------------------------------------------
Author:
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
index 98b6c613b88..5fc7a07d2ef 100644
--- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
+++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
@@ -6,7 +6,7 @@
%%
%% xeCJK.dtx (with options: `package')
%%
-%% $Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+%% $Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
@@ -31,9 +31,11 @@
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: xeCJK.dtx 351 2012-07-20 05:30:58Z sobenlee $
+\GetIdInfo$Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
{package for typesetting CJK scripts with XeLaTeX}
-\ProvidesExplPackage{\ExplFileName}{\ExplFileDate}{3.0.7}{\ExplFileDescription}
+\ProvidesExplPackage
+ {\ExplFileName}
+ {\ExplFileDate}{3.0.8}{\ExplFileDescription}
\msg_new:nnn { xeCJK } { Require-XeTeX }
{
The~xeCJK~package~requires~XeTeX~to~function.\\\\
@@ -75,14 +77,15 @@
\clist_new:N \l_xeCJK_tmpa_clist
\clist_new:N \l_xeCJK_tmpb_clist
\clist_new:N \l_xeCJK_tmpc_clist
+\cs_new_protected_nopar:Npn \xeCJK_no_break: { \tex_penalty:D \c_ten_thousand }
\tl_new:N \g_xeCJK_at_end_preamble_hook
\tl_new:N \g_xeCJK_after_preamble_hook
\tl_new:N \g_xeCJK_after_end_preamble_hook
-\cs_new:Nn \xeCJK_AtEndPreamble:n
+\cs_new_protected:Npn \xeCJK_AtEndPreamble:n #1
{ \tl_gput_right:Nn \g_xeCJK_at_end_preamble_hook {#1} }
-\cs_new:Nn \xeCJK_AfterPreamble:n
+\cs_new_protected:Npn \xeCJK_AfterPreamble:n #1
{ \tl_gput_right:Nn \g_xeCJK_after_preamble_hook {#1} }
-\cs_new:Nn \xeCJK_AfterEndPreamble:n
+\cs_new_protected:Npn \xeCJK_AfterEndPreamble:n #1
{ \tl_gput_right:Nn \g_xeCJK_after_end_preamble_hook {#1} }
\AtBeginDocument { \g_xeCJK_after_preamble_hook }
\tl_put_left:Nn \document { \group_end: \g_xeCJK_at_end_preamble_hook \group_begin: }
@@ -97,7 +100,7 @@
\tl_to_lowercase:n
{
\group_end:
- \prg_new_conditional:Nnn \xeCJK_if_outer_macro:c { p , T , F , TF }
+ \prg_new_conditional:Npnn \xeCJK_if_outer_macro:c #1 { p , T , F , TF }
{
\exp_last_unbraced:Nf \xeCJK_if_outer_macro_aux:w
{ \cs_meaning:c {#1} } OUZER ~ MAYRO ; \q_stop
@@ -116,16 +119,8 @@
\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NTF #1#2#3
{
\cs_set_eq:NN \l_xeCJK_peek_search_token #1
- \cs_set:Npx \xeCJK_peek_true:w
- {
- \exp_not:N \group_align_safe_end:
- \exp_not:n {#2}
- }
- \cs_set:Npx \xeCJK_peek_false:w
- {
- \exp_not:N \group_align_safe_end:
- \exp_not:n {#3}
- }
+ \tl_set:Nn \xeCJK_peek_true:w { \group_align_safe_end: #2 }
+ \tl_set:Nn \xeCJK_peek_false:w { \group_align_safe_end: #3 }
\group_align_safe_begin:
\peek_after:Nw \xeCJK_peek_ignore_spaces_execute_branches:
}
@@ -133,7 +128,7 @@
{ \xeCJK_peek_catcode_ignore_spaces:NTF #1 {#2} { } }
\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NF #1#2
{ \xeCJK_peek_catcode_ignore_spaces:NTF #1 { } {#2} }
-\cs_new_nopar:Nn \xeCJK_peek_ignore_spaces_execute_branches:
+\cs_new_nopar:Npn \xeCJK_peek_ignore_spaces_execute_branches:
{
\if_meaning:w \l_peek_token \c_space_token
\tex_afterassignment:D \xeCJK_peek_ignore_spaces_execute_branches_aux:
@@ -142,9 +137,9 @@
\exp_after:wN \xeCJK_peek_execute_branches_catcode:
\fi:
}
-\cs_new_protected_nopar:Nn \xeCJK_peek_ignore_spaces_execute_branches_aux:
+\cs_new_protected_nopar:Npn \xeCJK_peek_ignore_spaces_execute_branches_aux:
{ \peek_after:Nw \xeCJK_peek_ignore_spaces_execute_branches: }
-\cs_new_nopar:Nn \xeCJK_peek_execute_branches_catcode:
+\cs_new_nopar:Npn \xeCJK_peek_execute_branches_catcode:
{
\if_catcode:w \exp_not:N \l_peek_token \exp_not:N \l_xeCJK_peek_search_token
\exp_after:wN \xeCJK_peek_true:w
@@ -152,7 +147,7 @@
\exp_after:wN \xeCJK_peek_false:w
\fi:
}
-\prg_new_conditional:Nnn \xeCJK_tl_if_blank:x { p , T , F , TF }
+\prg_new_conditional:Npnn \xeCJK_if_blank_x:n #1 { p , T , F , TF }
{
\if_int_compare:w \pdftex_strcmp:D { \c_empty_tl } {#1} = \c_zero
\prg_return_true:
@@ -161,6 +156,12 @@
\prg_return_true: \else: \prg_return_false: \fi:
\fi:
}
+\prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF }
+ {
+ \tl_if_exist:cTF { ver@ #1 . \c_xeCJK_pkg_extension_tl }
+ { \prg_return_true: } { \prg_return_false: }
+ }
+\tl_const:Nx \c_xeCJK_pkg_extension_tl { \@pkgextension }
\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 } }
@@ -184,7 +185,7 @@
\int_const:Nn \xeCJK_FullLeft_class { 2 }
\int_const:Nn \xeCJK_FullRight_class { 3 }
\int_const:Nn \xeCJK_Boundary_class { 255 }
-\cs_new_nopar:Nn \xeCJK_new_class:n
+\cs_new_protected_nopar:Npn \xeCJK_new_class:n #1
{
\exp_args:Nc \newXeTeXintercharclass { xeCJK_#1_class }
\clist_gclear_new:c { g_xeCJK_#1_range_clist }
@@ -203,48 +204,56 @@
{ \clist_gclear_new:c { g_xeCJK_#1_range_clist } }
\clist_new:N \g_xeCJK_CJK_class_clist
\prop_new:N \g_xeCJK_CJK_class_prop
-\cs_new_nopar:Nn \xeCJK_save_CJK_class:n
+\cs_new_protected_nopar:Npn \xeCJK_save_CJK_class:n #1
{
\clist_gput_right:Nx \g_xeCJK_CJK_class_clist {#1}
\prop_gput:Nvx \g_xeCJK_CJK_class_prop { xeCJK_#1_class } {#1}
}
\cs_generate_variant:Nn \prop_gput:Nnn { Nvx }
-\clist_map_inline:nn { CJK, FullLeft, FullRight } { \xeCJK_save_CJK_class:n {#1} }
-\cs_new_nopar:Nn \xeCJK_class_num:n { \tl_use:c { xeCJK_#1_class } }
-\NewDocumentCommand \xeCJKDeclareCharClass { > { \TrimSpaces } m m }
+\clist_map_function:nN { CJK, FullLeft, FullRight } \xeCJK_save_CJK_class:n
+\cs_new_nopar:Npn \xeCJK_class_num:n #1 { \tl_use:c { xeCJK_#1_class } }
+\NewDocumentCommand \xeCJKDeclareCharClass { s > { \TrimSpaces } m m }
+ {
+ \xeCJK_declare_char_class:nn {#2} {#3}
+ \IfBooleanT {#1} { \xeCJKResetPunctClass }
+ }
+\cs_new_protected_nopar:Npn \xeCJK_declare_char_class:nn #1#2
{
\clist_gput_right:cx { g_xeCJK_#1_range_clist } {#2}
\clist_map_inline:xn {#2}
{
\str_if_eq_x:nnF {##1} { -> }
{
- \xeCJK_setcharclass_aux:Nn \xeCJKsetcharclass {##1}
+ \xeCJK_set_char_class_aux:Nn \xeCJK_set_char_class:nnn {##1}
{ \xeCJK_class_num:n {#1} }
}
}
}
-\NewDocumentCommand \xeCJK_setcharclass_aux:Nn
+\NewDocumentCommand \xeCJK_set_char_class_aux:Nn
{ m > { \SplitArgument { 1 } { -> } } m } { #1 #2 }
\cs_generate_variant:Nn \clist_map_inline:nn { x }
-\NewDocumentCommand \xeCJKsetcharclass { m m m }
+\NewDocumentCommand \xeCJKsetcharclass { s m m m }
+ {
+ \xeCJK_set_char_class:nnn {#2} {#3} {#4}
+ \IfBooleanF {#1} { \xeCJKResetPunctClass }
+ }
+\cs_new_protected_nopar:Npn \xeCJK_set_char_class:nnn #1#2#3
{
\xeCJK_check_num_range:nnNN {#1} {#2} \l_xeCJK_tmpa_int \l_xeCJK_tmpb_int
\int_set:Nn \l_xeCJK_tmpc_int {#3}
\prop_if_in:NVTF \g_xeCJK_CJK_class_prop \l_xeCJK_tmpc_int
- { \cs_set_eq:NN \xeCJK_set_catcode:n \char_set_catcode_other:n }
- { \cs_set_eq:NN \xeCJK_set_catcode:n \use_none:n }
- \loop
- \xeCJK_set_catcode:n \l_xeCJK_tmpa_int
+ { \loop \char_set_catcode_other:n \l_xeCJK_tmpa_int }
+ { \loop }
\XeTeXcharclass \l_xeCJK_tmpa_int = \l_xeCJK_tmpc_int
\if_int_compare:w \l_xeCJK_tmpa_int < \l_xeCJK_tmpb_int
\int_incr:N \l_xeCJK_tmpa_int
\repeat
}
-\cs_new_nopar:Nn \xeCJK_check_num_range:nnNN
+\cs_new_protected_nopar:Npn \xeCJK_check_num_range:nnNN #1#2#3#4
{
- \bool_if:nTF { \xeCJK_tl_if_blank_p:x {#1} || \xeCJK_tl_if_blank_p:x {#2} }
+ \bool_if:nTF { \xeCJK_if_blank_x_p:n {#1} || \xeCJK_if_blank_x_p:n {#2} }
{
- \int_set:Nn #3 { \xeCJK_tl_if_blank:xTF {#1} {#2} {#1} }
+ \int_set:Nn #3 { \xeCJK_if_blank_x:nTF {#1} {#2} {#1} }
\int_set_eq:NN #3 #4
}
{
@@ -254,18 +263,18 @@
}
\NewDocumentCommand \xeCJKResetPunctClass { }
{
- \xeCJKDeclareCharClass { HalfLeft }
+ \xeCJK_declare_char_class:nn { HalfLeft }
{ "28 , "2D , "5B , "60 , "7B }
- \xeCJKDeclareCharClass { HalfRight }
+ \xeCJK_declare_char_class:nn { HalfRight }
{ "21 , "22 , "25 , "27 , "29 , "2C , "2E , "3A , "3B , "3F , "5D , "7D , }
- \xeCJKDeclareCharClass { FullLeft }
+ \xeCJK_declare_char_class:nn { FullLeft }
{
"2018 , "201C , "2116 , "3008 , "300A , "300C , "300E , "3010 , "3012 ,
"3014 , "3016 , "3018 , "301A , "301D , "3036 , "E76C , "FE59 , "FE5B ,
"FE5D , "FE5F , "FE60 , "FE69 , "FE6B , "FF03 , "FF04 , "FF08 , "FF20 ,
"FF3B , "FF5B , "FFE0 , "FFE1 , "FFE5 , "FFE6 ,
}
- \xeCJKDeclareCharClass { FullRight }
+ \xeCJK_declare_char_class:nn { FullRight }
{
"00B7 , "2019 , "201D , "2014 , "2025 , "2026 , "2030 , "2500 , "3001 ,
"3002 , "3005 , "3006 , "3009 , "300B , "300D , "300F , "3011 , "3015 ,
@@ -279,7 +288,7 @@
"FF6A , "FF6B , "FF6C , "FF6D , "FF6E , "FF6F , "FF70 , "FF9E , "FF9F ,
}
}
-\xeCJKDeclareCharClass { CJK }
+\xeCJK_declare_char_class:nn { CJK }
{
"1100 -> "11FF ,
"2E80 -> "2EFF ,
@@ -320,48 +329,30 @@
{ \XeTeXcharclass `##1 = \xeCJK_class_num:n { NormalSpace } }
}
\normalspacedchars{/}
-\cs_new_nopar:Nn \xeCJK_inter_class_toks:nnn
+\cs_new_protected_nopar:Npn \xeCJK_inter_class_toks:nnn #1#2#3
{ \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} = {#3} }
-\cs_generate_variant:Nn \xeCJK_inter_class_toks:nnn { nnc }
-\cs_new_nopar:Nn \xeCJK_clear_inter_class_toks:nn
- {
- \XeTeXinterchartoks
- \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} = { \c_empty_tl }
- }
-\cs_new_nopar:Nn \xeCJK_pre_inter_class_toks:nnn
+\cs_generate_variant:Nn \xeCJK_inter_class_toks:nnn { nnc , nnx }
+\cs_new_nopar:Npn \xeCJK_get_inter_class_toks:nn #1#2
+ { \tex_the:D \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} }
+\cs_new_protected_nopar:Npn \xeCJK_clear_inter_class_toks:nn #1#2
+ { \xeCJK_inter_class_toks:nnn {#1} {#2} { \c_empty_tl } }
+\cs_new_protected_nopar:Npn \xeCJK_pre_inter_class_toks:nnn #1#2#3
{
- \use:x
- {
- \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} =
- {
- \exp_not:n {#3} \tex_the:D \XeTeXinterchartoks
- \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2}
- }
- }
+ \xeCJK_inter_class_toks:nnx {#1} {#2}
+ { \exp_not:n {#3} \xeCJK_get_inter_class_toks:nn {#1} {#2} }
}
-\cs_new_nopar:Nn \xeCJK_app_inter_class_toks:nnn
+\cs_new_protected_nopar:Npn \xeCJK_app_inter_class_toks:nnn #1#2#3
{
- \use:x
- {
- \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} =
- {
- \tex_the:D \XeTeXinterchartoks \xeCJK_class_num:n {#1}
- \xeCJK_class_num:n {#2} \exp_not:n {#3}
- }
- }
+ \xeCJK_inter_class_toks:nnx {#1} {#2}
+ { \xeCJK_get_inter_class_toks:nn {#1} {#2} \exp_not:n {#3} }
}
\cs_generate_variant:Nn \xeCJK_app_inter_class_toks:nnn { nnc }
-\cs_new_nopar:Nn \xeCJK_get_inter_class_toks:nn
- { \tex_the:D \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} }
-\cs_new_nopar:Nn \xeCJK_copy_inter_class_toks:nnnn
+\cs_new_protected_nopar:Npn \xeCJK_copy_inter_class_toks:nnnn #1#2#3#4
{
- \use:x
- {
- \xeCJK_inter_class_toks:nnn {#1} {#2}
- { \xeCJK_get_inter_class_toks:nn {#3} {#4} }
- }
+ \xeCJK_inter_class_toks:nnx {#1} {#2}
+ { \xeCJK_get_inter_class_toks:nn {#3} {#4} }
}
-\cs_new_nopar:Nn \xeCJK_clear_CJK_toks:
+\cs_new_protected_nopar:Npn \xeCJK_clear_CJK_toks:
{
\clist_map_inline:Nn \g_xeCJK_CJK_class_clist
{ \xeCJK_clear_inter_class_toks:nn { Boundary } {##1} }
@@ -419,7 +410,7 @@
{ \xeCJK_pre_inter_class_toks:nnn {#1} { CJK } { \CJKecglue } }
}
\xeCJK_inter_class_toks:nnn { Boundary } { CJK } { \xeCJK_Boundary_and_CJK: }
-\cs_new_nopar:Nn \xeCJK_Boundary_and_CJK:
+\cs_new_protected_nopar:Npn \xeCJK_Boundary_and_CJK:
{
{ \xeCJK_check_for_glue: }
\c_group_begin_token
@@ -427,7 +418,7 @@
\xeCJK_select_font:
\CJKsymbol
}
-\cs_new_nopar:Nn \xeCJK_check_for_glue:
+\cs_new_protected_nopar:Npn \xeCJK_check_for_glue:
{
\bool_if:nTF
{ \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK_space } }
@@ -484,7 +475,7 @@
\xeCJK_ignorespaces:
}
\xeCJK_inter_class_toks:nnn { CJK } { CJK } { \xeCJK_CJK_and_CJK:N }
-\cs_new_nopar:Nn \xeCJK_CJK_and_CJK:N { \CJKglue \CJKsymbol {#1} }
+\cs_new_protected_nopar:Npn \xeCJK_CJK_and_CJK:N #1 { \CJKglue \CJKsymbol {#1} }
\clist_map_inline:nn { FullLeft, FullRight }
{
\xeCJK_inter_class_toks:nnn { Boundary } {#1}
@@ -502,7 +493,7 @@
\bool_if:nF
{ \str_if_eq_x_p:nn {#1} { FullLeft } || \str_if_eq_x_p:nn {#1} { FullRight } }
{
- \xeCJK_pre_inter_class_toks:nnn { FullLeft } {#1} { \nobreak }
+ \xeCJK_pre_inter_class_toks:nnn { FullLeft } {#1} { \xeCJK_no_break: }
\xeCJK_pre_inter_class_toks:nnn { FullRight } {#1} { \xeCJK_after_FullRight: }
}
}
@@ -511,14 +502,14 @@
\clist_map_inline:nn { FullLeft, FullRight }
{ \xeCJK_inter_class_toks:nnc {#1} {##1} { xeCJK_#1_and_##1:N } }
}
-\cs_new_nopar:Nn \xeCJK_punct_rule:n
+\cs_new_protected_nopar:Npn \xeCJK_punct_rule:n #1
{
\tex_vrule:D
\@width \dim_eval:c { \l_xeCJK_punct_coor_tl/rule/#1 }
\@depth \c_zero_dim
\@height \c_zero_dim \scan_stop:
}
-\cs_new_nopar:Nn \xeCJK_punct_glue:n
+\cs_new_protected_nopar:Npn \xeCJK_punct_glue:n #1
{
\skip_horizontal:n
{
@@ -527,22 +518,22 @@
\@minus \dim_eval:n { ( \tl_use:c { \l_xeCJK_punct_coor_tl/glue/#1 } ) /2 }
}
}
-\cs_new_nopar:Nn \xeCJK_punct_kern:n
+\cs_new_protected_nopar:Npn \xeCJK_punct_kern:n #1
{ \tex_kern:D \dim_eval:c { \l_xeCJK_punct_coor_tl/kern/#1 } }
\cs_generate_variant:Nn \dim_eval:n { c }
-\cs_new_nopar:Nn \xeCJK_before_FullLeft:N
+\cs_new_protected_nopar:Npn \xeCJK_before_FullLeft:N #1
{
\tl_set:Nx \l_xeCJK_lastpunct_tl {#1}
\xeCJK_punct_rule:n { l/#1 }
\CJKpunctsymbol {#1}
}
-\cs_new_nopar:Nn \xeCJK_after_FullRight:
+\cs_new_protected_nopar:Npn \xeCJK_after_FullRight:
{
\xeCJK_get_punct_bounds:nV { r } \l_xeCJK_lastpunct_tl
\xeCJK_punct_rule:n { r/\l_xeCJK_lastpunct_tl }
\xeCJK_punct_glue:n { r/\l_xeCJK_lastpunct_tl }
}
-\cs_new_nopar:Nn \xeCJK_CJK_and_FullLeft:N
+\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullLeft:N #1
{
\xeCJK_get_punct_bounds:nN { l } {#1}
\int_compare:nNnF \etex_lastnodetype:D = \c_one
@@ -554,12 +545,12 @@
\xeCJK_punct_glue:n { l/#1 }
}
}
-\cs_new_nopar:Nn \xeCJK_CJK_and_FullRight:N
+\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullRight:N #1
{
\xeCJK_get_punct_bounds:nN { r } {#1}
\xeCJK_punct_if_long:NTF {#1} \CJKglue
{
- \nobreak
+ \xeCJK_no_break:
\xeCJK_punct_if_middle:NT {#1}
{
\xeCJK_punct_glue:n { r/#1 }
@@ -569,25 +560,25 @@
\tl_gset:Nx \l_xeCJK_lastpunct_tl {#1}
\CJKpunctsymbol {#1}
}
-\cs_new_nopar:Nn \xeCJK_FullLeft_and_FullLeft:N
+\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullLeft:N #1
{
- \nobreak
+ \xeCJK_no_break:
\xeCJK_get_punct_bounds:nN { l } {#1}
\xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
\xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
\xeCJK_before_FullLeft:N {#1}
}
-\cs_new_nopar:Nn \xeCJK_FullLeft_and_FullRight:N
+\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullRight:N #1
{
- \nobreak
+ \xeCJK_no_break:
\xeCJK_get_punct_bounds:nN { r } {#1}
\xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
\xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
- \nobreak
+ \xeCJK_no_break:
\tl_set:Nx \l_xeCJK_lastpunct_tl {#1}
\CJKpunctsymbol {#1}
}
-\cs_new_nopar:Nn \xeCJK_FullRight_and_FullLeft:N
+\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullLeft:N #1
{
\xeCJK_punct_rule:n { r/\l_xeCJK_lastpunct_tl }
\xeCJK_get_punct_bounds:nN { l } {#1}
@@ -596,28 +587,28 @@
\xeCJK_punct_nobreak:
\xeCJK_before_FullLeft:N {#1}
}
-\cs_new_nopar:Nn \xeCJK_FullRight_and_FullRight:N
+\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullRight:N #1
{
\xeCJK_punct_rule:n { r/\l_xeCJK_lastpunct_tl }
\xeCJK_get_punct_bounds:nN { r } {#1}
\xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
\xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
- \nobreak
+ \xeCJK_no_break:
\tl_set:Nx \l_xeCJK_lastpunct_tl {#1}
\CJKpunctsymbol {#1}
}
- \prg_new_conditional:Nnn \xeCJK_if_last_node:n { p , T , F , TF }
+ \prg_new_conditional:Npnn \xeCJK_if_last_node:n #1 { p , T , F , TF }
{
\if_dim:w \dim_use:c { c_xeCJK_#1_node_dim } = \tex_lastkern:D
\prg_return_true: \else: \prg_return_false: \fi:
}
-\cs_new_nopar:Nn \xeCJK_def_node:nn
+\cs_new_protected_nopar:Npn \xeCJK_def_node:nn #1#2
{
\dim_if_exist:cTF { c_xeCJK_#1_node_dim }
{ \dim_gset:cn } { \dim_const:cn }
{ c_xeCJK_#1_node_dim } {#2}
}
-\cs_new_protected_nopar:Nn \xeCJK_make_node:n
+\cs_new_protected_nopar:Npn \xeCJK_make_node:n #1
{
\tex_kern:D - \dim_use:c { c_xeCJK_#1_node_dim }
\tex_kern:D \dim_use:c { c_xeCJK_#1_node_dim }
@@ -676,7 +667,7 @@
\bool_set_false:N \l_xeCJK_space_bool
\cs_set_eq:NN \xeCJK_ignorespaces: \xeCJK_ignore_spaces:
}
-\cs_new_nopar:Nn \xeCJK_ignore_spaces:
+\cs_new_protected_nopar:Npn \xeCJK_ignore_spaces:
{
\peek_catcode:NTF \c_space_token
{
@@ -701,7 +692,7 @@
}
}
}
-\cs_new_nopar:Nn \xeCJK_peek_math:
+\cs_new_protected_nopar:Npn \xeCJK_peek_math:
{
\peek_catcode:NTF \c_space_token
{
@@ -744,7 +735,7 @@
\cs_set_eq:NN \xeCJK_CJK_and_CJK:N \xeCJK_checksingle_save_CJKsymbol:N
}
}
-\cs_new_nopar:Nn \xeCJK_checksingle:N
+\cs_new_protected_nopar:Npn \xeCJK_checksingle:N #1
{
\peek_catcode:NTF \c_catcode_other_token
{ \xeCJK_checksingle:NN {#1} }
@@ -752,15 +743,15 @@
\bool_if:nTF
{
! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) &&
- \tl_if_empty_p:x { \token_get_arg_spec:c { l_peek_token } } &&
+ \xeCJK_if_blank_x_p:n { \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 }
+ \exp_args:NNc \exp_after:wN \token_if_other_p:N { l_peek_token }
}
{ \xeCJK_checksingle:NN {#1} }
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} }
}
}
-\cs_new_nopar:Nn \xeCJK_checksingle:NN
+\cs_new_protected_nopar:Npn \xeCJK_checksingle:NN #1#2
{
\peek_catcode:NTF \c_catcode_other_token
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 }
@@ -793,22 +784,22 @@
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 }
}
}
-\cs_new_nopar:Nn \xeCJK_checksingle:NNN
+\cs_new_protected_nopar:Npn \xeCJK_checksingle:NNN #1#2#3
{
\bool_if:nTF
{
\token_if_eq_meaning_p:NN \l_peek_token \par ||
\token_if_eq_meaning_p:NN \l_peek_token \[ % \]
}
- { \CJKsymbol {#1} \nobreak #2 }
+ { \CJKsymbol {#1} \xeCJK_no_break: #2 }
{ \xeCJK_checksingle_env:NNN {#1} {#2} {#3} }
}
-\cs_new_nopar:Nn \xeCJK_checksingle_env:NNN
+\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNN #1#2#3
{
\peek_catcode_remove:NTF \c_math_toggle_token
{
\peek_catcode:NTF \c_math_toggle_token
- { \CJKsymbol {#1} \nobreak #2 \c_math_toggle_token }
+ { \CJKsymbol {#1} \xeCJK_no_break: #2 \c_math_toggle_token }
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 \c_math_toggle_token }
}
{
@@ -821,11 +812,11 @@
}
}
}
-\cs_new_nopar:Nn \xeCJK_checksingle_env:NNNNn
+\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNNNn #1#2#3#4#5
{
\clist_if_in:NnTF \g_xeCJK_inline_env_clist {#5}
{ \xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 }
- { \CJKsymbol {#1} \nobreak #2 }
+ { \CJKsymbol {#1} \xeCJK_no_break: #2 }
\scan_stop: #4 {#5}
}
\keys_define:nn { xeCJK / options }
@@ -849,44 +840,49 @@
\cs_generate_variant:Nn \token_if_math_toggle:NTF { c }
\tl_new:N \xeCJK_UL_subclass_patch_tl
\clist_new:N \g_xeCJK_CJK_subclass_clist
-\cs_new_nopar:Nn \xeCJK_erase_CJKsymbol:
+\cs_new_protected_nopar:Npn \xeCJK_erase_CJKsymbol:
{
\cs_gset_eq:NN \CJKsymbol_Block \CJKsymbol
\cs_gset_eq:NN \CJKsymbol \prg_do_nothing:
}
-\cs_new_nopar:Nn \xeCJK_restore_CJKsymbol:
+\cs_new_protected_nopar:Npn \xeCJK_restore_CJKsymbol:
{
\cs_gset_eq:NN \CJKsymbol \CJKsymbol_Block
\CJKsymbol
}
-\NewDocumentCommand \xeCJKDeclareSubCJKBlock { m m }
- { \xeCJKDeclareSubCharClass { CJK } {#1} {#2} }
+\NewDocumentCommand \xeCJKDeclareSubCJKBlock { s m m }
+ {
+ \xeCJKDeclareSubCharClass { CJK } {#2} {#3}
+ \IfBooleanT {#1} { \xeCJKResetPunctClass }
+ }
\@onlypreamble \xeCJKDeclareSubCJKBlock
\bool_new:N \l_xeCJK_sub_cancel_bool
-\NewDocumentCommand \xeCJKCancelSubCJKBlock { m }
+\NewDocumentCommand \xeCJKCancelSubCJKBlock { s m }
{
\bool_if:NF \l_xeCJK_sub_cancel_bool
{
\bool_set_true:N \l_xeCJK_sub_cancel_bool
- \xeCJK_sub_restore_or_cancel:n {#1}
+ \xeCJK_sub_restore_or_cancel:n {#2}
+ \IfBooleanT {#1} { \xeCJKResetPunctClass }
}
}
-\NewDocumentCommand \xeCJKRestoreSubCJKBlock { m }
+\NewDocumentCommand \xeCJKRestoreSubCJKBlock { s m }
{
\bool_if:NT \l_xeCJK_sub_cancel_bool
{
\bool_set_false:N \l_xeCJK_sub_cancel_bool
- \xeCJK_sub_restore_or_cancel:n {#1}
+ \xeCJK_sub_restore_or_cancel:n {#2}
+ \IfBooleanT {#1} { \xeCJKResetPunctClass }
}
}
-\cs_new_nopar:Nn \xeCJK_sub_restore_or_cancel:n
+\cs_new_protected_nopar:Npn \xeCJK_sub_restore_or_cancel:n #1
{
\clist_map_inline:xn {#1}
{
\cs_if_free:cTF { xeCJK_ CJK/##1 _class }
{ \xeCJK_error:nx { SubBlock-undefined } {##1} }
{
- \xeCJKDeclareCharClass
+ \xeCJK_declare_char_class:nn
{ CJK \bool_if:NF \l_xeCJK_sub_cancel_bool { /##1 } }
{ \tl_use:c { g_xeCJK_CJK/##1_range_clist } }
}
@@ -908,10 +904,10 @@
\xeCJK_new_sub_key:n {#2}
\xeCJK_UL_subclass_patch:nn {#1} {#2}
}
- \xeCJKDeclareCharClass { #1/#2 } {#3}
+ \xeCJK_declare_char_class:nn { #1/#2 } {#3}
}
\@onlypreamble \xeCJKDeclareSubCharClass
-\cs_new_nopar:Nn \xeCJK_set_sub_class_toks:nn
+\cs_new_protected_nopar:Npn \xeCJK_set_sub_class_toks:nn #1#2
{
\clist_map_inline:Nn \g_xeCJK_base_class_clist
{
@@ -950,7 +946,7 @@
{ \xeCJK_switch_font:nn {#2} {#1} }
}
}
-\cs_new_nopar:Nn \xeCJK_UL_subclass_patch:nn
+\cs_new_protected_nopar:Npn \xeCJK_UL_subclass_patch:nn #1#2
{
\tl_put_right:Nn \xeCJK_UL_subclass_patch_tl
{
@@ -1021,28 +1017,28 @@
\NewDocumentCommand \xeCJKallowbreakbetweenpuncts { }
{ \cs_set_eq:NN \xeCJK_punct_nobreak: \xeCJK_zero_glue: }
\NewDocumentCommand \xeCJKnobreakbetweenpuncts { }
- { \cs_set_eq:NN \xeCJK_punct_nobreak: \nobreak }
-\cs_new_protected_nopar:Nn \xeCJK_zero_glue: { \skip_horizontal:N \c_zero_skip }
+ { \cs_set_eq:NN \xeCJK_punct_nobreak: \xeCJK_no_break: }
+\cs_new_protected_nopar:Npn \xeCJK_zero_glue: { \skip_horizontal:N \c_zero_skip }
\clist_set:Nn \g_xeCJK_special_ps_clist { mixedwidth , long , middle }
\clist_map_inline:Nn \g_xeCJK_special_ps_clist
{
\tl_new:c { l_xeCJK_#1_punct_tl }
\prop_new:c { l_xeCJK_#1_punct_prop }
}
-\cs_new_nopar:Nn \xeCJK_set_special_punct:nn
+\cs_new_protected_nopar:Npn \xeCJK_set_special_punct:nn #1#2
{
\tl_set:cx { l_xeCJK_#1_punct_tl } {#2}
\prop_clear:c { l_xeCJK_#1_punct_prop }
\tl_map_inline:cn { l_xeCJK_#1_punct_tl }
{ \prop_put:cnn { l_xeCJK_#1_punct_prop } {##1} { } }
}
-\cs_new_nopar:Nn \xeCJK_add_special_punct:nn
+\cs_new_protected_nopar:Npn \xeCJK_add_special_punct:nn #1#2
{
\tl_put_right:cx { l_xeCJK_#1_punct_tl } {#2}
\tl_map_inline:cn { l_xeCJK_#1_punct_tl }
{ \prop_put:cnn { l_xeCJK_#1_punct_prop } {##1} { } }
}
-\cs_new_nopar:Nn \xeCJK_sub_special_punct:nn
+\cs_new_protected_nopar:Npn \xeCJK_sub_special_punct:nn #1#2
{
\tl_map_inline:xn {#2}
{
@@ -1055,7 +1051,7 @@
\cs_generate_variant:Nn \dim_add:Nn { Nc }
\cs_generate_variant:Nn \dim_set_min:Nn { Nc }
\tl_set:Nn \l_xeCJK_punct_coor_tl { \l_xeCJK_font_coor_tl/\l_xeCJK_punctstyle_tl }
-\cs_new_nopar:Nn \xeCJK_get_punct_bounds:nN
+\cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:nN #1#2
{
\tl_if_exist:cF { \l_xeCJK_punct_coor_tl/rule/#1/#2 }
{
@@ -1082,7 +1078,7 @@
{
\cs_if_exist_use:cF { g_xeCJK_punct_width/#2 }
{
- \xeCJK_tl_if_blank:xTF \g_xeCJK_punct_width_tl
+ \xeCJK_if_blank_x:nTF \g_xeCJK_punct_width_tl
{ \c_zero_dim }
{ \g_xeCJK_punct_width_tl }
}
@@ -1154,12 +1150,12 @@
\cs_generate_variant:Nn \xeCJK_get_punct_bounds:nN { nV }
\NewDocumentCommand \xeCJKsetwidth { m m }
{ \tl_map_inline:xn {#1} { \tl_gset:cn { g_xeCJK_punct_width/##1 } {#2} } }
-\prg_new_conditional:Nnn \xeCJK_punct_if_right:N { p , T , F , TF }
+\prg_new_conditional:Npnn \xeCJK_punct_if_right:N #1 { p , T , F , TF }
{
\tl_if_exist:cTF { \l_xeCJK_punct_coor_tl/glue/r/#1 }
\prg_return_true: \prg_return_false:
}
-\prg_new_conditional:Nnn \xeCJK_punct_if_both_left_right:NN { p , T , F , TF }
+\prg_new_conditional:Npnn \xeCJK_punct_if_both_left_right:NN #1#2 { p , T , F , TF }
{
\bool_if:nTF
{
@@ -1170,16 +1166,16 @@
}
\prg_return_true: \prg_return_false:
}
-\cs_generate_variant:Nn \prg_new_conditional:Nnn { c }
+\cs_generate_variant:Nn \prg_new_conditional:Npnn { c }
\clist_map_inline:Nn \g_xeCJK_special_ps_clist
{
- \prg_new_conditional:cnn { xeCJK_punct_if_#1:N } { p , T , F , TF }
+ \prg_new_conditional:cpnn { xeCJK_punct_if_#1:N } ##1 { p , T , F , TF }
{
\prop_if_in:cnTF { l_xeCJK_#1_punct_prop } {##1}
\prg_return_true: \prg_return_false:
}
}
-\cs_new_nopar:Nn \xeCJK_get_kern:NN
+\cs_new_protected_nopar:Npn \xeCJK_get_kern:NN #1#2
{
\tl_if_exist:cF { \l_xeCJK_punct_coor_tl/kern/#1-#2 }
{
@@ -1193,7 +1189,7 @@
\tl_gset:cV { \l_xeCJK_punct_coor_tl/kern/#1-#2 } \l_xeCJK_tmpa_dim
}
}
-\cs_new_nopar:Nn \xeCJK_calc_kern:NN
+\cs_new_protected_nopar:Npn \xeCJK_calc_kern:NN #1#2
{
\tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c_xeCJK_ps_marginkerning_tl
{
@@ -1245,7 +1241,7 @@
\dim_set_max:Nn \l_xeCJK_tmpa_dim \c_zero_dim
}
\cs_generate_variant:Nn \xeCJK_get_kern:NN { V }
-\cs_new_nopar:Nn \xeCJK_calc_kern:NnNN
+\cs_new_protected_nopar:Npn \xeCJK_calc_kern:NnNN #1#2#3#4
{
\dim_set:Nn #1
{
@@ -1260,7 +1256,7 @@
{ + \tl_use:c { \l_xeCJK_punct_coor_tl/rule/m/#4 } }
}
}
-\cs_new_nopar:Nn \xeCJK_get_punct_dimen:N
+\cs_new_protected_nopar:Npn \xeCJK_get_punct_dimen:N #1
{
\xeCJK_get_glyph_bounds:nNN { left } {#1} \l_xeCJK_tmpa_dim
\tl_gset:cV { \l_xeCJK_punct_coor_tl/bound/l/#1 } \l_xeCJK_tmpa_dim
@@ -1286,7 +1282,7 @@
}
}
}
-\cs_new_nopar:Nn \xeCJK_get_glyph_bounds:nNN
+\cs_new_protected_nopar:Npn \xeCJK_get_glyph_bounds:nNN #1#2#3
{
\dim_set:Nn #3
{
@@ -1328,7 +1324,7 @@
\cs_set_eq:NN \CJKsymbol \xeCJK_fallback_save_CJKsymbol:N
}
}
-\cs_new_nopar:Nn \xeCJK_fallback_testsymbol:N
+\cs_new_protected_nopar:Npn \xeCJK_fallback_testsymbol:N #1
{
\font_glyph_if_exist:NnTF \tex_font:D {`#1}
{ \xeCJK_fallback_save_CJKsymbol:N {#1} }
@@ -1357,7 +1353,7 @@
{ \xeCJK_set_family_fallback:nnn {#1} {#2} {#3} }
{ \xeCJK_set_family:nnn { #1/FallBack } {#2} {#3} }
}
-\cs_new_nopar:Nn \xeCJK_set_family_fallback:nnn
+\cs_new_protected_nopar:Npn \xeCJK_set_family_fallback:nnn #1#2#3
{
\group_begin:
\tl_set:Nx \l_xeCJK_family_fb_tl {#1}
@@ -1411,14 +1407,14 @@
}
\cs_generate_variant:Nn \keys_set_known:nnN { nx }
\clist_new:N \g_xeCJK_sub_key_clist
-\cs_new_nopar:Nn \xeCJK_new_sub_key:n
+\cs_new_protected_nopar:Npn \xeCJK_new_sub_key:n #1
{
\clist_gput_right:Nx \g_xeCJK_sub_key_clist {#1}
\keys_define:nn { xeCJK / features }
{
#1 .code:n =
{
- \xeCJK_tl_if_blank:xTF {##1}
+ \xeCJK_if_blank_x:nTF {##1}
{
\bool_set_false:c { l_xeCJK_copy_#1_bool }
\bool_set_false:c { l_xeCJK_add_#1_bool }
@@ -1442,7 +1438,7 @@
}
}
\cs_generate_variant:Nn \xeCJK_new_sub_key:n { x }
-\cs_new_nopar:Nn \xeCJK_get_sub_features:nn
+\cs_new_protected_nopar:Npn \xeCJK_get_sub_features:nn #1#2
{
\tl_set:Nx \l_xeCJK_tmpa_tl {#2}
\clist_clear:N \l_xeCJK_sub_fontfeat_clist
@@ -1450,35 +1446,35 @@
\exp_args:No \tl_if_head_eq_charcode:nNTF \l_xeCJK_tmpa_tl [ % ]
{
\exp_after:wN \xeCJK_get_sub_features_aux:n \l_xeCJK_tmpa_tl \c_empty_tl
- \xeCJK_tl_if_blank:xT \l_xeCJK_sub_fontname_tl
+ \xeCJK_if_blank_x:nT \l_xeCJK_sub_fontname_tl
{
\tl_set:Nx \l_xeCJK_sub_fontname_tl \l_xeCJK_tmpa_tl
\clist_clear:N \l_xeCJK_sub_fontfeat_clist
}
}
{ \tl_set:Nx \l_xeCJK_sub_fontname_tl \l_xeCJK_tmpa_tl }
- \xeCJK_tl_if_blank:xTF \l_xeCJK_sub_fontname_tl
+ \xeCJK_if_blank_x:nTF \l_xeCJK_sub_fontname_tl
{ \tl_set:Nx \l_xeCJK_sub_fontname_tl \l_xeCJK_fontname_tl }
{ \tl_replace_all:Nnx \l_xeCJK_sub_fontname_tl * \l_xeCJK_fontname_tl }
\clist_set:cx { l_xeCJK_#1_fontfeat_clist } \l_xeCJK_sub_fontfeat_clist
\tl_set:cx { l_xeCJK_#1_fontname_tl } \l_xeCJK_sub_fontname_tl
}
-\cs_new_nopar:Nn \xeCJK_gobble_brace:N
+\cs_new_protected_nopar:Npn \xeCJK_gobble_brace:N #1
{
- \exp_args:No \tl_if_head_group:nT #1
+ \exp_args:No \tl_if_head_is_group:nT #1
{
\exp_last_unbraced:NNo \tl_set:Nn #1 #1
\xeCJK_gobble_brace:N #1
}
}
-\cs_new_nopar:Npn \xeCJK_get_sub_features_aux:n [#1] #2
+\cs_new_protected_nopar:Npn \xeCJK_get_sub_features_aux:n [#1] #2
{
\clist_set:Nx \l_xeCJK_sub_fontfeat_clist {#1}
\tl_set:Nx \l_xeCJK_sub_fontname_tl {#2}
}
\xeCJK_new_sub_key:n { FallBack }
-\cs_new_nopar:Nn \xeCJK_map_features_id:n
- { \prop_get:Nn \g_xeCJK_features_id_prop { #1 } }
+\cs_new_nopar:Npn \xeCJK_map_features_id:n #1
+ { \prop_get:Nn \g_xeCJK_features_id_prop {#1} }
\prop_new:N \g_xeCJK_features_id_prop
\prop_put:Nnn \g_xeCJK_features_id_prop { bf } { Bold }
\prop_put:Nnn \g_xeCJK_features_id_prop { it } { Italic }
@@ -1525,7 +1521,7 @@
\tl_set:Nx \l_xeCJK_monoscale_tl { Scale = { \fp_use:N \g_xeCJK_monoscale_fp } }
}
}
-\cs_new_nopar:Nn \xeCJK_set_init:
+\cs_new_protected_nopar:Npn \xeCJK_set_init:
{
\tl_clear:N \l_xeCJK_monoscale_tl
\int_gincr:N \g_xeCJK_fontspec_int
@@ -1547,7 +1543,7 @@
\fp_set_eq:NN \l_xeCJK_EmboldenFactor_fp \g_xeCJK_EmboldenFactor_fp
\fp_set_eq:NN \l_xeCJK_SlantFactor_fp \g_xeCJK_SlantFactor_fp
}
-\cs_new_protected_nopar:Nn \xeCJK_set_family:nnn
+\cs_new_protected_nopar:Npn \xeCJK_set_family:nnn #1#2#3
{
\group_begin:
\xeCJK_set_init:
@@ -1578,7 +1574,7 @@
\group_end:
}
\cs_generate_variant:Nn \xeCJK_set_family:nnn { ncc }
-\cs_new_nopar:Nn \xeCJK_check_family:n
+\cs_new_protected_nopar:Npn \xeCJK_check_family:n #1
{
\prop_get:NnNT \g_xeCJK_family_prop {#1} \l_xeCJK_tmpa_tl
{
@@ -1588,12 +1584,12 @@
}
\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
+\cs_new_protected_nopar:Npn \xeCJK_add_font:nn #1#2
{
\prop_put:Nxx \l_xeCJK_add_font_prop
{ \xeCJK_map_features_id:n {#1} Font } {#2}
}
-\cs_new_nopar:Nn \xeCJK_add_font_if_new:nn
+\cs_new_protected_nopar:Npn \xeCJK_add_font_if_new:nn #1#2
{
\prop_put_if_new:Nxx \l_xeCJK_add_font_prop
{ \xeCJK_map_features_id:n {#1} Font } {#2}
@@ -1605,19 +1601,19 @@
\cs_generate_variant:Nn \prop_get:NnNF { 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
+\cs_new_protected_nopar:Npn \xeCJK_add_fake_bold:n #1
{
\clist_put_left:cx { l_xeCJK_fontfeat_#1_clist }
{ FakeBold = { \fp_use:N \l_xeCJK_EmboldenFactor_fp } }
}
-\cs_new_nopar:Nn \xeCJK_add_fake_slant:n
+\cs_new_protected_nopar:Npn \xeCJK_add_fake_slant:n #1
{
\clist_put_left:cx { l_xeCJK_fontfeat_#1_clist }
{ FakeSlant = { \fp_use:N \l_xeCJK_SlantFactor_fp } }
}
-\cs_new_nopar:Nn \xeCJK_parse_features:
+\cs_new_protected_nopar:Npn \xeCJK_parse_features:
{ \prop_map_inline:Nn \g_xeCJK_features_id_prop { \xeCJK_parse_features:n {##1} } }
-\cs_new_nopar:Nn \xeCJK_parse_features:n
+\cs_new_protected_nopar:Npn \xeCJK_parse_features:n #1
{
\xeCJK_if_font_select:nTF {#1}
{
@@ -1640,17 +1636,17 @@
}
{ \xeCJK_set_fake:n {#1} }
}
-\prg_new_conditional:Nnn \xeCJK_if_font_select:n { p, T, F, TF }
+\prg_new_conditional:Npnn \xeCJK_if_font_select:n #1 { p, T, F, TF }
{
- \exp_args:Nc \xeCJK_tl_if_blank:xTF { l_xeCJK_fontname_#1_tl }
+ \exp_args:Nc \xeCJK_if_blank_x:nTF { l_xeCJK_fontname_#1_tl }
\prg_return_false: \prg_return_true:
}
-\prg_new_conditional:Nnn \xeCJK_if_it_or_sl:n { p, T, F, TF }
+\prg_new_conditional:Npnn \xeCJK_if_it_or_sl:n #1 { p, T, F, TF }
{
\bool_if:nTF { \str_if_eq_x_p:nn { it } {#1} || \str_if_eq_x_p:nn { sl } {#1} }
\prg_return_true: \prg_return_false:
}
-\cs_new_nopar:Nn \xeCJK_set_fake:n
+\cs_new_protected_nopar:Npn \xeCJK_set_fake:n #1
{
\str_if_eq_x:nnTF {#1} { bf }
{ \bool_if:NT \l_xeCJK_AutoFakeBold_bool { \xeCJK_add_fake_bold:n {#1} } }
@@ -1674,7 +1670,7 @@
}
\xeCJK_add_font_if_new:nn {#1} *
}
-\cs_new_nopar:Nn \xeCJK_map_it_sl:n
+\cs_new_protected_nopar:Npn \xeCJK_map_it_sl:n #1
{
\xeCJK_if_map_font_select:nT {#1}
{
@@ -1683,14 +1679,14 @@
{ \xeCJK_add_font_if_new:nx {bf#1} { \xeCJK_get_map_font:n {#1} } }
}
}
-\cs_new_nopar:Nn \xeCJK_get_map_font:n
+\cs_new_nopar:Npn \xeCJK_get_map_font:n #1
{ \tl_use:c { l_xeCJK_fontname_\str_if_eq_x:nnTF {#1} {it} {sl} {it} _tl } }
-\prg_new_conditional:Nnn \xeCJK_if_map_font_select:n { p, T, F, TF }
+\prg_new_conditional:Npnn \xeCJK_if_map_font_select:n #1 { p, T, F, TF }
{
- \xeCJK_tl_if_blank:xTF { \xeCJK_get_map_font:n {#1} }
+ \xeCJK_if_blank_x:nTF { \xeCJK_get_map_font:n {#1} }
\prg_return_false: \prg_return_true:
}
-\cs_new_nopar:Nn \xeCJK_pass_features:
+\cs_new_protected_nopar:Npn \xeCJK_pass_features:
{
\prop_map_inline:Nn \g_xeCJK_features_id_prop
{
@@ -1702,13 +1698,13 @@
}
\prop_map_inline:Nn \l_xeCJK_add_font_prop
{ \clist_put_right:Nx \l_xeCJK_pass_features_clist { ##1 = { ##2 } } }
- \xeCJK_tl_if_blank:xF \l_xeCJK_monoscale_tl
+ \xeCJK_if_blank_x:nF \l_xeCJK_monoscale_tl
{ \clist_put_right:Nx \l_xeCJK_pass_features_clist \l_xeCJK_monoscale_tl }
}
\prop_new:N \g_xeCJK_family_prop
\prop_new:N \g_xeCJK_family_name_prop
\prop_new:N \g_xeCJK_family_options_prop
-\cs_new_nopar:Nn \xeCJK_save_family_info:
+\cs_new_protected_nopar:Npn \xeCJK_save_family_info:
{
\group_begin:
\clist_map_inline:Nn \g_xeCJK_CJK_subclass_clist
@@ -1720,7 +1716,7 @@
\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:
+\cs_new_protected_nopar:Npn \xeCJK_add_sub_block:
{
\clist_remove_duplicates:N \l_xeCJK_sub_key_clist
\clist_map_inline:Nn \l_xeCJK_sub_key_clist
@@ -1763,7 +1759,7 @@
}
}
}
-\cs_new_nopar:Nn \xeCJK_copy_family:nn
+\cs_new_protected_nopar:Npn \xeCJK_copy_family:nn #1#2
{
\xeCJK_family_if_exist:xT {#2}
{
@@ -1775,17 +1771,19 @@
}
\cs_generate_variant:Nn \xeCJK_copy_family:nn { xx }
\tl_set:Nn \l_xeCJK_font_coor_tl { xeCJK/\xeCJK@family/\f@series/\f@shape/\f@size }
-\cs_new_nopar:Nn \xeCJK_select_font:
+\cs_new_protected_nopar:Npn \xeCJK_select_font:
{
- \cs_if_exist_use:cF \l_xeCJK_font_coor_tl
+ \cs_if_exist_use:cF { \l_xeCJK_font_coor_tl }
{
\tl_set:Nx \l_xeCJK_current_coor_tl \l_xeCJK_font_coor_tl
- \cs_if_exist_use:cT { xeCJK/family/\xeCJK@family }
- { \exp_last_unbraced:NNV \cs_gset_eq:cN \l_xeCJK_current_coor_tl \tex_font:D }
+ \xeCJK_family_if_exist:xTF { \xeCJK@family }
+ { \use:c { xeCJK/family/\xeCJK@family } }
+ { \use_none:nnnn }
+ \exp_last_unbraced:NNV \cs_gset_eq:cN \l_xeCJK_current_coor_tl \tex_font:D
}
}
\cs_new_eq:NN \xeCJK@setfont \xeCJK_select_font:
-\cs_new_nopar:Nn \xeCJK_switch_font:nn
+\cs_new_protected_nopar:Npn \xeCJK_switch_font:nn #1#2
{
\str_if_eq_x:nnF {#1} {#2}
{
@@ -1806,17 +1804,20 @@
\xeCJK_select_font:
}
\xeCJK_msg_new:nn { CJK-block } { Switch~from~block~'#1'~to~'#2'. }
-\prg_new_protected_conditional:Nnn \xeCJK_family_if_exist:x { T, F, TF }
+\prg_new_protected_conditional:Npnn \xeCJK_family_if_exist:x #1 { T, F, TF }
{
- \cs_if_free:cTF { xeCJK/family/#1 } \prg_return_false:
+ \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_get:NxNF \g_xeCJK_family_name_prop {#1} \l_xeCJK_family_name_tl
+ { \use:c { xeCJK/family/#1 } }
\prg_return_true:
}
}
+\cs_generate_variant:Nn \prop_get:NnNTF { Nx }
\NewDocumentCommand \CJKfamily { m }
{
- \xeCJK_family_if_exist:xTF {#1}
+ \cs_if_exist:cTF { xeCJK/family/#1 }
{ \tl_set:Nx \xeCJK@family {#1} }
{
\seq_if_in:NxF \g_xeCJK_unknown_family_seq {#1}
@@ -1870,6 +1871,7 @@
\clist_new:N \g_xeCJK_default_features_clist
\NewDocumentCommand \defaultCJKfontfeatures { m }
{ \clist_gset:Nn \g_xeCJK_default_features_clist {#1} }
+\defaultCJKfontfeatures { Script = CJK }
\@onlypreamble \defaultCJKfontfeatures
\NewDocumentCommand \addCJKfontfeatures { m }
{
@@ -1954,7 +1956,7 @@
\repeat
}
\cs_new_eq:NN \xeCJK_math_type:n \mathchar@type
-\cs_new_nopar:Nn \xeCJK_set_mathfont:
+\cs_new_protected_nopar:Npn \xeCJK_set_mathfont:
{
\xeCJK_family_if_exist:xTF \c_xeCJK_math_tl
{ \tl_set:Nx \l_xeCJK_tmpa_tl \c_xeCJK_math_tl }
@@ -1973,7 +1975,7 @@
{
\clist_map_inline:cn { g_xeCJK_##1_range_clist }
{
- \xeCJK_setcharclass_aux:Nn \xeCJKsetmathcode {####1}
+ \xeCJK_set_char_class_aux:Nn \xeCJKsetmathcode {####1}
\mathalpha \c_xeCJK_math_tl
}
}
@@ -2001,7 +2003,7 @@
\xeCJK_set_monoscale:
\addCJKfontfeatures { Scale = \fp_use:N \g_xeCJK_monoscale_fp }
}
-\cs_new_nopar:Nn \xeCJK_set_monoscale:
+\cs_new_protected_nopar:Npn \xeCJK_set_monoscale:
{
\group_begin:
\fontfamily \ttdefault \selectfont
@@ -2010,7 +2012,7 @@
\group_end:
}
\NewDocumentCommand \setCJKmonoexspace { } { \xeCJK_set_monoexspace: }
-\cs_new_nopar:Nn \xeCJK_set_monoexspace:
+\cs_new_protected_nopar:Npn \xeCJK_set_monoexspace:
{
\group_begin:
\fontfamily \ttdefault \selectfont
@@ -2073,24 +2075,26 @@
{
\msg_redirect_module:nnn { xeCJK } { warning } { info }
\msg_redirect_module:nnn { xeCJK } { info } { none }
- \PassOptionsToPackage { quiet } { fontspec }
+ \xeCJK_if_package_loaded:nF { fontspec }
+ { \PassOptionsToPackage { quiet } { fontspec } }
},
silent .code:n =
{
\msg_redirect_module:nnn { xeCJK } { warning } { none }
\msg_redirect_module:nnn { xeCJK } { info } { none }
- \PassOptionsToPackage { silent } { fontspec }
+ \xeCJK_if_package_loaded:nF { fontspec }
+ { \PassOptionsToPackage { silent } { fontspec } }
},
unknown .code:n =
{
- \@ifpackageloaded { fontspec }
+ \xeCJK_if_package_loaded:nTF { fontspec }
{ \xeCJK_error:nx { key-unknown } { \l_keys_key_tl } }
{ \PassOptionsToPackage { \l_keys_key_tl } { fontspec } }
},
}
\xeCJK_msg_new:nn { key-unknown }
{
- Sorry,~but~\l_keys_module_tl\c_space_tl does~not~have~a~key~called~'#1'.\\\\
+ Sorry,~but~\l__keys_module_tl\c_space_tl does~not~have~a~key~called~'#1'.\\\\
The~key~'#1'~is~being~ignored.
}
\keys_set:nn { xeCJK / options }
@@ -2130,10 +2134,10 @@
\NewDocumentCommand \xeCJKsetslantfactor { m }
{ \xeCJKsetup { SlantFactor = {#1} } }
\NewDocumentCommand \punctstyle { m } { \xeCJKsetup { PunctStyle = {#1} } }
-\cs_new_nopar:Npn \xeCJKplainchr { \punctstyle { plain } }
+\NewDocumentCommand \xeCJKplainchr { } { \punctstyle { plain } }
\NewDocumentCommand \CJKsetecglue { m } { \xeCJKsetup { CJKecglue = {#1} } }
\cs_new_eq:NN \xeCJKsetecglue \CJKsetecglue
-\cs_new_nopar:Nn \xeCJK_fix_itcorr:
+\cs_new_protected_nopar:Npn \xeCJK_fix_itcorr:
{
\scan_stop:
\xeCJK_if_last_node:nTF { default }
@@ -2154,18 +2158,16 @@
\xeCJK_AfterEndPreamble:n
{
\int_compare:nNnF
- { \c_three + \seq_count:N \g_xeCJK_class_seq } = \xe@alloc@intercharclass
+ { \c_three + ( \seq_count:N \g_xeCJK_class_seq ) } = \xe@alloc@intercharclass
{
- \int_set_eq:NN \l_xeCJK_tmpa_int \c_three
- \int_until_do:nNnn \l_xeCJK_tmpa_int = \xe@alloc@intercharclass
+ \int_step_inline:nnnn \c_four \c_one \xe@alloc@intercharclass
{
- \int_incr:N \l_xeCJK_tmpa_int
- \seq_if_in:NVF \g_xeCJK_class_seq \l_xeCJK_tmpa_int
- { \xeCJK_set_others_toks:n \l_xeCJK_tmpa_int }
+ \seq_if_in:NnF \g_xeCJK_class_seq {#1}
+ { \xeCJK_set_others_toks:n {#1} }
}
}
}
-\cs_new_nopar:Nn \xeCJK_set_others_toks:n
+\cs_new_protected_nopar:Npn \xeCJK_set_others_toks:n #1
{
\int_set:Nn \xeCJK_Others_class {#1}
\clist_map_inline:Nn \g_xeCJK_CJK_class_clist
@@ -2176,12 +2178,12 @@
{ \xeCJK_get_inter_class_toks:nn { Default } { Others } }
\exp_args:Nnnx \xeCJK_pre_inter_class_toks:nnn { Others } {##1}
{ \xeCJK_get_inter_class_toks:nn { Others } { Default } }
- \tl_if_empty:xT { \xeCJK_get_inter_class_toks:nn { Others } { Boundary } }
+ \xeCJK_if_blank_x:nT { \xeCJK_get_inter_class_toks:nn { Others } { Boundary } }
{
\xeCJK_copy_inter_class_toks:nnnn
{ Others } { Boundary } { Default } { Boundary }
}
- \tl_if_empty:xT { \xeCJK_get_inter_class_toks:nn { Boundary } { Others } }
+ \xeCJK_if_blank_x:nT { \xeCJK_get_inter_class_toks:nn { Boundary } { Others } }
{
\xeCJK_copy_inter_class_toks:nnnn
{ Boundary } { Others } { Boundary } { Default }
@@ -2189,7 +2191,7 @@
}
}
\int_new:N \xeCJK_Others_class
-\cs_new_nopar:Nn \xeCJK_patch:Nnn
+\cs_new_protected_nopar:Npn \xeCJK_patch:Nnn #1#2#3
{ \tl_put_left:Nn #1 {#2} \tl_put_right:Nn #1 {#3} }
\xeCJK_AfterPreamble:n
{
@@ -2198,18 +2200,41 @@
\textellipsis \textemdash \textperiodcentered \textcentereddot
\textquoteleft \textquoteright \textquotedblleft \textquotedblright
}
- { \xeCJK_patch:Nnn #1 { \group_begin: \makexeCJKinactive } { \group_end: } }
+ {
+ \xeCJK_patch:Nnn #1
+ { \xeCJK_group_begin: \makexeCJKinactive }
+ { \xeCJK_group_end: }
+ }
\xeCJK_patch:Nnn \tipaencoding { \makexeCJKinactive } { }
\cs_set_eq:NN \xeCJK_aux_r \r
- \cs_set_nopar:Npn \r #1 { { \makexeCJKinactive \xeCJK_aux_r {#1} } }
- \@ifpackageloaded { pifont }
+ \cs_set_protected_nopar:Npn \r #1 { { \makexeCJKinactive \xeCJK_aux_r {#1} } }
+ \xeCJK_if_package_loaded:nT { pifont }
{
\RenewDocumentCommand \Pifont { m }
{
\fontencoding {U} \fontfamily {#1} \fontseries {m} \fontshape {n}
\selectfont \makexeCJKinactive
}
- } { }
+ }
+ }
+\cs_new_eq:NN \xeCJK_group_begin: \group_begin:
+\cs_new_eq:NN \xeCJK_group_end: \group_end:
+\xeCJK_AfterEndPreamble:n
+ {
+ \bool_if:nT
+ {
+ \xeCJK_if_package_loaded_p:n { hyperref } &&
+ \tl_if_exist_p:N \pdfstringdefPreHook
+ }
+ {
+ \tl_put_right:Nn \pdfstringdefPreHook
+ {
+ \cs_set_eq:NN \makexeCJKinactive \prg_do_nothing:
+ \cs_set_eq:NN \xeCJK_group_begin: \prg_do_nothing:
+ \cs_set_eq:NN \xeCJK_group_end: \prg_do_nothing:
+ \cs_set_eq:NN \CJKfamily \use_none:n
+ }
+ }
}
\tl_set:cn { ver@CJK.sty } { 2050/01/01 }
\cs_if_free:NT \CJK@ifundefined
@@ -2217,7 +2242,7 @@
\NewDocumentCommand \xeCJKcaption { o m }
{
\IfValueT {#1} { \XeTeXdefaultencoding "#1" }
- \cs_set_nopar:Nx \xeCJK_reset_at_catcode:
+ \cs_set_nopar:Npx \xeCJK_reset_at_catcode:
{
\exp_not:n { \char_set_catcode:nn { `\@ } }
{ \char_value_catcode:n { `\@ } }
@@ -2227,17 +2252,17 @@
\xeCJK_reset_at_catcode:
\XeTeXdefaultencoding "UTF-8"
}
-\cs_new_protected_nopar:Nn \xeCJK_ULprepunctchar:n
+\cs_new_protected_nopar:Npn \xeCJK_ULprepunctchar:n #1
{
- { \makexeCJKinactive \CJKpunctsymbol {#1} \nobreak }
+ { \makexeCJKinactive \CJKpunctsymbol {#1} \xeCJK_no_break: }
\tex_ignorespaces:D
}
-\cs_new_protected_nopar:Nn \xeCJK_ULpostpunctchar:n
+\cs_new_protected_nopar:Npn \xeCJK_ULpostpunctchar:n #1
{
{ \makexeCJKinactive \CJKpunctsymbol {#1} }
\xeCJK_ignorespaces:
}
-\cs_new_protected_nopar:Nn \xeCJK_ULroutines:
+\cs_new_protected_nopar:Npn \xeCJK_ULroutines:
{
\xeCJK_inter_class_toks:nnn { Default } { CJK } { \CJKecglue \CJKsymbol }
\xeCJK_inter_class_toks:nnn { HalfLeft } { CJK } { \CJKsymbol }
@@ -2258,12 +2283,12 @@
{
\cs_set_eq:NN \xeCJK_UL_CJKsymbol \CJKsymbol
\cs_set_eq:NN \xeCJK_UL_CJKpunctsymbol \CJKpunctsymbol
- \cs_set_nopar:Npn \CJKsymbol #1
+ \cs_set_protected_nopar:Npn \CJKsymbol #1
{
{ \xeCJK_select_font: \xeCJK_UL_CJKsymbol {#1} }
- \xeCJK_make_node:n { CJK } \xeCJK_ignorespaces:
+ { \xeCJK_make_node:n { CJK } } \xeCJK_ignorespaces:
}
- \cs_set_nopar:Npn \CJKpunctsymbol #1
+ \cs_set_protected_nopar:Npn \CJKpunctsymbol #1
{ { \xeCJK_select_font: \xeCJK_UL_CJKpunctsymbol {#1} } }
\xeCJK_ULroutines:
}
@@ -2277,8 +2302,9 @@
\bool_if:NT \g_xeCJK_number_bool
{
\tl_set:Nn \CJK@UnicodeEnc { UTF8 }
- \cs_set_nopar:Npn \CJKaddEncHook #1#2 { \cs_set_nopar:cpn { xeCJK_enc_#1 } {#2} }
- \cs_set_nopar:Npn \Unicode #1#2
+ \cs_set_protected_nopar:Npn \CJKaddEncHook #1#2
+ { \cs_set_nopar:cpn { xeCJK_enc_#1 } {#2} }
+ \cs_set_protected_nopar:Npn \Unicode #1#2
{ \tex_char:D \int_eval:n { (#1) * \c_two_hundred_fifty_six + (#2) } }
\RequirePackage { CJKnumb }
\use:c { xeCJK_enc_\CJK@UnicodeEnc }