summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-05-15 21:47:05 +0000
committerKarl Berry <karl@freefriends.org>2015-05-15 21:47:05 +0000
commitff006c2d366e4f0f3503a131959ab1ae04ea5e5f (patch)
tree5bd1fb5973b570c58af7743d199882d28b2a17fd /Master/texmf-dist/source
parentda5eaf8777934443b5a33ff8ed1d8c195c1e3034 (diff)
xecjk (15may15)
git-svn-id: svn://tug.org/texlive/trunk@37409 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx590
-rw-r--r--Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins120
2 files changed, 466 insertions, 244 deletions
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
index d5fbd5ef710..4d90a151a17 100644
--- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
+++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
@@ -38,7 +38,7 @@ This package consists of the file xeCJK.dtx,
xeCJK-example-CJKfntef.tex,
xeCJK-example-punctstyle.tex,
xeCJK-example-verbatim.tex,
- xeCJK-example-IVS.tex,
+ xeCJK-example-CM.tex,
xeCJK-example-listings.tex,
xunicode-symbols.tex,
xunicode-commands.tex,
@@ -52,7 +52,7 @@ This package consists of the file xeCJK.dtx,
If you are interested in the process of development you may observe
- http://code.google.com/p/ctex-kit/updates/list
+ https://github.com/CTeX-org/ctex-kit
Author:
Wenchang Sun <sunwch@nankai.edu.cn>
@@ -90,13 +90,52 @@ CJK scripts fonts (TrueType or OpenType).
%</internal>
%<*install>
+\newread\inputcheck
+\openin\inputcheck=xeCJK.ver
+\ifeof\inputcheck
+ \def\xeCJKPutVersion{\string\GetIdInfo$Id$}
+\else
+ \input xeCJK.ver
+\fi
+\closein\inputcheck
+
\input l3docstrip.tex
+
+\def\checkOption<#1{%
+ \ifcase
+ \ifx*#10\else \ifx/#11\else
+ \ifx+#12\else \ifx-#13\else
+ \ifx<#14\else \ifx @#15\else
+ \ifx.#16\else
+ 7\fi\fi\fi\fi\fi\fi\fi\relax
+ \expandafter\starOption\or
+ \expandafter\slashOption\or
+ \expandafter\plusOption\or
+ \expandafter\minusOption\or
+ \expandafter\verbOption\or
+ \expandafter\moduleOption\or
+ \expandafter\expOption\or
+ \expandafter\doOption\fi
+ #1%
+}
+\def\expOption .#1>#2\endLine{%
+ \maybeMsg{<.#1 . >}%
+ \Evaluate{#1}%
+ \begingroup
+ \catcode`\\=0 \catcode`\{=1 \catcode`\}=2
+ \xdef\expandedLineStuff{\scantokens{#2\noexpand}}%
+ \endgroup
+ \def\do##1##2##3{%
+ \if1\Expr{##2}\StreamPut##1{\expandedLineStuff}\fi
+ }%
+ \activefiles
+}
+
\keepsilent
\askforoverwritefalse
+
\preamble
-$Id: xeCJK.dtx 750 2014-12-26 08:13:35Z sobenlee@gmail.com $
-$URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
-----------------------------------------------------------------
Author:
Wenchang Sun <sunwch@nankai.edu.cn>
@@ -104,9 +143,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
Leo Liu <leoliu.pku@gmail.com>
Qing Lee <sobenlee@gmail.com>
- Copyright (C) 2007--2014 Wenchang Sun
- (C) 2009--2014 Leo Liu
- (C) 2012--2014 Qing Lee
+ Copyright (C) 2007--2015 Wenchang Sun
+ (C) 2009--2015 Leo Liu
+ (C) 2012--2015 Qing Lee
This file may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -144,7 +183,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
xeCJK-example-CJKfntef.tex,
xeCJK-example-punctstyle.tex,
xeCJK-example-verbatim.tex,
- xeCJK-example-IVS.tex,
+ xeCJK-example-CM.tex,
xeCJK-example-listings.tex,
xunicode-symbols.tex,
xunicode-commands.tex,
@@ -161,35 +200,36 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\declarepostamble\emptypostamble
\endpostamble
-\generate{
- \usedir{source/xelatex/xecjk}
- \file{xeCJK.ins}{\from{\jobname.dtx}{install}}
- \usedir{tex/xelatex/xecjk}
- \file{xeCJK.sty}{\from{\jobname.dtx}{package}}
- \file{xeCJKfntef.sty}{\from{\jobname.dtx}{fntef}}
- \file{xeCJK-listings.sty}{\from{\jobname.dtx}{listings}}
- \file{xunicode-addon.sty}{\from{\jobname.dtx}{xunicode}}
- \file{xunicode-extra.def}{\from{\jobname.dtx}{xunextra}}
- \usepreamble\emptypreamble
- \usepostamble\emptypostamble
- \usedir{tex/xelatex/xecjk/config}
- \file{xeCJK.cfg}{\from{\jobname.dtx}{config}}
- \usedir{doc/xelatex/xecjk/example}
- \file{xeCJK-example-autofake.tex}{\from{\jobname.dtx}{ex-autofake}}
- \file{xeCJK-example-fallback.tex}{\from{\jobname.dtx}{ex-fallback}}
- \file{xeCJK-example-subCJKblock.tex}{\from{\jobname.dtx}{ex-block}}
- \file{xeCJK-example-CJKecglue.tex}{\from{\jobname.dtx}{ex-ecglue}}
- \file{xeCJK-example-checksingle.tex}{\from{\jobname.dtx}{ex-single}}
- \file{xeCJK-example-CJKfntef.tex}{\from{\jobname.dtx}{ex-fntef}}
- \file{xeCJK-example-punctstyle.tex}{\from{\jobname.dtx}{ex-punctstyle}}
- \file{xeCJK-example-verbatim.tex}{\from{\jobname.dtx}{ex-verb}}
- \file{xeCJK-example-IVS.tex}{\from{\jobname.dtx}{ex-IVS}}
- \file{xeCJK-example-listings.tex}{\from{\jobname.dtx}{ex-listings}}
- \file{xunicode-symbols.tex}{\from{\jobname.dtx}{xunicode-symbols}}
- \nopreamble\nopostamble
- \usedir{doc/xelatex/xecjk}
- \file{README.txt}{\from{\jobname.dtx}{readme}}
-}
+\generate
+ {
+ \usedir{source/xelatex/xecjk}
+ \file{xeCJK.ins} {\from{\jobname.dtx}{install}}
+ \usedir{tex/xelatex/xecjk}
+ \file{xeCJK.sty} {\from{\jobname.dtx}{package}}
+ \file{xeCJKfntef.sty} {\from{\jobname.dtx}{fntef}}
+ \file{xeCJK-listings.sty} {\from{\jobname.dtx}{listings}}
+ \file{xunicode-addon.sty} {\from{\jobname.dtx}{xunicode}}
+ \file{xunicode-extra.def} {\from{\jobname.dtx}{xunextra}}
+ \usepreamble\emptypreamble
+ \usepostamble\emptypostamble
+ \usedir{tex/xelatex/xecjk/config}
+ \file{xeCJK.cfg} {\from{\jobname.dtx}{config}}
+ \usedir{doc/xelatex/xecjk/example}
+ \file{xeCJK-example-autofake.tex} {\from{\jobname.dtx}{ex-autofake}}
+ \file{xeCJK-example-fallback.tex} {\from{\jobname.dtx}{ex-fallback}}
+ \file{xeCJK-example-subCJKblock.tex} {\from{\jobname.dtx}{ex-block}}
+ \file{xeCJK-example-CJKecglue.tex} {\from{\jobname.dtx}{ex-ecglue}}
+ \file{xeCJK-example-checksingle.tex} {\from{\jobname.dtx}{ex-single}}
+ \file{xeCJK-example-CJKfntef.tex} {\from{\jobname.dtx}{ex-fntef}}
+ \file{xeCJK-example-punctstyle.tex} {\from{\jobname.dtx}{ex-punctstyle}}
+ \file{xeCJK-example-verbatim.tex} {\from{\jobname.dtx}{ex-verb}}
+ \file{xeCJK-example-CM.tex} {\from{\jobname.dtx}{ex-cm}}
+ \file{xeCJK-example-listings.tex} {\from{\jobname.dtx}{ex-listings}}
+ \file{xunicode-symbols.tex} {\from{\jobname.dtx}{xunicode-symbols}}
+ \nopreamble\nopostamble
+ \usedir{doc/xelatex/xecjk}
+ \file{README.txt} {\from{\jobname.dtx}{readme}}
+ }
\endbatchfile
%</install>
@@ -201,7 +241,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
%</!config&!xunextra>
-\GetIdInfo$Id: xeCJK.dtx 750 2014-12-26 08:13:35Z sobenlee@gmail.com $
+%<.!driver>\xeCJKPutVersion
+%<*driver>
+\InputIfFileExists{xeCJK.ver}{}{
+ \def\xeCJKGetVersionInfo{\GetIdInfo$Id$}}
+\xeCJKGetVersionInfo
+%</driver>
%<*driver|package>
{Typesetting CJK scripts with XeLaTeX}
%</driver|package>
@@ -223,7 +268,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%<fntef> {xeCJKfntef}
%<listings> {xeCJK-listings}
%<xunicode> {xunicode-addon}
- {\ExplFileDate}{3.3.0}{\ExplFileDescription}
+ {\ExplFileDate}{3.3.2}{\ExplFileDescription}
%<xunextra>\ExplSyntaxOff
%<*driver>
\let\xeCJKrevnum\ExplFileVersion
@@ -272,10 +317,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\AtBeginDocument{\DeleteShortVerb{\"}\MakeShortVerb{\|}}
\def\contentsname{目录}
\DeclareUrlCommand\email{\def\UrlLeft##1\UrlRight{\href{mailto:##1}{##1}}}
-\def\ctexkit{\href{http://code.google.com/p/ctex-kit/}{\texttt{ctex-kit}}}
+\def\ctexkit{\href{https://github.com/CTeX-org/ctex-kit/}{\texttt{ctex-kit}}}
\def\ctexkitrev#1{%
- \href{http://code.google.com/p/ctex-kit/source/detail?r=#1}
- {\texttt{ctex-kit} rev#1}}
+ \href{https://github.com/CTeX-org/ctex-kit/commit/#1}{\texttt{ctex-kit} rev. #1}}
\DeclareDocumentCommand\package{om}{%
\begingroup\edef\x{\endgroup\lowercase{%
\noexpand\href{http://www.ctan.org/pkg/\IfNoValueTF{#1}{#2}{#1}}}}%
@@ -401,8 +445,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \changes{v3.2.3}{2013/06/07}{提供四个 TECkit 映射文件用于句号转换和简繁互换。}
% \changes{v3.2.4}{2013/07/02}{遵循 \hologo{LaTeX3} 变量需要预先声明的原则。}
% \changes{v3.2.6}{2013/07/29}{\texttt{case} 类函数的用法与 \hologo{LaTeX3} 同步。}
+% \changes{v3.3.2}{2015/05/15}{随 Unicode 7.0.0 更新简繁汉字映射。}
%
-% \CheckSum{9717}
+% \CheckSum{9799}
% \GetFileInfo{\jobname.dtx}
%
% \title{\bfseries\pkg{xeCJK} 宏包}
@@ -583,6 +628,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 来说也不能正确处理。
% \end{function}
%
+% \begin{function}[added=2015-04-08]{WidowPenalty}
+% \begin{syntax}
+% WidowPenalty = \Arg{penalty|(10000)}
+% \end{syntax}
+% 使用 \texttt{CheckSingle} 选项后,设置段末三个汉字之间的 penalty。
+% 初始值为 $10000$,即禁止在它们之间折行。
+% \end{function}
+%
% \begin{function}[added=2012-12-06]{PlainEquation}
% \begin{syntax}
% PlainEquation = \meta{\TFF}
@@ -2122,34 +2175,51 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[internal]{\xeCJK_token_value_charcode:N}
% \changes{v3.2.4}{2013/06/30}{考虑 \texttt{charcode} 超出 BMP 的情况。}
+% \changes{v3.3.1}{2015/05/08}{\texttt{0.99992} 版修复了 \tn{meaning} 的 Bug。}
% 当记号 |#1| 的 \texttt{charcode} 大于等于 \texttt{0x10000} 时,\XeTeX\
% \texttt{0.9999.0} 版以前的 \tn{meaning} 的返回结果比较特殊\footnote{参见
% \url{http://tug.org/pipermail/xetex/2013-January/023967.html} 和
% \url{http://tex.stackexchange.com/a/64848}。},需要特别处理。同时使用较新版本中
-% 提供的原语设置 \texttt{mathcode}。目前,\texttt{0.9999.0} 版以后的 \XeTeX 的
-% \tn{meaning} 对于超出 BMP 的字符,会返回两个字符,分别对应于其 UTF-16 编码的
-% 首尾代理。\footnote{参见 \url{http://tug.org/pipermail/xetex/2013-June/024543.html}。}
+% 提供的原语设置 \texttt{mathcode}。\texttt{0.9999.0} 版以后的 \XeTeX 的 \tn{meaning}
+% 对于超出 BMP 的字符,会返回两个字符,分别对应于其 UTF-16 编码的首尾代理^^A
+% \footnote{参见 \url{http://tug.org/pipermail/xetex/2013-June/024543.html}。}。
+% 这一 Bug 在 TeX Live 2015 的 \texttt{0.99992} 版中得到修复^^A
+% \footnote{参见\url{http://tug.org/pipermail/xetex/2015-May/025941.html}}。
% \begin{macrocode}
\cs_new_nopar:Npn \xeCJK_token_value_charcode:N #1
- { \exp_after:wN \@@_token_value_charcode:w \token_to_meaning:N #1 \q_stop }
-\fp_compare:nNnTF { \int_use:N \xetex_XeTeXversion:D \XeTeXrevision } > { 0.9998 }
- {
- \cs_new_nopar:Npn \@@_token_value_charcode:w #1 ~ #2 ~ #3#4 \q_stop
- {
- \int_eval:n
- {
- \tl_if_empty:nTF {#4}
- { `#3 }
- { ( `#3 - "D800 ) * "400 + ( `#4 - "DC00 ) + "10000 }
- }
- }
- \cs_new_eq:NN \xeCJK_xetex_mathcode:w \Umathcode
- }
- {
- \cs_new_nopar:Npn \@@_token_value_charcode:w #1 ~ #2 ~ #3#4 \q_stop
- { \int_eval:n { \tl_if_empty:nTF {#4} { `#3 } { "20000 } } }
- \cs_new_eq:NN \xeCJK_xetex_mathcode:w \XeTeXmathcode
- }
+ { \exp_after:wN \@@_get_charcode:w \token_to_meaning:N #1 \q_stop }
+\group_begin:
+ \cs_set:Npn \@@_tmp:w #1 ~ #2 ~ #3#4#5 \q_stop
+ {
+ \tl_if_empty:nTF { #4#5 }
+ {
+ \cs_new_nopar:Npn \@@_get_charcode:w ##1 ~ ##2 ~ ##3 \q_stop
+ { \int_eval:n { `##3 } }
+ \cs_new_eq:NN \xeCJK_xetex_mathcode:w \Umathcode
+ }
+ {
+ \tl_if_empty:nTF {#5}
+ {
+ \cs_new_nopar:Npn \@@_get_charcode:w ##1 ~ ##2 ~ ##3##4 \q_stop
+ {
+ \int_eval:n
+ {
+ \tl_if_empty:nTF { ##4 }
+ { `##3 }
+ { ( `##3 - "D800 ) * "400 + ( `##4 - "DC00 ) + "10000 }
+ }
+ }
+ \cs_new_eq:NN \xeCJK_xetex_mathcode:w \Umathcode
+ }
+ {
+ \cs_new_nopar:Npn \@@_get_charcode:w ##1 ~ ##2 ~ ##3##4 \q_stop
+ { \int_eval:n { \tl_if_empty:nTF { ##4 } { `##3 } { "20000 } } }
+ \cs_new_eq:NN \xeCJK_xetex_mathcode:w \XeTeXmathcode
+ }
+ }
+ }
+ \exp_after:wN \@@_tmp:w \token_to_meaning:N ^^^^^20000 { } \q_stop
+\group_end:
% \end{macrocode}
% \end{macro}
%
@@ -2265,10 +2335,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macro}
%
% \changes{v3.2.0}{2013/05/20}{增加 \texttt{IVS} 字符类用于处理异体字选择符。}
+% \changes{v3.3.1}{2015/01/22}{\texttt{IVS} 字符类更名为 \texttt{CM}。}
%
% \pkg{xeCJK} 需要以下字符类别用于字符输出。其中 |Default|、|CJK|、|FullLeft|、
% |FullRight|、|Boundary| 为 \XeTeX\ 中预定义的类别,\pkg{xeCJK} 新增加了\
-% |HalfLeft|、|HalfRight|、|NormalSpace| 和 |IVS|。其中异体字选择符
+% |HalfLeft|、|HalfRight|、|NormalSpace| 和 |CM|。其中异体字选择符
% (Ideographic Variation Selectors)\footnote{\url{http://www.unicode.org/reports/tr37/}}
% 需要 \XeTeX\ |0.9999.0| 以上的版本^^A
% \footnote{\url{http://tug.org/pipermail/xetex/2013-March/024118.html}}和相关字体的支持。
@@ -2284,7 +2355,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% |HalfRight| & 半角右标点 & , . ? ) ] \} \\
% |NormalSpace| & 前后原始间距的符号 & / \\
% |Boundary| & 边界 & 空格 \\
-% |IVS| & 异体字选择符 & “回字有四样写法”\\
+% |CM| & 组合标识 & 异体字选择符\\
% |HangulJamo| & 朝鲜文字母 & |ᄻ||ᆟ||ᇫ|\\
% \bottomrule
% \end{tabular}
@@ -2303,13 +2374,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \changes{v3.2.15}{2014/11/10}{增加 \texttt{HangulJamo} 字符类。}
%
-% \begin{macro}[internal]{HalfLeft,HalfRight,NormalSpace,IVS,HangulJamo}
+% \begin{macro}[internal]{HalfLeft,HalfRight,NormalSpace,CM,HangulJamo}
% 新增西文半角左/右标点、前后原始间距的符号和异体字选择符类。
% \begin{macrocode}
\xeCJK_new_class:n { HalfLeft }
\xeCJK_new_class:n { HalfRight }
\xeCJK_new_class:n { NormalSpace }
-\xeCJK_new_class:n { IVS }
+\xeCJK_new_class:n { CM }
\xeCJK_new_class:n { HangulJamo }
% \end{macrocode}
% \end{macro}
@@ -2430,7 +2501,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}[var,internal]{\c_@@_CJ_chars_clist}
% Conditional Japanese Starter (CJ)。这类字符的禁则是可选的^^A
-% \footnote{\url{https://code.google.com/p/ctex-kit/issues/detail?id=166}},
+% \footnote{\url{https://github.com/CTeX-org/ctex-kit/issues/165}},
% 为实现的简单计,我们把它们归入 CJK 类,即没有禁则。
% \PrintPunctList{CJ}{Conditional Japanese Starter}
% \begin{macrocode}
@@ -2603,13 +2674,30 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[var,internal]{\c_@@_IVS_chars_clist}
-% 包括日文假名浊点和异体字选择符。
+% \begin{macro}[var,internal]{\c_@@_CM_chars_clist}
+% \changes{v3.3.1}{2015/01/22}{补充音调符号。}
+% 包括日文假名浊点和异体字选择符。组合标识是最好是归入 256 类,即透明类,不会影响
+% 状态。但也会产生一定问题。比如下面的例子,位于行尾的“二”造成分组不匹配。
+% \begin{verbatim}
+% \XeTeXinterchartokenstate=1
+% \XeTeXcharclass`二=256
+% \XeTeXinterchartoks 255 1 = {\bgroup}
+% \XeTeXinterchartoks 1 255 = {\egroup}
+% \XeTeXinterchartoks 1 1 = {x}
+% \font\zhfont="SimSun"
+% \zhfont
+% 一二三二
+% \bye
+% \end{verbatim}
% \begin{macrocode}
-\clist_const:Nn \c_@@_IVS_chars_clist
+\clist_const:Nn \c_@@_CM_chars_clist
{
% \end{macrocode}
% \begin{itemize}[nosep,leftmargin=0pt]
+% \item Diacritics (音调符号)
+% \begin{macrocode}
+ "302A -> "302F ,
+% \end{macrocode}
% \item 日文假名浊点
% \begin{macrocode}
"3099 -> "309A ,
@@ -2670,7 +2758,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\tl_const:cn { \@@_CJK_class_tl:c { \@@_class_csname:n {#1} } } {#1}
}
\clist_map_function:nN
- { CJK , FullLeft , FullRight , IVS , HangulJamo } \@@_save_CJK_class:n
+ { CJK , FullLeft , FullRight , CM , HangulJamo } \@@_save_CJK_class:n
% \end{macrocode}
% \end{macro}
%
@@ -2708,7 +2796,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \xeCJK_class_num:n {#1} }
}
}
- \xeCJK_set_char_class:nnn { "3099 } { "309A } { \xeCJK_class_num:n { IVS } }
+ \xeCJK_set_char_class:nnn { "3099 } { "309A } { \xeCJK_class_num:n { CM } }
}
\NewDocumentCommand \@@_set_char_class_aux:Nnw
{ m > { \SplitArgument { 1 } { -> } } m } { #1 #2 }
@@ -2810,7 +2898,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\xeCJK_declare_char_class:nV { CJK } \c_@@_CJK_chars_clist
\xeCJK_declare_char_class:nV { NormalSpace } \c_@@_NormalSpace_chars_clist
- \xeCJK_declare_char_class:nV { IVS } \c_@@_IVS_chars_clist
+ \xeCJK_declare_char_class:nV { CM } \c_@@_CM_chars_clist
\xeCJK_declare_char_class:nV { HangulJamo } \c_@@_HangulJamo_chars_clist
\xeCJKResetPunctClass
}
@@ -2840,7 +2928,17 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_clear_inter_class_toks:nn}
-% 清除相邻类别之间的内容。
+% 清除相邻类别之间的内容。注意,直接赋空值可能会导致 \XeTeX 崩溃。例如
+% \begin{verbatim}
+% \XeTeXinterchartokenstate = 1
+% \XeTeXcharclass`A=10
+% \XeTeXinterchartoks 10 10 = {xx}
+% \begingroup
+% \XeTeXinterchartoks 10 10 = {} AA
+% \endgroup
+% \bye
+% \end{verbatim}
+% 如果把上述例子中的分组 \tn{begingroup} 和 \tn{endgroup} 去掉,则结果正常,甚为怪异。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_clear_inter_class_toks:nn #1#2
{ \xeCJK_inter_class_toks:nnn {#1} {#2} { \prg_do_nothing: } }
@@ -2877,8 +2975,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\cs_new_protected_nopar:Npn \xeCJK_copy_inter_class_toks:nnnn #1#2#3#4
{
\tl_set:Nx \l_@@_tmp_tl { \xeCJK_get_inter_class_toks:nn {#3} {#4} }
- \tl_if_empty:NF \l_@@_tmp_tl
- { \xeCJK_inter_class_toks:nnx {#1} {#2} { \exp_not:V \l_@@_tmp_tl } }
+ \tl_if_empty:NTF \l_@@_tmp_tl
+ {
+ \tl_set:Nx \l_@@_tmp_tl { \xeCJK_get_inter_class_toks:nn {#1} {#2} }
+ \tl_if_empty:NF \l_@@_tmp_tl
+ { \xeCJK_clear_inter_class_toks:nn {#1} {#2} }
+ }
+ { \xeCJK_inter_class_toks:nnx {#1} {#2} { \exp_not:o \l_@@_tmp_tl } }
}
% \end{macrocode}
% \end{macro}
@@ -2892,7 +2995,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\tl_if_empty:NF \l_@@_tmp_tl
{
\tl_replace_all:Nnn \l_@@_tmp_tl {#3} {#4}
- \xeCJK_inter_class_toks:nnx {#1} {#2} { \exp_not:V \l_@@_tmp_tl }
+ \xeCJK_inter_class_toks:nnx {#1} {#2} { \exp_not:o \l_@@_tmp_tl }
}
}
% \end{macrocode}
@@ -2914,7 +3017,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{tabular}{l*9c}
% \toprule
% & |Default| & |CJK| & |FullL| & |FullR| & |HalfL|
-% & |HalfR| & |Normal| & |Bound| & |IVS| \\ \midrule
+% & |HalfR| & |Normal| & |Bound| & |CM| \\ \midrule
% |Default|
% &
% & \tokslink{def-cjk}
@@ -2924,7 +3027,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% &
% &
% & \tokslink{def-bound}
-% & \tokslink{def-IVS}\\
+% & \tokslink{def-cm}\\
% |CJK|
% & \tokslink{def-cjk}
% & \tokslink{cjk-cjk}
@@ -2944,7 +3047,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% & \tokslink{def-cjk}
% & \tokslink{def-cjk}
% & \tokslink{fl-fr-bound}
-% & \tokslink{def-IVS}\\
+% & \tokslink{def-cm}\\
% |FullRight|
% & \tokslink{def-cjk}
% & \tokslink{fl-fr-others}
@@ -2954,7 +3057,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% & \tokslink{def-cjk}
% & \tokslink{def-cjk}
% & \tokslink{fl-fr-bound}
-% & \tokslink{def-IVS}\\
+% & \tokslink{def-cm}\\
% |HalfLeft|
% &
% & \tokslink{def-cjk}
@@ -2964,7 +3067,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% &
% &
% &
-% & \tokslink{def-IVS}\\
+% & \tokslink{def-cm}\\
% |HalfRight|
% &
% & \tokslink{def-cjk}
@@ -2974,7 +3077,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% &
% &
% & \tokslink{def-bound}
-% & \tokslink{def-IVS}\\
+% & \tokslink{def-cm}\\
% |NormalSpace|
% &
% & \tokslink{def-cjk}
@@ -2984,7 +3087,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% &
% &
% & \tokslink{ns-bound}
-% & \tokslink{def-IVS}\\
+% & \tokslink{def-cm}\\
% |Boundary|
% & \tokslink{bound-def}
% & \tokslink{bound-cjk}
@@ -2994,17 +3097,17 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% &
% & \tokslink{bound-ns}
% &
-% & \tokslink{def-IVS}\\
-% |IVS|
-% & \tokslink{def-IVS}
-% & \tokslink{def-IVS}
-% & \tokslink{def-IVS}
-% & \tokslink{def-IVS}
-% & \tokslink{def-IVS}
-% & \tokslink{def-IVS}
-% & \tokslink{def-IVS}
-% & \tokslink{def-IVS}
-% & \tokslink{def-IVS}\\
+% & \tokslink{def-cm}\\
+% |CM|
+% & \tokslink{def-cm}
+% & \tokslink{def-cm}
+% & \tokslink{def-cm}
+% & \tokslink{def-cm}
+% & \tokslink{def-cm}
+% & \tokslink{def-cm}
+% & \tokslink{def-cm}
+% & \tokslink{def-cm}
+% & \tokslink{def-cm}\\
% \bottomrule
% \end{tabular}
% \end{center}
@@ -3022,19 +3125,19 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
-% \hypertarget{def-IVS}{\texttt{IVS}} 字符类与 |CJK| 字符类基本相同,只是从 |CJK|
-% 转移到 |IVS| 时,不加入任何内容。
+% \hypertarget{def-cm}{\texttt{CM}} 字符类与 |CJK| 字符类基本相同,只是从 |CJK|
+% 转移到 |CM| 时,不加入任何内容。
% \begin{macrocode}
\AtEndOfPackage
{
\seq_map_inline:Nn \g_@@_class_seq
{
- \str_if_eq:nnTF {#1} { IVS }
- { \xeCJK_copy_inter_class_toks:nnnn { IVS } {#1} { CJK } { CJK } }
+ \str_if_eq:nnTF {#1} { CM }
+ { \xeCJK_copy_inter_class_toks:nnnn { CM } {#1} { CJK } { CJK } }
{
- \xeCJK_copy_inter_class_toks:nnnn { IVS } {#1} { CJK } {#1}
+ \xeCJK_copy_inter_class_toks:nnnn { CM } {#1} { CJK } {#1}
\str_if_eq:nnF {#1} { CJK }
- { \xeCJK_copy_inter_class_toks:nnnn {#1} { IVS } {#1} { CJK } }
+ { \xeCJK_copy_inter_class_toks:nnnn {#1} { CM } {#1} { CJK } }
}
}
}
@@ -3109,7 +3212,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\bool_if:nTF
{
\xeCJK_if_last_node_p:n { CJK } ||
- \xeCJK_if_last_node_p:n { CJK-nobreak }
+ \xeCJK_if_last_node_p:n { CJK-widow }
}
{ \xeCJK_remove_node: \CJKecglue }
{
@@ -3222,8 +3325,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK-space } }
{ \xeCJK_remove_node: \CJKglue }
{
- \xeCJK_if_last_node:nTF { CJK-nobreak }
- { \xeCJK_remove_node: \xeCJK_no_break: \CJKglue }
+ \xeCJK_if_last_node:nTF { CJK-widow }
+ { \xeCJK_remove_node: \xeCJK_widow_penalty: \CJKglue }
{
\bool_if:nTF
{
@@ -3315,7 +3418,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\xeCJK_declare_node:n { CJK-space }
\xeCJK_declare_node:n { default }
\xeCJK_declare_node:n { default-space }
-\xeCJK_declare_node:n { CJK-nobreak }
+\xeCJK_declare_node:n { CJK-widow }
\xeCJK_declare_node:n { normalspace }
% \end{macrocode}
% \end{macro}
@@ -4106,6 +4209,27 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
+% \changes{v3.3.1}{2015/04/08}{新选项 \texttt{WidowPenalty}。}
+%
+% \begin{macro}{WidowPenalty}
+% 设置段末汉字的 penalty,默认值是 $10000$。
+% \begin{macrocode}
+\keys_define:nn { xeCJK / options }
+ {
+ WidowPenalty .int_set:N = \l_@@_widow_penalty_int ,
+ WidowPenalty .default:n = { \c_ten_thousand }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\xeCJK_widow_penalty:}
+% 预防段末孤字而插入的 penalty,值为 \cs{l_@@_widow_penalty_int}。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \xeCJK_widow_penalty:
+ { \tex_penalty:D \l_@@_widow_penalty_int }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}[internal]{\xeCJK_check_single:Nw}
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_check_single:Nw #1
@@ -4217,8 +4341,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\peek_catcode:NTF \c_math_toggle_token
{
- \xeCJK_no_break: \@@_check_single_save:N #1
- \xeCJK_make_node:n { CJK-nobreak } #2 #4
+ \xeCJK_widow_penalty: \@@_check_single_save:N #1
+ \xeCJK_make_node:n { CJK-widow } #2 #4
}
{ \@@_check_single_save:N #1 #2#3#4 }
}
@@ -4231,6 +4355,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% {解决使用 \texttt{CheckSingle} 时,某些 \tn{CJKglue} 不能被正确加入的问题。}
%
% \begin{macro}[internal]{\xeCJK_check_single_cs:NNn}
+% \changes{v3.3.1}{2015/04/06}{补充可能遗漏的空格。}
% 在使用 \texttt{CheckSingle} 选项时,在 \package{tablists} 宏包定义的
% \env{tabenum} 环境中会出现下面的错误:
% \begin{verbatim}
@@ -4252,8 +4377,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \group_align_safe_end: \use_iii:nnn }
{ \xeCJK_check_single_env:nnNn }
{
- \xeCJK_no_break: \@@_check_single_save:N #1
- \xeCJK_make_node:n { CJK-nobreak } #2
+ \xeCJK_widow_penalty: \@@_check_single_save:N #1
+ \xeCJK_make_node:n { CJK-widow } #2#3
}
{ \@@_check_single_save:N #1 #2#3 }
}
@@ -6251,15 +6376,17 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \begin{macro}{LoadFandol}
% \changes{v3.2.10}{2014/03/01}{当没有设置字体时,使用 Fandol 字体系列。}
+% \changes{v3.3.1}{2015/04/08}{为方便 MacTeX 用户,Fandol 字体改用文件名。}
% \begin{macrocode}
\keys_define:nn { xeCJK / options }
{ LoadFandol .bool_gset:N = \g_@@_fandol_bool }
\cs_new_protected_nopar:Npn \@@_load_fandol:
{
\setCJKmainfont
- [ BoldFont = FandolSong-Bold , ItalicFont = FandolKai ] { FandolSong-Regular }
- \setCJKsansfont [ BoldFont = FandolHei-Bold ] { FandolHei-Regular }
- \setCJKmonofont { FandolFang }
+ [ Extension = .otf , BoldFont = FandolSong-Bold , ItalicFont = FandolKai-Regular ]
+ { FandolSong-Regular }
+ \setCJKsansfont [ Extension = .otf , BoldFont = FandolHei-Bold ] { FandolHei-Regular }
+ \setCJKmonofont [ Extension = .otf ] { FandolFang-Regular }
}
% \end{macrocode}
% \end{macro}
@@ -6919,6 +7046,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
PunctStyle = quanjiao ,
NewLineCS = { \par \[ } ,
EnvCS = { \begin \end } ,
+ WidowPenalty = \c_ten_thousand ,
NoBreakCS = { \footnote \footnotemark \nobreak } ,
KaiMingPunct = { ^^^^3002 ^^^^ff0e ^^^^ff1f ^^^^ff01 } ,
LongPunct = { ^^^^2014 ^^^^2015 ^^^^2500 ^^^^2025 ^^^^2026 } ,
@@ -7134,6 +7262,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% {解决汉字后紧跟 \tn{(}\texttt{...}\tn{)} 形式的行内数学公式时,不能加入间距的问题。}
% \changes{v3.2.6}{2013/08/03}{考虑 \pkg{ulem} 对 \tn{MakeRobust} 的不当定义。}
% \changes{v3.2.6}{2013/08/03}{考虑 \tn{math} 和 \tn{ensuremath}。}
+% \changes{v3.3.1}{2015/04/14}{兼容 \LaTeXe{} 2015。}
% \tn{(} 的在 \LaTeXe 中的定义是
% \begin{verbatim}
% \def\({\relax\ifmmode\@badmath\else$\fi}
@@ -7193,42 +7322,31 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
The~current~meaning~of~`#1'~is:\\
\iow_indent:n {#2}
}
-\@@_math_robust:N \(
-\@@_math_robust:N \)
-\@@_math_robust:N \math
-\@@_math_robust:N \endmath
-\@@_math_robust:N \ensuremath
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[internal]{\[,\]}
-% \changes{v3.2.5}{2013/07/25}{解决 \pkg{fixltx2e} 和 \pkg{amsthm} 的冲突。}
-% 当 \pkg{amsmath} 没有在 \pkg{amsthm} 之前被调用时,\pkg{amsthm} 会展开 |\[|,
-% 并用 |$| 作为参数定界记号,相关代码为
-% \begin{verbatim}
-% \def\@tempa#1$#2#3\@nil{%
-% \def\[{#1$#2\def\@currenvir{displaymath}#3}%
-% }%
-% \expandafter\@tempa\[\@nil
-% \end{verbatim}
-% 而 \pkg{fixltx2e} 中使用了 |\MakeRobust\[|,使得将 |\[| 展开一次的内容中并
-% 不直接含有 |$|,从而造成了 \texttt{Runaway argument?} 的错误。可以在 \pkg{amsthm}
-% 之前引入 \pkg{amsmath},避免出现这个错误。我们下面用 \hologo{eTeX} 的 \tn{protected}
-% 来定义它。当然,如果之后只使用 \pkg{amsthm},那么 |\[| 会被修改,将不再是^^A
-% “健壮”的了。这也是上面 \cs{@@_math_robust:NN} 中还使用 \cs{scan_align_safe_stop:} 的原因。
-% \begin{macrocode}
-\bool_if:nF
+\cs_if_eq:NNTF \( \math
+ {
+ \@@_math_robust:N \(
+ \cs_set_eq:NN \math \(
+ }
+ {
+ \@@_math_robust:N \(
+ \@@_math_robust:N \math
+ }
+\cs_if_eq:NNTF \) \endmath
{
- \xeCJK_if_package_loaded_p:n { amsmath } ||
- \xeCJK_if_package_loaded_p:n { amsthm }
+ \@@_math_robust:N \)
+ \cs_set_eq:NN \endmath \)
}
{
- \@@_math_robust:N \[
- \@@_math_robust:N \]
+ \@@_math_robust:N \)
+ \@@_math_robust:N \endmath
}
+\@@_math_robust:N \ensuremath
% \end{macrocode}
% \end{macro}
%
+% \changes{v3.2.5}{2013/07/25}{解决 \pkg{fixltx2e} 和 \pkg{amsthm} 的冲突。}
+% \changes{v3.3.1}{2015/04/15}{删去 \pkg{fixltx2e} 和 \pkg{amsthm} 的冲突补丁。}
+%
% \begin{macro}[internal]{\nobreakspace}
% \changes{v3.1.2}{2013/01/01}
% {修正非 \tn{UTFencname} 编码下面 \pkg{xunicode} 重定义的 \tn{nobreakspace} 会失效的问题。}
@@ -7380,15 +7498,25 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%<@@=xeCJK>
% \end{macrocode}\egroup
%
+% \begin{macro}[internal]{\g_@@_xetex_allocator_int}
+% \changes{v3.3.1}{2015/04/14}{兼容 \LaTeXe{} 2015。}
+% \changes{v3.3.2}{2015/05/15}{\tn{xe@alloc@intercharclass} 总是有定义的。}
+% \LaTeXe{} 2015/01/01 接管了 \tn{newXeTeXintercharclass}。
+% \begin{macrocode}
+\cs_new_eq:NN \g_@@_xetex_allocator_int \xe@alloc@intercharclass
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}[internal]{\@@_set_others_toks:n}
% 简单处理与同样使用 \tn{XeTeXinterchartoks} 机制的宏包的兼容问题。
% \begin{macrocode}
\@@_after_end_preamble:n
{
\int_compare:nNnF
- { \c_three + \seq_count:N \g_@@_new_class_seq } = \xe@alloc@intercharclass
+ { \c_three + \seq_count:N \g_@@_new_class_seq } =
+ { \g_@@_xetex_allocator_int }
{
- \int_step_inline:nnnn \c_four \c_one \xe@alloc@intercharclass
+ \int_step_inline:nnnn \c_four \c_one \g_@@_xetex_allocator_int
{
\seq_if_in:NnF \g_@@_new_class_seq {#1}
{ \@@_set_others_toks:n {#1} }
@@ -7632,6 +7760,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 为使用 \pkg{CJKnumb} 宏包而作一些处理。另外 \pkg{CJKnumb} 使用的是传统汉字“萬”
% 和“億”,我们在这里把它们修正为简体字。
% \changes{v3.2.10}{2014/03/01}{使用 \pkg{CJKnumb} 时,让 \tn{Unicode} 有定义。}
+% \changes{v3.3.1}{2015/05/08}{应用 \texttt{0.99992} 版的新原语 \tn{Ucharcat}。}
% \begin{macrocode}
\cs_new_protected:Npn \CJKaddEncHook #1#2
{
@@ -7650,14 +7779,22 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \cs_new_eq:NN \Unicode \xeCJK_unicode_char:nn }
}
}
-\cs_new_protected_nopar:Npn \xeCJK_char_from_charcode:Nn #1#2
+\str_if_eq_x:nnTF
+ { \token_to_str:N \Ucharcat } { \token_to_meaning:N \Ucharcat }
{
- \group_begin:
- \char_set_lccode:nn { "4E00 } {#2}
- \tl_to_lowercase:n
+ \cs_new_protected_nopar:Npn \xeCJK_char_from_charcode:Nn #1#2
+ { \tl_const:Nx #1 { \Ucharcat \int_eval:n {#2} ~ \c_eleven } }
+ }
+ {
+ \cs_new_protected_nopar:Npn \xeCJK_char_from_charcode:Nn #1#2
{
- \group_end:
- \tl_const:Nn #1 { ^^^^4e00 }
+ \group_begin:
+ \char_set_lccode:nn { "4E00 } {#2}
+ \tex_lowercase:D
+ {
+ \group_end:
+ \tl_const:Nn #1 { ^^^^4e00 }
+ }
}
}
\cs_new_nopar:Npn \@@_calc_unicode:nn #1#2
@@ -7667,14 +7804,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
-% 最后引入本地配置文件。使用 \tn{@pushfilename} 和 \tn{@pushfilename} 是为了使
-% 配置文件可以不受 \hologo{LaTeX3} 语法环境的影响。
+% 最后引入本地配置文件。
% \begin{macrocode}
\bool_if:NT \g_@@_config_bool
{
- \@pushfilename
+ \ExplSyntaxOff
\file_input:n { \g_@@_config_name_tl .cfg }
- \@popfilename
+ \ExplSyntaxOn
}
% \end{macrocode}
%
@@ -9017,7 +9153,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\tl_set_eq:NN \l_xeCJK_punct_style_tl \c_@@_punct_style_plain_tl
\l_@@_restore_listings_toks_tl
- \@@_listings_output_IVS:
+ \@@_listings_output_CM:
}
\lst@AddToHook { PreSet } { \bool_set_true:N \l_@@_listings_env_bool }
% \end{macrocode}
@@ -9027,21 +9163,32 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% {解决 \texttt{listings} 坏境中代码行号输出不正确的问题,并解决在其中跨页时对页眉
% 和页脚的影响。}
% \changes{v3.2.15}{2014/11/10}{修正 \texttt{breaklines} 无效的问题。}
+% \changes{v3.3.1}{2015/04/20}
+% {解决 \texttt{prebreak} 和 \texttt{postbreak} 功能失效的问题。}
% 为使代码行号结果正确,需要在 \tn{lst@numberstyle} 中恢复 \tn{XeTeXinterchartoks}。
% 在 \texttt{listings} 环境中换页时,对 \tn{XeTeXinterchartoks} 的修改会影响到
% 页眉和页脚,需要在 \tn{shipout} 盒子中恢复成正常定义。加入 \cs{tex_noindent:D}
% 是为了进入水平模式,防止汉字出现在首行的时候可能会产生额外空行。
+% \tn{lst@prebreak} 和 \tn{lst@postbreak} 是在 \tn{discretionary} 中直接输出的,
+% 应该恢复正常的 \tn{XeTeXinterchartoks}。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_listings_initial_hook:
{
\tex_noindent:D
- \bool_gset_false:N \g_@@_listings_IVS_bool
+ \bool_gset_false:N \g_@@_listings_CM_bool
\tl_put_left:Nn \lst@numberstyle { \l_@@_restore_listings_toks_tl }
\xeCJK_add_to_shipout:n { \l_@@_restore_listings_toks_tl }
\lst@ifbreaklines
\cs_set_eq:NN \@@_listings_CJK_toks_hook: \@@_listings_breaklines_toks:
+ \tl_if_empty:NF \lst@prebreak
+ { \tl_put_left:Nn \lst@prebreak { \l_@@_restore_listings_toks_tl } }
+ \tl_if_empty:NF \lst@postbreak
+ { \tl_put_left:Nn \lst@postbreak { \l_@@_restore_listings_toks_tl } }
\fi:
+ \int_set:Nn \l_@@_listings_max_char_int
+ { \lst@ifec 255 \else: 127 \fi: }
}
+\int_new:N \l_@@_listings_max_char_int
% \end{macrocode}
% \end{macro}
%
@@ -9051,32 +9198,42 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_listings_toks_hook:
{
- \tl_set:Nx \l_@@_restore_listings_toks_tl
- {
- \@@_backup_inter_class_toks:nn { Boundary } { Default }
- \@@_backup_inter_class_toks:nn { Boundary } { CJK }
- \@@_backup_inter_class_toks:nn { Boundary } { IVS }
- \@@_backup_inter_class_toks:nn { Boundary } { HangulJamo }
- \@@_backup_inter_class_toks:nn { Boundary } { FullLeft }
- \@@_backup_inter_class_toks:nn { Boundary } { FullRight }
- }
- \seq_map_inline:Nn \g_@@_CJK_sub_class_seq
+ \tl_clear:N \l_@@_restore_listings_toks_tl
+ \seq_map_function:NN
+ \g_@@_class_seq \@@_backup_inter_class_toks:n
+ \seq_map_inline:Nn \g_@@_non_CJK_class_seq
{
- \tl_put_right:Nx \l_@@_restore_listings_toks_tl
- { \@@_backup_inter_class_toks:nn { Boundary } { CJK/##1 } }
+ \str_if_eq:nnF { ##1 } { Boundary }
+ {
+ \xeCJK_inter_class_toks:nnn { Boundary } { ##1 }
+ { \@@_listings_process_Default:nN { ##1 } }
+ }
}
- \xeCJK_inter_class_toks:nnn { Boundary } { Default }
- { \@@_listings_process_Default:N }
- \xeCJK_inter_class_toks:nnn { Boundary } { IVS }
- { \@@_listings_process_IVS:nN { \c_zero } }
+ \xeCJK_inter_class_toks:nnn { Boundary } { CM }
+ { \@@_listings_process_CM:nN { \c_zero } }
\@@_listings_CJK_toks_hook:
}
-\tl_new:N \l_@@_restore_listings_toks_tl
-\cs_new_nopar:Npn \@@_backup_inter_class_toks:nn #1#2
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\@@_backup_inter_class_toks:n}
+% 注意,给 \tn{XeTeXinterchartoks} 赋空值,会导致 \XeTeX 崩溃!
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_backup_inter_class_toks:n #1
{
- \xeCJK_inter_class_toks:nnn {#1} {#2}
- { \xeCJK_get_inter_class_toks:nn {#1} {#2} }
+ \tl_set:Nx \l_@@_tmp_tl
+ { \xeCJK_get_inter_class_toks:nn { Boundary } {#1} }
+ \tl_put_right:Nx \l_@@_restore_listings_toks_tl
+ {
+ \xeCJK_inter_class_toks:nnn { Boundary } {#1}
+ {
+ \tl_if_empty:NTF \l_@@_tmp_tl
+ { \exp_not:N \prg_do_nothing: }
+ { \exp_not:o \l_@@_tmp_tl }
+ }
+ }
}
+\tl_new:N \l_@@_restore_listings_toks_tl
% \end{macrocode}
% \end{macro}
%
@@ -9118,17 +9275,42 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\@@_listings_process_Default:N,\@@_listings_process_CJK:nN}
+% \begin{macro}[internal]{\@@_listings_process_Default:nN}
% \changes{v3.2.3}{2013/06/08}{在 \texttt{listings} 坏境中对 \tn{charcode} 大于
% $255$ 的字符根据其 \tn{catcode} 区分 \texttt{letter} 和 \texttt{other}。}
+% \changes{v3.3.1}{2015/01/27}{对 \pkg{listings} 的字符扩展不影响到其符号表中的
+% 七位或八位字符。}
% 对于 \tn{charcode} 大于 $255$ 的字符,根据 \tn{catcode} 进行处理。
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_listings_process_Default:N #1
+\cs_new_protected_nopar:Npn \@@_listings_process_Default:nN #1#2
{
- \token_if_letter:NTF #1
- { \lst@ProcessLetter #1 }
- { \lst@ProcessOther #1 }
+ \int_compare:nNnTF
+ { \xeCJK_token_value_charcode:N #2 } > \l_@@_listings_max_char_int
+ {
+ \token_if_letter:NTF #2
+ { \lst@ProcessLetter #2 }
+ { \lst@ProcessOther #2 }
+ }
+ { \@@_listings_output_Default:nN {#1} #2 }
}
+% \end{macrocode}
+% 输出时,要注意把对应的 \tn{XeTeXinterchartoks} 清空掉,否则会造成死循环。
+% \cs{scan_stop:} 是造边界,输出 \cs{group_end:}。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_listings_output_Default:nN #1#2
+ {
+ \group_begin:
+ \xeCJK_clear_inter_class_toks:nn { Boundary } {#1}
+ \xeCJK_inter_class_toks:nnn {#1} { Boundary } { \group_end: }
+ #2
+ \scan_stop:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\@@_listings_process_CJK:nN}
+% 对 CJK 字符类的处理。
+% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_listings_process_CJK:nN #1#2
{
\token_if_letter:NTF #2
@@ -9139,7 +9321,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macro}
%
% \begin{macro}[internal]{\@@_listings_append:nN}
-% 普通 CJK 字符的宽度为一般基本宽度的两倍,IVS 类不增加宽度。这里有一个问题,
+% 普通 CJK 字符的宽度为一般基本宽度的两倍,CM 类不增加宽度。这里有一个问题,
% 对 CJK 字符类中的一些半角字符(例如半角日文假名)没有区分开。\pkg{listings} 通过
% 重定义 \tn{lst@Append} 将代码写入外部文件,因此需要保留。
% \begin{macrocode}
@@ -9277,35 +9459,35 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\@@_listings_process_IVS:nN}
-% \texttt{IVS} 类作为 \texttt{letter} 处理,不用增加 \tn{lst@length}。
+% \begin{macro}[internal]{\@@_listings_process_CM:nN}
+% \texttt{CM} 类作为 \texttt{letter} 处理,不用增加 \tn{lst@length}。
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_listings_process_IVS:nN
+\cs_new_protected_nopar:Npn \@@_listings_process_CM:nN
{
\reverse_if:N \lst@ifflexible
- \bool_gset_true:N \g_@@_listings_IVS_bool
+ \bool_gset_true:N \g_@@_listings_CM_bool
\fi:
\@@_listings_process_letter:nN
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\@@_listings_output_IVS:}
+% \begin{macro}[internal]{\@@_listings_output_CM:}
% 在使用 \texttt{columns=fixed} 选项时,\pkg{listings} 会在输出盒子里的每个字符
-% 之间加入 \tn{hss},这就破坏了 \XeTeX 将基本字和 IVS 正确的组合起来。
+% 之间加入 \tn{hss},这就破坏了 \XeTeX 将基本字和组合标识正确的组合起来。
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_listings_output_IVS:
+\cs_new_protected_nopar:Npn \@@_listings_output_CM:
{
\reverse_if:N \lst@ifflexible
- \bool_if:NT \g_@@_listings_IVS_bool
+ \bool_if:NT \g_@@_listings_CM_bool
{
- \bool_gset_false:N \g_@@_listings_IVS_bool
+ \bool_gset_false:N \g_@@_listings_CM_bool
\xeCJK_cs_clear:N \lst@FillOutputBox
\cs_set_eq:NN \CJKglue \tex_hss:D
}
\fi:
}
-\bool_new:N \g_@@_listings_IVS_bool
+\bool_new:N \g_@@_listings_CM_bool
% \end{macrocode}
% \end{macro}
%
@@ -9322,7 +9504,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\token_if_cs:NTF #3
{ #2#3 }
{
- \int_compare:nNnTF { `#3 } > { \lst@ifec 255 \else: 127 \fi: }
+ \int_compare:nNnTF { `#3 } > { \l_@@_listings_max_char_int }
{ \@@_listings_peek_active_loop:TF { #1#3 } { #2#3 } }
{ #2#3 }
}
@@ -9348,7 +9530,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\cs_new_protected_nopar:Npn \@@_listings_inline_group:w
{
\exp_after:wN \@@_listings_inline_group:n
- \exp_after:wN { \if_false: } \fi:
+ \exp_after:wN { \if_int_compare:w `} = \c_zero \fi:
}
\cs_set_eq:NN \lst@InlineGJ \@@_listings_inline_group:w
\cs_new_protected:Npn \@@_listings_inline_group:n #1
@@ -9472,11 +9654,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\clist_remove_duplicates:N \l_@@_encname_clist
\use:x
{
- \bool_if:NT \l__kernel_expl_bool { \ExplSyntaxOff }
+ \ExplSyntaxOff
\char_set_catcode_letter:n { 64 }
\@@_reload:N \exp_not:N \l_@@_encname_clist
+ \bool_if:NTF \l__kernel_expl_bool
+ { \ExplSyntaxOn }
+ { \ExplSyntaxOff }
\char_set_catcode:nn { 64 } { \char_value_catcode:n { 64 } }
- \bool_if:NT \l__kernel_expl_bool { \ExplSyntaxOn }
}
}
\cs_new_protected:Npn \@@_reload:N #1
@@ -9669,7 +9853,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\@@_provide_text_command_default:N #1
\group_begin:
\char_set_lccode:nn { `0 } { \@@_check_slot:n {#3} }
- \tl_to_lowercase:n
+ \tex_lowercase:D
{
\group_end:
\@@_declare_character:NNxn 0
@@ -9932,7 +10116,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\group_begin:
\char_set_lccode:nn { `4 } { \@@_check_slot:n {#4} }
\char_set_lccode:nn { `5 } { \@@_check_slot:n {#5} }
- \tl_to_lowercase:n
+ \tex_lowercase:D
{
\group_end:
\@@_declare_encoded:NNNNxx 4 5
@@ -12215,10 +12399,10 @@ lang_set = {
%</ex-verb>
% \end{macrocode}
%
-% \subsection{\pkg{xeCJK-example-IVS.tex}}
+% \subsection{\pkg{xeCJK-example-CM.tex}}
%
% \begin{macrocode}
-%<*ex-IVS>
+%<*ex-cm>
% \end{macrocode}
%
% \begin{macrocode}
@@ -12256,7 +12440,7 @@ lang_set = {
% \end{macrocode}
%
% \begin{macrocode}
-%</ex-IVS>
+%</ex-cm>
% \end{macrocode}
%
% \subsection{\pkg{xeCJK-example-listings.tex}}
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins
index 80c0f3f94b4..8ccb6dd5dbc 100644
--- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins
+++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins
@@ -6,8 +6,6 @@
%%
%% xeCJK.dtx (with options: `install')
%%
-%% $Id: xeCJK.dtx 750 2014-12-26 08:13:35Z sobenlee@gmail.com $
-%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
%% Wenchang Sun <sunwch@nankai.edu.cn>
@@ -15,9 +13,9 @@
%% Leo Liu <leoliu.pku@gmail.com>
%% Qing Lee <sobenlee@gmail.com>
%%
-%% Copyright (C) 2007--2014 Wenchang Sun
-%% (C) 2009--2014 Leo Liu
-%% (C) 2012--2014 Qing Lee
+%% Copyright (C) 2007--2015 Wenchang Sun
+%% (C) 2009--2015 Leo Liu
+%% (C) 2012--2015 Qing Lee
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -32,13 +30,52 @@
%% -----------------------------------------------------------------
%%
+\newread\inputcheck
+\openin\inputcheck=xeCJK.ver
+\ifeof\inputcheck
+ \def\xeCJKPutVersion{\string\GetIdInfo$Id$}
+\else
+ \input xeCJK.ver
+\fi
+\closein\inputcheck
+
\input l3docstrip.tex
+
+\def\checkOption<#1{%
+ \ifcase
+ \ifx*#10\else \ifx/#11\else
+ \ifx+#12\else \ifx-#13\else
+ \ifx<#14\else \ifx @#15\else
+ \ifx.#16\else
+ 7\fi\fi\fi\fi\fi\fi\fi\relax
+ \expandafter\starOption\or
+ \expandafter\slashOption\or
+ \expandafter\plusOption\or
+ \expandafter\minusOption\or
+ \expandafter\verbOption\or
+ \expandafter\moduleOption\or
+ \expandafter\expOption\or
+ \expandafter\doOption\fi
+ #1%
+}
+\def\expOption .#1>#2\endLine{%
+ \maybeMsg{<.#1 . >}%
+ \Evaluate{#1}%
+ \begingroup
+ \catcode`\\=0 \catcode`\{=1 \catcode`\}=2
+ \xdef\expandedLineStuff{\scantokens{#2\noexpand}}%
+ \endgroup
+ \def\do##1##2##3{%
+ \if1\Expr{##2}\StreamPut##1{\expandedLineStuff}\fi
+ }%
+ \activefiles
+}
+
\keepsilent
\askforoverwritefalse
+
\preamble
-$Id: xeCJK.dtx 750 2014-12-26 08:13:35Z sobenlee@gmail.com $
-$URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
-----------------------------------------------------------------
Author:
Wenchang Sun <sunwch@nankai.edu.cn>
@@ -46,9 +83,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
Leo Liu <leoliu.pku@gmail.com>
Qing Lee <sobenlee@gmail.com>
- Copyright (C) 2007--2014 Wenchang Sun
- (C) 2009--2014 Leo Liu
- (C) 2012--2014 Qing Lee
+ Copyright (C) 2007--2015 Wenchang Sun
+ (C) 2009--2015 Leo Liu
+ (C) 2012--2015 Qing Lee
This file may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -86,7 +123,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
xeCJK-example-CJKfntef.tex,
xeCJK-example-punctstyle.tex,
xeCJK-example-verbatim.tex,
- xeCJK-example-IVS.tex,
+ xeCJK-example-CM.tex,
xeCJK-example-listings.tex,
xunicode-symbols.tex,
xunicode-commands.tex,
@@ -103,35 +140,36 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\declarepostamble\emptypostamble
\endpostamble
-\generate{
- \usedir{source/xelatex/xecjk}
- \file{xeCJK.ins}{\from{\jobname.dtx}{install}}
- \usedir{tex/xelatex/xecjk}
- \file{xeCJK.sty}{\from{\jobname.dtx}{package}}
- \file{xeCJKfntef.sty}{\from{\jobname.dtx}{fntef}}
- \file{xeCJK-listings.sty}{\from{\jobname.dtx}{listings}}
- \file{xunicode-addon.sty}{\from{\jobname.dtx}{xunicode}}
- \file{xunicode-extra.def}{\from{\jobname.dtx}{xunextra}}
- \usepreamble\emptypreamble
- \usepostamble\emptypostamble
- \usedir{tex/xelatex/xecjk/config}
- \file{xeCJK.cfg}{\from{\jobname.dtx}{config}}
- \usedir{doc/xelatex/xecjk/example}
- \file{xeCJK-example-autofake.tex}{\from{\jobname.dtx}{ex-autofake}}
- \file{xeCJK-example-fallback.tex}{\from{\jobname.dtx}{ex-fallback}}
- \file{xeCJK-example-subCJKblock.tex}{\from{\jobname.dtx}{ex-block}}
- \file{xeCJK-example-CJKecglue.tex}{\from{\jobname.dtx}{ex-ecglue}}
- \file{xeCJK-example-checksingle.tex}{\from{\jobname.dtx}{ex-single}}
- \file{xeCJK-example-CJKfntef.tex}{\from{\jobname.dtx}{ex-fntef}}
- \file{xeCJK-example-punctstyle.tex}{\from{\jobname.dtx}{ex-punctstyle}}
- \file{xeCJK-example-verbatim.tex}{\from{\jobname.dtx}{ex-verb}}
- \file{xeCJK-example-IVS.tex}{\from{\jobname.dtx}{ex-IVS}}
- \file{xeCJK-example-listings.tex}{\from{\jobname.dtx}{ex-listings}}
- \file{xunicode-symbols.tex}{\from{\jobname.dtx}{xunicode-symbols}}
- \nopreamble\nopostamble
- \usedir{doc/xelatex/xecjk}
- \file{README.txt}{\from{\jobname.dtx}{readme}}
-}
+\generate
+ {
+ \usedir{source/xelatex/xecjk}
+ \file{xeCJK.ins} {\from{\jobname.dtx}{install}}
+ \usedir{tex/xelatex/xecjk}
+ \file{xeCJK.sty} {\from{\jobname.dtx}{package}}
+ \file{xeCJKfntef.sty} {\from{\jobname.dtx}{fntef}}
+ \file{xeCJK-listings.sty} {\from{\jobname.dtx}{listings}}
+ \file{xunicode-addon.sty} {\from{\jobname.dtx}{xunicode}}
+ \file{xunicode-extra.def} {\from{\jobname.dtx}{xunextra}}
+ \usepreamble\emptypreamble
+ \usepostamble\emptypostamble
+ \usedir{tex/xelatex/xecjk/config}
+ \file{xeCJK.cfg} {\from{\jobname.dtx}{config}}
+ \usedir{doc/xelatex/xecjk/example}
+ \file{xeCJK-example-autofake.tex} {\from{\jobname.dtx}{ex-autofake}}
+ \file{xeCJK-example-fallback.tex} {\from{\jobname.dtx}{ex-fallback}}
+ \file{xeCJK-example-subCJKblock.tex} {\from{\jobname.dtx}{ex-block}}
+ \file{xeCJK-example-CJKecglue.tex} {\from{\jobname.dtx}{ex-ecglue}}
+ \file{xeCJK-example-checksingle.tex} {\from{\jobname.dtx}{ex-single}}
+ \file{xeCJK-example-CJKfntef.tex} {\from{\jobname.dtx}{ex-fntef}}
+ \file{xeCJK-example-punctstyle.tex} {\from{\jobname.dtx}{ex-punctstyle}}
+ \file{xeCJK-example-verbatim.tex} {\from{\jobname.dtx}{ex-verb}}
+ \file{xeCJK-example-CM.tex} {\from{\jobname.dtx}{ex-cm}}
+ \file{xeCJK-example-listings.tex} {\from{\jobname.dtx}{ex-listings}}
+ \file{xunicode-symbols.tex} {\from{\jobname.dtx}{xunicode-symbols}}
+ \nopreamble\nopostamble
+ \usedir{doc/xelatex/xecjk}
+ \file{README.txt} {\from{\jobname.dtx}{readme}}
+ }
\endbatchfile
%%
@@ -156,7 +194,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% xeCJK-example-CJKfntef.tex,
%% xeCJK-example-punctstyle.tex,
%% xeCJK-example-verbatim.tex,
-%% xeCJK-example-IVS.tex,
+%% xeCJK-example-CM.tex,
%% xeCJK-example-listings.tex,
%% xunicode-symbols.tex,
%% xunicode-commands.tex,