diff options
15 files changed, 1754 insertions, 1472 deletions
diff --git a/Master/texmf-dist/doc/xelatex/xecjk/README b/Master/texmf-dist/doc/xelatex/xecjk/README deleted file mode 100644 index 6145bc6f7b7..00000000000 --- a/Master/texmf-dist/doc/xelatex/xecjk/README +++ /dev/null @@ -1,71 +0,0 @@ - -xeCJK is a package written for XeLaTeX which allows users to typeset -CJK scripts easily. - - - different default fonts for CJK and other characters; - - spaces automatically ignored between CJK characters; - - special effects on full-width CJK punctuation; and - - automatic adjustment of the space between CJK and other characters. - -This package is licensed in LPPL. - -This package consists of the file xeCJK.dtx, - full-stop.map, - fullwidth-stop.map, - han-simp.map, - han-trad.map, - and the derived files xeCJK.pdf, - xeCJK.sty, - xeCJK.cfg, - xeCJK.ins, - xeCJKfntef.sty, - xeCJK-listings.sty, - xunicode-addon.sty, - xunicode-extra.def, - xeCJK-example-autofake.tex, - xeCJK-example-fallback.tex, - xeCJK-example-subCJKblock.tex, - xeCJK-example-CJKecglue.tex, - xeCJK-example-checksingle.tex, - xeCJK-example-CJKfntef.tex, - xeCJK-example-punctstyle.tex, - xeCJK-example-verbatim.tex, - xeCJK-example-CM.tex, - xeCJK-example-listings.tex, - xunicode-symbols.tex, - xunicode-commands.tex, - xunicode-combine-marks.tex, - xunicode-symbols.pdf, - full-stop.tec, - fullwidth-stop.tec, - han-simp.tec, - han-trad.tec, and - README.txt (this file). - -If you are interested in the process of development you may observe - - https://github.com/CTeX-org/ctex-kit - - Author: - Wenchang Sun <sunwch@nankai.edu.cn> - Current Maintainers: - Leo Liu <leoliu.pku@gmail.com> - Qing Lee <sobenlee@gmail.com> - -Installation ------------- -The package is supplied in dtx format and as a pre-extracted zip file, -xecjk.tds.zip. The later is most convenient for most users: simply -unzip this in your local texmf directory and run texhash to update the -database of file locations. If you want to unpack the dtx yourself, -running "xetex xeCJK.dtx" will extract the package whereas -"xelatex xeCJK.dtx" will typeset the documentation. - -The package requires LaTeX3 support as provided in the l3kernel and -l3packages bundles and the fontspec package. All of these are available -on CTAN as ready-to-install zip files. Suitable versions are available -in the latest version of MiKTeX and TeX Live (updating the relevant -packages online may be necessary). - -To compile the documentation without error, you will need some specific -CJK scripts fonts (TrueType or OpenType). diff --git a/Master/texmf-dist/doc/xelatex/xecjk/README.md b/Master/texmf-dist/doc/xelatex/xecjk/README.md new file mode 100644 index 00000000000..ee06cc9f0b9 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xecjk/README.md @@ -0,0 +1,73 @@ +xeCJK +===== + +`xeCJK` is a package written for XeLaTeX which allows users to typeset +CJK scripts easily. + + - Different default fonts for CJK and other characters. + - Spaces automatically ignored between CJK characters. + - Special effects on full-width CJK punctuation. + - Automatic adjustment of the space between CJK and other characters. + +Contributing +------------ + +This package is a part of the [ctex-kit](https://github.com/CTeX-org/ctex-kit) project. + +Issues and pull requests are welcome. + +Copyright and Licence +--------------------- + + Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> + Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> + ---------------------------------------------------------------------- + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and the latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. + + This work has the LPPL maintenance status `maintained'. + + The Current Maintainers of this work are Leo Liu and Qing Lee. + + This package consists of the files xeCJK.dtx, + full-stop.map, + fullwidth-stop.map, + han-simp.map, + han-trad.map, + and the derived files xeCJK.pdf, + xeCJK.sty, + xeCJK.cfg, + xeCJK.ins, + xeCJKfntef.sty, + xeCJK-listings.sty, + xunicode-addon.sty, + xunicode-extra.def, + xeCJK-example-autofake.tex, + xeCJK-example-fallback.tex, + xeCJK-example-subCJKblock.tex, + xeCJK-example-CJKecglue.tex, + xeCJK-example-checksingle.tex, + xeCJK-example-CJKfntef.tex, + xeCJK-example-punctstyle.tex, + xeCJK-example-verbatim.tex, + xeCJK-example-CM.tex, + xeCJK-example-listings.tex, + xeCJK-example-mathblock.tex, + xunicode-symbols.tex, + xunicode-commands.tex, + xunicode-combine-marks.tex, + xunicode-symbols.pdf, + full-stop.tec, + fullwidth-stop.tec, + han-simp.tec, + han-trad.tec, and + README.md (this file). diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-mathblock.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-mathblock.tex new file mode 100644 index 00000000000..e4b8346b56a --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-mathblock.tex @@ -0,0 +1,47 @@ +%% +%% This is file `xeCJK-example-mathblock.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xeCJK.dtx (with options: `ex-mathblock') +%% +\documentclass{article} + +\usepackage{url} +\usepackage[CJKmath]{xeCJK} + +\setCJKmainfont[BoldFont=SimHei]{SimSun} +\setCJKmonofont{KaiTi} + +\ExplSyntaxOn +\tl_const:Nn \c_test_text_tl { 天地玄黃宇宙洪荒日月盈昃辰宿列張寒來暑往秋收冬藏閏餘成歲律呂調陽 } +\cs_new:Npn \test_color:n #1 + { \exp_args:No \str_range:nnn { \mdfivesum {#1} } { 1 } { 6 } } +\tl_map_inline:Nn \c_test_text_tl + { + \xeCJKDeclareSubCJKBlock {#1} { `#1 } + \setCJKmainfont + [ #1 , Color = \test_color:n {#1} , BoldFont = SimHei ] { SimSun } + \setCJKmonofont [ #1 ] { KaiTi } + } +\cs_new_protected_nopar:Npn \TEST + { + \exp_args:No \path { \c_test_text_tl } \par + \c_test_text_tl \par + $ \c_test_text_tl $ + } +\ExplSyntaxOff + +\begin{document} + +\TEST + +\bigskip + +\bfseries\mathversion{bold}\TEST + +\end{document} +%% +%% +%% End of file `xeCJK-example-mathblock.tex'. diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf Binary files differindex bde676d31d4..4100534d02a 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf +++ b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf b/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf Binary files differindex 835cf06e8bf..2b28ae687ac 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf +++ b/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf diff --git a/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/full-stop.map b/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/full-stop.map index 6f38a7b3eda..0a23fe0e05f 100644 --- a/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/full-stop.map +++ b/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/full-stop.map @@ -1,4 +1,4 @@ -; TECkit mapping for conversion of `FULLWIDTH FULL STOP' to `IDEOGRAPHIC FULL STOP' +; TECkit mapping for conversion of `FULLWIDTH FULL STOP" to `IDEOGRAPHIC FULL STOP" ; LHSName "FULLWIDTH FULL STOP" diff --git a/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/fullwidth-stop.map b/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/fullwidth-stop.map index 0b030edb532..4c2c9c991a1 100644 --- a/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/fullwidth-stop.map +++ b/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/fullwidth-stop.map @@ -1,4 +1,4 @@ -; TECkit mapping for conversion of `IDEOGRAPHIC FULL STOP' to `FULLWIDTH FULL STOP' +; TECkit mapping for conversion of `IDEOGRAPHIC FULL STOP" to `FULLWIDTH FULL STOP" ; LHSName "IDEOGRAPHIC FULL STOP" diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx index af634c8171e..5d995356257 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx @@ -4,206 +4,160 @@ \iffalse %</internal> %<*readme> +xeCJK +===== -xeCJK is a package written for XeLaTeX which allows users to typeset +`xeCJK` is a package written for XeLaTeX which allows users to typeset CJK scripts easily. + - Different default fonts for CJK and other characters. + - Spaces automatically ignored between CJK characters. + - Special effects on full-width CJK punctuation. + - Automatic adjustment of the space between CJK and other characters. - - different default fonts for CJK and other characters; - - spaces automatically ignored between CJK characters; - - special effects on full-width CJK punctuation; and - - automatic adjustment of the space between CJK and other characters. - +Contributing +------------ -This package is licensed in LPPL. +This package is a part of the [ctex-kit](https://github.com/CTeX-org/ctex-kit) project. -This package consists of the file xeCJK.dtx, - full-stop.map, - fullwidth-stop.map, - han-simp.map, - han-trad.map, - and the derived files xeCJK.pdf, - xeCJK.sty, - xeCJK.cfg, - xeCJK.ins, - xeCJKfntef.sty, - xeCJK-listings.sty, - xunicode-addon.sty, - xunicode-extra.def, - xeCJK-example-autofake.tex, - xeCJK-example-fallback.tex, - xeCJK-example-subCJKblock.tex, - xeCJK-example-CJKecglue.tex, - xeCJK-example-checksingle.tex, - xeCJK-example-CJKfntef.tex, - xeCJK-example-punctstyle.tex, - xeCJK-example-verbatim.tex, - xeCJK-example-CM.tex, - xeCJK-example-listings.tex, - xunicode-symbols.tex, - xunicode-commands.tex, - xunicode-combine-marks.tex, - xunicode-symbols.pdf, - full-stop.tec, - fullwidth-stop.tec, - han-simp.tec, - han-trad.tec, and - README.txt (this file). +Issues and pull requests are welcome. -If you are interested in the process of development you may observe +Copyright and Licence +--------------------- - https://github.com/CTeX-org/ctex-kit + Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> + Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> + ---------------------------------------------------------------------- - Author: - Wenchang Sun <sunwch@nankai.edu.cn> - Current Maintainers: - Leo Liu <leoliu.pku@gmail.com> - Qing Lee <sobenlee@gmail.com> + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and the latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. + This work has the LPPL maintenance status `maintained'. -Installation ------------- -The package is supplied in dtx format and as a pre-extracted zip file, -xecjk.tds.zip. The later is most convenient for most users: simply -unzip this in your local texmf directory and run texhash to update the -database of file locations. If you want to unpack the dtx yourself, -running "xetex xeCJK.dtx" will extract the package whereas -"xelatex xeCJK.dtx" will typeset the documentation. + The Current Maintainers of this work are Leo Liu and Qing Lee. -The package requires LaTeX3 support as provided in the l3kernel and -l3packages bundles and the fontspec package. All of these are available -on CTAN as ready-to-install zip files. Suitable versions are available -in the latest version of MiKTeX and TeX Live (updating the relevant -packages online may be necessary). - -To compile the documentation without error, you will need some specific -CJK scripts fonts (TrueType or OpenType). + This package consists of the files xeCJK.dtx, + full-stop.map, + fullwidth-stop.map, + han-simp.map, + han-trad.map, + and the derived files xeCJK.pdf, + xeCJK.sty, + xeCJK.cfg, + xeCJK.ins, + xeCJKfntef.sty, + xeCJK-listings.sty, + xunicode-addon.sty, + xunicode-extra.def, + xeCJK-example-autofake.tex, + xeCJK-example-fallback.tex, + xeCJK-example-subCJKblock.tex, + xeCJK-example-CJKecglue.tex, + xeCJK-example-checksingle.tex, + xeCJK-example-CJKfntef.tex, + xeCJK-example-punctstyle.tex, + xeCJK-example-verbatim.tex, + xeCJK-example-CM.tex, + xeCJK-example-listings.tex, + xeCJK-example-mathblock.tex, + xunicode-symbols.tex, + xunicode-commands.tex, + xunicode-combine-marks.tex, + xunicode-symbols.pdf, + full-stop.tec, + fullwidth-stop.tec, + han-simp.tec, + han-trad.tec, and + README.md (this file). %</readme> %<*internal> \fi \begingroup - \edef\tempa{\fmtname} - \edef\tempb{plain} -\expandafter\endgroup -\ifx\tempa\tempb + \def\temp{LaTeX2e} +\expandafter\endgroup\ifx\temp\fmtname\else \csname fi\endcsname %</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 +\input ctxdocstrip % \preamble ------------------------------------------------------------------ - Author: - Wenchang Sun <sunwch@nankai.edu.cn> - Current Maintainers: - Leo Liu <leoliu.pku@gmail.com> - Qing Lee <sobenlee@gmail.com> + Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> + Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> +---------------------------------------------------------------------- - Copyright (C) 2007--2010 Wenchang Sun - (C) 2009--2016 Leo Liu - (C) 2012--2016 Qing Lee + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and the latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. - This file may be distributed and/or modified under the - conditions of the LaTeX Project Public License, either version 1.3 - of this license or (at your option) any later version. - The latest version of this license is in - http://www.latex-project.org/lppl.txt - and version 1.3 or later is part of all distributions of LaTeX - version 2005/12/01 or later. + This work has the LPPL maintenance status `maintained'. - This work has the LPPL maintenance status "maintained". - The Current Maintainer of this work are Leo Liu and Qing Lee. ------------------------------------------------------------------ + The Current Maintainers of this work are Leo Liu and Qing Lee. + +---------------------------------------------------------------------- \endpreamble \postamble - This package consists of the file xeCJK.dtx, - full-stop.map, - fullwidth-stop.map, - han-simp.map, - han-trad.map, - and the derived files xeCJK.pdf, - xeCJK.sty, - xeCJK.cfg, - xeCJK.ins, - xeCJKfntef.sty, - xeCJK-listings.sty, - xunicode-addon.sty, - xunicode-extra.def, - xeCJK-example-autofake.tex, - xeCJK-example-fallback.tex, - xeCJK-example-subCJKblock.tex, - xeCJK-example-CJKecglue.tex, - xeCJK-example-checksingle.tex, - xeCJK-example-CJKfntef.tex, - xeCJK-example-punctstyle.tex, - xeCJK-example-verbatim.tex, - xeCJK-example-CM.tex, - xeCJK-example-listings.tex, - xunicode-symbols.tex, - xunicode-commands.tex, - xunicode-combine-marks.tex, - xunicode-symbols.pdf, - full-stop.tec, - fullwidth-stop.tec, - han-simp.tec, - han-trad.tec, and - README.txt. -\endpostamble -\declarepreamble\emptypreamble -\endpreamble -\declarepostamble\emptypostamble + This package consists of the files xeCJK.dtx, + full-stop.map, + fullwidth-stop.map, + han-simp.map, + han-trad.map, + and the derived files xeCJK.pdf, + xeCJK.sty, + xeCJK.cfg, + xeCJK.ins, + xeCJKfntef.sty, + xeCJK-listings.sty, + xunicode-addon.sty, + xunicode-extra.def, + xeCJK-example-autofake.tex, + xeCJK-example-fallback.tex, + xeCJK-example-subCJKblock.tex, + xeCJK-example-CJKecglue.tex, + xeCJK-example-checksingle.tex, + xeCJK-example-CJKfntef.tex, + xeCJK-example-punctstyle.tex, + xeCJK-example-verbatim.tex, + xeCJK-example-CM.tex, + xeCJK-example-listings.tex, + xeCJK-example-mathblock.tex, + xunicode-symbols.tex, + xunicode-commands.tex, + xunicode-combine-marks.tex, + xunicode-symbols.pdf, + full-stop.tec, + fullwidth-stop.tec, + han-simp.tec, + han-trad.tec, and + README.md. \endpostamble \generate { +%</install> +%<*internal> \usedir{source/xelatex/xecjk} \file{xeCJK.ins} {\from{\jobname.dtx}{install}} +%</internal> +%<*install> \usedir{tex/xelatex/xecjk} \file{xeCJK.sty} {\from{\jobname.dtx}{package}} \file{xeCJKfntef.sty} {\from{\jobname.dtx}{fntef}} @@ -225,10 +179,11 @@ CJK scripts fonts (TrueType or OpenType). \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{xeCJK-example-mathblock.tex} {\from{\jobname.dtx}{ex-mathblock}} \file{xunicode-symbols.tex} {\from{\jobname.dtx}{xunicode-symbols}} \nopreamble\nopostamble \usedir{doc/xelatex/xecjk} - \file{README.txt} {\from{\jobname.dtx}{readme}} + \file{README.md} {\from{\jobname.dtx}{readme}} } \endbatchfile @@ -236,101 +191,42 @@ CJK scripts fonts (TrueType or OpenType). %<*internal> \fi %</internal> -%<*driver|package|config|fntef|listings|xunicode|xunextra> -%<*!config&!xunextra> -\NeedsTeXFormat{LaTeX2e} -\RequirePackage{expl3} -%</!config&!xunextra> -%<.!driver>\xeCJKPutVersion -%<*driver> -\InputIfFileExists{xeCJK.ver}{}{ - \def\xeCJKGetVersionInfo{\GetIdInfo$Id$}} -\xeCJKGetVersionInfo -%</driver> -%<*driver|package> - {Typesetting CJK scripts with XeLaTeX} -%</driver|package> +%<*package|config|fntef|listings|xunicode|xunextra> +%<!(config|xunextra)>\NeedsTeXFormat{LaTeX2e} +%<!(config|xunextra)>\RequirePackage{expl3} +%<+!driver>\GetIdInfo$Id$ +%<package> {Typesetting CJK scripts with XeLaTeX} %<config> {Configuration file for xeCJK package} %<fntef> {xeCJK font effect} %<listings> {xeCJK patch file for listings} %<xunicode> {addon file for xunicode} %<xunextra> {extra definition for xunicode} -%<*driver|config|xunextra> -\ProvidesExplFile -%</driver|config|xunextra> +%<package>\ProvidesExplPackage{\ExplFileName} +%<config>\ProvidesExplFile{\ExplFileName.cfg} +%<fntef>\ProvidesExplPackage{xeCJKfntef} +%<listings>\ProvidesExplPackage{xeCJK-listings} +%<xunicode>\ProvidesExplPackage{xunicode-addon} +%<xunextra>\ProvidesExplFile{xunicode-extra.def} +%<!driver> {\ExplFileDate}{3.4.0}{\ExplFileDescription} +%</package|config|fntef|listings|xunicode|xunextra> %<*driver> - {\ExplFileName.\ExplFileExtension} -%</driver> -%<config> {\ExplFileName.cfg} -%<xunextra> {xunicode-extra.def} -%<package|fntef|listings|xunicode>\ProvidesExplPackage -%<package> {\ExplFileName} -%<fntef> {xeCJKfntef} -%<listings> {xeCJK-listings} -%<xunicode> {xunicode-addon} - {\ExplFileDate}{3.3.4}{\ExplFileDescription} -%<xunextra>\ExplSyntaxOff -%<*driver> -\let\xeCJKrevnum\ExplFileVersion -\ExplSyntaxOff -%</driver> -%</driver|package|config|fntef|listings|xunicode|xunextra> -% -%<*driver> -\expandafter\let\csname ver@thumbpdf.sty\endcsname\fmtversion -\documentclass[numbered,a4paper,full]{l3doc} -\hypersetup{pdfstartview=FitH} -\usepackage{xeCJK} -\usepackage{xeCJKfntef} -\usepackage{geometry} -\usepackage[toc]{multitoc} -\usepackage{indentfirst} -\usepackage{unicode-math} -\usepackage{fvrb-ex} -\fvset{formatcom=\xeCJKVerbAddon} -\linespread{1.1} -\setlist{noitemsep,topsep=1ex} -\newlist{optiondesc}{description}{3} -\setlist[optiondesc]{font=\mdseries\ttfamily,align=right,labelsep=.5em,leftmargin=4.5em} -\def\PSKeyVal#1#2{\item[#1]\makebox[4em][l]{\meta{#2}}\ignorespaces} -\setmainfont{TeX Gyre Pagella} -\setsansfont{CMU Sans Serif} -\setmonofont[ - UprightFont=* Light, BoldFont=* Bold, - SlantedFont=* Light Oblique]{CMU Typewriter Text} -\setCJKmainfont[BoldFont=Adobe Heiti Std,ItalicFont=Adobe Kaiti Std]{Adobe Song Std} -\setmathfont{texgyrepagella-math.otf} -\setCJKmonofont{Adobe Kaiti Std} +\documentclass{ctxdoc} \xeCJKDeclareSubCJKBlock{HKMD} { "FF65 } \xeCJKDeclareSubCJKBlock{Ext-B} { "20000 -> "2A6DF } -\xeCJKDeclareSubCJKBlock{Hangul}{ "1100 -> "11FF, "3130 -> "318F, "A960 -> "A97F, "AC00 -> "D7AF } +\xeCJKDeclareSubCJKBlock{Hangul} + { "1100 -> "11FF, "3130 -> "318F, "A960 -> "A97F, "AC00 -> "D7AF } \setCJKmainfont[HKMD]{Microsoft YaHei} \setCJKmainfont[Ext-B]{SimSun-ExtB} \setCJKmainfont[Hangul, Script=Hangul]{Malgun Gothic} -\xeCJKsetup{PunctStyle=kaiming,KaiMingPunct+={:;}} -\def\MacroFont{\small\linespread{1}\normalfont\ttfamily} -\def\XeTeX{\hologo{XeTeX}} -\def\XeLaTeX{\hologo{XeLaTeX}} -\def\LaTeX{\hologo{LaTeX}} -\def\LaTeXe{\hologo{LaTeX2e}} -\parindent=2em -\AtBeginDocument{\DeleteShortVerb{\"}\MakeShortVerb{\|}} -\def\contentsname{目录} -\DeclareUrlCommand\email{\def\UrlLeft##1\UrlRight{\href{mailto:##1}{##1}}} -\def\ctexkit{\href{https://github.com/CTeX-org/ctex-kit/}{\texttt{ctex-kit}}} -\def\ctexkitrev#1{% - \href{https://github.com/CTeX-org/ctex-kit/commit/#1}{\texttt{ctex-kit} rev. #1}} -\makeatletter +\newlist{psopt}{description}{3} +\setlist[psopt]{% + font=\mdseries\ttfamily, align=right, + labelsep=.5em, leftmargin=4.5em, labelindent=0pt} +\newcommand\PSKeyVal[2]{% + \item[#1]\makebox[4em][l]{\meta{#2}}\ignorespaces} +\newcommand\tokslink[1]{\hyperlink{#1}{\ding{51}}} +\AtBeginDocument{\DeleteShortVerb{\"}} \ExplSyntaxOn -\DeclareDocumentCommand \package { o m } - { - \exp_args:Nx \href - { - http \token_to_str:N : //www.ctan.org/pkg/ - \IfNoValueTF {#1} { \str_fold_case:n {#2} } {#1} - } - { \pkg {#2} } - } \NewDocumentCommand \PrintPunctList { O{7} m m } { \par @@ -360,84 +256,10 @@ CJK scripts fonts (TrueType or OpenType). \endgroup \par } -\cs_set_protected:Npn \__codedoc_special_index_aux:nnnnn #1#2#3#4#5 - { - \__codedoc_special_index_set:Nn \l__codedoc_index_escaped_macro_tl {#2} - \str_if_eq:onTF { \@currenvir } { macrocode } - { \codeline@wrindex } - { - \HD@target - \index - } - { - \tl_if_empty:nF { #3 #4 } - { #3 \actualchar #4 \levelchar } - #1 - \actualchar - { - \token_to_str:N \verbatim@font \c_space_tl - \l__codedoc_index_escaped_macro_tl - } - \encapchar - hdclindex{\the\c@HD@hypercount}{#5} - } - } -\DeclareDocumentCommand \cs { O{} m } - { \__codedoc_cmd_aux:no {#1} { \c__codedoc_backslash_tl #2 } } -\DeclareDocumentCommand \tn { O{} m } - { - \__codedoc_cmd_aux:no - { index = TeX , replace = false , #1 } - { \c__codedoc_backslash_tl #2 } - } -\DeclareDocumentCommand \meta { +m } - { \__codedoc_meta_aux:n {#1} } -\DeclareExpandableDocumentCommand \bookmarkcstn { O{} m } - { \tl_to_str:n {#2} } -\cs_new:Npn \bookmarkmeta #1 { < \tl_to_str:n {#1} > } -\cs_generate_variant:Nn \__codedoc_cmd_aux:nn { no } -\AtBeginEnvironment { syntax } - { - \char_set_active_eq:NN \| \orbar - \char_set_active_eq:NN \( \defaultvalaux - } \ExplSyntaxOff -\pdfstringdefDisableCommands{% - \let\cs\bookmarkcstn - \let\tn\bookmarkcstn - \let\meta\bookmarkmeta} -\geometry{includemp,hmargin={0mm,15mm},vmargin=15mm,footskip=7mm} -\appto\meta@font@select{\xeCJKsetup{PunctStyle=plain,CJKecglue}} -\preto\IndexParms{\linespread{1}} -\appto\GlossaryParms{% - \def\@idxitem{\par\hangindent 2em}% - \def\subitem{\@idxitem\hspace*{1em}}% - \def\subsubitem{\@idxitem\hspace*{2em}}} -\patchcmd\changes@{\space}{\lbrack}{}{} -\patchcmd\@wrglossary{hdpindex}{hdclindex{\the\c@HD@hypercount}}{}{} -\def\orbar{\textup{\textbar}} -\def\defaultval#1{\textbf{\textup{#1}}} -\def\defaultvalaux#1){\defaultval{#1}} -\def\TF{true\orbar false} -\def\TTF{\defaultval{true}\orbar false} -\def\TFF{true\orbar\defaultval{false}} -\@addtoreset{CodelineNo}{section} -\def\gobblelineno{% - \addtocounter{CodelineNo}{\m@ne}\let\theCodelineNo\relax} -\def\tokslink#1{\hyperlink{#1}{\ding{51}}} -\makeatother -\def\indexname{代码索引} -\def\glossaryname{版本历史} -\GlossaryPrologue{% - \addtocounter{secnumdepth}{-10}% - \section{\glossaryname}} -\IndexPrologue{% - \section{\indexname}% - 斜体的数字表示对应项说明所在的页码,下划线的数字表示定义所在的代码行号,而直立体的 - 数字表示对应项使用时所在的行号。} \begin{document} \DocInput{\jobname.dtx} - \newgeometry{margin=15mm,footskip=7mm} + \IndexLayout \PrintChanges \PrintIndex \end{document} @@ -453,12 +275,12 @@ CJK scripts fonts (TrueType or OpenType). % \changes{v3.3.2}{2015/05/15}{随 Unicode 7.0.0 更新简繁汉字映射。} % \changes{v3.3.3}{2015/09/25}{更新 \hologo{LaTeX3} 代码。} % -% \CheckSum{9822} -% \GetFileInfo{\jobname.dtx} +% \CheckSum{10060} +% \GetFileId{xeCJK.sty} % % \title{\bfseries\pkg{xeCJK} 宏包} -% \author{\href{http://www.ctex.org}{ctex.org}} -% \date{\filedate\qquad\fileversion\thanks{\ctexkitrev{\xeCJKrevnum}.}} +% \author{\href{http://www.ctex.org}{CTEX.ORG}} +% \date{\filedate\qquad\fileversion\thanks{\ctexkitrev{\ExplFileVersion}.}} % \maketitle % % \tableofcontents @@ -469,7 +291,7 @@ CJK scripts fonts (TrueType or OpenType). % \section{简介} % % \pkg{xeCJK} 是一个 \XeLaTeX 宏包,用于排版中日韩(CJK)文字。主要功能: -% \begin{enumerate}[labelindent=\parindent,leftmargin=*] +% \begin{enumerate} % \item 分别设置 CJK 和英文字体; % \item 自动忽略 CJK 文字间的空格而保留其它空格,允许在非标点汉字和英文 % 字母 (a -- z, A -- Z) 间断行; @@ -477,7 +299,7 @@ CJK scripts fonts (TrueType or OpenType). % \item 自动调整中英文间空白。 % \end{enumerate} % -% \pkg{xeCJK} 使用了 \XeTeX 的一些最新特性,需要 \XeTeX{} |0.9995.0 [2009/06/29]| 以 +% \pkg{xeCJK} 使用了 \XeTeX 的一些最新特性,需要 \XeTeX{} 0.9995.0 (2009/06/29) 以 % 后的版本。\pkg{xeCJK} 依赖 \hologo{LaTeX3} 项目的宏包套件 % \package{l3kernel} 和 \package{l3packages} 。 % \pkg{xeCJK} 还需要通过 \package{fontspec} 宏包来调用系统字体。 @@ -490,22 +312,22 @@ CJK scripts fonts (TrueType or OpenType). % \section{基本用法} % % 与其他 \LaTeX{} 宏包一样,引入 \pkg{xeCJK} 宏包只要在导言区使用 -% \begin{verbatim} +% \begin{frameverb} % \usepackage{xeCJK} -% \end{verbatim} +% \end{frameverb} % 在引入 \pkg{xeCJK} 宏包之后,只要设置 CJK 文字的字体,就可以在文档中使用中日 % 韩文字了。 % % 可以在各种文档类中使用 \pkg{xeCJK} 宏包,最简单的示例是: -% \begin{verbatim} -% \documentclass{article} -% \usepackage{xeCJK} -% \setCJKmainfont{SimSun} -% -% \begin{document} -% 中文 \LaTeX 示例。 -% \end{document} -% \end{verbatim} +% \begin{ctexexam} +% \documentclass{article} +% \usepackage{xeCJK} +% \setCJKmainfont{SimSun} +% +% \begin{document} +% 中文 \LaTeX 示例。 +% \end{document} +% \end{ctexexam} % 上述示例设置了中文字体 SimSun(宋体)。运行此示例要求系统安装了设置的字体, % 源文件用 UTF-8 编码保存,使用 \XeLaTeX{} 编译。 % @@ -535,19 +357,19 @@ CJK scripts fonts (TrueType or OpenType). % \end{syntax} % 其中 \meta{key_1}, \meta{key_2} 是设置选项,而 \meta{val_1}, \meta{val_2} 则是对应选项的 % 设置内容。多个选项可以在一个语句中完成设置。例如 -% \begin{verbatim} -% \usepackage[PunctStyle=kaiming]{xeCJK} -% \end{verbatim} +% \begin{ctexexam} +% \usepackage[PunctStyle=kaiming]{xeCJK} +% \end{ctexexam} % 等价于 -% \begin{verbatim} -% \usepackage{xeCJK} -% ...... -% \xeCJKsetup{PunctStyle=kaiming} -% \end{verbatim} +% \begin{ctexexam} +% \usepackage{xeCJK} +% ...... +% \xeCJKsetup{PunctStyle=kaiming} +% \end{ctexexam} % \end{function} % -% 有些选项或命令后面带有 \hypertarget{expstar}{\hyperlink{expstar}{$\star$}} 号,这表示这 -% 个选项或命令只能在导言区中使用,而 \hypertarget{rexpstar}{\hyperlink{rexpstar}{\ding{73}}} +% 有些选项或命令后面带有 \exptarget\expstar 号,这表示这 +% 个选项或命令只能在导言区中使用,而 \rexptarget\rexpstar % 号则表示这个选项或命令只能在导言区使用,并且只影响随后定义的 CJK 字体。其余不带特殊标记的 % 选项或命令,如果没有特别说明,可以在导言区或正文中使用。% % 使用粗体来表示 \pkg{xeCJK} 的默认设置。 @@ -563,9 +385,9 @@ CJK scripts fonts (TrueType or OpenType). % \texttt{xeCJK-\meta{name}.cfg}。然后把这个文件放在本地的 |TDS| 目录下的适当 % 位置。使用 \TeX~Live 的用户,可以新建下列目录,然后再把 % \texttt{xeCJK-\meta{name}.cfg} 放在里面: -% \begin{verbatim} -% texlive/texmf-local/tex/xelatex/xecjk -% \end{verbatim} +% \begin{frameverb} +% texlive/texmf-local/tex/xelatex/xecjk +% \end{frameverb} % 最后还需要在命令行下执行 |mktexlsr|,刷新文件名数据库以便 \TeX 系统能够找到它。 % \end{function} % @@ -587,7 +409,7 @@ CJK scripts fonts (TrueType or OpenType). % 缺省状态下,\pkg{xeCJK} 会忽略 CJK 文字之间的空格,使用这一选项来保留它们之间的空格。 % \end{function} % -% \begin{function}[EXP]{CJKmath} +% \begin{function}[EXP,updated=2016-05-04]{CJKmath} % \begin{syntax} % CJKmath = \meta{\TFF} % \end{syntax} @@ -710,7 +532,7 @@ CJK scripts fonts (TrueType or OpenType). % \begin{syntax} % SlantFactor = \Arg{数字|(0.167)} % \end{syntax} -% 设置伪斜体的粗细程度,范围是 $-0.999 \sim 0.999$。 +% 设置伪斜体的倾斜程度,范围是 $-0.999 \sim 0.999$。 % \end{function} % % \begin{function}[updated=2012-11-10]{PunctStyle} @@ -718,14 +540,14 @@ CJK scripts fonts (TrueType or OpenType). % PunctStyle = \Arg{(quanjiao)|banjiao|kaiming|hangmobanjiao|CCT|plain|...} % \end{syntax} % 设置标点处理格式。\pkg{xeCJK} 中预先定义好的格式为 -% \begin{description}[font=\mdseries\ttfamily,align=right,labelsep=1em,labelindent=2em,leftmargin=*] +% \begin{optdesc} % \item[quanjiao] 全角式:所有标点占一个汉字宽度,相邻两个标点占 1.5 汉字宽度; % \item[banjiao] 半角式:所有标点占半个汉字宽度; % \item[kaiming] 开明式:句末点号用全角,其他半角; % \item[hangmobanjiao] 行末半角式:所有标点占一个汉字宽度,行首行末对齐; % \item[CCT] CCT 格式:所有标点符号的宽度略小于一个汉字宽度; % \item[plain] 原样(不调整标点间距)。 -% \end{description} +% \end{optdesc} % 可以使用 \ref{subsec:punctstyle} 中介绍的 \tn{xeCJKDeclarePunctStyle} 定义新的标点 % 格式。 % \end{function} @@ -782,12 +604,14 @@ CJK scripts fonts (TrueType or OpenType). % 这一选项改变这一设置。 % \end{function} % -% \begin{function}[added=2014-05-13]{RubberPunctSkip} +% \begin{function}[updated=2016-05-13]{RubberPunctSkip} % \begin{syntax} -% RubberPunctSkip = \meta{\TTF} +% RubberPunctSkip = \meta{\TTF|plus|minus} % \end{syntax} -% 缺省状态下,标点符号前/后的间距有一定的弹性。让本选项设置为 \texttt{false} -% 可以禁用这一特性,从而使得前/后的间距为固定值。 +% 缺省状态下,标点符号前/后的间距有一定的弹性。可以伸长到原始边界宽度,可以收缩到 +% 标点另一侧的边界宽度。将本选项设置为 \texttt{plus},将只允许伸长;设置为 +% \texttt{minus} 只允许收缩。设置为 \texttt{false} 将禁用这一特性, +% 从而使得前/后的间距为固定值。 % \end{function} % % \begin{function}[added=2012-12-02]{CheckFullRight} @@ -906,14 +730,14 @@ CJK scripts fonts (TrueType or OpenType). % 文档中可以使用它来切换 CJK 字体族。可以不必指定 \meta{family},这时候 \meta{family} % 将等于 \meta{font-switch}。事实上,\tn{newCJKfontfamily} 是 \tn{setCJKfamilyfont} 和 % \tn{CJKfamily} 的合并。例如 -% \begin{verbatim} -% \newCJKfontfamily[song]\songti{SimSun} -% \end{verbatim} +% \begin{ctexexam} +% \newCJKfontfamily[song]\songti{SimSun} +% \end{ctexexam} % 等价于 -% \begin{verbatim} -% \setCJKfamilyfont{song}{SimSun} -% \newcommand*{\songti}{\CJKfamily{song}} -% \end{verbatim} +% \begin{ctexexam} +% \setCJKfamilyfont{song}{SimSun} +% \newcommand*{\songti}{\CJKfamily{song}} +% \end{ctexexam} % \end{function} % % \begin{function}{\CJKfontspec} @@ -928,13 +752,13 @@ CJK scripts fonts (TrueType or OpenType). % \tn{defaultCJKfontfeatures} \Arg{font features} % \end{syntax} % 全局设置 CJK 字体族的默认选项。例如,使用 -% \begin{verbatim} -% \defaultCJKfontfeatures{Scale=0.962216} -% \end{verbatim} +% \begin{ctexexam} +% \defaultCJKfontfeatures{Scale=0.962216} +% \end{ctexexam} % 可以将全部 CJK 字体缩小为 |0.962216|。\pkg{xeCJK} 宏包的初始化设置是 -% \begin{verbatim} -% \defaultCJKfontfeatures{Script=CJK} -% \end{verbatim} +% \begin{frameverb} +% \defaultCJKfontfeatures{Script=CJK} +% \end{frameverb} % \end{function} % % \begin{function}[updated=2013-06-30]{\addCJKfontfeatures} @@ -947,34 +771,31 @@ CJK scripts fonts (TrueType or OpenType). % 临时增加当前使用的 CJK 字体的选项。第一条命令,仅对当前 CJK 主分区字体有效; % 第二条对主分区和其它分区的字体都有效;第三条仅对可选参数中指定的分区有效; % 第四条对主分区和可选参数中指定的分区有效。例如,使用 -% \begin{verbatim} -% \addCJKfontfeatures{Scale=1.1} -% \end{verbatim} +% \begin{ctexexam} +% \addCJKfontfeatures{Scale=1.1} +% \end{ctexexam} % 可以将文档中当前使用的 CJK 主分区字体放大为 |1.1|。 % \end{function} % % \begin{function}{\CJKrmdefault} % 保存 \tn{textrm} 和 \tn{rmfamily} 所使用的 CJK 字体族,默认值是 |rm|。 -% 类似西文字体的 \tn{rmdefault}。 % \end{function} % % \begin{function}{\CJKsfdefault} % 保存 \tn{textsf} 和 \tn{sffamily} 所使用的 CJK 字体族,默认值是 |sf|。 -% 类似西文字体的 \tn{sfdefault}。 % \end{function} % % \begin{function}{\CJKttdefault} % 保存 \tn{texttt} 和 \tn{ttfamily} 所使用的 CJK 字体族,默认值是 |tt|。 -% 类似西文字体的 \tn{ttdefault}。 % \end{function} % % \begin{function}[updated=2013-01-01]{\CJKfamilydefault} % 保存 \tn{textnormal} 和 \tn{normalfont} 所使用的 CJK 字体族。类似西文字体的 \tn{familydefault}。 % 初始值是 \tn{CJKrmdefault}。如果没有在导言区中修改它,\pkg{xeCJK} 会在导言区 % 结束的时候根据西文字体的情况自动更新 \tn{CJKfamilydefault}。因此,在导言区里使用 -% \begin{verbatim} -% \renewcommand\familydefault{\sfdefault} -% \end{verbatim} +% \begin{frameverb} +% \renewcommand\familydefault{\sfdefault} +% \end{frameverb} % 就可以将全文的 CJK 和西文默认字体都改为无衬线字体族。 % \end{function} % @@ -992,10 +813,10 @@ CJK scripts fonts (TrueType or OpenType). % \tn{setCJKfallbackfamilyfont} \Arg{family} \oarg{font features} \Arg{font name} % \end{syntax} % 设置 CJK 字体族 \meta{family} 的备用字体。例如,使用 -% \begin{verbatim} -% \setCJKmainfont{SimSun} -% \setCJKfallbackfamilyfont{\CJKrmdefault}{SimSun-ExtB} -% \end{verbatim} +% \begin{ctexexam} +% \setCJKmainfont{SimSun} +% \setCJKfallbackfamilyfont{\CJKrmdefault}{SimSun-ExtB} +% \end{ctexexam} % 可以将 |SimSun-ExtB| 作为 |SimSun| 的备用字体。 % \end{function} % @@ -1005,17 +826,17 @@ CJK scripts fonts (TrueType or OpenType). % \end{syntax} % \pkg{xeCJK} 在 \meta{font features} 里增加了 |FallBack| 这个选项。用来在声明主 % 字体的时候,同时设置备用字体。例如,上面的例子等价于: -% \begin{verbatim} -% \setCJKmainfont[FallBack=SimSun-ExtB]{SimSun} -% \end{verbatim} +% \begin{ctexexam} +% \setCJKmainfont[FallBack=SimSun-ExtB]{SimSun} +% \end{ctexexam} % 如果 |FallBack| 的值为空,将设置的是备用字体。例如, -% \begin{verbatim} -% \setCJKmainfont[FallBack,AutoFakeBold,Scale=.97]{SimSun-ExtB} -% \end{verbatim} +% \begin{ctexexam} +% \setCJKmainfont[FallBack,AutoFakeBold,Scale=.97]{SimSun-ExtB} +% \end{ctexexam} % 等价于 -% \begin{verbatim} -% \setCJKfallbackfamilyfont{\CJKrmdefault}[AutoFakeBold,Scale=.97]{SimSun-ExtB} -% \end{verbatim} +% \begin{ctexexam} +% \setCJKfallbackfamilyfont{\CJKrmdefault}[AutoFakeBold,Scale=.97]{SimSun-ExtB} +% \end{ctexexam} % \end{function} % % \begin{function}[EXP,updated=2013-06-30]{\setCJKfallbackfamilyfont} @@ -1028,12 +849,12 @@ CJK scripts fonts (TrueType or OpenType). % \ \} % \end{syntax} % \tn{setCJKfallbackfamilyfont} 还可以用于设置多层的备用字体。例如,使用 -% \begin{verbatim} -% \setCJKmainfont[AutoFakeBold,AutoFakeSlant]{KaiTi_GB2312} -% \setCJKfallbackfamilyfont{\CJKrmdefault}[AutoFakeSlant] -% { [BoldFont=SimHei]{SimSun} , -% [AutoFakeBold] {SimSun-ExtB} } -% \end{verbatim} +% \begin{ctexexam} +% \setCJKmainfont[AutoFakeBold,AutoFakeSlant]{KaiTi_GB2312} +% \setCJKfallbackfamilyfont{\CJKrmdefault}[AutoFakeSlant] +% { [BoldFont=SimHei]{SimSun} , +% [AutoFakeBold] {SimSun-ExtB} } +% \end{ctexexam} % 之后,就设置了 |SimSun| 是 |KaiTi_GB2312| 的备用字体,而 |SimSun-ExtB| 是 % |SimSun| 的备用字体。若当前字体族缺字,并没有备用字体,则尝试使用 % \tn{CJKfamilydefault} 的备用字体。 @@ -1048,67 +869,67 @@ CJK scripts fonts (TrueType or OpenType). % \XeTeX{} 通常使用 fontconfig 库查找和调用字体,因此,可以用 |fc-list| 命令显 % 示可用的字体。在命令行(Windows 的“命令提示符”,Linux 的 Console)下运行以 % 下命令: -% \begin{verbatim} -% fc-list > fontlist.txt -% \end{verbatim} +% \begin{frameverb} +% fc-list > fontlist.txt +% \end{frameverb} % 可以将系统中所有安装的字体列表存入 \file{fontlist.txt} 文件中(可能很长)。 % % |fc-list| 命令列出的信息很多,而且在安装字体较多的 Windows 系统上的输出将非 % 常庞大,如其中可能包含: -% \begin{verbatim} -% Times New Roman:style=cursiva,kurzíva,kursiv,Πλάγια,Italic, -% Kursivoitu,Italique,Dőlt,Corsivo,Cursief,kursywa,Itálico,Курсив, -% İtalik,Poševno,nghiêng,Etzana -% Times New Roman:style=Negreta cursiva,tučné kurzíva,fed kursiv, -% Fett Kursiv,Έντονα Πλάγια,Bold Italic,Negrita Cursiva, -% Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo, -% Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico, -% Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik, -% Krepko poševno,nghiêng đậm,Lodi etzana -% Times New Roman:style=Negreta,tučné,fed,Fett,Έντονα,Bold,Negrita, -% Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiona,Negrito, -% Полужирный,Fet,Kalın,Krepko,đậm,Lodia -% Times New Roman:style=Normal,obyčejné,Standard,Κανονικά,Regular, -% Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno, -% thường,Arrunta -% 宋体,SimSun:style=Regular -% 黑体,SimHei:style=Normal,obyčejné,Standard,Κανονικά,Regular,Normaali, -% Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta -% \end{verbatim} +% \begin{frameverb} +% Times New Roman:style=cursiva,kurzíva,kursiv,Πλάγια,Italic, +% Kursivoitu,Italique,Dőlt,Corsivo,Cursief,kursywa,Itálico,Курсив, +% İtalik,Poševno,nghiêng,Etzana +% Times New Roman:style=Negreta cursiva,tučné kurzíva,fed kursiv, +% Fett Kursiv,Έντονα Πλάγια,Bold Italic,Negrita Cursiva, +% Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo, +% Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico, +% Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik, +% Krepko poševno,nghiêng đậm,Lodi etzana +% Times New Roman:style=Negreta,tučné,fed,Fett,Έντονα,Bold,Negrita, +% Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiona,Negrito, +% Полужирный,Fet,Kalın,Krepko,đậm,Lodia +% Times New Roman:style=Normal,obyčejné,Standard,Κανονικά,Regular, +% Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno, +% thường,Arrunta +% 宋体,SimSun:style=Regular +% 黑体,SimHei:style=Normal,obyčejné,Standard,Κανονικά,Regular,Normaali, +% Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta +% \end{frameverb} % 在 \pkg{fontspec} 或 \pkg{xeCJK} 中使用的字体族名是上面列表中冒号前的部分。 % 例如可以使用 -% \begin{verbatim} -% \setmainfont{Times New Roman} -% \setCJKmainfont{SimSun} % 或者 \setCJKmainfont{宋体} -% \end{verbatim} +% \begin{ctexexam} +% \setmainfont{Times New Roman} +% \setCJKmainfont{SimSun} % 或者 \setCJKmainfont{宋体} +% \end{ctexexam} % 来设置字体。 % % 为了方便起见,|fc-list| 命令也可以加上各种选项控制输出格式,例如如果只要列出 % 所有的中文字体的字体族名,可以用命令: -% \begin{verbatim} +% \begin{frameverb} % fc-list -f "%{family}\n" :lang=zh > zhfont.txt -% \end{verbatim} +% \end{frameverb} % 这样就把字体列表保存在文件 \file{zhfont.txt} 中\footnote{由于汉字编码原因, % Windows 下总需要把字体列表输出的文件中防止乱码。}。这样列出的字体列表就比较 % 简明易用,如 Windows 下预装的中文字体: -% \begin{verbatim} -% Arial Unicode MS -% FangSong,仿宋 -% KaiTi,楷体 -% Microsoft YaHei,微软雅黑 -% MingLiU,細明體 -% NSimSun,新宋体 -% PMingLiU,新細明體 -% SimHei,黑体 -% SimSun,宋体 -% \end{verbatim} +% \begin{frameverb} +% Arial Unicode MS +% FangSong,仿宋 +% KaiTi,楷体 +% Microsoft YaHei,微软雅黑 +% MingLiU,細明體 +% NSimSun,新宋体 +% PMingLiU,新細明體 +% SimHei,黑体 +% SimSun,宋体 +% \end{frameverb} % 要列出日文和韩文的字体,可以把 |:lang=zh| 选项中的 |zh| 改成 |ja| 或 |ko|。 % % \pkg{fontspec} 和 \pkg{xeCJK} 也可以使用字体的文件名访问字体。例如 Windows % 下的宋体也可以使用命令: -% \begin{verbatim} -% \setCJKmainfont{simsun.ttc} -% \end{verbatim} +% \begin{frameverb} +% \setCJKmainfont{simsun.ttc} +% \end{frameverb} % 来设置。设置字体文件名的相关选项和语法在 \pkg{fontspec} 宏包手册中叙述甚详, % 这里不再赘述。有个别字体名不规范的中文字体,\pkg{xeCJK} 宏包可能无法正确地通 % 过字体名访问,那么也可以使用这种方式设置。 @@ -1126,27 +947,27 @@ CJK scripts fonts (TrueType or OpenType). % \tn{xeCJKDeclareSubCJKBlock} * \Arg{block} \Arg{block range} % \end{syntax} % 其中 \meta{block range} 是逗号列表,可以是 CJK 字符的 |Unicode| 范围,也可以是单个字符 -% 的 |Unicode|。例如\strut +% 的 |Unicode|。例如 % \end{function} -% \begin{verbatim} -% { `中 -> `文 , "3400 -> "4DBF , "5000 -> "7000 , `汉 , `字 , "3500 } -% \end{verbatim} +% \begin{ctexexam} +% { `中 -> `文 , "3400 -> "4DBF , "5000 -> "7000 , `汉 , `字 , "3500 } +% \end{ctexexam} % 的形式。需要注意的是,这里设置的 \meta{block range} 除非确实需要(例如某些特殊字体使用 % 了 |Unicode| 中的私人使用区的情况),否则不要超出源代码中预设的 % \hyperlink{CJKcharclass}{CJK 文字范围}。使用 -% \begin{verbatim} -% \xeCJKDeclareSubCJKBlock{SPUA}{ "E400 -> "E4DA , "E500 -> "E5E8 , "E600 -> "E6CE } -% \xeCJKDeclareSubCJKBlock{Ext-B}{ "20000 -> "2A6DF } -% \end{verbatim} +% \begin{ctexexam} +% \xeCJKDeclareSubCJKBlock{SPUA}{ "E400 -> "E4DA , "E500 -> "E5E8 , "E600 -> "E6CE } +% \xeCJKDeclareSubCJKBlock{Ext-B}{ "20000 -> "2A6DF } +% \end{ctexexam} % 就声明了 |SPUA| 和 |Ext-B| 这两个个子分区。同时在 \ref{subsec:fontset} 节介绍的 % CJK 字体设置命令的 \meta{font features} 里新建了 |SPUA| 和 |Ext-B| 这两个选项。 % 新建的这两个选项的使用方法跟 \ref{subsec:fontset} 介绍的 |FallBack| 类似。可以 % 通过它们来设置字体。 % % 例如,可以使用 -% \begin{verbatim} -% \setCJKmainfont[SPUA=SunmanPUA,Ext-B=SimSun-ExtB]{SimSun} -% \end{verbatim} +% \begin{ctexexam} +% \setCJKmainfont[SPUA=SunmanPUA,Ext-B=SimSun-ExtB]{SimSun} +% \end{ctexexam} % 设置文档的主字体是 |SimSun|,|SPUA| 分区的字体是 |SunmanPUA|,而 |Ext-B| 分区 % 的字体是 |SimSun-ExtB|。 % @@ -1198,7 +1019,7 @@ CJK scripts fonts (TrueType or OpenType). % \tn{normalspacedchars} \Arg{char list} % \end{syntax} % 在 \meta{char list} 中出现的字符两端不自动添加空格,初始设置是 |/|、|\|、 -% - (|U+002D|) 和 \textendash\ (|U+2013|)。 +% 和 |-| (|U+002D|)。 % \end{function} % % \subsection{标点符号的处理} @@ -1220,10 +1041,10 @@ CJK scripts fonts (TrueType or OpenType). % \tn{xeCJKsetwidth} * \Arg{标点列表} \Arg{length} % \end{syntax} % \meta{标点列表}可以是单个标点,也可以是多个标点。例如, -% \begin{verbatim} -% \xeCJKsetwidth{。?}{0.7em} -% \end{verbatim} -% 将设置句号和问号所占的宽度为 |0.7 em|。带星号的命令,设置标点符号出现在行首/尾 +% \begin{ctexexam} +% \xeCJKsetwidth{。?}{0.7em} +% \end{ctexexam} +% 将设置句号和问号所占的宽度为 |0.7em|。带星号的命令,设置标点符号出现在行首/尾 % 时的宽度。 % \end{function} % @@ -1233,10 +1054,10 @@ CJK scripts fonts (TrueType or OpenType). % \end{syntax} % \pkg{xeCJK} 会根据选定的标点处理格式自动调整相邻的前后两个 |CJK| 标点符号的 % 空白宽度。如果需要对个别情况进行特殊调整,可以使用这个命令。例如, -% \begin{verbatim} -% \xeCJKsetkern{:}{“}{0.3em} -% \end{verbatim} -% 将设置冒号与左双引号之间的空白宽度为 |0.3 em|。 +% \begin{ctexexam} +% \xeCJKsetkern{:}{“}{0.3em} +% \end{ctexexam} +% 将设置冒号与左双引号之间的空白宽度为 |0.3em|。 % \end{function} % % \subsubsection{定义标点符号处理格式} @@ -1253,7 +1074,7 @@ CJK scripts fonts (TrueType or OpenType). % \begin{syntax} % \tn{xeCJKEditPunctStyle} \Arg{style} \Arg{options} % \end{syntax} -% 修改已有的标点符号处理格式。\strut +% 修改已有的标点符号处理格式。 % \end{function} % % 下面是可以设置的标点符号格式选项。其中左边一栏是选项名称,中间是选项的输入值类 @@ -1262,13 +1083,13 @@ CJK scripts fonts (TrueType or OpenType). % 对于 \meta{length} 类型的选项,将其设置为 \tn{maxdimen},而对于 \meta{real} 类型 % 的选项,将其设置为 |nan|。 % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{enabled-global-setting}{boolean} % 是否使用 \tn{xeCJKsetup} 的 |PunctWidth|、|PunctBoundWidth| 选项和 % \tn{xeCJKsetwidth}、\tn{xeCJKsetkern} 的设置。默认值是 |true|。 -% \end{optiondesc} +% \end{psopt} % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{fixed-punct-width}{length} % 设置单个标点符号的宽度。默认值是 \tn{maxdimen}。 % \PSKeyVal{fixed-punct-ratio}{real} @@ -1283,13 +1104,13 @@ CJK scripts fonts (TrueType or OpenType). % 来设置。默认值是与 |fixed-punct-width| 选项的值相同。 % \PSKeyVal{middle-punct-width}{real} % 设置居中标点符号的宽度比例。默认值是与 |fixed-punct-ratio| 选项的值相同。 -% \end{optiondesc} +% \end{psopt} % % 以上三个选项设置的是标点的固定宽度或比例,\pkg{xeCJK} 会根据设定的选项计算标点符号 % 左/右的空白宽度。下面的选项设置的是标点符号左/右的空白宽度或比例,因此不同标点符号 % 的宽度可能会不同。为了使下面的选项生效,需要先禁用上面的相应选项。优先级自上而下。 % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{fixed-margin-width}{length} % 设置标点的左/右空白宽度。默认值是 \tn{maxdimen}。 % \PSKeyVal{fixed-margin-ratio}{real} @@ -1303,11 +1124,11 @@ CJK scripts fonts (TrueType or OpenType). % \PSKeyVal{middle-margin-ratio}{real} % 设置居中标点的两边空白宽度之和与两边实际两边边界宽度之和的比例。 % 默认值是与 |fixed-margin-ratio| 的值相同。 -% \end{optiondesc} +% \end{psopt} % % 下面选项设置标点符号出现在行首或者行尾时的宽度或比例。 % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{bound-punct-width}{length} % 设置标点符号出现在行首/尾时的宽度。默认值是 \tn{maxdimen}。 % \PSKeyVal{bound-punct-ratio}{real} @@ -1319,32 +1140,32 @@ CJK scripts fonts (TrueType or OpenType). % \PSKeyVal{enabled-hanging}{boolean} % 当以上选项的计算结果得到的宽度小于标点符号的实际边界宽度时,是否允许标点符号 % 悬挂出页面边界。默认值是 |false|。 -% \end{optiondesc} +% \end{psopt} % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{add-min-bound-to-margin}{boolean} % 是否在以上计算结果的基础上再加上标点的左右实际边界宽度中的最小值。这个选项 % 对居中的标点无效。默认值是 |false|。 -% \end{optiondesc} +% \end{psopt} % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{optimize-margin}{boolean} % 使用以上设置空白宽度或比例的选项时,最终输出的标点符号左/右的空白宽度可能大 % 于原来的实际边界宽度。若此时本选项被设置为 |true|,则使用原来的实际边界宽度。 % 而使用 |fixed-punct-width| 选项计算得出的左/右宽度可能小于该标点的另一侧宽 % 度,若此时本选项被启用,则使用该标点的另一侧宽度。默认值为 |false|。 -% \end{optiondesc} +% \end{psopt} % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{margin-minimum}{length} % 指定标点符号左/右的最小空白宽度。当经过以上选项设置的空白宽度小于这个选项的值 -% 时,则使用这个选项的值。默认值是 |0 pt|。 -% \end{optiondesc} +% 时,则使用这个选项的值。默认值是 |0pt|。 +% \end{psopt} % % 下面的选项处理的是前后相邻的两个标点符号之间的空白宽度。这些选项是互斥的,优先级 % 自上而下。 % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{enabled-kerning}{boolean} % 是否调整前后相邻的两个标点之间的空白宽度。如果设置为 |false|,则每个标点都按 % 原来的输出宽度输出。默认值是 |true|。 @@ -1368,50 +1189,50 @@ CJK scripts fonts (TrueType or OpenType). % 设置前后两个标点之间的空白宽度。默认值是 \tn{maxdimen}。 % \PSKeyVal{kerning-margin-ratio}{real} % 设置前后两个标点之间的空白宽度与实际输出空白的比例。默认值是 |1.0|。 -% \end{optiondesc} +% \end{psopt} % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{optimize-kerning}{boolean} % 使用以上选项计算出两个标点之间的空白宽度可能小于通过 |min-bound-to-kerning| % 选项得出的结果。当出现这一情况时,若此选项被设置为 |true|,则使用该选项的空 % 白宽度。默认值为 |false|。 -% \end{optiondesc} +% \end{psopt} % -% \begin{optiondesc} +% \begin{psopt} % \PSKeyVal{kerning-margin-minimum}{length} % 指定两个标点之间的最小空白宽度。当经过以上选项设置的空白宽度小于这个选项的值 -% 时,则使用这个选项的值。默认值是 |0 pt|。 -% \end{optiondesc} +% 时,则使用这个选项的值。默认值是 |0pt|。 +% \end{psopt} % % 事实上,\pkg{xeCJK} 的默认设置就相当于中文全角(|quanjiao|)格式。可以使用上面 % 说明的选项定义新的标点处理格式。例如,使用 -% \begin{verbatim} -% \xeCJKDeclarePunctStyle { mine } -% { -% fixed-punct-ratio = nan , -% fixed-margin-width = 0 pt , -% mixed-margin-width = \maxdimen , -% mixed-margin-ratio = 0.5 , -% middle-margin-width = \maxdimen , -% middle-margin-ratio = 0.5 , -% add-min-bound-to-margin = true , -% bound-punct-width = 0 em , -% enabled-hanging = true , -% min-bound-to-kerning = true , -% kerning-margin-minimum = 0.1 em -% } -% \end{verbatim} -% 就定义了一个名为 |mine| 的标点处理格式。可以在通过 -% \begin{verbatim} -% \xeCJKsetup{PunctStyle=mine} -% \end{verbatim} +% \begin{ctexexam} +% \xeCJKDeclarePunctStyle { mine } +% { +% fixed-punct-ratio = nan , +% fixed-margin-width = 0 pt , +% mixed-margin-width = \maxdimen , +% mixed-margin-ratio = 0.5 , +% middle-margin-width = \maxdimen , +% middle-margin-ratio = 0.5 , +% add-min-bound-to-margin = true , +% bound-punct-width = 0 em , +% enabled-hanging = true , +% min-bound-to-kerning = true , +% kerning-margin-minimum = 0.1 em +% } +% \end{ctexexam} +% 就定义了一个名为 |mine| 的标点处理格式。可以在导演区通过 +% \begin{frameverb} +% \xeCJKsetup{PunctStyle=mine} +% \end{frameverb} % 在文档中使用这个格式。它的意义是:使用标点符号的实际左右边界中的最小值作为其左/右 % 空白的宽度,对于句末标点和居中标点,再加上实际边界空白的一半;当标点出现在行首或 % 行尾时宽度为零,允许悬挂出页面边界;使用相邻两个标点的实际边界中的较小值作为它们 -% 之间的空白宽度,并且最小的空白宽度是 |0.1 em|。再例如,使用 -% \begin{verbatim} -% \xeCJKEditPunctStyle { hangmobanjiao } { enabled-global-setting = false } -% \end{verbatim} +% 之间的空白宽度,并且最小的空白宽度是 |0.1em|。再例如,使用 +% \begin{ctexexam} +% \xeCJKEditPunctStyle { hangmobanjiao } { enabled-global-setting = false } +% \end{ctexexam} % 将使得 \tn{xeCJKsetkern} 等的设置对 |hangmobanjiao| 这一格式无效。 % % \subsection{\pkg{xeCJKfntef} 用法说明} @@ -1634,7 +1455,7 @@ CJK scripts fonts (TrueType or OpenType). % \end{CJKfilltwosides*} % \end{SideBySideExample} % -% \subsection{其它} +% \subsection{其他} % \label{subsec:others} % % \begin{function}[updated=2013-11-16]{\xeCJKVerbAddon,\xeCJKOffVerbAddon} @@ -1690,18 +1511,18 @@ CJK scripts fonts (TrueType or OpenType). % \hologo{LaTeX3} 放弃了 \tn{outer} 宏的概念,因此相关工具在 % 遇到 \tn{outer} 宏时可能会存在问题。按照目前 \pkg{xeCJK} 的实现方式,在 CJK 文字 % 后面遇到 \tn{outer} 宏时会出现类似 -% \begin{verbatim} +% \begin{frameverb} % ! Forbidden control sequence found while scanning use of \use_i:nn -% \end{verbatim} +% \end{frameverb} % 的错误。目前已知的有 \package{cprotect} 宏包提供的 \tn{cprotect}。它的定义是 -% \begin{verbatim} +% \begin{frameverb} % \outer\long\def\cprotect{\icprotect} -% \end{verbatim} +% \end{frameverb} % 因此,这时可以暂时用 \tn{icprotect} 代替 \tn{cprotect}。事实上,当 \pkg{cprotect} % 被引入时,\pkg{xeCJK} 将使用 -% \begin{verbatim} +% \begin{frameverb} % \let\cprotect\icprotect -% \end{verbatim} +% \end{frameverb} % 来取消 \tn{cprotect} 的外部宏限制。但由于 \tn{cprotect} 的特殊性,应该只在外部 % 使用它,即不要让它出现在任何宏的参数中。其它 \tn{outer} 宏的情况,可以在它前面 % 加上 \tn{relax} 来回避上面的错误。 @@ -2808,22 +2629,27 @@ CJK scripts fonts (TrueType or OpenType). % \begin{macrocode} \NewDocumentCommand \xeCJKDeclareCharClass { s > { \TrimSpaces } m m } { - \xeCJK_declare_char_class:nx {#2} {#3} + \xeCJK_declare_char_class:nn {#2} {#3} \IfBooleanT {#1} { \xeCJKResetPunctClass } } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\xeCJK_declare_char_class:nn,\@@_set_char_class_aux:Nnw} +% \begin{macro}[internal]{\xeCJK_declare_char_class:nn,\xeCJK_declare_char_class:nN} +% \begin{macro}[aux]{\@@_set_char_class_aux:Nnw} % 用于设置字符所属的类别,|#1| 为类别名称,|#2| 为字符的 |Unicode|,相邻字符用 % 半角逗号隔开,支持类似 |"1100 -> "11FF| 起止范围的使用方式。 % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_declare_char_class:nn #1#2 { - \clist_set:Nn \l_@@_tmp_clist {#2} + \clist_set:Nx \l_@@_tmp_clist {#2} + \xeCJK_declare_char_class:nN {#1} \l_@@_tmp_clist + } +\cs_new_protected_nopar:Npn \xeCJK_declare_char_class:nN #1#2 + { \clist_gconcat:ccN - { g_@@_#1_range_clist } { g_@@_#1_range_clist } \l_@@_tmp_clist - \clist_map_inline:Nn \l_@@_tmp_clist + { g_@@_#1_range_clist } { g_@@_#1_range_clist } #2 + \clist_map_inline:Nn #2 { \str_if_eq:nnF {##1} { -> } { @@ -2836,9 +2662,10 @@ CJK scripts fonts (TrueType or OpenType). \NewDocumentCommand \@@_set_char_class_aux:Nnw { m > { \SplitArgument { 1 } { -> } } m } { #1 #2 } \cs_generate_variant:Nn \clist_gconcat:NNN { cc } -\cs_generate_variant:Nn \xeCJK_declare_char_class:nn { nx , nV } +\cs_generate_variant:Nn \xeCJK_declare_char_class:nn { nc } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}[internal]{\@@_check_num_range:nnNN} % \begin{macrocode} @@ -2920,10 +2747,14 @@ CJK scripts fonts (TrueType or OpenType). % \begin{macrocode} \NewDocumentCommand \xeCJKResetPunctClass { } { - \xeCJK_declare_char_class:nV { HalfLeft } \c_@@_HalfLeft_chars_clist - \xeCJK_declare_char_class:nV { HalfRight } \c_@@_HalfRight_chars_clist - \xeCJK_declare_char_class:nV { FullLeft } \c_@@_FullLeft_chars_clist - \xeCJK_declare_char_class:nV { FullRight } \c_@@_FullRight_chars_clist + \clist_gclear:N \g_@@_HalfLeft_range_clist + \clist_gclear:N \g_@@_HalfRight_range_clist + \clist_gclear:N \g_@@_FullLeft_range_clist + \clist_gclear:N \g_@@_FullRight_range_clist + \xeCJK_declare_char_class:nN { HalfLeft } \c_@@_HalfLeft_chars_clist + \xeCJK_declare_char_class:nN { HalfRight } \c_@@_HalfRight_chars_clist + \xeCJK_declare_char_class:nN { FullLeft } \c_@@_FullLeft_chars_clist + \xeCJK_declare_char_class:nN { FullRight } \c_@@_FullRight_chars_clist } % \end{macrocode} % \end{macro} @@ -2934,10 +2765,14 @@ CJK scripts fonts (TrueType or OpenType). % \begin{macrocode} \NewDocumentCommand \xeCJKResetCharClass { } { - \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 { CM } \c_@@_CM_chars_clist - \xeCJK_declare_char_class:nV { HangulJamo } \c_@@_HangulJamo_chars_clist + \clist_gclear:N \g_@@_CJK_range_clist + \clist_gclear:N \g_@@_NormalSpace_range_clist + \clist_gclear:N \g_@@_CM_range_clist + \clist_gclear:N \g_@@_HangulJamo_range_clist + \xeCJK_declare_char_class:nN { CJK } \c_@@_CJK_chars_clist + \xeCJK_declare_char_class:nN { NormalSpace } \c_@@_NormalSpace_chars_clist + \xeCJK_declare_char_class:nN { CM } \c_@@_CM_chars_clist + \xeCJK_declare_char_class:nN { HangulJamo } \c_@@_HangulJamo_chars_clist \xeCJKResetPunctClass } % \end{macrocode} @@ -3228,21 +3063,8 @@ CJK scripts fonts (TrueType or OpenType). { \xeCJK_check_for_ecglue: } \cs_new_protected_nopar:Npn \@@_check_for_xecglue: { - \bool_if:nTF - { - \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven && - \skip_if_eq_p:nn \tex_lastskip:D \c_xeCJK_space_skip_tl - } - { - \tex_unskip:D - \bool_if:nTF - { - \xeCJK_if_last_node_p:n { CJK } || - \xeCJK_if_last_node_p:n { CJK-space } - } - { \xeCJK_remove_node: \CJKecglue } - { \xeCJK_space_glue: } - } + \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + { \@@_replace_space: } { \@@_check_for_ecglue: } } \cs_new_protected_nopar:Npn \@@_check_for_ecglue: @@ -3262,6 +3084,32 @@ CJK scripts fonts (TrueType or OpenType). % \end{macrocode} % \end{macro} % +% \changes{v3.4.0}{2016/05/08}{改进 \texttt{xCJKecglue} 的实现。} +% +% \begin{macro}[internal]{\@@_replace_space:} +% 将空格替换为 \tn{CJKecglue}。注意由 \tn{leaders} 等产生的 glue,并不能正确地还回去。 +% 好在 \LaTeXe{} 中常用的 \tn{hrulefill} 和 \tn{dotfill} 定义末尾都有 |\kern\z@| 保护。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_replace_space: + { + \skip_set_eq:NN \l_@@_last_skip \tex_lastskip:D + \tex_unskip:D + \xeCJK_if_last_node:nTF { CJK-space } + { \xeCJK_remove_node: \CJKecglue } + { + \xeCJK_if_last_node:nTF { CJK } + { + \skip_if_eq:nnTF { \l_@@_last_skip } { \c_xeCJK_space_skip_tl } + { \xeCJK_remove_node: \CJKecglue } + { \skip_horizontal:N \l_@@_last_skip } + } + { \skip_horizontal:N \l_@@_last_skip } + } + } +\skip_new:N \l_@@_last_skip +% \end{macrocode} +% \end{macro} +% % \hypertarget{def-bound}{} % \begin{macrocode} \clist_map_inline:nn { Default , HalfRight } @@ -3299,21 +3147,8 @@ CJK scripts fonts (TrueType or OpenType). { \xeCJK_check_for_ecglue_normalsp: } \cs_new_protected_nopar:Npn \@@_check_for_xecglue_normalsp: { - \bool_if:nTF - { - \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven && - \skip_if_eq_p:nn \tex_lastskip:D \c_xeCJK_space_skip_tl - } - { - \tex_unskip:D - \bool_if:nTF - { - \xeCJK_if_last_node_p:n { CJK } || - \xeCJK_if_last_node_p:n { CJK-space } - } - { \xeCJK_remove_node: \CJKecglue } - { \xeCJK_space_glue: } - } + \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + { \@@_replace_space: } { \@@_check_for_ecglue_normalsp: } } \cs_new_protected_nopar:Npn \@@_check_for_ecglue_normalsp: @@ -3379,37 +3214,39 @@ CJK scripts fonts (TrueType or OpenType). \cs_new_eq:NN \xeCJK_check_for_xglue: \prg_do_nothing: \cs_new_protected_nopar:Npn \@@_check_for_xglue: { - \bool_if:nT - { - \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven && - ( \skip_if_eq_p:nn \tex_lastskip:D \c_xeCJK_space_skip_tl || - \skip_if_eq_p:nn \tex_lastskip:D \l_@@_ecglue_skip ) - } + \int_compare:nNnT \etex_lastnodetype:D = \c_eleven { + \skip_set_eq:NN \l_@@_last_skip \tex_lastskip:D \tex_unskip:D - \bool_if:nTF + \xeCJK_if_last_node:nTF { CJK-space } + { \xeCJK_remove_node: \@@_ccglue_or_space: } { - \xeCJK_if_last_node_p:n { default-space } || - \int_compare_p:nNn \etex_lastnodetype:D = \c_ten || - \xeCJK_if_last_node_p:n { default } + \xeCJK_if_last_node:nTF { default-space } + { \xeCJK_remove_node: \CJKecglue } + { \@@_check_for_xglue_aux: } } - { \xeCJK_remove_node: \CJKecglue } + } + } +\cs_new_protected_nopar:Npn \@@_check_for_xglue_aux: + { + \skip_if_eq:nnTF { \l_@@_last_skip } { \c_xeCJK_space_skip_tl } + { + \xeCJK_if_last_node:nTF { CJK } + { \xeCJK_remove_node: \@@_ccglue_or_space: } { - \bool_if:nTF - { - \xeCJK_if_last_node_p:n { CJK } || - \xeCJK_if_last_node_p:n { CJK-space } - } + \xeCJK_if_last_node:nTF { default } + { \xeCJK_remove_node: \CJKecglue } { - \xeCJK_remove_node: - \bool_if:NTF \l_@@_reserve_space_bool - { \xeCJK_space_glue: } - { \CJKglue } + \int_compare:nNnTF \etex_lastnodetype:D = \c_ten + { \CJKecglue } + { \skip_horizontal:N \l_@@_last_skip } } - { \xeCJK_space_glue: } } } + { \skip_horizontal:N \l_@@_last_skip } } +\cs_new_protected_nopar:Npn \@@_ccglue_or_space: + { \CJKglue } % \end{macrocode} % \end{macro} % @@ -3516,6 +3353,10 @@ CJK scripts fonts (TrueType or OpenType). \xeCJK_glue_to_skip:nN {#1} \l_@@_ecglue_skip \cs_set_eq:NN \xeCJK_space_or_xecglue: \CJKecglue \cs_set_eq:NN \xeCJK_check_for_xglue: \@@_check_for_xglue: + \cs_set_eq:NN \xeCJK_check_for_ecglue: \@@_check_for_xecglue: + \cs_set_eq:NN + \xeCJK_check_for_ecglue_normalsp: + \@@_check_for_xecglue_normalsp: } , xCJKecglue .default:n = { true } } @@ -3530,10 +3371,26 @@ CJK scripts fonts (TrueType or OpenType). % \begin{macrocode} \keys_define:nn { xeCJK / options } { - CJKspace .bool_set:N = \l_@@_reserve_space_bool , - space .meta:n = { CJKspace = true } , - nospace .meta:n = { CJKspace = false } + CJKspace .choice: , + CJKspace / true .code:n = + { + \bool_set_true:N \l_@@_reserve_space_bool + \cs_set_eq:NN \@@_maybe_reserve_space: \@@_reserve_space: + \cs_set_protected_nopar:Npn \@@_ccglue_or_space: + { \xeCJK_space_glue: } + } , + CJKspace / false .code:n = + { + \bool_set_false:N \l_@@_reserve_space_bool + \xeCJK_cs_clear:N \@@_maybe_reserve_space: + \cs_set_protected_nopar:Npn \@@_ccglue_or_space: + { \CJKglue } + } , + CJKspace .default:n = { true } , + space .meta:n = { CJKspace = true } , + nospace .meta:n = { CJKspace = false } } +\bool_new:N \l_@@_reserve_space_bool % \end{macrocode} % \end{macro} % @@ -3559,16 +3416,20 @@ CJK scripts fonts (TrueType or OpenType). { \bool_if:NTF \l_@@_peek_ignore_spaces_bool { - \bool_if:nTF + \group_align_safe_begin: + \token_if_macro:NTF \l_peek_token { - \token_if_macro_p:N \l_peek_token || - ( \l_@@_reserve_space_bool && \token_if_letter_p:N \l_peek_token ) + \group_align_safe_end: + \xeCJK_class_group_end: + { \xeCJK_make_node:n { CJK-space } } + \xeCJK_space_or_xecglue: } { - \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } } - \xeCJK_space_or_xecglue: + \group_align_safe_end: + \xeCJK_class_group_end: + { \xeCJK_make_node:n { CJK-space } } + \@@_maybe_reserve_space: } - { \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } } } } { \token_if_eq_meaning:NNTF \l_peek_token \scan_stop: @@ -3585,6 +3446,9 @@ CJK scripts fonts (TrueType or OpenType). \token_if_eq_meaning:NNTF #1 \scan_stop: {#1} { \cs_set_eq:NN #1 \scan_stop: #1 } } +\cs_new_protected:Npn \@@_reserve_space: + { \token_if_letter:NT \l_peek_token { \xeCJK_space_or_xecglue: } } +\cs_new_eq:NN \@@_maybe_reserve_space: \prg_do_nothing: % \end{macrocode} % \end{macro} % @@ -3602,12 +3466,10 @@ CJK scripts fonts (TrueType or OpenType). { \xeCJK_if_last_node:nT { CJK } { \xeCJK_remove_node: { \xeCJK_make_node:n { CJK-space } } } - \bool_if:nT - { - \token_if_macro_p:N \l_peek_token || - ( \l_@@_reserve_space_bool && \token_if_letter_p:N \l_peek_token ) - } - { \xeCJK_space_or_xecglue: } + \group_align_safe_begin: + \token_if_macro:NTF \l_peek_token + { \group_align_safe_end: \xeCJK_space_or_xecglue: } + { \group_align_safe_end: \@@_maybe_reserve_space: } } } } @@ -3720,17 +3582,11 @@ CJK scripts fonts (TrueType or OpenType). % 根据所选的标点处理方式在标点符号左/右增加的空白。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_punct_glue:NN #1#2 - { \@@_punct_hskip:n { \@@_punct_skip:nn {#1} {#2} } } -\cs_new_eq:NN \@@_punct_hskip:n \skip_horizontal:n -\cs_new_protected_nopar:Npn \@@_punct_rigid_skip:nn #1#2 - { \@@_use_punct_dim:nnn { glue } {#1} {#2} } -\cs_new_protected_nopar:Npn \@@_punct_rubber_skip:nn #1#2 { - \@@_use_punct_dim:nnn { glue } {#1} {#2} - plus \@@_use_punct_dim:nnn { plus } {#1} {#2} - minus \@@_use_punct_dim:nnn { minus } {#1} {#2} + \@@_punct_hskip:n + { \@@_use_dim_or_skip:nnn { glue } {#1} {#2} } } -\cs_new_eq:NN \@@_punct_skip:nn \@@_punct_rubber_skip:nn +\cs_new_eq:NN \@@_punct_hskip:n \skip_horizontal:n % \end{macrocode} % \end{macro} % @@ -3738,7 +3594,10 @@ CJK scripts fonts (TrueType or OpenType). % 相邻两个标点之间的间距。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_punct_kern:NN #1#2 - { \tex_kern:D \@@_use_punct_dim:nnn { kern } {#1} {#2} \exp_stop_f: } + { + \@@_nobreak_hskip:n + { \@@_use_dim_or_skip:nnn { kern } {#1} {#2} } + } % \end{macrocode} % \end{macro} % @@ -4069,7 +3928,7 @@ CJK scripts fonts (TrueType or OpenType). { \@@_punct_rule:NN \c_@@_right_tl #1 \@@_punct_breakable_kern:n - { \@@_use_punct_dim:nnn { break_kern } {#1} {#2} } + { \@@_use_dim_or_skip:nnn { break_kern } {#1} {#2} } \@@_punct_rule:NN \c_@@_left_tl #2 } \cs_new_eq:NN \@@_punct_breakable_kern:n \skip_horizontal:n @@ -4529,9 +4388,9 @@ CJK scripts fonts (TrueType or OpenType). % 声明 CJK 子区范围,|#1| 为自定义名称,|#2| 为子区的 |Unicode| 范围。 % \begin{macrocode} \NewDocumentCommand \xeCJKDeclareSubCJKBlock - { s > { \TrimSpaces } m > { \TrimSpaces } m } + { s > { \TrimSpaces } m m } { - \xeCJK_declare_sub_char_class:nxx { CJK } {#2} {#3} + \xeCJK_declare_sub_char_class:nxn { CJK } {#2} {#3} \IfBooleanT {#1} { \xeCJKResetPunctClass } } \@onlypreamble \xeCJKDeclareSubCJKBlock @@ -4571,9 +4430,9 @@ CJK scripts fonts (TrueType or OpenType). { \int_if_exist:cTF { \@@_class_csname:n { CJK/##1 } } { - \xeCJK_declare_char_class:nx + \xeCJK_declare_char_class:nc { CJK \bool_if:NF \l_@@_sub_cancel_bool { /##1 } } - { \tl_use:c { g_@@_CJK/##1_range_clist } } + { g_@@_CJK/##1_range_clist } } { \@@_error:nx { SubBlock-undefined } {##1} } } @@ -4600,7 +4459,7 @@ CJK scripts fonts (TrueType or OpenType). } \xeCJK_declare_char_class:nn { #1/#2 } {#3} } -\cs_generate_variant:Nn \xeCJK_declare_sub_char_class:nnn { nxx } +\cs_generate_variant:Nn \xeCJK_declare_sub_char_class:nnn { nx } % \end{macrocode} % \end{macro} % @@ -4710,6 +4569,7 @@ CJK scripts fonts (TrueType or OpenType). % \end{macro} % % \changes{v3.2.12}{2014/05/12}{新增 \texttt{RubberPunctSkip} 选项。} +% \changes{v3.4.0}{2016/05/13}{\texttt{RubberPunctSkip} 选项有新的值 \texttt{plus} 和 \texttt{minus}。} % % \begin{macro} % {AllowBreakBetweenPuncts,KaiMingPunct,LongPunct, @@ -4746,9 +4606,13 @@ CJK scripts fonts (TrueType or OpenType). RubberPunctSkip .choice: , RubberPunctSkip .default:n = { true } , RubberPunctSkip / true .code:n = - { \cs_set_eq:NN \@@_punct_skip:nn \@@_punct_rubber_skip:nn } , + { \cs_set_eq:NN \@@_use_dim_or_skip:nnn \@@_use_punct_skip:nnn } , + RubberPunctSkip / plus .code:n = + { \cs_set_eq:NN \@@_use_dim_or_skip:nnn \@@_use_punct_skip_plus:nnn } , + RubberPunctSkip / minus .code:n = + { \cs_set_eq:NN \@@_use_dim_or_skip:nnn \@@_use_punct_skip_minus:nnn } , RubberPunctSkip / false .code:n = - { \cs_set_eq:NN \@@_punct_skip:nn \@@_punct_rigid_skip:nn } + { \cs_set_eq:NN \@@_use_dim_or_skip:nnn \@@_use_punct_dim:nnn } } \bool_new:N \l_@@_punct_breakable_bool % \end{macrocode} @@ -4814,18 +4678,50 @@ CJK scripts fonts (TrueType or OpenType). % % 一些用于记录的辅助函数。 % \begin{macrocode} -\cs_new_nopar:Npn \@@_punct_dim_csname:nn #1#2 - { c__\l_xeCJK_current_font_tl/\l_xeCJK_punct_style_tl/#1/#2/tl } -\cs_new_nopar:Npn \@@_punct_dim_csname:nnn #1#2#3 - { c__\l_xeCJK_current_font_tl/\l_xeCJK_punct_style_tl/#1/#2/#3/tl } -\cs_new_nopar:Npn \@@_use_punct_dim:nn #1#2 - { \use:c { \@@_punct_dim_csname:nn {#1} {#2} } } -\cs_new_nopar:Npn \@@_use_punct_dim:nnn #1#2#3 - { \use:c { \@@_punct_dim_csname:nnn {#1} {#2} {#3} } } -\cs_new_protected_nopar:Npn \@@_save_punct_dim:nnn #1#2#3 - { \tl_const:cx { \@@_punct_dim_csname:nn {#1} {#2} } { \dim_eval:n {#3} } } -\cs_new_protected_nopar:Npn \@@_save_punct_dim:nnnn #1#2#3#4 - { \tl_const:cx { \@@_punct_dim_csname:nnn {#1} {#2} {#3} } { \dim_eval:n {#4} } } +\cs_new:Npn \@@_punct_csname:n #1 + { c_@@_\l_xeCJK_current_font_tl/\l_xeCJK_punct_style_tl/#1/tl } +\cs_new:Npn \@@_use_punct_dim:nn #1#2 + { \use:c { \@@_punct_csname:n { dim/#1/#2 } } } +\cs_new:Npn \@@_use_punct_dim:nnn #1#2#3 + { \use:c { \@@_punct_csname:n { dim/#1/#2/#3 } } } +\cs_new:Npn \@@_use_punct_skip:nnn #1#2#3 + { \use:c { \@@_punct_csname:n { skip/#1/#2/#3 } } } +\cs_new:Npn \@@_use_punct_skip_plus:nnn #1#2#3 + { \use:c { \@@_punct_csname:n { skip/plus/#1/#2/#3 } } } +\cs_new:Npn \@@_use_punct_skip_minus:nnn #1#2#3 + { \use:c { \@@_punct_csname:n { skip/minus/#1/#2/#3 } } } +\cs_new_protected:Npn \@@_save_punct_dim:nnn #1#2 + { \@@_save_punct_width_aux:nnn { dim } { #1/#2 } } +\cs_new_protected:Npn \@@_save_punct_dim:nnnn #1#2#3 + { \@@_save_punct_width_aux:nnn { dim } { #1/#2/#3 } } +\cs_new_protected:Npn \@@_save_punct_skip:nnnn #1#2#3#4 + { + \@@_save_punct_width_aux:nnn { skip } { #1/#2/#3 } {#4} + \@@_save_punct_width_aux:nnn { skip } { plus/#1/#2/#3 } {#4} + \@@_save_punct_width_aux:nnn { skip } { minus/#1/#2/#3 } {#4} + } +\cs_new_protected:Npn \@@_save_punct_skip:nnnnnn #1#2#3#4#5#6 + { + \use:x + { + \@@_save_punct_skip_aux:nnnn { #1/#2/#3 } + { \dim_eval:n {#4} } + { \dim_max:nn { \c_zero_dim } {#5} } + { \dim_max:nn { \c_zero_dim } {#6} } + } + } +\cs_new_protected:Npn \@@_save_punct_skip_aux:nnnn #1#2#3#4 + { + \@@_save_punct_width_aux:nnn { skip } {#1} { #2 ~ plus ~ #3 ~ minus ~ #4 ~ } + \@@_save_punct_width_aux:nnn { skip } { plus/#1 } { #2 ~ plus ~ #3 ~ } + \@@_save_punct_width_aux:nnn { skip } { minus/#1 } { #2 ~ minus ~ #4 ~ } + } +\cs_new_protected:Npn \@@_save_punct_width_aux:nnn #1#2#3 + { + \tl_const:cx { \@@_punct_csname:n { #1/#2 } } + { \use:c { #1_eval:n } {#3} } + } +\cs_new_eq:NN \@@_use_dim_or_skip:nnn \@@_use_punct_skip:nnn % \end{macrocode} % % \changes{v3.1.0}{2012/11/14}{使用 \pkg{xtemplate} 宏包的机制来组织标点符号的处理。} @@ -4919,20 +4815,19 @@ CJK scripts fonts (TrueType or OpenType). % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:NN #1#2 { - \tl_if_exist:cF { \@@_punct_dim_csname:nnn { glue } {#1} {#2} } + \tl_if_exist:cF { \@@_punct_csname:n { dim/glue/#1/#2 } } { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c_@@_punct_style_plain_tl { \@@_save_punct_dim:nnnn { rule } {#1} {#2} { \c_zero_dim } \@@_save_punct_dim:nnnn { glue } {#1} {#2} { \c_zero_dim } - \@@_save_punct_dim:nnnn { plus } {#1} {#2} { \c_zero_dim } - \@@_save_punct_dim:nnnn { minus } {#1} {#2} { \c_zero_dim } \@@_save_punct_dim:nnnn { offset } {#1} {#2} { \c_zero_dim } \@@_save_punct_dim:nnnn { bound } \c_@@_left_tl {#2} { \c_zero_dim } \@@_save_punct_dim:nnnn { bound } \c_@@_right_tl {#2} { \c_zero_dim } + \@@_save_punct_skip:nnnn { glue } {#1} {#2} { \c_zero_skip } } { - { \xeCJK_select_font: \xeCJK_calc_punct_dimen:f {#2} } + { \xeCJK_select_font: \xeCJK_calc_punct_dimen:o {#2} } \dim_set:Nn \l_@@_bound_dim { \@@_use_punct_dim:nnn { bound } {#1} {#2} } \dim_set:Nn \l_@@_reverse_bound_dim @@ -4957,12 +4852,14 @@ CJK scripts fonts (TrueType or OpenType). % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_get_punct_kerning:NN #1#2 { - \tl_if_exist:cF { \@@_punct_dim_csname:nnn { kern } {#1} {#2} } + \tl_if_exist:cF { \@@_punct_csname:n { dim/kern/#1/#2 } } { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c_@@_punct_style_plain_tl { \@@_save_punct_dim:nnnn { kern } {#1} {#2} { \c_zero_dim } \@@_save_punct_dim:nnnn { break_kern } {#1} {#2} { \c_zero_dim } + \@@_save_punct_skip:nnnn { kern } {#1} {#2} { \c_zero_skip } + \@@_save_punct_skip:nnnn { break_kern } {#1} {#2} { \c_zero_skip } } { \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } @@ -5053,27 +4950,21 @@ CJK scripts fonts (TrueType or OpenType). } } \@@_save_punct_dim:nnnn { glue } {#1} {#2} { \l_@@_tmp_dim } - \@@_save_punct_dim:nnnn { plus } {#1} {#2} + \@@_save_punct_skip:nnnnnn { glue } {#1} {#2} + { \l_@@_tmp_dim } { - \dim_max:nn { \c_zero_dim } + \@@_punct_if_middle:NTF {#2} { - \@@_punct_if_middle:NTF {#2} - { - ( \@@_use_punct_dim:nn { width } {#2} - - \@@_use_punct_dim:nn { dimen } {#2} ) / \c_two - - \l_@@_tmp_dim - } - { \l_@@_bound_dim - \l_@@_tmp_dim } + ( \@@_use_punct_dim:nn { width } {#2} - + \@@_use_punct_dim:nn { dimen } {#2} ) / \c_two + - \l_@@_tmp_dim } + { \l_@@_bound_dim - \l_@@_tmp_dim } } - \@@_save_punct_dim:nnnn { minus } {#1} {#2} { - \dim_max:nn { \c_zero_dim } - { - \@@_punct_if_middle:NTF {#2} - { .5 \l_@@_tmp_dim } - { \l_@@_tmp_dim - \l_@@_reverse_bound_dim } - } + \@@_punct_if_middle:NTF {#2} + { .5 \l_@@_tmp_dim } + { \l_@@_tmp_dim - \l_@@_reverse_bound_dim } } } % \end{macrocode} @@ -5172,39 +5063,56 @@ CJK scripts fonts (TrueType or OpenType). % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_punct_kerning_process:NN #1#2 { - \dim_set:Nn \l_@@_tmp_dim + \dim_set:Nn \l_@@_original_margin_dim + { \@@_original_kerning_margin:NN {#1} {#2} } + \dim_set:Nn \l_@@_minimum_bound_dim + { \@@_punct_min_bound:NN {#1} {#2} } + \dim_set:Nn \l_@@_kerning_margin_dim { \bool_if:nTF { \l_@@_enabled_global_setting_bool && \tl_if_exist_p:c { g_@@_punct/kern/#1/#2/tl } } - { \tl_use:c { g_@@_punct/kern/#1/#2/tl } } + { \use:c { g_@@_punct/kern/#1/#2/tl } } { \bool_if:NTF \l_@@_enabled_kerning_bool { \@@_calc_kerning_margin:NN {#1} {#2} } - { \@@_original_kerning_margin:NN {#1} {#2} } + { \l_@@_original_margin_dim } } } - \@@_save_punct_dim:nnnn { kern } {#1} {#2} - { - \l_@@_tmp_dim - - ( \@@_use_punct_dim:nnn { bound } \c_@@_right_tl {#1} ) - - ( \@@_use_punct_dim:nnn { bound } \c_@@_left_tl {#2} ) - } + \@@_save_kerning:nnNN { kern } { bound } {#1} {#2} \@@_punct_if_right:NF {#2} { \@@_punct_if_right:NT {#1} - { - \@@_save_punct_dim:nnnn { break_kern } {#1} {#2} - { - \l_@@_tmp_dim - - ( \@@_use_punct_dim:nnn { offset } \c_@@_right_tl {#1} ) - - ( \@@_use_punct_dim:nnn { offset } \c_@@_left_tl {#2} ) - } - } + { \@@_save_kerning:nnNN { break_kern } { offset } {#1} {#2} } } } +\dim_new:N \l_@@_minimum_bound_dim +\dim_new:N \l_@@_kerning_margin_dim +\dim_new:N \l_@@_original_margin_dim +% \end{macrocode} +% \end{macro} +% +% \changes{v3.4.0}{2016/05/12}{标点符号的压缩量能伸长到原始空白,能收缩到较小边距。} +% +% \begin{macro}[internal]{\@@_save_kerning:nnNN} +% 相邻两个标点符号的间距能伸长到原始空白(未压缩时的状态),能收缩到较小边距。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_save_kerning:nnNN #1#2#3#4 + { + \dim_set:Nn \l_@@_tmp_dim + { + \l_@@_kerning_margin_dim + - ( \@@_use_punct_dim:nnn {#2} \c_@@_right_tl {#3} ) + - ( \@@_use_punct_dim:nnn {#2} \c_@@_left_tl {#4} ) + } + \@@_save_punct_dim:nnnn {#1} {#3} {#4} { \l_@@_tmp_dim } + \@@_save_punct_skip:nnnnnn {#1} {#3} {#4} + { \l_@@_tmp_dim } + { \l_@@_original_margin_dim - \l_@@_kerning_margin_dim } + { \l_@@_kerning_margin_dim - \l_@@_minimum_bound_dim } + } % \end{macrocode} % \end{macro} % @@ -5234,10 +5142,10 @@ CJK scripts fonts (TrueType or OpenType). { \l_@@_kerning_margin_minimum_dim } { \bool_if:NTF \l_@@_min_bound_to_kerning_bool - { \@@_punct_min_bound:NN {#1} {#2} } + { \l_@@_minimum_bound_dim } { \bool_if:NTF \l_@@_optimize_kerning_bool - { \dim_max:nn { \@@_punct_min_bound:NN {#1} {#2} } } + { \dim_max:nn { \l_@@_minimum_bound_dim } } { \use:n } { \dim_compare:nNnTF \l_@@_kerning_total_width_dim < \c_max_dim @@ -5282,7 +5190,7 @@ CJK scripts fonts (TrueType or OpenType). { \fp_use:N \l_@@_kerning_margin_ratio_fp \use:n } } { \fp_use:c { l_@@_#1_align_ratio_fp } \use:n } - { \etex_dimexpr:D \@@_original_kerning_margin:NN {#2} {#3} \scan_stop: } + { \l_@@_original_margin_dim } } } % \end{macrocode} @@ -5349,16 +5257,18 @@ CJK scripts fonts (TrueType or OpenType). { \@@_use_punct_dim:nn { width } {#1} - \l_@@_tmp_dim } \@@_punct_if_long:NT {#1} { - \@@_save_punct_dim:nnnn { kern } {#1} {#1} + \dim_set:Nn \l_@@_tmp_dim { \str_case:nnTF {#1} { { ^^^^2025 } { } { ^^^^2026 } { } } { \c_zero_dim } { - \l_@@_tmp_dim } } + \@@_save_punct_dim:nnnn { kern } {#1} {#1} { \l_@@_tmp_dim } + \@@_save_punct_skip:nnnn { kern } {#1} {#1} { \l_@@_tmp_dim } } } -\cs_generate_variant:Nn \xeCJK_calc_punct_dimen:N { f } +\cs_generate_variant:Nn \xeCJK_calc_punct_dimen:N { o } % \end{macrocode} % \end{macro} % @@ -5982,7 +5892,7 @@ CJK scripts fonts (TrueType or OpenType). % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_copy_family:nn} +% \begin{macro}[internal]{\@@_copy_family:nn,\@@_copy_family:xx} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_copy_family:nn #1#2 { @@ -6004,7 +5914,8 @@ CJK scripts fonts (TrueType or OpenType). { \@@_family_nfss_csname:n {#2} } } } -\cs_generate_variant:Nn \@@_copy_family:nn { xx } +\cs_new_protected_nopar:Npn \@@_copy_family:xx #1#2 + { \use:x { \@@_copy_family:nn {#1} {#2} } } % \end{macrocode} % \end{macro} % @@ -6040,36 +5951,40 @@ CJK scripts fonts (TrueType or OpenType). \@@_info:nxx { CJK-block } {#1} {#2} \str_if_eq:nnTF {#2} { CJK } { \xeCJK_select_font: } - { \@@_block_select_font:n {#2} } + { \xeCJK_select_font:n {#2} } } } \@@_msg_new:nn { CJK-block } { Switch~from~block~`#1'~to~`#2'. } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_block_select_font:n} +% \begin{macro}[internal]{\xeCJK_select_font:n,\xeCJK_block_family:nn} % 若当前 CJK 字体族没有定义子分区 |#1| 的字体,则使用 \tn{CJKfamilydefault} 的对应 % 分区字体;若 \tn{CJKfamilydefault} 也没有定义该分区字体,则使用当前 CJK 字体族的 % 主分区字体。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_block_select_font:n #1 +\cs_new_protected_nopar:Npn \xeCJK_select_font:n #1 { \exp_args:Nc \cs_if_exist_use:NF { \@@_font_csname:n { \CJK@family/#1 } } { - \xeCJK_family_if_exist:xF { \l_xeCJK_family_tl/#1 } - { - \@@_copy_family:xx { \l_xeCJK_family_tl/#1 } - { - \cs_if_exist:cTF - { \@@_family_csname:n { \CJKfamilydefault/#1 } } - { \CJKfamilydefault/#1 } { \l_xeCJK_family_tl } - } - } + \xeCJK_block_family:nn { \l_xeCJK_family_tl } {#1} \@@_family_use:x { \l_xeCJK_family_tl/#1 } \xeCJK_font_gset_to_current:c { \@@_font_csname:n { \CJK@family/#1 } } } } +\cs_new_protected_nopar:Npn \xeCJK_block_family:nn #1#2 + { + \xeCJK_family_if_exist:xF { #1/#2 } + { + \@@_copy_family:xx { #1/#2 } + { + \cs_if_exist:cTF + { \@@_family_csname:n { \CJKfamilydefault/#2 } } + { \CJKfamilydefault/#2 } {#1} + } + } + } % \end{macrocode} % \end{macro} % @@ -6462,37 +6377,35 @@ CJK scripts fonts (TrueType or OpenType). { \@@_warning:n { fandol } \@@_load_fandol: - \use:n - } - { - \@@_warning:nx { no-CJKfamily } { \CJKfamilydefault } - \use_none:n + \xeCJK_ensure_default_family: } + { \@@_warning:nx { no-CJKfamily } { \CJKfamilydefault } } } - { \use:n } + { \xeCJK_ensure_default_family: } + } +\cs_new_protected_nopar:Npn \xeCJK_ensure_default_family: + { + \xeCJK_family_if_exist:xF { \CJKfamilydefault } { - \xeCJK_family_if_exist:xF { \CJKfamilydefault } + \tl_set_eq:NN \l_@@_tmp_tl \CJKfamilydefault + \str_if_eq_x:nnTF { \CJKfamilydefault } { \CJKrmdefault } + { \use:n } { - \tl_set_eq:NN \l_@@_tmp_tl \CJKfamilydefault - \str_if_eq_x:nnTF { \CJKfamilydefault } { \CJKrmdefault } - { \use:n } - { - \xeCJK_family_if_exist:xTF { \CJKrmdefault } - { \tl_gset:Nn \CJKfamilydefault { \CJKrmdefault } } - } + \xeCJK_family_if_exist:xTF { \CJKrmdefault } + { \tl_gset:Nn \CJKfamilydefault { \CJKrmdefault } } + } + { + \prop_map_inline:Nn \g_@@_family_font_name_prop { - \prop_map_inline:Nn \g_@@_family_font_name_prop - { - \prop_map_break:n - { \tl_gset_rescan:Nnn \CJKfamilydefault { } {#1} } - } + \prop_map_break:n + { \tl_gset_rescan:Nnn \CJKfamilydefault { } { ##1 } } } - \@@_warning:nxx { CJKfamilydefault-undefined } - { \l_@@_tmp_tl } { \CJKfamilydefault } } - \xeCJK_switch_family:n { \CJKfamilydefault } - \bool_if:NT \g_@@_math_bool { \xeCJK_set_mathfont: } + \@@_warning:nxx { CJKfamilydefault-undefined } + { \l_@@_tmp_tl } { \CJKfamilydefault } } + \xeCJK_switch_family:n { \CJKfamilydefault } + \bool_if:NT \g_@@_math_bool { \xeCJK_set_mathfont: } } \@@_msg_new:nn { no-CJKfamily } { @@ -6536,53 +6449,178 @@ CJK scripts fonts (TrueType or OpenType). % \changes{v3.2.6}{2013/08/01}{设置粗体时先检查对应字体是否存在。} % \changes{v3.2.7}{2013/11/09}{将 CJK 字符的数学归类由 $7$ 改为 $0$,解决汉字路径的问题。} % \changes{v3.2.13}{2014/06/20}{修复参数类型错误。} +% \changes{v3.4.0}{2016/05/01}{CJKmath 的字符范围遵从 \tn{xeCJKDeclareCharClass} 的设置。} % 当没有设置 CJK 数学字体时,使用 \tn{CJKfamilydefault} 作为数学字体。 % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_set_mathfont: { \xeCJK_family_if_exist:xTF { \c_@@_math_tl } - { \use:n } + { \@@_set_mathfont_aux: } { - \xeCJK_family_if_exist:xTF { \CJKfamilydefault } - { \use:n } { \use_none:n } + \xeCJK_family_if_exist:xT { \CJKfamilydefault } + { + \@@_copy_family:xx { \c_@@_math_tl } { \CJKfamilydefault } + \@@_set_mathfont_aux: + } } + } +\cs_new_protected_nopar:Npn \@@_set_mathfont_aux: + { + \tl_const:Nx \c_@@_math_family_tl { \l_@@_fontspec_family_tl } + \xeCJK_declare_mathfont:nn { \c_@@_math_tl } { \c_@@_math_family_tl } + \int_const:Nn \c_xeCJK_math_fam_int { \use:c { sym \c_@@_math_tl } } + \clist_concat:NNN \g_@@_math_chars_clist + \g_@@_CJK_range_clist \g_@@_FullLeft_range_clist + \clist_concat:NNN \g_@@_math_chars_clist + \g_@@_math_chars_clist \g_@@_FullRight_range_clist + \xeCJK_gset_mathcode:Nn \g_@@_math_chars_clist { \c_xeCJK_math_fam_int } + \xeCJK_set_mathfont_block: + } +\clist_new:N \g_@@_math_chars_clist +\prop_new:N \g_@@_fam_prop +% \end{macrocode} +% \end{macro} +% +% \changes{v3.4.0}{2016/05/04}{CJKmath 功能也支持分区字体。} +% +% \begin{macro}[internal]{\xeCJK_set_mathfont_block:} +% 分区数学字体。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \xeCJK_set_mathfont_block: + { + \seq_if_empty:NF \g_@@_CJK_sub_class_seq + { + \seq_map_function:NN + \g_@@_CJK_sub_class_seq + \xeCJK_set_mathfont_block:n + } + } +\cs_new_protected_nopar:Npn \xeCJK_set_mathfont_block:n #1 + { + \xeCJK_block_family:nn { \c_@@_math_tl } {#1} + \prop_get:NoNTF \g_@@_fam_prop + { \l_@@_fontspec_family_tl } \l_@@_tmp_tl + { \int_set:Nn \l_@@_fam_int { \l_@@_tmp_tl } } + { + \xeCJK_declare_mathfont:nn + { \c_@@_math_tl / #1 } { \l_@@_fontspec_family_tl } + \@@_set_mathfont_block_aux:cn { sym \c_@@_math_tl / #1 } {#1} + } + \xeCJK_gset_mathcode:cn { g_@@_CJK/#1_range_clist } { \l_@@_fam_int } + } +\cs_new_protected_nopar:Npn \@@_set_mathfont_block_aux:Nn #1#2 + { + \int_set_eq:NN \l_@@_fam_int #1 + \prop_gput:Nnn \g_@@_block_fam_prop {#2} {#1} + } +\int_new:N \l_@@_fam_int +\prop_new:N \g_@@_block_fam_prop +\cs_generate_variant:Nn \@@_set_mathfont_block_aux:Nn { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xeCJK_declare_mathfont:nn} +% \begin{macrocode} +\cs_new_protected_nopar:Npn \xeCJK_declare_mathfont:nn #1#2 + { + \xeCJK_declare_symbol_font:nnnnn {#1} { \c_@@_encoding_tl } + {#2} { \mddefault } { \updefault } + \cs_if_free:cF + { \c_@@_encoding_tl/#2/\bfdefault/\updefault } + { + \SetSymbolFont {#1} { bold } { \c_@@_encoding_tl } + {#2} { \bfdefault } { \updefault } + } + \prop_gput:Nxx \g_@@_fam_prop {#2} { \exp_not:c { sym #1 } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xeCJK_declare_symbol_font:nnnnn} +% 主要功能同 \tn{DeclareSymbolFont},不带编码和重复定义检查。 +% \begin{macrocode} +\cs_new_protected:Npn \xeCJK_declare_symbol_font:nnnnn #1 + { \@@_declare_symbol_font:cnnnn { sym #1 } } +\cs_new_protected:Npn \@@_declare_symbol_font:Nnnnn #1 + { + \xeCJK_new_fam:N #1 + \xeCJK_new_symbol_font:Nnnnn #1 + } +\cs_generate_variant:Nn \@@_declare_symbol_font:Nnnnn { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xeCJK_new_fam:N} +% 我们从 $255$ 往下分配 \tn{fam},|\count18| 是 \LaTeXe{} 记录最后分配的 \tn{fam} 编号, +% 作为我们的分配器的下限。事实上,还应该相应地减小 \tn{e@mathgroup@top} 才合理,但这可能会有不利影响, +% 我们暂未处理。 +% \begin{macrocode} +\cs_new_protected:Npn \xeCJK_new_fam:N #1 + { + \int_compare:nNnTF + { \g_@@_fam_allocation_int } > { \g_@@_fam_bottom_int } { - \tl_const:Nx \c_@@_math_family_tl { \l_@@_fontspec_family_tl } - \DeclareSymbolFont { \c_@@_math_tl } { \c_@@_encoding_tl } - { \c_@@_math_family_tl } { \mddefault } { \shapedefault } - \cs_if_free:cF - { \c_@@_encoding_tl/\c_@@_math_family_tl/\bfdefault/\shapedefault } + \int_set_eq:NN \allocationnumber \g_@@_fam_allocation_int + \int_const:Nn #1 { \allocationnumber } + \iow_log:x { - \SetSymbolFont { \c_@@_math_tl } { bold } { \c_@@_encoding_tl } - { \c_@@_math_family_tl } { \bfdefault } { \shapedefault } - } - \int_const:Nn \c_xeCJK_math_fam_int { \use:c { sym \c_@@_math_tl } } - \clist_concat:NNN \l_@@_tmp_clist - \c_@@_CJK_chars_clist \c_@@_FullLeft_chars_clist - \clist_concat:NNN \l_@@_tmp_clist - \l_@@_tmp_clist \c_@@_FullRight_chars_clist - \clist_map_inline:Nn \l_@@_tmp_clist - { - \@@_set_char_class_aux:Nnw \xeCJK_gset_mathcode:nnnn {##1} - { \c_zero } { \c_xeCJK_math_fam_int } + \token_to_str:N #1 = + \token_to_str:N \mathgroup \int_use:N \allocationnumber } + \int_gdecr:N \g_@@_fam_allocation_int } + { \@@_error:n { fam-exhausted } } + } +\tex_countdef:D \g_@@_fam_bottom_int = 18 ~ +\int_new:N \g_@@_fam_allocation_int +\int_gset_eq:NN \g_@@_fam_allocation_int \c_two_hundred_fifty_five +\@@_msg_new:nn { fam-exhausted } + { No~room~for~a~new~fam. } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xeCJK_new_symbol_font:Nnnnn} +% \begin{macro}[aux]{\@@_new_symbol_font:NN} +% 功能同 \tn{new@symbolfont},但我们不增加 \tn{c@mv@normal} 和 \tn{c@mv@bold} 之类的计数器。 +% \begin{macrocode} +\cs_new_protected:Npn \xeCJK_new_symbol_font:Nnnnn #1#2#3#4#5 + { \@@_new_symbol_font:Nc #1 { #2/#3/#4/#5 } } +\cs_new_protected:Npn \@@_new_symbol_font:NN #1#2 + { + \tl_put_right:Nn \group@list { \group@elt #1 #2 } + \cs_set_nopar:Npn \version@elt ##1 + { \tl_put_right:Nn ##1 { \getanddefine@fonts #1 #2 } } + \version@list } +\cs_generate_variant:Nn \@@_new_symbol_font:NN { Nc } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}[internal]{\xeCJK_gset_mathcode:nnnn} +% \begin{macro}[internal]{\xeCJK_gset_mathcode:Nn, +% \xeCJK_gset_mathcode:Nnn,\xeCJK_gset_mathcode:nnnn} +% CJK 字符的数学类别固定为 $0$(\tn{mathord})。 % \begin{macrocode} +\cs_new_protected_nopar:Npn \xeCJK_gset_mathcode:Nn #1#2 + { + \clist_map_inline:Nn #1 + { + \@@_set_char_class_aux:Nnw \xeCJK_gset_mathcode:nnnn { ##1 } + { \c_zero } {#2} + } + } +\cs_generate_variant:Nn \xeCJK_gset_mathcode:Nn { c } \cs_new_protected_nopar:Npn \xeCJK_gset_mathcode:nnnn #1#2#3#4 { \@@_check_num_range:nnNN {#1} {#2} \l_@@_begin_int \l_@@_end_int \xeCJK_int_until_do:nn { \l_@@_begin_int > \l_@@_end_int } { - \tex_global:D \utex_mathcode:D - \l_@@_begin_int = #3 ~ #4 \l_@@_begin_int + \xeCJK_gset_mathcode:Nnn \l_@@_begin_int {#3} {#4} \int_incr:N \l_@@_begin_int } } +\cs_new_protected_nopar:Npn \xeCJK_gset_mathcode:Nnn #1#2#3 + { \tex_global:D \utex_mathcode:D #1 = #2 ~ #3 ~ #1 } % \end{macrocode} % \end{macro} % @@ -7257,20 +7295,47 @@ CJK scripts fonts (TrueType or OpenType). % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_update_url_font:,\Url@MathSetup} +% \begin{macro}[internal]{\xeCJK@update@fam,\Url@MathSetup} % \changes{v3.2.7}{2013/11/09}{使通过 \tn{UrlFont} 等命令设置的 CJK 字体生效。} % 使通过 \tn{urlstyle} 或者 \tn{UrlFont} 设置的路径中使用的 CJK 字体生效。 +% 使用 \tn{everymath} 钩子中数学模式中重定义 CJK 数学字体,以确保我们的设置在 +% \tn{check@mathfonts} 之后生效,不会被它覆盖。 +% 更合理的方式是定义一个新的 \tn{mathversion} 来切换。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_update_url_font: +\cs_new_protected_nopar:Npn \xeCJK@update@fam + { + \addto@hook \everymath + { + \@@_update_main_fam: + \@@_update_block_fam: + } + } +\cs_new_protected_nopar:Npn \@@_update_main_fam: { \group_begin: \xeCJK_select_font: \exp_after:wN \group_end: - \exp_after:wN \tex_textfont:D \exp_after:wN \c_xeCJK_math_fam_int - \tex_the:D \tex_font:D + \exp_after:wN \tex_textfont:D \exp_after:wN \c_xeCJK_math_fam_int + \tex_the:D \tex_font:D + } +\cs_new_protected_nopar:Npn \@@_update_block_fam: + { + \prop_if_empty:NF \g_@@_block_fam_prop + { + \prop_map_function:NN + \g_@@_block_fam_prop + \@@_update_block_fam:nn + } + } +\cs_new_protected_nopar:Npn \@@_update_block_fam:nn #1#2 + { + \int_set:Nn \l_@@_fam_int {#2} + \group_begin: \xeCJK_select_font:n {#1} \exp_after:wN \group_end: + \exp_after:wN \tex_textfont:D \exp_after:wN \l_@@_fam_int + \tex_the:D \tex_font:D } \@@_after_end_preamble:n { \bool_if:nT { \g_@@_math_bool && \cs_if_exist_p:N \Url@MathSetup } - { \tl_put_right:Nn \Url@MathSetup { \@@_update_url_font: } } + { \tl_put_right:Nn \Url@MathSetup { \xeCJK@update@fam } } } % \end{macrocode} % \end{macro} @@ -7467,11 +7532,9 @@ CJK scripts fonts (TrueType or OpenType). % \end{macrocode} % \end{macro} % -% \newbox\xeCJKtmpbox -% \setbox\xeCJKtmpbox\vbox\bgroup\gobblelineno % \begin{macrocode} %<@@=> -% \end{macrocode}\egroup +% \end{macrocode} % % \begin{macro}[internal]{\xeCJK@fix@penalty} % \changes{v3.1.0}{2012/11/13}{采用通过不修改原语 \tn{/} 的方式对修复倾斜校正。} @@ -7537,10 +7600,9 @@ CJK scripts fonts (TrueType or OpenType). % \end{macrocode} % \end{macro} % -% \setbox\xeCJKtmpbox\vbox\bgroup\gobblelineno % \begin{macrocode} %<@@=xeCJK> -% \end{macrocode}\egroup +% \end{macrocode} % % \begin{macro}[internal]{\g_@@_xetex_allocator_int} % \changes{v3.3.1}{2015/04/14}{兼容 \LaTeXe{} 2015。} @@ -9621,10 +9683,9 @@ CJK scripts fonts (TrueType or OpenType). %</listings> % \end{macrocode} % -% \setbox\xeCJKtmpbox\vbox\bgroup\gobblelineno % \begin{macrocode} %<@@=xunadd> -% \end{macrocode}\egroup +% \end{macrocode} % % \subsection{\pkg{xunicode-addon}} % @@ -11956,10 +12017,11 @@ CJK scripts fonts (TrueType or OpenType). %</xunextra> % \end{macrocode} % -% \setbox\xeCJKtmpbox\vbox\bgroup\gobblelineno +% \end{implementation} +% % \begin{macrocode} %<@@=xeCJK> -% \end{macrocode}\egroup +% \end{macrocode} % % \subsection{\pkg{xeCJK.cfg}} % @@ -11977,7 +12039,13 @@ CJK scripts fonts (TrueType or OpenType). %</config> % \end{macrocode} % -% \begin{comment} +% \Finale +% +% \endinput +% +% \DisableImplementation +% +% \begin{implementation} % % \makeatletter % \let\special@index\@gobble @@ -12610,16 +12678,64 @@ int main() %</ex-listings> % \end{macrocode} % +% \subsection{\pkg{xeCJK-example-mathblock.tex}} +% +% \begin{macrocode} +%<*ex-mathblock> +% \end{macrocode} +% +% \begin{macrocode} +\documentclass{article} + +\usepackage{url} +\usepackage[CJKmath]{xeCJK} + +\setCJKmainfont[BoldFont=SimHei]{SimSun} +\setCJKmonofont{KaiTi} + +\ExplSyntaxOn +\tl_const:Nn \c_test_text_tl { 天地玄黃宇宙洪荒日月盈昃辰宿列張寒來暑往秋收冬藏閏餘成歲律呂調陽 } +\cs_new:Npn \test_color:n #1 + { \exp_args:No \str_range:nnn { \mdfivesum {#1} } { 1 } { 6 } } +\tl_map_inline:Nn \c_test_text_tl + { + \xeCJKDeclareSubCJKBlock {#1} { `#1 } + \setCJKmainfont + [ #1 , Color = \test_color:n {#1} , BoldFont = SimHei ] { SimSun } + \setCJKmonofont [ #1 ] { KaiTi } + } +\cs_new_protected_nopar:Npn \TEST + { + \exp_args:No \path { \c_test_text_tl } \par + \c_test_text_tl \par + $ \c_test_text_tl $ + } +\ExplSyntaxOff + +\begin{document} + +\TEST + +\bigskip + +\bfseries\mathversion{bold}\TEST + +\end{document} +% \end{macrocode} +% +% \begin{macrocode} +%</ex-mathblock> +% \end{macrocode} +% % \subsection{\pkg{xunicode-symbols.tex}} % % \begin{macrocode} %<*xunicode-symbols> % \end{macrocode} % -% \setbox\xeCJKtmpbox\vbox\bgroup\gobblelineno % \begin{macrocode} %<@@=xunsym> -% \end{macrocode}\egroup +% \end{macrocode} % % \begin{macrocode} \documentclass[a4paper]{article} @@ -12801,11 +12917,6 @@ int main() %</xunicode-symbols> % \end{macrocode} % -% \end{comment} -% % \end{implementation} % -% -% \Finale -% \endinput diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins index 1047b2d3483..057f01d3ab1 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins @@ -6,144 +6,93 @@ %% %% xeCJK.dtx (with options: `install') %% -%% ----------------------------------------------------------------- -%% Author: -%% Wenchang Sun <sunwch@nankai.edu.cn> -%% Current Maintainers: -%% Leo Liu <leoliu.pku@gmail.com> -%% Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> +%% Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> +%% Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> +%% ---------------------------------------------------------------------- %% -%% Copyright (C) 2007--2010 Wenchang Sun -%% (C) 2009--2016 Leo Liu -%% (C) 2012--2016 Qing Lee +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% This work has the LPPL maintenance status `maintained'. %% -%% This work has the LPPL maintenance status "maintained". -%% The Current Maintainer of this work are Leo Liu and Qing Lee. -%% ----------------------------------------------------------------- +%% The Current Maintainers of this work are Leo Liu and Qing Lee. +%% +%% ---------------------------------------------------------------------- %% -\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 +\input ctxdocstrip % \preamble ------------------------------------------------------------------ - Author: - Wenchang Sun <sunwch@nankai.edu.cn> - Current Maintainers: - Leo Liu <leoliu.pku@gmail.com> - Qing Lee <sobenlee@gmail.com> + Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> + Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> +---------------------------------------------------------------------- - Copyright (C) 2007--2010 Wenchang Sun - (C) 2009--2016 Leo Liu - (C) 2012--2016 Qing Lee + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and the latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. - This file may be distributed and/or modified under the - conditions of the LaTeX Project Public License, either version 1.3 - of this license or (at your option) any later version. - The latest version of this license is in - http://www.latex-project.org/lppl.txt - and version 1.3 or later is part of all distributions of LaTeX - version 2005/12/01 or later. + This work has the LPPL maintenance status `maintained'. - This work has the LPPL maintenance status "maintained". - The Current Maintainer of this work are Leo Liu and Qing Lee. ------------------------------------------------------------------ + The Current Maintainers of this work are Leo Liu and Qing Lee. + +---------------------------------------------------------------------- \endpreamble \postamble - This package consists of the file xeCJK.dtx, - full-stop.map, - fullwidth-stop.map, - han-simp.map, - han-trad.map, - and the derived files xeCJK.pdf, - xeCJK.sty, - xeCJK.cfg, - xeCJK.ins, - xeCJKfntef.sty, - xeCJK-listings.sty, - xunicode-addon.sty, - xunicode-extra.def, - xeCJK-example-autofake.tex, - xeCJK-example-fallback.tex, - xeCJK-example-subCJKblock.tex, - xeCJK-example-CJKecglue.tex, - xeCJK-example-checksingle.tex, - xeCJK-example-CJKfntef.tex, - xeCJK-example-punctstyle.tex, - xeCJK-example-verbatim.tex, - xeCJK-example-CM.tex, - xeCJK-example-listings.tex, - xunicode-symbols.tex, - xunicode-commands.tex, - xunicode-combine-marks.tex, - xunicode-symbols.pdf, - full-stop.tec, - fullwidth-stop.tec, - han-simp.tec, - han-trad.tec, and - README.txt. -\endpostamble -\declarepreamble\emptypreamble -\endpreamble -\declarepostamble\emptypostamble + This package consists of the files xeCJK.dtx, + full-stop.map, + fullwidth-stop.map, + han-simp.map, + han-trad.map, + and the derived files xeCJK.pdf, + xeCJK.sty, + xeCJK.cfg, + xeCJK.ins, + xeCJKfntef.sty, + xeCJK-listings.sty, + xunicode-addon.sty, + xunicode-extra.def, + xeCJK-example-autofake.tex, + xeCJK-example-fallback.tex, + xeCJK-example-subCJKblock.tex, + xeCJK-example-CJKecglue.tex, + xeCJK-example-checksingle.tex, + xeCJK-example-CJKfntef.tex, + xeCJK-example-punctstyle.tex, + xeCJK-example-verbatim.tex, + xeCJK-example-CM.tex, + xeCJK-example-listings.tex, + xeCJK-example-mathblock.tex, + xunicode-symbols.tex, + xunicode-commands.tex, + xunicode-combine-marks.tex, + xunicode-symbols.pdf, + full-stop.tec, + fullwidth-stop.tec, + han-simp.tec, + han-trad.tec, and + README.md. \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}} @@ -165,45 +114,47 @@ \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{xeCJK-example-mathblock.tex} {\from{\jobname.dtx}{ex-mathblock}} \file{xunicode-symbols.tex} {\from{\jobname.dtx}{xunicode-symbols}} \nopreamble\nopostamble \usedir{doc/xelatex/xecjk} - \file{README.txt} {\from{\jobname.dtx}{readme}} + \file{README.md} {\from{\jobname.dtx}{readme}} } \endbatchfile %% -%% This package consists of the file xeCJK.dtx, -%% full-stop.map, -%% fullwidth-stop.map, -%% han-simp.map, -%% han-trad.map, -%% and the derived files xeCJK.pdf, -%% xeCJK.sty, -%% xeCJK.cfg, -%% xeCJK.ins, -%% xeCJKfntef.sty, -%% xeCJK-listings.sty, -%% xunicode-addon.sty, -%% xunicode-extra.def, -%% xeCJK-example-autofake.tex, -%% xeCJK-example-fallback.tex, -%% xeCJK-example-subCJKblock.tex, -%% xeCJK-example-CJKecglue.tex, -%% xeCJK-example-checksingle.tex, -%% xeCJK-example-CJKfntef.tex, -%% xeCJK-example-punctstyle.tex, -%% xeCJK-example-verbatim.tex, -%% xeCJK-example-CM.tex, -%% xeCJK-example-listings.tex, -%% xunicode-symbols.tex, -%% xunicode-commands.tex, -%% xunicode-combine-marks.tex, -%% xunicode-symbols.pdf, -%% full-stop.tec, -%% fullwidth-stop.tec, -%% han-simp.tec, -%% han-trad.tec, and -%% README.txt. +%% This package consists of the files xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.cfg, +%% xeCJK.ins, +%% xeCJKfntef.sty, +%% xeCJK-listings.sty, +%% xunicode-addon.sty, +%% xunicode-extra.def, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex, +%% xeCJK-example-CJKfntef.tex, +%% xeCJK-example-punctstyle.tex, +%% xeCJK-example-verbatim.tex, +%% xeCJK-example-CM.tex, +%% xeCJK-example-listings.tex, +%% xeCJK-example-mathblock.tex, +%% xunicode-symbols.tex, +%% xunicode-commands.tex, +%% xunicode-combine-marks.tex, +%% xunicode-symbols.pdf, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and +%% README.md. %% %% End of file `xeCJK.ins'. diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty index 1d5affa3d8a..8e449676869 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty @@ -6,36 +6,33 @@ %% %% xeCJK.dtx (with options: `listings') %% -%% ----------------------------------------------------------------- -%% Author: -%% Wenchang Sun <sunwch@nankai.edu.cn> -%% Current Maintainers: -%% Leo Liu <leoliu.pku@gmail.com> -%% Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> +%% Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> +%% Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> +%% ---------------------------------------------------------------------- %% -%% Copyright (C) 2007--2010 Wenchang Sun -%% (C) 2009--2016 Leo Liu -%% (C) 2012--2016 Qing Lee +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% This work has the LPPL maintenance status `maintained'. %% -%% This work has the LPPL maintenance status "maintained". -%% The Current Maintainer of this work are Leo Liu and Qing Lee. -%% ----------------------------------------------------------------- +%% The Current Maintainers of this work are Leo Liu and Qing Lee. +%% +%% ---------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 8518191 2016-02-10 16:25:31 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 463fb57 2016-05-14 12:24:41 +0800 Qing Lee <sobenlee@gmail.com> $ {xeCJK patch file for listings} -\ProvidesExplPackage - {xeCJK-listings} - {\ExplFileDate}{3.3.4}{\ExplFileDescription} +\ProvidesExplPackage{xeCJK-listings} + {\ExplFileDate}{3.4.0}{\ExplFileDescription} \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { xeCJK } } \ProcessOptions \scan_stop: \RequirePackage { xeCJK } @@ -331,37 +328,38 @@ } { \ } %% -%% This package consists of the file xeCJK.dtx, -%% full-stop.map, -%% fullwidth-stop.map, -%% han-simp.map, -%% han-trad.map, -%% and the derived files xeCJK.pdf, -%% xeCJK.sty, -%% xeCJK.cfg, -%% xeCJK.ins, -%% xeCJKfntef.sty, -%% xeCJK-listings.sty, -%% xunicode-addon.sty, -%% xunicode-extra.def, -%% xeCJK-example-autofake.tex, -%% xeCJK-example-fallback.tex, -%% xeCJK-example-subCJKblock.tex, -%% xeCJK-example-CJKecglue.tex, -%% xeCJK-example-checksingle.tex, -%% xeCJK-example-CJKfntef.tex, -%% xeCJK-example-punctstyle.tex, -%% xeCJK-example-verbatim.tex, -%% xeCJK-example-CM.tex, -%% xeCJK-example-listings.tex, -%% xunicode-symbols.tex, -%% xunicode-commands.tex, -%% xunicode-combine-marks.tex, -%% xunicode-symbols.pdf, -%% full-stop.tec, -%% fullwidth-stop.tec, -%% han-simp.tec, -%% han-trad.tec, and -%% README.txt. +%% This package consists of the files xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.cfg, +%% xeCJK.ins, +%% xeCJKfntef.sty, +%% xeCJK-listings.sty, +%% xunicode-addon.sty, +%% xunicode-extra.def, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex, +%% xeCJK-example-CJKfntef.tex, +%% xeCJK-example-punctstyle.tex, +%% xeCJK-example-verbatim.tex, +%% xeCJK-example-CM.tex, +%% xeCJK-example-listings.tex, +%% xeCJK-example-mathblock.tex, +%% xunicode-symbols.tex, +%% xunicode-commands.tex, +%% xunicode-combine-marks.tex, +%% xunicode-symbols.pdf, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and +%% README.md. %% %% End of file `xeCJK-listings.sty'. diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg index e374933479d..b0d70da52e9 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg @@ -6,11 +6,10 @@ %% %% xeCJK.dtx (with options: `config') %% -\GetIdInfo$Id: xeCJK.dtx 8518191 2016-02-10 16:25:31 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 463fb57 2016-05-14 12:24:41 +0800 Qing Lee <sobenlee@gmail.com> $ {Configuration file for xeCJK package} -\ProvidesExplFile - {\ExplFileName.cfg} - {\ExplFileDate}{3.3.4}{\ExplFileDescription} +\ProvidesExplFile{\ExplFileName.cfg} + {\ExplFileDate}{3.4.0}{\ExplFileDescription} %% %% diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index 18f0c54e2aa..ba88db7d131 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty @@ -6,36 +6,33 @@ %% %% xeCJK.dtx (with options: `package') %% -%% ----------------------------------------------------------------- -%% Author: -%% Wenchang Sun <sunwch@nankai.edu.cn> -%% Current Maintainers: -%% Leo Liu <leoliu.pku@gmail.com> -%% Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> +%% Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> +%% Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> +%% ---------------------------------------------------------------------- %% -%% Copyright (C) 2007--2010 Wenchang Sun -%% (C) 2009--2016 Leo Liu -%% (C) 2012--2016 Qing Lee +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% This work has the LPPL maintenance status `maintained'. %% -%% This work has the LPPL maintenance status "maintained". -%% The Current Maintainer of this work are Leo Liu and Qing Lee. -%% ----------------------------------------------------------------- +%% The Current Maintainers of this work are Leo Liu and Qing Lee. +%% +%% ---------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 8518191 2016-02-10 16:25:31 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 463fb57 2016-05-14 12:24:41 +0800 Qing Lee <sobenlee@gmail.com> $ {Typesetting CJK scripts with XeLaTeX} -\ProvidesExplPackage - {\ExplFileName} - {\ExplFileDate}{3.3.4}{\ExplFileDescription} +\ProvidesExplPackage{\ExplFileName} + {\ExplFileDate}{3.4.0}{\ExplFileDescription} \msg_new:nnn { xeCJK } { Require-XeTeX } { The~xeCJK~package~requires~XeTeX~to~function.\\\\ @@ -550,15 +547,19 @@ \cs_new_nopar:Npn \xeCJK_class_num:n #1 { \use:c { \__xeCJK_class_csname:n {#1} } } \NewDocumentCommand \xeCJKDeclareCharClass { s > { \TrimSpaces } m m } { - \xeCJK_declare_char_class:nx {#2} {#3} + \xeCJK_declare_char_class:nn {#2} {#3} \IfBooleanT {#1} { \xeCJKResetPunctClass } } \cs_new_protected_nopar:Npn \xeCJK_declare_char_class:nn #1#2 { - \clist_set:Nn \l__xeCJK_tmp_clist {#2} + \clist_set:Nx \l__xeCJK_tmp_clist {#2} + \xeCJK_declare_char_class:nN {#1} \l__xeCJK_tmp_clist + } +\cs_new_protected_nopar:Npn \xeCJK_declare_char_class:nN #1#2 + { \clist_gconcat:ccN - { g__xeCJK_#1_range_clist } { g__xeCJK_#1_range_clist } \l__xeCJK_tmp_clist - \clist_map_inline:Nn \l__xeCJK_tmp_clist + { g__xeCJK_#1_range_clist } { g__xeCJK_#1_range_clist } #2 + \clist_map_inline:Nn #2 { \str_if_eq:nnF {##1} { -> } { @@ -571,7 +572,7 @@ \NewDocumentCommand \__xeCJK_set_char_class_aux:Nnw { m > { \SplitArgument { 1 } { -> } } m } { #1 #2 } \cs_generate_variant:Nn \clist_gconcat:NNN { cc } -\cs_generate_variant:Nn \xeCJK_declare_char_class:nn { nx , nV } +\cs_generate_variant:Nn \xeCJK_declare_char_class:nn { nc } \cs_new_protected_nopar:Npn \__xeCJK_check_num_range:nnNN #1#2#3#4 { \bool_if:nTF { \xeCJK_if_blank_x_p:n {#1} || \xeCJK_if_blank_x_p:n {#2} } @@ -617,17 +618,25 @@ } \NewDocumentCommand \xeCJKResetPunctClass { } { - \xeCJK_declare_char_class:nV { HalfLeft } \c__xeCJK_HalfLeft_chars_clist - \xeCJK_declare_char_class:nV { HalfRight } \c__xeCJK_HalfRight_chars_clist - \xeCJK_declare_char_class:nV { FullLeft } \c__xeCJK_FullLeft_chars_clist - \xeCJK_declare_char_class:nV { FullRight } \c__xeCJK_FullRight_chars_clist + \clist_gclear:N \g__xeCJK_HalfLeft_range_clist + \clist_gclear:N \g__xeCJK_HalfRight_range_clist + \clist_gclear:N \g__xeCJK_FullLeft_range_clist + \clist_gclear:N \g__xeCJK_FullRight_range_clist + \xeCJK_declare_char_class:nN { HalfLeft } \c__xeCJK_HalfLeft_chars_clist + \xeCJK_declare_char_class:nN { HalfRight } \c__xeCJK_HalfRight_chars_clist + \xeCJK_declare_char_class:nN { FullLeft } \c__xeCJK_FullLeft_chars_clist + \xeCJK_declare_char_class:nN { FullRight } \c__xeCJK_FullRight_chars_clist } \NewDocumentCommand \xeCJKResetCharClass { } { - \xeCJK_declare_char_class:nV { CJK } \c__xeCJK_CJK_chars_clist - \xeCJK_declare_char_class:nV { NormalSpace } \c__xeCJK_NormalSpace_chars_clist - \xeCJK_declare_char_class:nV { CM } \c__xeCJK_CM_chars_clist - \xeCJK_declare_char_class:nV { HangulJamo } \c__xeCJK_HangulJamo_chars_clist + \clist_gclear:N \g__xeCJK_CJK_range_clist + \clist_gclear:N \g__xeCJK_NormalSpace_range_clist + \clist_gclear:N \g__xeCJK_CM_range_clist + \clist_gclear:N \g__xeCJK_HangulJamo_range_clist + \xeCJK_declare_char_class:nN { CJK } \c__xeCJK_CJK_chars_clist + \xeCJK_declare_char_class:nN { NormalSpace } \c__xeCJK_NormalSpace_chars_clist + \xeCJK_declare_char_class:nN { CM } \c__xeCJK_CM_chars_clist + \xeCJK_declare_char_class:nN { HangulJamo } \c__xeCJK_HangulJamo_chars_clist \xeCJKResetPunctClass } \xeCJKResetCharClass @@ -727,21 +736,8 @@ { \xeCJK_check_for_ecglue: } \cs_new_protected_nopar:Npn \__xeCJK_check_for_xecglue: { - \bool_if:nTF - { - \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven && - \skip_if_eq_p:nn \tex_lastskip:D \c_xeCJK_space_skip_tl - } - { - \tex_unskip:D - \bool_if:nTF - { - \xeCJK_if_last_node_p:n { CJK } || - \xeCJK_if_last_node_p:n { CJK-space } - } - { \xeCJK_remove_node: \CJKecglue } - { \xeCJK_space_glue: } - } + \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + { \__xeCJK_replace_space: } { \__xeCJK_check_for_ecglue: } } \cs_new_protected_nopar:Npn \__xeCJK_check_for_ecglue: @@ -758,6 +754,23 @@ } } \cs_new_eq:NN \xeCJK_check_for_ecglue: \__xeCJK_check_for_ecglue: +\cs_new_protected_nopar:Npn \__xeCJK_replace_space: + { + \skip_set_eq:NN \l__xeCJK_last_skip \tex_lastskip:D + \tex_unskip:D + \xeCJK_if_last_node:nTF { CJK-space } + { \xeCJK_remove_node: \CJKecglue } + { + \xeCJK_if_last_node:nTF { CJK } + { + \skip_if_eq:nnTF { \l__xeCJK_last_skip } { \c_xeCJK_space_skip_tl } + { \xeCJK_remove_node: \CJKecglue } + { \skip_horizontal:N \l__xeCJK_last_skip } + } + { \skip_horizontal:N \l__xeCJK_last_skip } + } + } +\skip_new:N \l__xeCJK_last_skip \clist_map_inline:nn { Default , HalfRight } { \xeCJK_inter_class_toks:nnn {#1} { Boundary } @@ -782,21 +795,8 @@ { \xeCJK_check_for_ecglue_normalsp: } \cs_new_protected_nopar:Npn \__xeCJK_check_for_xecglue_normalsp: { - \bool_if:nTF - { - \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven && - \skip_if_eq_p:nn \tex_lastskip:D \c_xeCJK_space_skip_tl - } - { - \tex_unskip:D - \bool_if:nTF - { - \xeCJK_if_last_node_p:n { CJK } || - \xeCJK_if_last_node_p:n { CJK-space } - } - { \xeCJK_remove_node: \CJKecglue } - { \xeCJK_space_glue: } - } + \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + { \__xeCJK_replace_space: } { \__xeCJK_check_for_ecglue_normalsp: } } \cs_new_protected_nopar:Npn \__xeCJK_check_for_ecglue_normalsp: @@ -849,37 +849,39 @@ \cs_new_eq:NN \xeCJK_check_for_xglue: \prg_do_nothing: \cs_new_protected_nopar:Npn \__xeCJK_check_for_xglue: { - \bool_if:nT - { - \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven && - ( \skip_if_eq_p:nn \tex_lastskip:D \c_xeCJK_space_skip_tl || - \skip_if_eq_p:nn \tex_lastskip:D \l__xeCJK_ecglue_skip ) - } + \int_compare:nNnT \etex_lastnodetype:D = \c_eleven { + \skip_set_eq:NN \l__xeCJK_last_skip \tex_lastskip:D \tex_unskip:D - \bool_if:nTF + \xeCJK_if_last_node:nTF { CJK-space } + { \xeCJK_remove_node: \__xeCJK_ccglue_or_space: } { - \xeCJK_if_last_node_p:n { default-space } || - \int_compare_p:nNn \etex_lastnodetype:D = \c_ten || - \xeCJK_if_last_node_p:n { default } + \xeCJK_if_last_node:nTF { default-space } + { \xeCJK_remove_node: \CJKecglue } + { \__xeCJK_check_for_xglue_aux: } } - { \xeCJK_remove_node: \CJKecglue } + } + } +\cs_new_protected_nopar:Npn \__xeCJK_check_for_xglue_aux: + { + \skip_if_eq:nnTF { \l__xeCJK_last_skip } { \c_xeCJK_space_skip_tl } + { + \xeCJK_if_last_node:nTF { CJK } + { \xeCJK_remove_node: \__xeCJK_ccglue_or_space: } { - \bool_if:nTF - { - \xeCJK_if_last_node_p:n { CJK } || - \xeCJK_if_last_node_p:n { CJK-space } - } + \xeCJK_if_last_node:nTF { default } + { \xeCJK_remove_node: \CJKecglue } { - \xeCJK_remove_node: - \bool_if:NTF \l__xeCJK_reserve_space_bool - { \xeCJK_space_glue: } - { \CJKglue } + \int_compare:nNnTF \etex_lastnodetype:D = \c_ten + { \CJKecglue } + { \skip_horizontal:N \l__xeCJK_last_skip } } - { \xeCJK_space_glue: } } } + { \skip_horizontal:N \l__xeCJK_last_skip } } +\cs_new_protected_nopar:Npn \__xeCJK_ccglue_or_space: + { \CJKglue } \prg_new_conditional:Npnn \xeCJK_if_last_node:n #1 { p , T , F , TF } { \if_dim:w \use:c { c__xeCJK_#1_node_dim } = \tex_lastkern:D @@ -957,6 +959,10 @@ \xeCJK_glue_to_skip:nN {#1} \l__xeCJK_ecglue_skip \cs_set_eq:NN \xeCJK_space_or_xecglue: \CJKecglue \cs_set_eq:NN \xeCJK_check_for_xglue: \__xeCJK_check_for_xglue: + \cs_set_eq:NN \xeCJK_check_for_ecglue: \__xeCJK_check_for_xecglue: + \cs_set_eq:NN + \xeCJK_check_for_ecglue_normalsp: + \__xeCJK_check_for_xecglue_normalsp: } , xCJKecglue .default:n = { true } } @@ -965,10 +971,26 @@ \bool_new:N \l__xeCJK_xecglue_bool \keys_define:nn { xeCJK / options } { - CJKspace .bool_set:N = \l__xeCJK_reserve_space_bool , - space .meta:n = { CJKspace = true } , - nospace .meta:n = { CJKspace = false } + CJKspace .choice: , + CJKspace / true .code:n = + { + \bool_set_true:N \l__xeCJK_reserve_space_bool + \cs_set_eq:NN \__xeCJK_maybe_reserve_space: \__xeCJK_reserve_space: + \cs_set_protected_nopar:Npn \__xeCJK_ccglue_or_space: + { \xeCJK_space_glue: } + } , + CJKspace / false .code:n = + { + \bool_set_false:N \l__xeCJK_reserve_space_bool + \xeCJK_cs_clear:N \__xeCJK_maybe_reserve_space: + \cs_set_protected_nopar:Npn \__xeCJK_ccglue_or_space: + { \CJKglue } + } , + CJKspace .default:n = { true } , + space .meta:n = { CJKspace = true } , + nospace .meta:n = { CJKspace = false } } +\bool_new:N \l__xeCJK_reserve_space_bool \xeCJK_inter_class_toks:nnn { CJK } { Boundary } { \xeCJK_CJK_and_Boundary:w } \cs_new_protected_nopar:Npn \xeCJK_CJK_and_Boundary:w { @@ -981,16 +1003,20 @@ { \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool { - \bool_if:nTF + \group_align_safe_begin: + \token_if_macro:NTF \l_peek_token { - \token_if_macro_p:N \l_peek_token || - ( \l__xeCJK_reserve_space_bool && \token_if_letter_p:N \l_peek_token ) + \group_align_safe_end: + \xeCJK_class_group_end: + { \xeCJK_make_node:n { CJK-space } } + \xeCJK_space_or_xecglue: } { - \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } } - \xeCJK_space_or_xecglue: + \group_align_safe_end: + \xeCJK_class_group_end: + { \xeCJK_make_node:n { CJK-space } } + \__xeCJK_maybe_reserve_space: } - { \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } } } } { \token_if_eq_meaning:NNTF \l_peek_token \scan_stop: @@ -1007,6 +1033,9 @@ \token_if_eq_meaning:NNTF #1 \scan_stop: {#1} { \cs_set_eq:NN #1 \scan_stop: #1 } } +\cs_new_protected:Npn \__xeCJK_reserve_space: + { \token_if_letter:NT \l_peek_token { \xeCJK_space_or_xecglue: } } +\cs_new_eq:NN \__xeCJK_maybe_reserve_space: \prg_do_nothing: \cs_new_protected_nopar:Npn \xeCJK_ignore_spaces:w { \xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token @@ -1019,12 +1048,10 @@ { \xeCJK_if_last_node:nT { CJK } { \xeCJK_remove_node: { \xeCJK_make_node:n { CJK-space } } } - \bool_if:nT - { - \token_if_macro_p:N \l_peek_token || - ( \l__xeCJK_reserve_space_bool && \token_if_letter_p:N \l_peek_token ) - } - { \xeCJK_space_or_xecglue: } + \group_align_safe_begin: + \token_if_macro:NTF \l_peek_token + { \group_align_safe_end: \xeCJK_space_or_xecglue: } + { \group_align_safe_end: \__xeCJK_maybe_reserve_space: } } } } @@ -1079,19 +1106,16 @@ { \tex_kern:D #1 \exp_stop_f: } } \cs_new_protected_nopar:Npn \__xeCJK_punct_glue:NN #1#2 - { \__xeCJK_punct_hskip:n { \__xeCJK_punct_skip:nn {#1} {#2} } } -\cs_new_eq:NN \__xeCJK_punct_hskip:n \skip_horizontal:n -\cs_new_protected_nopar:Npn \__xeCJK_punct_rigid_skip:nn #1#2 - { \__xeCJK_use_punct_dim:nnn { glue } {#1} {#2} } -\cs_new_protected_nopar:Npn \__xeCJK_punct_rubber_skip:nn #1#2 { - \__xeCJK_use_punct_dim:nnn { glue } {#1} {#2} - plus \__xeCJK_use_punct_dim:nnn { plus } {#1} {#2} - minus \__xeCJK_use_punct_dim:nnn { minus } {#1} {#2} + \__xeCJK_punct_hskip:n + { \__xeCJK_use_dim_or_skip:nnn { glue } {#1} {#2} } } -\cs_new_eq:NN \__xeCJK_punct_skip:nn \__xeCJK_punct_rubber_skip:nn +\cs_new_eq:NN \__xeCJK_punct_hskip:n \skip_horizontal:n \cs_new_protected_nopar:Npn \__xeCJK_punct_kern:NN #1#2 - { \tex_kern:D \__xeCJK_use_punct_dim:nnn { kern } {#1} {#2} \exp_stop_f: } + { + \__xeCJK_nobreak_hskip:n + { \__xeCJK_use_dim_or_skip:nnn { kern } {#1} {#2} } + } \tl_new:N \g__xeCJK_last_punct_tl \cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_CJK: { @@ -1306,7 +1330,7 @@ { \__xeCJK_punct_rule:NN \c__xeCJK_right_tl #1 \__xeCJK_punct_breakable_kern:n - { \__xeCJK_use_punct_dim:nnn { break_kern } {#1} {#2} } + { \__xeCJK_use_dim_or_skip:nnn { break_kern } {#1} {#2} } \__xeCJK_punct_rule:NN \c__xeCJK_left_tl #2 } \cs_new_eq:NN \__xeCJK_punct_breakable_kern:n \skip_horizontal:n @@ -1598,9 +1622,9 @@ { PlainEquation .bool_set:N = \l__xeCJK_plain_equation_bool } \seq_new:N \g__xeCJK_CJK_sub_class_seq \NewDocumentCommand \xeCJKDeclareSubCJKBlock - { s > { \TrimSpaces } m > { \TrimSpaces } m } + { s > { \TrimSpaces } m m } { - \xeCJK_declare_sub_char_class:nxx { CJK } {#2} {#3} + \xeCJK_declare_sub_char_class:nxn { CJK } {#2} {#3} \IfBooleanT {#1} { \xeCJKResetPunctClass } } \@onlypreamble \xeCJKDeclareSubCJKBlock @@ -1629,9 +1653,9 @@ { \int_if_exist:cTF { \__xeCJK_class_csname:n { CJK/##1 } } { - \xeCJK_declare_char_class:nx + \xeCJK_declare_char_class:nc { CJK \bool_if:NF \l__xeCJK_sub_cancel_bool { /##1 } } - { \tl_use:c { g__xeCJK_CJK/##1_range_clist } } + { g__xeCJK_CJK/##1_range_clist } } { \__xeCJK_error:nx { SubBlock-undefined } {##1} } } @@ -1653,7 +1677,7 @@ } \xeCJK_declare_char_class:nn { #1/#2 } {#3} } -\cs_generate_variant:Nn \xeCJK_declare_sub_char_class:nnn { nxx } +\cs_generate_variant:Nn \xeCJK_declare_sub_char_class:nnn { nx } \cs_new_protected_nopar:Npn \__xeCJK_set_sub_class_toks:nn #1#2 { \seq_map_inline:Nn \g__xeCJK_base_class_seq @@ -1758,9 +1782,13 @@ RubberPunctSkip .choice: , RubberPunctSkip .default:n = { true } , RubberPunctSkip / true .code:n = - { \cs_set_eq:NN \__xeCJK_punct_skip:nn \__xeCJK_punct_rubber_skip:nn } , + { \cs_set_eq:NN \__xeCJK_use_dim_or_skip:nnn \__xeCJK_use_punct_skip:nnn } , + RubberPunctSkip / plus .code:n = + { \cs_set_eq:NN \__xeCJK_use_dim_or_skip:nnn \__xeCJK_use_punct_skip_plus:nnn } , + RubberPunctSkip / minus .code:n = + { \cs_set_eq:NN \__xeCJK_use_dim_or_skip:nnn \__xeCJK_use_punct_skip_minus:nnn } , RubberPunctSkip / false .code:n = - { \cs_set_eq:NN \__xeCJK_punct_skip:nn \__xeCJK_punct_rigid_skip:nn } + { \cs_set_eq:NN \__xeCJK_use_dim_or_skip:nnn \__xeCJK_use_punct_dim:nnn } } \bool_new:N \l__xeCJK_punct_breakable_bool \clist_new:N \g__xeCJK_special_punct_clist @@ -1813,18 +1841,50 @@ \prg_return_true: \else: \prg_return_false: \fi: } } -\cs_new_nopar:Npn \__xeCJK_punct_dim_csname:nn #1#2 - { c__\l_xeCJK_current_font_tl/\l_xeCJK_punct_style_tl/#1/#2/tl } -\cs_new_nopar:Npn \__xeCJK_punct_dim_csname:nnn #1#2#3 - { c__\l_xeCJK_current_font_tl/\l_xeCJK_punct_style_tl/#1/#2/#3/tl } -\cs_new_nopar:Npn \__xeCJK_use_punct_dim:nn #1#2 - { \use:c { \__xeCJK_punct_dim_csname:nn {#1} {#2} } } -\cs_new_nopar:Npn \__xeCJK_use_punct_dim:nnn #1#2#3 - { \use:c { \__xeCJK_punct_dim_csname:nnn {#1} {#2} {#3} } } -\cs_new_protected_nopar:Npn \__xeCJK_save_punct_dim:nnn #1#2#3 - { \tl_const:cx { \__xeCJK_punct_dim_csname:nn {#1} {#2} } { \dim_eval:n {#3} } } -\cs_new_protected_nopar:Npn \__xeCJK_save_punct_dim:nnnn #1#2#3#4 - { \tl_const:cx { \__xeCJK_punct_dim_csname:nnn {#1} {#2} {#3} } { \dim_eval:n {#4} } } +\cs_new:Npn \__xeCJK_punct_csname:n #1 + { c__xeCJK_\l_xeCJK_current_font_tl/\l_xeCJK_punct_style_tl/#1/tl } +\cs_new:Npn \__xeCJK_use_punct_dim:nn #1#2 + { \use:c { \__xeCJK_punct_csname:n { dim/#1/#2 } } } +\cs_new:Npn \__xeCJK_use_punct_dim:nnn #1#2#3 + { \use:c { \__xeCJK_punct_csname:n { dim/#1/#2/#3 } } } +\cs_new:Npn \__xeCJK_use_punct_skip:nnn #1#2#3 + { \use:c { \__xeCJK_punct_csname:n { skip/#1/#2/#3 } } } +\cs_new:Npn \__xeCJK_use_punct_skip_plus:nnn #1#2#3 + { \use:c { \__xeCJK_punct_csname:n { skip/plus/#1/#2/#3 } } } +\cs_new:Npn \__xeCJK_use_punct_skip_minus:nnn #1#2#3 + { \use:c { \__xeCJK_punct_csname:n { skip/minus/#1/#2/#3 } } } +\cs_new_protected:Npn \__xeCJK_save_punct_dim:nnn #1#2 + { \__xeCJK_save_punct_width_aux:nnn { dim } { #1/#2 } } +\cs_new_protected:Npn \__xeCJK_save_punct_dim:nnnn #1#2#3 + { \__xeCJK_save_punct_width_aux:nnn { dim } { #1/#2/#3 } } +\cs_new_protected:Npn \__xeCJK_save_punct_skip:nnnn #1#2#3#4 + { + \__xeCJK_save_punct_width_aux:nnn { skip } { #1/#2/#3 } {#4} + \__xeCJK_save_punct_width_aux:nnn { skip } { plus/#1/#2/#3 } {#4} + \__xeCJK_save_punct_width_aux:nnn { skip } { minus/#1/#2/#3 } {#4} + } +\cs_new_protected:Npn \__xeCJK_save_punct_skip:nnnnnn #1#2#3#4#5#6 + { + \use:x + { + \__xeCJK_save_punct_skip_aux:nnnn { #1/#2/#3 } + { \dim_eval:n {#4} } + { \dim_max:nn { \c_zero_dim } {#5} } + { \dim_max:nn { \c_zero_dim } {#6} } + } + } +\cs_new_protected:Npn \__xeCJK_save_punct_skip_aux:nnnn #1#2#3#4 + { + \__xeCJK_save_punct_width_aux:nnn { skip } {#1} { #2 ~ plus ~ #3 ~ minus ~ #4 ~ } + \__xeCJK_save_punct_width_aux:nnn { skip } { plus/#1 } { #2 ~ plus ~ #3 ~ } + \__xeCJK_save_punct_width_aux:nnn { skip } { minus/#1 } { #2 ~ minus ~ #4 ~ } + } +\cs_new_protected:Npn \__xeCJK_save_punct_width_aux:nnn #1#2#3 + { + \tl_const:cx { \__xeCJK_punct_csname:n { #1/#2 } } + { \use:c { #1_eval:n } {#3} } + } +\cs_new_eq:NN \__xeCJK_use_dim_or_skip:nnn \__xeCJK_use_punct_skip:nnn \DeclareObjectType { xeCJK / punctuation } { \c_zero } \DeclareTemplateInterface { xeCJK / punctuation } { basic } { \c_zero } { @@ -1901,20 +1961,19 @@ { \AssignTemplateKeys } \cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:NN #1#2 { - \tl_if_exist:cF { \__xeCJK_punct_dim_csname:nnn { glue } {#1} {#2} } + \tl_if_exist:cF { \__xeCJK_punct_csname:n { dim/glue/#1/#2 } } { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c__xeCJK_punct_style_plain_tl { \__xeCJK_save_punct_dim:nnnn { rule } {#1} {#2} { \c_zero_dim } \__xeCJK_save_punct_dim:nnnn { glue } {#1} {#2} { \c_zero_dim } - \__xeCJK_save_punct_dim:nnnn { plus } {#1} {#2} { \c_zero_dim } - \__xeCJK_save_punct_dim:nnnn { minus } {#1} {#2} { \c_zero_dim } \__xeCJK_save_punct_dim:nnnn { offset } {#1} {#2} { \c_zero_dim } \__xeCJK_save_punct_dim:nnnn { bound } \c__xeCJK_left_tl {#2} { \c_zero_dim } \__xeCJK_save_punct_dim:nnnn { bound } \c__xeCJK_right_tl {#2} { \c_zero_dim } + \__xeCJK_save_punct_skip:nnnn { glue } {#1} {#2} { \c_zero_skip } } { - { \xeCJK_select_font: \xeCJK_calc_punct_dimen:f {#2} } + { \xeCJK_select_font: \xeCJK_calc_punct_dimen:o {#2} } \dim_set:Nn \l__xeCJK_bound_dim { \__xeCJK_use_punct_dim:nnn { bound } {#1} {#2} } \dim_set:Nn \l__xeCJK_reverse_bound_dim @@ -1933,12 +1992,14 @@ \dim_new:N \l__xeCJK_reverse_bound_dim \cs_new_protected_nopar:Npn \xeCJK_get_punct_kerning:NN #1#2 { - \tl_if_exist:cF { \__xeCJK_punct_dim_csname:nnn { kern } {#1} {#2} } + \tl_if_exist:cF { \__xeCJK_punct_csname:n { dim/kern/#1/#2 } } { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c__xeCJK_punct_style_plain_tl { \__xeCJK_save_punct_dim:nnnn { kern } {#1} {#2} { \c_zero_dim } \__xeCJK_save_punct_dim:nnnn { break_kern } {#1} {#2} { \c_zero_dim } + \__xeCJK_save_punct_skip:nnnn { kern } {#1} {#2} { \c_zero_skip } + \__xeCJK_save_punct_skip:nnnn { break_kern } {#1} {#2} { \c_zero_skip } } { \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } @@ -2024,27 +2085,21 @@ } } \__xeCJK_save_punct_dim:nnnn { glue } {#1} {#2} { \l__xeCJK_tmp_dim } - \__xeCJK_save_punct_dim:nnnn { plus } {#1} {#2} + \__xeCJK_save_punct_skip:nnnnnn { glue } {#1} {#2} + { \l__xeCJK_tmp_dim } { - \dim_max:nn { \c_zero_dim } + \__xeCJK_punct_if_middle:NTF {#2} { - \__xeCJK_punct_if_middle:NTF {#2} - { - ( \__xeCJK_use_punct_dim:nn { width } {#2} - - \__xeCJK_use_punct_dim:nn { dimen } {#2} ) / \c_two - - \l__xeCJK_tmp_dim - } - { \l__xeCJK_bound_dim - \l__xeCJK_tmp_dim } + ( \__xeCJK_use_punct_dim:nn { width } {#2} - + \__xeCJK_use_punct_dim:nn { dimen } {#2} ) / \c_two + - \l__xeCJK_tmp_dim } + { \l__xeCJK_bound_dim - \l__xeCJK_tmp_dim } } - \__xeCJK_save_punct_dim:nnnn { minus } {#1} {#2} { - \dim_max:nn { \c_zero_dim } - { - \__xeCJK_punct_if_middle:NTF {#2} - { .5 \l__xeCJK_tmp_dim } - { \l__xeCJK_tmp_dim - \l__xeCJK_reverse_bound_dim } - } + \__xeCJK_punct_if_middle:NTF {#2} + { .5 \l__xeCJK_tmp_dim } + { \l__xeCJK_tmp_dim - \l__xeCJK_reverse_bound_dim } } } \cs_new_protected_nopar:Npn \xeCJK_punct_offset_process:NN #1#2 @@ -2121,38 +2176,47 @@ } \cs_new_protected_nopar:Npn \xeCJK_punct_kerning_process:NN #1#2 { - \dim_set:Nn \l__xeCJK_tmp_dim + \dim_set:Nn \l__xeCJK_original_margin_dim + { \__xeCJK_original_kerning_margin:NN {#1} {#2} } + \dim_set:Nn \l__xeCJK_minimum_bound_dim + { \__xeCJK_punct_min_bound:NN {#1} {#2} } + \dim_set:Nn \l__xeCJK_kerning_margin_dim { \bool_if:nTF { \l__xeCJK_enabled_global_setting_bool && \tl_if_exist_p:c { g__xeCJK_punct/kern/#1/#2/tl } } - { \tl_use:c { g__xeCJK_punct/kern/#1/#2/tl } } + { \use:c { g__xeCJK_punct/kern/#1/#2/tl } } { \bool_if:NTF \l__xeCJK_enabled_kerning_bool { \__xeCJK_calc_kerning_margin:NN {#1} {#2} } - { \__xeCJK_original_kerning_margin:NN {#1} {#2} } + { \l__xeCJK_original_margin_dim } } } - \__xeCJK_save_punct_dim:nnnn { kern } {#1} {#2} - { - \l__xeCJK_tmp_dim - - ( \__xeCJK_use_punct_dim:nnn { bound } \c__xeCJK_right_tl {#1} ) - - ( \__xeCJK_use_punct_dim:nnn { bound } \c__xeCJK_left_tl {#2} ) - } + \__xeCJK_save_kerning:nnNN { kern } { bound } {#1} {#2} \__xeCJK_punct_if_right:NF {#2} { \__xeCJK_punct_if_right:NT {#1} - { - \__xeCJK_save_punct_dim:nnnn { break_kern } {#1} {#2} - { - \l__xeCJK_tmp_dim - - ( \__xeCJK_use_punct_dim:nnn { offset } \c__xeCJK_right_tl {#1} ) - - ( \__xeCJK_use_punct_dim:nnn { offset } \c__xeCJK_left_tl {#2} ) - } - } + { \__xeCJK_save_kerning:nnNN { break_kern } { offset } {#1} {#2} } + } + } +\dim_new:N \l__xeCJK_minimum_bound_dim +\dim_new:N \l__xeCJK_kerning_margin_dim +\dim_new:N \l__xeCJK_original_margin_dim +\cs_new_protected_nopar:Npn \__xeCJK_save_kerning:nnNN #1#2#3#4 + { + \dim_set:Nn \l__xeCJK_tmp_dim + { + \l__xeCJK_kerning_margin_dim + - ( \__xeCJK_use_punct_dim:nnn {#2} \c__xeCJK_right_tl {#3} ) + - ( \__xeCJK_use_punct_dim:nnn {#2} \c__xeCJK_left_tl {#4} ) } + \__xeCJK_save_punct_dim:nnnn {#1} {#3} {#4} { \l__xeCJK_tmp_dim } + \__xeCJK_save_punct_skip:nnnnnn {#1} {#3} {#4} + { \l__xeCJK_tmp_dim } + { \l__xeCJK_original_margin_dim - \l__xeCJK_kerning_margin_dim } + { \l__xeCJK_kerning_margin_dim - \l__xeCJK_minimum_bound_dim } } \cs_new_nopar:Npn \__xeCJK_original_kerning_margin:NN #1#2 { @@ -2172,10 +2236,10 @@ { \l__xeCJK_kerning_margin_minimum_dim } { \bool_if:NTF \l__xeCJK_min_bound_to_kerning_bool - { \__xeCJK_punct_min_bound:NN {#1} {#2} } + { \l__xeCJK_minimum_bound_dim } { \bool_if:NTF \l__xeCJK_optimize_kerning_bool - { \dim_max:nn { \__xeCJK_punct_min_bound:NN {#1} {#2} } } + { \dim_max:nn { \l__xeCJK_minimum_bound_dim } } { \use:n } { \dim_compare:nNnTF \l__xeCJK_kerning_total_width_dim < \c_max_dim @@ -2215,7 +2279,7 @@ { \fp_use:N \l__xeCJK_kerning_margin_ratio_fp \use:n } } { \fp_use:c { l__xeCJK_#1_align_ratio_fp } \use:n } - { \etex_dimexpr:D \__xeCJK_original_kerning_margin:NN {#2} {#3} \scan_stop: } + { \l__xeCJK_original_margin_dim } } } \cs_new_nopar:Npn \__xeCJK_punct_min_bound:NN #1#2 @@ -2264,16 +2328,18 @@ { \__xeCJK_use_punct_dim:nn { width } {#1} - \l__xeCJK_tmp_dim } \__xeCJK_punct_if_long:NT {#1} { - \__xeCJK_save_punct_dim:nnnn { kern } {#1} {#1} + \dim_set:Nn \l__xeCJK_tmp_dim { \str_case:nnTF {#1} { { ^^^^2025 } { } { ^^^^2026 } { } } { \c_zero_dim } { - \l__xeCJK_tmp_dim } } + \__xeCJK_save_punct_dim:nnnn { kern } {#1} {#1} { \l__xeCJK_tmp_dim } + \__xeCJK_save_punct_skip:nnnn { kern } {#1} {#1} { \l__xeCJK_tmp_dim } } } -\cs_generate_variant:Nn \xeCJK_calc_punct_dimen:N { f } +\cs_generate_variant:Nn \xeCJK_calc_punct_dimen:N { o } \cs_new_nopar:Npn \xeCJK_glyph_bounds:NN #1#2 { \dim_use:N \xetex_glyphbounds:D #1 ~ @@ -2746,7 +2812,8 @@ { \__xeCJK_family_nfss_csname:n {#2} } } } -\cs_generate_variant:Nn \__xeCJK_copy_family:nn { xx } +\cs_new_protected_nopar:Npn \__xeCJK_copy_family:xx #1#2 + { \use:x { \__xeCJK_copy_family:nn {#1} {#2} } } \tl_new:N \l_xeCJK_current_font_tl \tl_set:Nn \l_xeCJK_current_font_tl { \__xeCJK_font_csname:n { \CJK@family } } \cs_new_nopar:Npn \__xeCJK_font_csname:n #1 { xeCJK/#1/\f@series/\f@shape/\f@size } @@ -2767,28 +2834,32 @@ \__xeCJK_info:nxx { CJK-block } {#1} {#2} \str_if_eq:nnTF {#2} { CJK } { \xeCJK_select_font: } - { \__xeCJK_block_select_font:n {#2} } + { \xeCJK_select_font:n {#2} } } } \__xeCJK_msg_new:nn { CJK-block } { Switch~from~block~`#1'~to~`#2'. } -\cs_new_protected_nopar:Npn \__xeCJK_block_select_font:n #1 +\cs_new_protected_nopar:Npn \xeCJK_select_font:n #1 { \exp_args:Nc \cs_if_exist_use:NF { \__xeCJK_font_csname:n { \CJK@family/#1 } } { - \xeCJK_family_if_exist:xF { \l_xeCJK_family_tl/#1 } - { - \__xeCJK_copy_family:xx { \l_xeCJK_family_tl/#1 } - { - \cs_if_exist:cTF - { \__xeCJK_family_csname:n { \CJKfamilydefault/#1 } } - { \CJKfamilydefault/#1 } { \l_xeCJK_family_tl } - } - } + \xeCJK_block_family:nn { \l_xeCJK_family_tl } {#1} \__xeCJK_family_use:x { \l_xeCJK_family_tl/#1 } \xeCJK_font_gset_to_current:c { \__xeCJK_font_csname:n { \CJK@family/#1 } } } } +\cs_new_protected_nopar:Npn \xeCJK_block_family:nn #1#2 + { + \xeCJK_family_if_exist:xF { #1/#2 } + { + \__xeCJK_copy_family:xx { #1/#2 } + { + \cs_if_exist:cTF + { \__xeCJK_family_csname:n { \CJKfamilydefault/#2 } } + { \CJKfamilydefault/#2 } {#1} + } + } + } \cs_new_nopar:Npn \__xeCJK_family_csname:n #1 { xeCJK/family/#1 } \cs_new_nopar:Npn \__xeCJK_family_nfss_csname:n #1 { xeCJK/family/nfss/#1 } \cs_new_nopar:Npn \__xeCJK_family_use:x #1 { \use:c { \__xeCJK_family_nfss_csname:n {#1} } } @@ -3075,37 +3146,35 @@ { \__xeCJK_warning:n { fandol } \__xeCJK_load_fandol: - \use:n - } - { - \__xeCJK_warning:nx { no-CJKfamily } { \CJKfamilydefault } - \use_none:n + \xeCJK_ensure_default_family: } + { \__xeCJK_warning:nx { no-CJKfamily } { \CJKfamilydefault } } } - { \use:n } + { \xeCJK_ensure_default_family: } + } +\cs_new_protected_nopar:Npn \xeCJK_ensure_default_family: + { + \xeCJK_family_if_exist:xF { \CJKfamilydefault } { - \xeCJK_family_if_exist:xF { \CJKfamilydefault } + \tl_set_eq:NN \l__xeCJK_tmp_tl \CJKfamilydefault + \str_if_eq_x:nnTF { \CJKfamilydefault } { \CJKrmdefault } + { \use:n } { - \tl_set_eq:NN \l__xeCJK_tmp_tl \CJKfamilydefault - \str_if_eq_x:nnTF { \CJKfamilydefault } { \CJKrmdefault } - { \use:n } - { - \xeCJK_family_if_exist:xTF { \CJKrmdefault } - { \tl_gset:Nn \CJKfamilydefault { \CJKrmdefault } } - } + \xeCJK_family_if_exist:xTF { \CJKrmdefault } + { \tl_gset:Nn \CJKfamilydefault { \CJKrmdefault } } + } + { + \prop_map_inline:Nn \g__xeCJK_family_font_name_prop { - \prop_map_inline:Nn \g__xeCJK_family_font_name_prop - { - \prop_map_break:n - { \tl_gset_rescan:Nnn \CJKfamilydefault { } {#1} } - } + \prop_map_break:n + { \tl_gset_rescan:Nnn \CJKfamilydefault { } { ##1 } } } - \__xeCJK_warning:nxx { CJKfamilydefault-undefined } - { \l__xeCJK_tmp_tl } { \CJKfamilydefault } } - \xeCJK_switch_family:n { \CJKfamilydefault } - \bool_if:NT \g__xeCJK_math_bool { \xeCJK_set_mathfont: } + \__xeCJK_warning:nxx { CJKfamilydefault-undefined } + { \l__xeCJK_tmp_tl } { \CJKfamilydefault } } + \xeCJK_switch_family:n { \CJKfamilydefault } + \bool_if:NT \g__xeCJK_math_bool { \xeCJK_set_mathfont: } } \__xeCJK_msg_new:nn { no-CJKfamily } { @@ -3132,43 +3201,130 @@ \cs_new_protected_nopar:Npn \xeCJK_set_mathfont: { \xeCJK_family_if_exist:xTF { \c__xeCJK_math_tl } - { \use:n } - { - \xeCJK_family_if_exist:xTF { \CJKfamilydefault } - { \use:n } { \use_none:n } - } + { \__xeCJK_set_mathfont_aux: } { - \tl_const:Nx \c__xeCJK_math_family_tl { \l__xeCJK_fontspec_family_tl } - \DeclareSymbolFont { \c__xeCJK_math_tl } { \c__xeCJK_encoding_tl } - { \c__xeCJK_math_family_tl } { \mddefault } { \shapedefault } - \cs_if_free:cF - { \c__xeCJK_encoding_tl/\c__xeCJK_math_family_tl/\bfdefault/\shapedefault } + \xeCJK_family_if_exist:xT { \CJKfamilydefault } { - \SetSymbolFont { \c__xeCJK_math_tl } { bold } { \c__xeCJK_encoding_tl } - { \c__xeCJK_math_family_tl } { \bfdefault } { \shapedefault } + \__xeCJK_copy_family:xx { \c__xeCJK_math_tl } { \CJKfamilydefault } + \__xeCJK_set_mathfont_aux: } - \int_const:Nn \c_xeCJK_math_fam_int { \use:c { sym \c__xeCJK_math_tl } } - \clist_concat:NNN \l__xeCJK_tmp_clist - \c__xeCJK_CJK_chars_clist \c__xeCJK_FullLeft_chars_clist - \clist_concat:NNN \l__xeCJK_tmp_clist - \l__xeCJK_tmp_clist \c__xeCJK_FullRight_chars_clist - \clist_map_inline:Nn \l__xeCJK_tmp_clist + } + } +\cs_new_protected_nopar:Npn \__xeCJK_set_mathfont_aux: + { + \tl_const:Nx \c__xeCJK_math_family_tl { \l__xeCJK_fontspec_family_tl } + \xeCJK_declare_mathfont:nn { \c__xeCJK_math_tl } { \c__xeCJK_math_family_tl } + \int_const:Nn \c_xeCJK_math_fam_int { \use:c { sym \c__xeCJK_math_tl } } + \clist_concat:NNN \g__xeCJK_math_chars_clist + \g__xeCJK_CJK_range_clist \g__xeCJK_FullLeft_range_clist + \clist_concat:NNN \g__xeCJK_math_chars_clist + \g__xeCJK_math_chars_clist \g__xeCJK_FullRight_range_clist + \xeCJK_gset_mathcode:Nn \g__xeCJK_math_chars_clist { \c_xeCJK_math_fam_int } + \xeCJK_set_mathfont_block: + } +\clist_new:N \g__xeCJK_math_chars_clist +\prop_new:N \g__xeCJK_fam_prop +\cs_new_protected_nopar:Npn \xeCJK_set_mathfont_block: + { + \seq_if_empty:NF \g__xeCJK_CJK_sub_class_seq + { + \seq_map_function:NN + \g__xeCJK_CJK_sub_class_seq + \xeCJK_set_mathfont_block:n + } + } +\cs_new_protected_nopar:Npn \xeCJK_set_mathfont_block:n #1 + { + \xeCJK_block_family:nn { \c__xeCJK_math_tl } {#1} + \prop_get:NoNTF \g__xeCJK_fam_prop + { \l__xeCJK_fontspec_family_tl } \l__xeCJK_tmp_tl + { \int_set:Nn \l__xeCJK_fam_int { \l__xeCJK_tmp_tl } } + { + \xeCJK_declare_mathfont:nn + { \c__xeCJK_math_tl / #1 } { \l__xeCJK_fontspec_family_tl } + \__xeCJK_set_mathfont_block_aux:cn { sym \c__xeCJK_math_tl / #1 } {#1} + } + \xeCJK_gset_mathcode:cn { g__xeCJK_CJK/#1_range_clist } { \l__xeCJK_fam_int } + } +\cs_new_protected_nopar:Npn \__xeCJK_set_mathfont_block_aux:Nn #1#2 + { + \int_set_eq:NN \l__xeCJK_fam_int #1 + \prop_gput:Nnn \g__xeCJK_block_fam_prop {#2} {#1} + } +\int_new:N \l__xeCJK_fam_int +\prop_new:N \g__xeCJK_block_fam_prop +\cs_generate_variant:Nn \__xeCJK_set_mathfont_block_aux:Nn { c } +\cs_new_protected_nopar:Npn \xeCJK_declare_mathfont:nn #1#2 + { + \xeCJK_declare_symbol_font:nnnnn {#1} { \c__xeCJK_encoding_tl } + {#2} { \mddefault } { \updefault } + \cs_if_free:cF + { \c__xeCJK_encoding_tl/#2/\bfdefault/\updefault } + { + \SetSymbolFont {#1} { bold } { \c__xeCJK_encoding_tl } + {#2} { \bfdefault } { \updefault } + } + \prop_gput:Nxx \g__xeCJK_fam_prop {#2} { \exp_not:c { sym #1 } } + } +\cs_new_protected:Npn \xeCJK_declare_symbol_font:nnnnn #1 + { \__xeCJK_declare_symbol_font:cnnnn { sym #1 } } +\cs_new_protected:Npn \__xeCJK_declare_symbol_font:Nnnnn #1 + { + \xeCJK_new_fam:N #1 + \xeCJK_new_symbol_font:Nnnnn #1 + } +\cs_generate_variant:Nn \__xeCJK_declare_symbol_font:Nnnnn { c } +\cs_new_protected:Npn \xeCJK_new_fam:N #1 + { + \int_compare:nNnTF + { \g__xeCJK_fam_allocation_int } > { \g__xeCJK_fam_bottom_int } + { + \int_set_eq:NN \allocationnumber \g__xeCJK_fam_allocation_int + \int_const:Nn #1 { \allocationnumber } + \iow_log:x { - \__xeCJK_set_char_class_aux:Nnw \xeCJK_gset_mathcode:nnnn {##1} - { \c_zero } { \c_xeCJK_math_fam_int } + \token_to_str:N #1 = + \token_to_str:N \mathgroup \int_use:N \allocationnumber } + \int_gdecr:N \g__xeCJK_fam_allocation_int + } + { \__xeCJK_error:n { fam-exhausted } } + } +\tex_countdef:D \g__xeCJK_fam_bottom_int = 18 ~ +\int_new:N \g__xeCJK_fam_allocation_int +\int_gset_eq:NN \g__xeCJK_fam_allocation_int \c_two_hundred_fifty_five +\__xeCJK_msg_new:nn { fam-exhausted } + { No~room~for~a~new~fam. } +\cs_new_protected:Npn \xeCJK_new_symbol_font:Nnnnn #1#2#3#4#5 + { \__xeCJK_new_symbol_font:Nc #1 { #2/#3/#4/#5 } } +\cs_new_protected:Npn \__xeCJK_new_symbol_font:NN #1#2 + { + \tl_put_right:Nn \group@list { \group@elt #1 #2 } + \cs_set_nopar:Npn \version@elt ##1 + { \tl_put_right:Nn ##1 { \getanddefine@fonts #1 #2 } } + \version@list + } +\cs_generate_variant:Nn \__xeCJK_new_symbol_font:NN { Nc } +\cs_new_protected_nopar:Npn \xeCJK_gset_mathcode:Nn #1#2 + { + \clist_map_inline:Nn #1 + { + \__xeCJK_set_char_class_aux:Nnw \xeCJK_gset_mathcode:nnnn { ##1 } + { \c_zero } {#2} } } +\cs_generate_variant:Nn \xeCJK_gset_mathcode:Nn { c } \cs_new_protected_nopar:Npn \xeCJK_gset_mathcode:nnnn #1#2#3#4 { \__xeCJK_check_num_range:nnNN {#1} {#2} \l__xeCJK_begin_int \l__xeCJK_end_int \xeCJK_int_until_do:nn { \l__xeCJK_begin_int > \l__xeCJK_end_int } { - \tex_global:D \utex_mathcode:D - \l__xeCJK_begin_int = #3 ~ #4 \l__xeCJK_begin_int + \xeCJK_gset_mathcode:Nnn \l__xeCJK_begin_int {#3} {#4} \int_incr:N \l__xeCJK_begin_int } } +\cs_new_protected_nopar:Npn \xeCJK_gset_mathcode:Nnn #1#2#3 + { \tex_global:D \utex_mathcode:D #1 = #2 ~ #3 ~ #1 } \int_new:N \l__xeCJK_verb_case_int \keys_define:nn { xeCJK / options } { @@ -3636,16 +3792,40 @@ } } { \AtBeginDocument { \xeCJK_fix_hbar: } } -\cs_new_protected_nopar:Npn \__xeCJK_update_url_font: +\cs_new_protected_nopar:Npn \xeCJK@update@fam + { + \addto@hook \everymath + { + \__xeCJK_update_main_fam: + \__xeCJK_update_block_fam: + } + } +\cs_new_protected_nopar:Npn \__xeCJK_update_main_fam: { \group_begin: \xeCJK_select_font: \exp_after:wN \group_end: - \exp_after:wN \tex_textfont:D \exp_after:wN \c_xeCJK_math_fam_int - \tex_the:D \tex_font:D + \exp_after:wN \tex_textfont:D \exp_after:wN \c_xeCJK_math_fam_int + \tex_the:D \tex_font:D + } +\cs_new_protected_nopar:Npn \__xeCJK_update_block_fam: + { + \prop_if_empty:NF \g__xeCJK_block_fam_prop + { + \prop_map_function:NN + \g__xeCJK_block_fam_prop + \__xeCJK_update_block_fam:nn + } + } +\cs_new_protected_nopar:Npn \__xeCJK_update_block_fam:nn #1#2 + { + \int_set:Nn \l__xeCJK_fam_int {#2} + \group_begin: \xeCJK_select_font:n {#1} \exp_after:wN \group_end: + \exp_after:wN \tex_textfont:D \exp_after:wN \l__xeCJK_fam_int + \tex_the:D \tex_font:D } \__xeCJK_after_end_preamble:n { \bool_if:nT { \g__xeCJK_math_bool && \cs_if_exist_p:N \Url@MathSetup } - { \tl_put_right:Nn \Url@MathSetup { \__xeCJK_update_url_font: } } + { \tl_put_right:Nn \Url@MathSetup { \xeCJK@update@fam } } } \@ifpackagelater { fontspec } { 2014/06/21 } { } { @@ -4031,37 +4211,38 @@ \ExplSyntaxOn } %% -%% This package consists of the file xeCJK.dtx, -%% full-stop.map, -%% fullwidth-stop.map, -%% han-simp.map, -%% han-trad.map, -%% and the derived files xeCJK.pdf, -%% xeCJK.sty, -%% xeCJK.cfg, -%% xeCJK.ins, -%% xeCJKfntef.sty, -%% xeCJK-listings.sty, -%% xunicode-addon.sty, -%% xunicode-extra.def, -%% xeCJK-example-autofake.tex, -%% xeCJK-example-fallback.tex, -%% xeCJK-example-subCJKblock.tex, -%% xeCJK-example-CJKecglue.tex, -%% xeCJK-example-checksingle.tex, -%% xeCJK-example-CJKfntef.tex, -%% xeCJK-example-punctstyle.tex, -%% xeCJK-example-verbatim.tex, -%% xeCJK-example-CM.tex, -%% xeCJK-example-listings.tex, -%% xunicode-symbols.tex, -%% xunicode-commands.tex, -%% xunicode-combine-marks.tex, -%% xunicode-symbols.pdf, -%% full-stop.tec, -%% fullwidth-stop.tec, -%% han-simp.tec, -%% han-trad.tec, and -%% README.txt. +%% This package consists of the files xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.cfg, +%% xeCJK.ins, +%% xeCJKfntef.sty, +%% xeCJK-listings.sty, +%% xunicode-addon.sty, +%% xunicode-extra.def, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex, +%% xeCJK-example-CJKfntef.tex, +%% xeCJK-example-punctstyle.tex, +%% xeCJK-example-verbatim.tex, +%% xeCJK-example-CM.tex, +%% xeCJK-example-listings.tex, +%% xeCJK-example-mathblock.tex, +%% xunicode-symbols.tex, +%% xunicode-commands.tex, +%% xunicode-combine-marks.tex, +%% xunicode-symbols.pdf, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and +%% README.md. %% %% End of file `xeCJK.sty'. diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty index 18afb61899e..ebcfc0357f0 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty @@ -6,36 +6,33 @@ %% %% xeCJK.dtx (with options: `fntef') %% -%% ----------------------------------------------------------------- -%% Author: -%% Wenchang Sun <sunwch@nankai.edu.cn> -%% Current Maintainers: -%% Leo Liu <leoliu.pku@gmail.com> -%% Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> +%% Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> +%% Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> +%% ---------------------------------------------------------------------- %% -%% Copyright (C) 2007--2010 Wenchang Sun -%% (C) 2009--2016 Leo Liu -%% (C) 2012--2016 Qing Lee +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% This work has the LPPL maintenance status `maintained'. %% -%% This work has the LPPL maintenance status "maintained". -%% The Current Maintainer of this work are Leo Liu and Qing Lee. -%% ----------------------------------------------------------------- +%% The Current Maintainers of this work are Leo Liu and Qing Lee. +%% +%% ---------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 8518191 2016-02-10 16:25:31 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 463fb57 2016-05-14 12:24:41 +0800 Qing Lee <sobenlee@gmail.com> $ {xeCJK font effect} -\ProvidesExplPackage - {xeCJKfntef} - {\ExplFileDate}{3.3.4}{\ExplFileDescription} +\ProvidesExplPackage{xeCJKfntef} + {\ExplFileDate}{3.4.0}{\ExplFileDescription} \PassOptionsToPackage { normalem } { ulem } \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { ulem } } \ProcessOptions \scan_stop: @@ -1014,37 +1011,38 @@ \skip_new:N \c__xeCJK_filll_skip \skip_set:Nn \c__xeCJK_filll_skip { \c_zero_dim plus 1 filll } %% -%% This package consists of the file xeCJK.dtx, -%% full-stop.map, -%% fullwidth-stop.map, -%% han-simp.map, -%% han-trad.map, -%% and the derived files xeCJK.pdf, -%% xeCJK.sty, -%% xeCJK.cfg, -%% xeCJK.ins, -%% xeCJKfntef.sty, -%% xeCJK-listings.sty, -%% xunicode-addon.sty, -%% xunicode-extra.def, -%% xeCJK-example-autofake.tex, -%% xeCJK-example-fallback.tex, -%% xeCJK-example-subCJKblock.tex, -%% xeCJK-example-CJKecglue.tex, -%% xeCJK-example-checksingle.tex, -%% xeCJK-example-CJKfntef.tex, -%% xeCJK-example-punctstyle.tex, -%% xeCJK-example-verbatim.tex, -%% xeCJK-example-CM.tex, -%% xeCJK-example-listings.tex, -%% xunicode-symbols.tex, -%% xunicode-commands.tex, -%% xunicode-combine-marks.tex, -%% xunicode-symbols.pdf, -%% full-stop.tec, -%% fullwidth-stop.tec, -%% han-simp.tec, -%% han-trad.tec, and -%% README.txt. +%% This package consists of the files xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.cfg, +%% xeCJK.ins, +%% xeCJKfntef.sty, +%% xeCJK-listings.sty, +%% xunicode-addon.sty, +%% xunicode-extra.def, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex, +%% xeCJK-example-CJKfntef.tex, +%% xeCJK-example-punctstyle.tex, +%% xeCJK-example-verbatim.tex, +%% xeCJK-example-CM.tex, +%% xeCJK-example-listings.tex, +%% xeCJK-example-mathblock.tex, +%% xunicode-symbols.tex, +%% xunicode-commands.tex, +%% xunicode-combine-marks.tex, +%% xunicode-symbols.pdf, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and +%% README.md. %% %% End of file `xeCJKfntef.sty'. diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty index be3750f1aca..0c979a61813 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty @@ -6,36 +6,33 @@ %% %% xeCJK.dtx (with options: `xunicode') %% -%% ----------------------------------------------------------------- -%% Author: -%% Wenchang Sun <sunwch@nankai.edu.cn> -%% Current Maintainers: -%% Leo Liu <leoliu.pku@gmail.com> -%% Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> +%% Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> +%% Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> +%% ---------------------------------------------------------------------- %% -%% Copyright (C) 2007--2010 Wenchang Sun -%% (C) 2009--2016 Leo Liu -%% (C) 2012--2016 Qing Lee +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% This work has the LPPL maintenance status `maintained'. %% -%% This work has the LPPL maintenance status "maintained". -%% The Current Maintainer of this work are Leo Liu and Qing Lee. -%% ----------------------------------------------------------------- +%% The Current Maintainers of this work are Leo Liu and Qing Lee. +%% +%% ---------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 8518191 2016-02-10 16:25:31 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 463fb57 2016-05-14 12:24:41 +0800 Qing Lee <sobenlee@gmail.com> $ {addon file for xunicode} -\ProvidesExplPackage - {xunicode-addon} - {\ExplFileDate}{3.3.4}{\ExplFileDescription} +\ProvidesExplPackage{xunicode-addon} + {\ExplFileDate}{3.4.0}{\ExplFileDescription} \bool_if:nF { \sys_if_engine_xetex_p: || @@ -598,37 +595,38 @@ { #2 {#3} } } %% -%% This package consists of the file xeCJK.dtx, -%% full-stop.map, -%% fullwidth-stop.map, -%% han-simp.map, -%% han-trad.map, -%% and the derived files xeCJK.pdf, -%% xeCJK.sty, -%% xeCJK.cfg, -%% xeCJK.ins, -%% xeCJKfntef.sty, -%% xeCJK-listings.sty, -%% xunicode-addon.sty, -%% xunicode-extra.def, -%% xeCJK-example-autofake.tex, -%% xeCJK-example-fallback.tex, -%% xeCJK-example-subCJKblock.tex, -%% xeCJK-example-CJKecglue.tex, -%% xeCJK-example-checksingle.tex, -%% xeCJK-example-CJKfntef.tex, -%% xeCJK-example-punctstyle.tex, -%% xeCJK-example-verbatim.tex, -%% xeCJK-example-CM.tex, -%% xeCJK-example-listings.tex, -%% xunicode-symbols.tex, -%% xunicode-commands.tex, -%% xunicode-combine-marks.tex, -%% xunicode-symbols.pdf, -%% full-stop.tec, -%% fullwidth-stop.tec, -%% han-simp.tec, -%% han-trad.tec, and -%% README.txt. +%% This package consists of the files xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.cfg, +%% xeCJK.ins, +%% xeCJKfntef.sty, +%% xeCJK-listings.sty, +%% xunicode-addon.sty, +%% xunicode-extra.def, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex, +%% xeCJK-example-CJKfntef.tex, +%% xeCJK-example-punctstyle.tex, +%% xeCJK-example-verbatim.tex, +%% xeCJK-example-CM.tex, +%% xeCJK-example-listings.tex, +%% xeCJK-example-mathblock.tex, +%% xunicode-symbols.tex, +%% xunicode-commands.tex, +%% xunicode-combine-marks.tex, +%% xunicode-symbols.pdf, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and +%% README.md. %% %% End of file `xunicode-addon.sty'. diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def index 767654b9d2b..1937f559f6f 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def +++ b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def @@ -6,35 +6,31 @@ %% %% xeCJK.dtx (with options: `xunextra') %% -%% ----------------------------------------------------------------- -%% Author: -%% Wenchang Sun <sunwch@nankai.edu.cn> -%% Current Maintainers: -%% Leo Liu <leoliu.pku@gmail.com> -%% Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> +%% Copyright (C) 2009--2016 by Leo Liu <leoliu.pku@gmail.com> +%% Copyright (C) 2012--2016 by Qing Lee <sobenlee@gmail.com> +%% ---------------------------------------------------------------------- %% -%% Copyright (C) 2007--2010 Wenchang Sun -%% (C) 2009--2016 Leo Liu -%% (C) 2012--2016 Qing Lee +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% This work has the LPPL maintenance status `maintained'. %% -%% This work has the LPPL maintenance status "maintained". -%% The Current Maintainer of this work are Leo Liu and Qing Lee. -%% ----------------------------------------------------------------- +%% The Current Maintainers of this work are Leo Liu and Qing Lee. %% -\GetIdInfo$Id: xeCJK.dtx 8518191 2016-02-10 16:25:31 +0800 Qing Lee <sobenlee@gmail.com> $ +%% ---------------------------------------------------------------------- +%% +\GetIdInfo$Id: xeCJK.dtx 463fb57 2016-05-14 12:24:41 +0800 Qing Lee <sobenlee@gmail.com> $ {extra definition for xunicode} -\ProvidesExplFile - {xunicode-extra.def} - {\ExplFileDate}{3.3.4}{\ExplFileDescription} -\ExplSyntaxOff +\ProvidesExplFile{xunicode-extra.def} + {\ExplFileDate}{3.4.0}{\ExplFileDescription} \DeclareUTFComposite\textsuperscript \DeclareUTFComposite\textsubscript \DeclareUTFEncodedAccent\textsbleftarrow{"20EE}{"20FF} @@ -1449,37 +1445,38 @@ \DeclareUTFSymbol\textneg{"00AC} \DeclareUTFSymbol\textcdot{"00B7} %% -%% This package consists of the file xeCJK.dtx, -%% full-stop.map, -%% fullwidth-stop.map, -%% han-simp.map, -%% han-trad.map, -%% and the derived files xeCJK.pdf, -%% xeCJK.sty, -%% xeCJK.cfg, -%% xeCJK.ins, -%% xeCJKfntef.sty, -%% xeCJK-listings.sty, -%% xunicode-addon.sty, -%% xunicode-extra.def, -%% xeCJK-example-autofake.tex, -%% xeCJK-example-fallback.tex, -%% xeCJK-example-subCJKblock.tex, -%% xeCJK-example-CJKecglue.tex, -%% xeCJK-example-checksingle.tex, -%% xeCJK-example-CJKfntef.tex, -%% xeCJK-example-punctstyle.tex, -%% xeCJK-example-verbatim.tex, -%% xeCJK-example-CM.tex, -%% xeCJK-example-listings.tex, -%% xunicode-symbols.tex, -%% xunicode-commands.tex, -%% xunicode-combine-marks.tex, -%% xunicode-symbols.pdf, -%% full-stop.tec, -%% fullwidth-stop.tec, -%% han-simp.tec, -%% han-trad.tec, and -%% README.txt. +%% This package consists of the files xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.cfg, +%% xeCJK.ins, +%% xeCJKfntef.sty, +%% xeCJK-listings.sty, +%% xunicode-addon.sty, +%% xunicode-extra.def, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex, +%% xeCJK-example-CJKfntef.tex, +%% xeCJK-example-punctstyle.tex, +%% xeCJK-example-verbatim.tex, +%% xeCJK-example-CM.tex, +%% xeCJK-example-listings.tex, +%% xeCJK-example-mathblock.tex, +%% xunicode-symbols.tex, +%% xunicode-commands.tex, +%% xunicode-combine-marks.tex, +%% xunicode-symbols.pdf, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and +%% README.md. %% %% End of file `xunicode-extra.def'. |