summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-05-14 22:03:09 +0000
committerKarl Berry <karl@freefriends.org>2016-05-14 22:03:09 +0000
commit1ffd29c330984928904e5f95a4033d334fba974b (patch)
treeda2c8a81497119292b01e00a76fb78727f65da93 /Master/texmf-dist/source
parent1bafd95e83267f9e55b47de90fa004d4db84971d (diff)
ctex (14may16)
git-svn-id: svn://tug.org/texlive/trunk@41120 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/ctex/ctex.dtx1461
-rw-r--r--Master/texmf-dist/source/latex/ctex/ctex.ins283
2 files changed, 1121 insertions, 623 deletions
diff --git a/Master/texmf-dist/source/latex/ctex/ctex.dtx b/Master/texmf-dist/source/latex/ctex/ctex.dtx
index 42507c1bb6a..cf14799e05d 100644
--- a/Master/texmf-dist/source/latex/ctex/ctex.dtx
+++ b/Master/texmf-dist/source/latex/ctex/ctex.dtx
@@ -26,95 +26,118 @@
\iffalse
%</internal>
%<*readme>
-ctex is a collection of macro packages and document classes
+ctex
+====
+
+`ctex` is a collection of macro packages and document classes
for LaTeX Chinese typesetting.
-This package is licensed in LPPL.
+Authors and Contributors
+------------------------
-The authors and contributors of this package are:
+* Wu Lingyun <aloft@ctex.org>
+* Jiang Jiang <gzjjgod@gmail.com>
+* Wang Yue <yuleopen@gmail.com>
+* Liu Haiyang <leoliu.pku@gmail.com>
+* Li Yanrui <liyanrui.m2@gmail.com>
+* Chen Zhichu <zhichu.chen@gmail.com>
+* Li Qing <sobenlee@gmail.com>
+* Liam Huang <liamhuang0205@gmail.com>
- * Wu Lingyun <aloft@ctex.org>
- * Jiang Jiang <gzjjgod@gmail.com>
- * Wang Yue <yuleopen@gmail.com>
- * Liu Haiyang <leoliu.pku@gmail.com>
- * Li Yanrui <liyanrui.m2@gmail.com>
- * Chen Zhichu <zhichu.chen@gmail.com>
- * Li Qing <sobenlee@gmail.com>
- * Liam Huang <liamhuang0205@gmail.com>
+Contributing
+------------
-If you are interested in the process of development you
-may observe
+This package is a part of the [ctex-kit](https://github.com/CTeX-org/ctex-kit) project.
- https://github.com/CTeX-org/ctex-kit
+Issues and pull requests are welcome.
-Report feedback in the Issues section of ctex-kit project,
-or in [ctex](http://bbs.ctex.org) forum.
+Copyright and Licence
+---------------------
-This package consists of the file ctex.dtx, and the derived files
+ Copyright (C) 2003--2016
+ CTEX.ORG and any individual authors listed elsewhere in this file.
+ ----------------------------------------------------------------------
- ctex.pdf,
- ctex.ins,
- ctex.sty,
- ctexsize.sty,
- ctexheading.sty,
- ctexart.cls,
- ctexbook.cls,
- ctexrep.cls,
- ctexbeamer.cls,
- ctexcap.sty,
- ctexhook.sty,
- ctexpatch.sty,
- ctex-c5size.clo,
- ctex-cs4size.clo,
- ctex-article.def,
- ctex-book.def,
- ctex-report.def,
- ctex-beamer.def,
- ctex-scheme-plain.def,
- ctex-scheme-plain-article.def,
- ctex-scheme-plain-book.def,
- ctex-scheme-plain-report.def,
- ctex-scheme-plain-beamer.def,
- ctex-scheme-chinese.def,
- ctex-scheme-chinese-article.def,
- ctex-scheme-chinese-book.def,
- ctex-scheme-chinese-report.def,
- ctex-scheme-chinese-beamer.def,
- ctex-name-gbk.cfg,
- ctex-name-utf8.cfg,
- ctex.cfg,
- ctexopts.cfg,
- ctex-engine-pdftex.def,
- ctex-engine-xetex.def,
- ctex-engine-luatex.def,
- ctex-engine-uptex.def,
- c19rm.fd,
- c19sf.fd,
- c19tt.fd,
- c70rm.fd,
- c70sf.fd,
- c70tt.fd,
- ctex-fontset-windows.def,
- ctex-fontset-windowsnew.def,
- ctex-fontset-windowsold.def,
- ctex-fontset-adobe.def,
- ctex-fontset-fandol.def,
- ctex-fontset-mac.def,
- ctex-fontset-founder.def,
- ctex-fontset-ubuntu.def,
- ctexspa.def,
- ctexpunct.spa,
- ctexmakespa.tex,
- ctexspamacro.tex,
- zhadobefonts.tex,
- zhfandolfonts.tex,
- zhfounderfonts.tex,
- zhubuntufonts.tex,
- zhwindowsfonts.tex,
- translator-theorem-dictionary-ChineseGBK.dict,
- translator-theorem-dictionary-ChineseUTF8.dict, and
- README (this file).
+ 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, Qing Lee and Liam Huang.
+
+ This package consists of the file ctex.dtx,
+ and the derived files ctex.pdf,
+ ctex.ins,
+ ctex.sty,
+ ctexsize.sty,
+ ctexheading.sty,
+ ctexart.cls,
+ ctexbook.cls,
+ ctexrep.cls,
+ ctexbeamer.cls,
+ ctxdoc.cls,
+ ctexcap.sty,
+ ctexhook.sty,
+ ctexpatch.sty,
+ ctex-c5size.clo,
+ ctex-cs4size.clo,
+ ctex-article.def,
+ ctex-book.def,
+ ctex-report.def,
+ ctex-beamer.def,
+ ctex-scheme-plain.def,
+ ctex-scheme-plain-article.def,
+ ctex-scheme-plain-book.def,
+ ctex-scheme-plain-report.def,
+ ctex-scheme-plain-beamer.def,
+ ctex-scheme-chinese.def,
+ ctex-scheme-chinese-article.def,
+ ctex-scheme-chinese-book.def,
+ ctex-scheme-chinese-report.def,
+ ctex-scheme-chinese-beamer.def,
+ ctex-name-gbk.cfg,
+ ctex-name-utf8.cfg,
+ ctex.cfg,
+ ctexopts.cfg,
+ ctex-engine-pdftex.def,
+ ctex-engine-xetex.def,
+ ctex-engine-luatex.def,
+ ctex-engine-aptex.def,
+ ctex-engine-uptex.def,
+ c19rm.fd,
+ c19sf.fd,
+ c19tt.fd,
+ c70rm.fd,
+ c70sf.fd,
+ c70tt.fd,
+ ctex-fontset-windows.def,
+ ctex-fontset-windowsnew.def,
+ ctex-fontset-windowsold.def,
+ ctex-fontset-adobe.def,
+ ctex-fontset-fandol.def,
+ ctex-fontset-mac.def,
+ ctex-fontset-founder.def,
+ ctex-fontset-ubuntu.def,
+ ctexspa.def,
+ ctexpunct.spa,
+ ctexmakespa.tex,
+ ctexspamacro.tex,
+ ctxdocstrip.tex,
+ zhadobefonts.tex,
+ zhfandolfonts.tex,
+ zhfounderfonts.tex,
+ zhubuntufonts.tex,
+ zhwindowsfonts.tex,
+ translator-theorem-dictionary-ChineseGBK.dict,
+ translator-theorem-dictionary-ChineseUTF8.dict, and
+ README.md (this file).
%</readme>
%<*internal>
\fi
@@ -125,50 +148,7 @@ This package consists of the file ctex.dtx, and the derived files
%</internal>
%<*install>
-\newread\inputcheck
-\openin\inputcheck=ctex.ver
-\ifeof\inputcheck
- \def\ctexPutVersion{\string\GetIdInfo$Id$}
-\else
- \input ctex.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
@@ -193,7 +173,6 @@ This package consists of the file ctex.dtx, and the derived files
------------------------------------------------------------------------------
\endpreamble
-
\postamble
This package consists of the file ctex.dtx,
@@ -206,6 +185,7 @@ This package consists of the file ctex.dtx, and the derived files
ctexbook.cls,
ctexrep.cls,
ctexbeamer.cls,
+ ctxdoc.cls,
ctexcap.sty,
ctexhook.sty,
ctexpatch.sty,
@@ -232,6 +212,7 @@ This package consists of the file ctex.dtx, and the derived files
ctex-engine-pdftex.def,
ctex-engine-xetex.def,
ctex-engine-luatex.def,
+ ctex-engine-aptex.def,
ctex-engine-uptex.def,
c19rm.fd,
c19sf.fd,
@@ -251,6 +232,7 @@ This package consists of the file ctex.dtx, and the derived files
ctexpunct.spa,
ctexmakespa.tex,
ctexspamacro.tex,
+ ctxdocstrip.tex,
zhadobefonts.tex,
zhfandolfonts.tex,
zhfounderfonts.tex,
@@ -258,13 +240,9 @@ This package consists of the file ctex.dtx, and the derived files
zhwindowsfonts.tex,
translator-theorem-dictionary-ChineseGBK.dict,
translator-theorem-dictionary-ChineseUTF8.dict, and
- README.
+ README.md.
\endpostamble
-\declarepostamble\emptypostamble
-\endpostamble
-
-
\generate
{
\usedir{tex/latex/ctex}
@@ -276,6 +254,7 @@ This package consists of the file ctex.dtx, and the derived files
\file{ctexrep.cls} {\from{\jobname.dtx}{class,report}}
\file{ctexbeamer.cls} {\from{\jobname.dtx}{class,beamer}}
\usepostamble\emptypostamble
+ \file{ctxdoc.cls} {\from{\jobname.dtx}{ctxdoc}}
\file{ctexcap.sty} {\from{\jobname.dtx}{ctexcap}}
\file{ctexhook.sty} {\from{\jobname.dtx}{ctexhook}}
\file{ctexpatch.sty} {\from{\jobname.dtx}{ctexpatch}}
@@ -302,6 +281,7 @@ This package consists of the file ctex.dtx, and the derived files
\file{ctex-engine-pdftex.def} {\from{\jobname.dtx}{pdftex}}
\file{ctex-engine-xetex.def} {\from{\jobname.dtx}{xetex}}
\file{ctex-engine-luatex.def} {\from{\jobname.dtx}{luatex}}
+ \file{ctex-engine-aptex.def} {\from{\jobname.dtx}{aptex}}
\file{ctex-engine-uptex.def} {\from{\jobname.dtx}{uptex}}
\file{c19rm.fd} {\from{\jobname.dtx}{rm,c19}}
\file{c19sf.fd} {\from{\jobname.dtx}{sf,c19}}
@@ -317,11 +297,16 @@ This package consists of the file ctex.dtx, and the derived files
\file{ctex-fontset-mac.def} {\from{\jobname.dtx}{fontset,mac}}
\file{ctex-fontset-founder.def} {\from{\jobname.dtx}{fontset,founder}}
\file{ctex-fontset-ubuntu.def} {\from{\jobname.dtx}{fontset,ubuntu}}
+ \file{translator-theorem-dictionary-ChineseGBK.dict}
+ {\from{\jobname.dtx}{dict,theorem,GBK}}
+ \file{translator-theorem-dictionary-ChineseUTF8.dict}
+ {\from{\jobname.dtx}{dict,theorem,UTF8}}
\file{ctexspa.def}
{
\from{\jobname.dtx} {ctexspa}
\from{ctexpunct.spa} {}
}
+ \usedir{tex/generic/ctex}
\file{ctexmakespa.tex} {\from{\jobname.dtx}{spa,make}}
\file{ctexspamacro.tex} {\from{\jobname.dtx}{spa,macro}}
\file{zhadobefonts.tex} {\from{\jobname.dtx}{zhmap,adobe}}
@@ -329,15 +314,16 @@ This package consists of the file ctex.dtx, and the derived files
\file{zhfounderfonts.tex} {\from{\jobname.dtx}{zhmap,founder}}
\file{zhubuntufonts.tex} {\from{\jobname.dtx}{zhmap,ubuntu}}
\file{zhwindowsfonts.tex} {\from{\jobname.dtx}{zhmap,windows}}
- \file{translator-theorem-dictionary-ChineseGBK.dict}
- {\from{\jobname.dtx}{dict,theorem,GBK}}
- \file{translator-theorem-dictionary-ChineseUTF8.dict}
- {\from{\jobname.dtx}{dict,theorem,UTF8}}
+ \file{ctxdocstrip.tex} {\from{\jobname.dtx}{docstrip}}
+%</install>
+%<*internal>
\usedir{source/latex/ctex}
\file{\jobname.ins} {\from{\jobname.dtx}{install}}
+%</internal>
+%<*install>
\nopreamble\nopostamble
\usedir{doc/latex/ctex}
- \file{README.txt} {\from{\jobname.dtx}{readme}}
+ \file{README.md} {\from{\jobname.dtx}{readme}}
}
\catcode32=12\space
@@ -356,6 +342,7 @@ This package consists of the file ctex.dtx, and the derived files
\Msg{* ctexbook.cls *}
\Msg{* ctexrep.cls *}
\Msg{* ctexbeamer.cls *}
+\Msg{* ctxdoc.cls *}
\Msg{* ctexcap.sty *}
\Msg{* ctexhook.sty *}
\Msg{* ctexpatch.sty *}
@@ -382,6 +369,7 @@ This package consists of the file ctex.dtx, and the derived files
\Msg{* ctex-engine-pdftex.def *}
\Msg{* ctex-engine-xetex.def *}
\Msg{* ctex-engine-luatex.def *}
+\Msg{* ctex-engine-aptex.def *}
\Msg{* ctex-engine-uptex.def *}
\Msg{* c19rm.fd *}
\Msg{* c19sf.fd *}
@@ -400,6 +388,7 @@ This package consists of the file ctex.dtx, and the derived files
\Msg{* ctexspa.def *}
\Msg{* ctexmakespa.tex *}
\Msg{* ctexspamacro.tex *}
+\Msg{* ctxdocstrip.tex *}
\Msg{* zhadobefonts.tex *}
\Msg{* zhfandolfonts.tex *}
\Msg{* zhfounderfonts.tex *}
@@ -420,20 +409,13 @@ This package consists of the file ctex.dtx, and the derived files
%<*internal>
\fi
%</internal>
-%<*!(readme|install|zhmap|spa)>
+%<*!(driver|readme|install|zhmap|spa|docstrip)>
%<*!(c19|c70|ctexspa|dict)>
-%<*driver|class|style|ctexcap|ctexhook|ctexpatch>
-\NeedsTeXFormat{LaTeX2e}
-\RequirePackage{expl3}
-%</driver|class|style|ctexcap|ctexhook|ctexpatch>
-%<.!(readme|install|zhmap|spa|c19|c70|ctexspa)>\ctexPutVersion
-%<*driver>
-\InputIfFileExists{ctex.ver}{}{
- \def\ctexGetVersionInfo{\GetIdInfo$Id$}}
-\ctexGetVersionInfo
- {ctex source file}
-\ProvidesExplFile{\ExplFileName.\ExplFileExtension}
-%</driver>
+%<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\NeedsTeXFormat{LaTeX2e}
+%<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\RequirePackage{expl3}
+%<+!driver>\GetIdInfo$Id$
+%<ctxdoc> {ctex documentation (CTEX)}
+%<ctxdoc>\ProvidesExplClass{ctxdoc}
%<ctex> {Chinese adapter in LaTeX (CTEX)}
%<ctex>\ProvidesExplPackage{\ExplFileName}
%<ctexsize> {Chinese font size definition (CTEX)}
@@ -500,6 +482,8 @@ This package consists of the file ctex.dtx, and the derived files
%<xetex>\ProvidesExplFile{ctex-engine-xetex.def}
%<luatex> {LuaLaTeX adapter (CTEX)}
%<luatex>\ProvidesExplFile{ctex-engine-luatex.def}
+%<aptex> {Asian pTeX adapter (CTEX)}
+%<aptex>\ProvidesExplFile{ctex-engine-aptex.def}
%<uptex> {upTeX adapter (CTEX)}
%<uptex>\ProvidesExplFile{ctex-engine-uptex.def}
%<windows> {Windows fonts definition (CTEX)}
@@ -518,294 +502,26 @@ This package consists of the file ctex.dtx, and the derived files
%<founder>\ProvidesExplFile{ctex-fontset-founder.def}
%<ubuntu> {Ubuntu fonts definition (CTEX)}
%<ubuntu>\ProvidesExplFile{ctex-fontset-ubuntu.def}
- {\ExplFileDate}{2.4}{\ExplFileDescription}
+%<!driver> {\ExplFileDate}{2.4.1}{\ExplFileDescription}
%</!(c19|c70|ctexspa|dict)>
-%<rm&c19>\ProvidesFile{c19rm.fd}%
-%<sf&c19>\ProvidesFile{c19sf.fd}%
-%<tt&c19>\ProvidesFile{c19tt.fd}%
-%<rm&c70>\ProvidesFile{c70rm.fd}%
-%<sf&c70>\ProvidesFile{c70sf.fd}%
-%<tt&c70>\ProvidesFile{c70tt.fd}%
+%<c19&rm>\ProvidesFile{c19rm.fd}%
+%<c19&sf>\ProvidesFile{c19sf.fd}%
+%<c19&tt>\ProvidesFile{c19tt.fd}%
+%<c70&rm>\ProvidesFile{c70rm.fd}%
+%<c70&sf>\ProvidesFile{c70sf.fd}%
+%<c70&tt>\ProvidesFile{c70tt.fd}%
%<ctexspa>\ProvidesFile{ctexspa.def}%
%<dict&theorem&GBK>\ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}%
%<dict&theorem&UTF8>\ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}%
%<c19|c70> [2016/04/23 v2.4 Chinese font definition (CTEX)]
%<ctexspa> [2016/04/23 v2.4 Space info for CJKpunct (CTEX)]
%<dict&theorem> [2016/02/20 v1.0 Chinese translation for theorem name (CTEX)]
-%</!(readme|install|zhmap|spa)>
+%</!(driver|readme|install|zhmap|spa|docstrip)>
%<*driver>
-\ExplSyntaxOff
-\let\ctexrevnum\ExplFileVersion
-\expandafter\let\csname ver@thumbpdf.sty\endcsname\fmtversion
-\documentclass[a4paper,full,numbered]{l3doc}
-\usepackage[UTF8, punct = kaiming, heading,
- linespread = 1.2, sub3section]{ctex}
-\ctexset{
- abstractname = 简介,
- indexname = 代码索引,
- section = {
- format = \Large\bfseries\raggedright,
- name = {第,节},
- },
-}
-\usepackage[toc]{multitoc}
-\usepackage{geometry}
-\usepackage{tabularx}
-\usepackage{siunitx}
-\usepackage{unicode-math}
-\geometry{includemp,hmargin={0mm,15mm},vmargin={25mm,15mm},footskip=7mm}
-\hypersetup{pdfstartview=FitH,bookmarksdepth=subparagraph}
-\setcounter{secnumdepth}{4}
-\setcounter{tocdepth}{2}
-\newcommand*\email{\nolinkurl}
-\setmainfont{TeX Gyre Pagella}
-\setsansfont{TeX Gyre Heros}
-\setmonofont[
- UprightFont=* Light, BoldFont=* Bold,
- SlantedFont=* Light Oblique]{CMU Typewriter Text}
-\setmathfont{texgyrepagella-math.otf}
-\usepackage{xcolor}
-\usepackage{caption}
-\captionsetup{strut=off, labelsep=quad, labelfont+=bf}
-\makeatletter
-%% <--- http://tex.stackexchange.com/a/40896
-\patchcmd{\@addtocurcol}%
- {\vskip \intextsep}%
- {\edef\save@first@penalty{\the\lastpenalty}\unpenalty
- \ifnum \lastpenalty = \@M % hopefully the OR penalty
- \unpenalty
- \else
- \penalty \save@first@penalty \relax % put it back
- \fi
- \ifnum\outputpenalty <-\@Mii
- \addvspace\intextsep
- \vskip\parskip
- \else
- \addvspace\intextsep
- \fi}%
- {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
-\patchcmd{\@addtocurcol}%
- {\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}%
- {\ifnum\outputpenalty <-\@Mii
- \aftergroup\vskip\aftergroup\intextsep
- \aftergroup\nointerlineskip
- \else
- \vskip\intextsep
- \fi}%
- {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
-\patchcmd{\@getpen}{\@M}{\@Mi}
- {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
-%% --->
-%% 不对代码实现的 \section 以下标题编目录。
-\AtBeginEnvironment{implementation}{%
- \ifnum\value{tocdepth}>\@ne
- \addtocontents{toc}{\protect\value{tocdepth}=1\relax}%
- \fi}
-\ifxetex
- \let\ctexdocverbaddon\xeCJKVerbAddon
- \def\ctexdisableecglue{\xeCJKsetup{CJKecglue}}
- \appto\meta@font@select{\ifinner\ctexdisableecglue\fi}
-\else
- \let\ctexdocverbaddon\relax
- \def\ctexdisableecglue{\ltjsetparameter{autoxspacing=false}}
- \appto\meta@font@select{\ctexdisableecglue}
-\fi
-\setlist{noitemsep,topsep=\smallskipamount}
-\setlist[1]{labelindent=\parindent}
-\setlist[enumerate]{leftmargin=*}
-\setlist[itemize]{leftmargin=*}
-\newlist{optdesc}{description}{3}
-%% 设置间距为 \marginparsep,与 l3doc 一致
-\setlist[optdesc]{%
- font=\mdseries\small\ttfamily,align=right,listparindent=\parindent,
- labelsep=\marginparsep,labelindent=-\marginparsep,leftmargin=*}
-\fvset{
- fontsize=\small,baselinestretch=1,numbersep=5pt,
- formatcom=\ctexdocverbaddon,
- listparameters=\setlength\topsep{\MacrocodeTopsep}}
-\DefineVerbatimEnvironment{frameverb}{Verbatim}{%
- gobble=4,
- frame=single,framesep=8pt,
- listparameters=
- \setlength\topsep{\medskipamount}%
- \appto\FV@EndList{\nointerlineskip}}
-\DefineVerbatimEnvironment{ctexexam}{Verbatim}{%
- gobble=4,
- frame=single,framesep=10pt,
- label=\rule{0pt}{12pt}\textnormal{\bfseries 例 \arabic{ctexexam}},
- listparameters=
- \setlength\topsep{\bigskipamount}%
- \refstepcounter{ctexexam}\ctexexamlabelref
- \appto\FV@EndList{\nointerlineskip}}
-\define@key{FV}{labelref}{\def\ctexexamlabelref{\label{#1}}}
-\let\ctexexamlabelref\empty
-\newcounter{ctexexam}
-\BeforeBeginEnvironment{function}{\par\nointerlineskip}
-\AtEndEnvironment{function}{%
- \par\xdef\ctexfixprevdepth{\prevdepth=\the\prevdepth\space}%
- \ctexfixdescrcoffinyoffset}
-%% l3doc 会在 function 环境的 syntax 和 descr 盒子中间加上 \medskipamount 的距离。
-%% 但是若 syntax 盒子为空(未使用 syntax 环境),就会显得不好看。
-%% 此时我们通过将 \medskipamount 设置为零来修正。
-\def\ctexfixdescrcoffinyoffset{%
- \aftergroup\aftergroup\aftergroup\ctexzeromedskipamount}
-\def\ctexzeromedskipamount{\setlength\medskipamount{\z@skip}}
-\AfterEndEnvironment{syntax}{\let\ctexfixdescrcoffinyoffset\relax}
-\AfterEndEnvironment{function}{\ctexfixprevdepth}
-\AtBeginEnvironment{syntax}{\linespread{1}\ctexdisableecglue}
-\preto\MacroFont{\linespread{1}}
-\appto\MacroFont{\hyphenchar\font\m@ne\ctexdocverbaddon}
-\preto\AltMacroFont{\linespread{1}}
-\appto\AltMacroFont{\hyphenchar\font\m@ne\ctexdocverbaddon}
-\def\Module#1{\mbox{%
- \color{purple}\footnotesize\normalfont\sffamily\textlangle#1\textrangle}}
-\newcommand*\exptarget{\Hy@raisedlink{\hypertarget{expstar}{}}}
-\newcommand*\rexptarget{\Hy@raisedlink{\hypertarget{rexpstar}{}}}
-\newcommand*\expstar{\hyperlink{expstar}{$\star$}}
-\newcommand*\rexpstar{\hyperlink{rexpstar}{\ding{73}}}
-\ExplSyntaxOn
-%% l3doc 会设置列表环境中 \listparindent=\z@,我们在这里恢复它。
-\cs_set_eq:NN \list \__codedoc_oldlist:nn
-\cs_new_nopar:Npn \zihaopt #1
- {
- \exp_last_unbraced:Nf \tl_head:w
- { \prop_item:Nn \c__ctex_font_size_prop {#1} } { } \q_stop
- }
-%% 用 \vtop 让函数名字和语法盒子首行对齐
-\patchcmd \__codedoc_syntax:w
- { { minipage } { \l__codedoc_syntax_dim } }
- { { minipage } [t] { \l__codedoc_syntax_dim } }
- { \iow_term:n { *** ~ SUCCESS ~ *** } }
- { \iow_term:n { *** ~ FAIL ~ *** } }
-%% 左侧边注的函数列表采用单倍行距
-\cs_set_protected_nopar:Npx \__codedoc_typeset_names:
- {
- \exp_not:N \linespread { 1 }
- \exp_not:o { \__codedoc_typeset_names: }
- }
-\patchcmd \__codedoc_macro_typeset_one:n
- { \vbox_unpack_clear:N }
- { \linespread { 1 } \selectfont \vbox_unpack_clear:N }
- { \iow_term:n { *** ~ SUCCESS ~ *** } }
- { \iow_term:n { *** ~ FAIL ~ *** } }
-%% 不重复使用 \HD@target,避免索引出现重复页码
-\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 }
- { \textbackslash \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_catcode_active:N \|
- \char_set_active_eq:NN \| \orbar
- \char_set_catcode_active:N \(
- \char_set_active_eq:NN \( \defaultvalaux
- }
-%% 不对目录中出现的 \cs 和 \tn 等编索引
-\DeclareDocumentCommand \StopSpecialIndexModule { }
- { \cs_set_eq:NN \__codedoc_special_index_module:nnnn \use_none:nnnn }
-\tl_map_inline:nn { \actualchar \encapchar \levelchar }
- { \exp_args:Nx \DoNotIndex { \bslash \tl_to_str:N #1 } }
-\ExplSyntaxOff
-\AtBeginDocument{\addtocontents{toc}{\StopSpecialIndexModule}}
-\pdfstringdefDisableCommands{%
- \let\cs\bookmarkcstn
- \let\tn\bookmarkcstn
- \let\meta\bookmarkmeta
- \let\opt\@firstofone}
-\preto\@thehead{\cslet{MakeUppercase\space}{\@iden}}
-\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}}
-\protected\def\opt{\texttt}
-\def\pdfTeX{\hologo{pdfTeX}}
-\def\XeTeX{\hologo{XeTeX}}
-\def\XeLaTeX{\hologo{XeLaTeX}}
-\def\LuaLaTeX{\hologo{LuaLaTeX}}
-\def\pdfLaTeX{\hologo{pdfLaTeX}}
-\def\LaTeX{\hologo{LaTeX}}
-\def\LaTeXe{\hologo{LaTeX2e}}
-\def\LaTeXiii{\hologo{LaTeX3}}
-\def\dvipdfmx{DVIPDFM\textit{x}}
-\def\upTeX{up\TeX}
-\def\upLaTeX{up\LaTeX}
-\def\ctexkitrev#1{%
- \href{https://github.com/CTeX-org/ctex-kit/commit/#1}{\texttt{ctex-kit} rev. #1}}
-\patchcmd\theCodelineNo{\sffamily\tiny}{\normalfont\sffamily\tiny}{}{}
-\appto\GlossaryParms{%
- \def\@idxitem{\par\hangindent 2em }%
- \def\subitem{\@idxitem\hspace*{1em}}%
- \def\subsubitem{\@idxitem\hspace*{2em}}}
-\patchcmd\l@section{2.5em}{1.5em}{}{}
-\patchcmd\l@subsection{2.5em}{1.5em}{}{}
-\patchcmd\changes@{\space}{\lbrack}{}{}
-\patchcmd\@wrglossary{hdpindex}{%
- \ifnum\c@HD@hypercount=\z@
- hdpindex%
- \else
- hdclindex{\the\c@HD@hypercount}\fi}{}{}
-\newenvironment{defaultcapconfig}{%
- \MakePercentComment
- \input{ctex-name-utf8.cfg}%
- \ExplSyntaxOff
- \MakePercentIgnore}{}
-\newcommand*\BSTACK{\begin{tabular}[t]{@{}l@{}}}
-\newcommand*\ESTACK{\end{tabular}}
-\makeatother
-\EnableCrossrefs
-\CodelineIndex
-\RecordChanges
-\def\glossaryname{版本历史}
-\GlossaryPrologue{\section{\glossaryname}}
-\IndexPrologue{%
- \section{\indexname}
- \textit{意大利体的数字表示描述对应索引项的页码;
- 带下划线的数字表示定义对应索引项的代码行号;
- 罗马字体的数字表示使用对应索引项的代码行号。}}
-\setlength\IndexMin{.4\textheight}
-\usepackage{makecell}
-\newcommand{\bashcmd}{\texttt}
-\newcommand{\TeXLive}{\TeX\ Live}
-\newcommand{\MiKTeX}{\hologo{MiKTeX}}
-\usepackage{threeparttable}
+\documentclass{ctxdoc}
\begin{document}
\DocInput{\jobname.dtx}
- \newgeometry{hmargin=15mm,vmargin={25mm,15mm},footskip=7mm}
- \ctexset{section/numbering=false}
+ \IndexLayout
\PrintChanges
\PrintIndex
\end{document}
@@ -821,7 +537,7 @@ This package consists of the file ctex.dtx, and the derived files
% \changes{v2.4}{2015/02/19}{加强 \pkg{beamer} 宏包支持。}
%
%
-% \CheckSum{5506}
+% \CheckSum{5581}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -839,11 +555,11 @@ This package consists of the file ctex.dtx, and the derived files
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-% \GetFileInfo{\jobname.dtx}%
+% \GetFileId{ctex.sty}%
%
% \title{\bfseries \CTeX{} 宏集手册}
% \author{\href{http://www.ctex.org}{ctex.org}}
-% \date{\filedate\qquad\fileversion\thanks{\ctexkitrev{\ctexrevnum}.}}
+% \date{\filedate\qquad\fileversion\thanks{\ctexkitrev{\ExplFileVersion}.}}
% \maketitle
%
% \begin{abstract}
@@ -1116,19 +832,15 @@ This package consists of the file ctex.dtx, and the derived files
% \begin{threeparttable}
% \caption{\CTeX{} 宏集的中文支持方式}
% \label{tab:chinese-support}
-% \begin{tabular}{ll}
+% \begin{tabular}{*6c}
% \toprule
-% 编译方式 & 支持宏包 \\
+% 编译方式 & (pdf)\LaTeX & \XeLaTeX & \LuaLaTeX & \upLaTeX\tnote{*} \\
% \midrule
-% (pdf)\LaTeX & \pkg{CJK} \\
-% \XeLaTeX & \pkg{xeCJK} \\
-% \LuaLaTeX & \pkg{LuaTeX-ja} \\
-% \upLaTeX\tnote{*} & 原生 \\
+% 支持宏包 & \pkg{CJK} & \pkg{xeCJK} & \pkg{LuaTeX-ja} & 原生 \\
% \bottomrule
% \end{tabular}
-% \smallskip
% \begin{tablenotes}
-% \item[*] p\LaTeX-ng(或称 Ap\LaTeX)与 \upLaTeX{} 兼容。使用 p\LaTeX-ng 编译
+% \item[*] p\LaTeX-ng(或称 \ApLaTeX)与 \upLaTeX{} 兼容。使用 p\LaTeX-ng 编译
% 时,\pkg{ctex} 采用与 \upLaTeX{} 相同的设置。
% \end{tablenotes}
% \end{threeparttable}
@@ -1202,8 +914,7 @@ This package consists of the file ctex.dtx, and the derived files
% \makecell{\pkg{zhmetrics-uptex}\\Fandol 字库} \\
% \bottomrule
% \end{tabular}
-% \smallskip
-% \begin{tablenotes}\footnotesize
+% \begin{tablenotes}
% \item [1] Windows Vista 及以后的 Windows 操作系统。
% \item [2] Windows XP 及以前的 Windows 操作系统。
% \item [3] 由马起园、苏杰、黄晨成等人开发的开源中文字体,
@@ -1329,7 +1040,9 @@ This package consists of the file ctex.dtx, and the derived files
% 本选项可以用于四个 \CTeX{} 文档类和 \pkg{ctex} 宏包,
% 也可以用于 \pkg{ctexsize} 宏包。
%
-% \opt{scheme = chinese} 时,默认值为 |5|,即设置 \tn{normalsize} 为五号字。
+% \opt{scheme = chinese} 时,对标准文档类默认值为 |5|,即设置
+% \tn{normalsize} 为五号字;对 \cls{beamer} 则为 |false|,使用文档类原有的设
+% 置。
% \end{function}
%
% \begin{table}[htbp]
@@ -1422,9 +1135,9 @@ This package consists of the file ctex.dtx, and the derived files
% 选择文章的排版方案,预设有 \opt{chinese} 和 \opt{plain} 两种方案。%
% \end{function}
% \begin{optdesc}[itemsep=\medskipamount]
-% \item[chinese] 调整默认字号为五号字,并调整行距为 |1.3|;
-% 汉化文档中的标题名字(如“图”、“表”、“目录”和“参考文献”等,
-% 见 \ref{subs:capname}~节);
+% \item[chinese] 对 \cls{beamer} 以外的文档类,调整默认字号为五号字,并调
+%` 整行距为 |1.3|;汉化文档中的标题名字(如“图”、“表”、“目录”和“参
+% 考文献”等,见 \ref{subs:capname}~节);
% 在 \opt{heading = true} 的情况下^^A
% \footnote{使用 \CTeX{} 文档类,或者使用 \pkg{ctex} 宏包且开启该选项时。}^^A
% (\ref{subs:options-heading}~节),还会将章节标题的风格修改为
@@ -1495,8 +1208,9 @@ This package consists of the file ctex.dtx, and the derived files
% 接受一个浮点数值,设置行距倍数。本选项的初始值与 \opt{scheme} 有关。
% \end{function}
% \begin{optdesc}
-% \item[scheme = chinese] 初始值为 $1.3$,即 $1.3$ 倍行距。此时,相邻两行的基线
-% (\tn{baselineskip})距离为 $1.3\times 1.2=1.56$ 倍字体高度。
+% \item[scheme = chinese] 对标准文档类初始值为 $1.3$,即 $1.3$ 倍行距。此
+% 时,相邻两行的基线(\tn{baselineskip})距离为 $1.3\times 1.2=1.56$ 倍字体
+% 高度。对 \cls{beamer} 不改变行距,即使用默认的单倍行距。
%
% \item[scheme = plain] \CTeX{} 宏集默认不调整行距倍数,文档中的行距由所选文档类和
% 其他宏包或用户设置决定。
@@ -1964,7 +1678,7 @@ This package consists of the file ctex.dtx, and the derived files
% \begin{ctexexam}
% \ctexset{
% chapter/format = \sffamily\raggedright,
-% section/format+ = \sffamily
+% section/format += \sffamily
% }
% \end{ctexexam}
%
@@ -2256,7 +1970,7 @@ This package consists of the file ctex.dtx, and the derived files
% \end{tabular}
% \end{table}
%
-% \begin{function}[EXP,updated=2015-06-27]{.../beforeskip}
+% \begin{function}[EXP,updated=2016-05-10]{.../beforeskip}
% \begin{syntax}
% beforeskip = \Arg{弹性间距}
% \end{syntax}
@@ -2287,6 +2001,15 @@ This package consists of the file ctex.dtx, and the derived files
% \end{tabular}
% \end{table}
%
+% \begin{function}[EXP,added=2016-05-10]{part/fixbeforeskip,chapter/fixbeforeskip}
+% \begin{syntax}
+% fixbeforeskip = \TFF
+% \end{syntax}
+% \cls{book} 和 \cls{report} 类的 \tn{part} 和 \tn{chapter} 标题与正文顶部的距离除了由
+% \opt{beforeskip} 选项设置的垂直间距外,还会有一个空行。
+% \opt{fixbeforeskip} 选项用于抑制这个多余空行。
+% \end{function}
+%
% \begin{function}[EXP,updated=2015-06-27]{.../afterskip}
% \begin{syntax}
% afterskip = \Arg{弹性间距}
@@ -2467,11 +2190,13 @@ This package consists of the file ctex.dtx, and the derived files
% \begin{ctexexam}[labelref=exam:miscopt]
% \ctexset {
% chapter = {
-% format = \Huge\bfseries,
-% nameformat = \hrule height 1bp \relax\bigskip\hfill\chapternamebox,
-% number = \arabic{chapter},
-% aftername = \par\medskip,
-% aftertitle = \bigskip\hrule height 2bp \relax
+% beforeskip = 0pt,
+% fixbeforeskip = true,
+% format = \Huge\bfseries,
+% nameformat = \rule{\linewidth}{1bp}\par\bigskip\hfill\chapternamebox,
+% number = \arabic{chapter},
+% aftername = \par\medskip,
+% aftertitle = \par\bigskip\nointerlineskip\rule{\linewidth}{2bp}\par
% }
% }
% \newcommand\chapternamebox[1]{%
@@ -2554,9 +2279,10 @@ This package consists of the file ctex.dtx, and the derived files
% \CTeX{} 宏集的中文数字转换功能实际上是调用 \pkg{zhnumber} 宏包来完成。下面只
% 介绍一些基本的用法,更高级的用法可以查阅 \pkg{zhnumber} 宏包的文档。
%
-% \begin{function}[updated=2014-03-08]{\chinese}
+% \begin{function}[updated=2016-05-01]{\chinese}
% \begin{syntax}
% \tn{chinese} \Arg{counter}
+% \tn{pagenumbering} \{chinese\}
% \end{syntax}
% \tn{chinese} 命令与 \tn{roman} 等命令的用法类似,作用在一个 \LaTeX{}
% 计数器上,将计数器的值以中文数字的形式输出。
@@ -3168,18 +2894,20 @@ This package consists of the file ctex.dtx, and the derived files
%</class>
% \end{macrocode}
%
-% \begin{variable}[int]{\c_@@_engine_file_str}
-% 引擎检查,暂不支持 \pTeX{} 系。
+% \begin{variable}[int]{\c_@@_engine_str,\c_@@_engine_file_str}
+% 引擎检查。目前 \LaTeXiii{} 将 \ApTeX{} 识别为 \upTeX。
% \begin{macrocode}
+\str_const:Nx \c_@@_engine_str
+ { \cs_if_exist:NTF \ngostype { aptex } { \c_sys_engine_str } }
\msg_new:nnnn { ctex } { engine-not-supported }
{ Engine~`#1'~is~not~yet~supported,~ctex~will~abort! }
- { You~can~switch~to~xelatex,~lualatex~or~pdflatex.}
-\file_if_exist:nTF { ctex-engine- \c_sys_engine_str .def }
+ { You~can~switch~to~xelatex,~lualatex,~pdflatex,~uplatex,~or~aplatex. }
+\file_if_exist:nTF { ctex-engine- \c_@@_engine_str .def }
{
\str_const:Nx \c_@@_engine_file_str
- { ctex-engine- \c_sys_engine_str .def }
+ { ctex-engine- \c_@@_engine_str .def }
}
- { \msg_critical:nnx { ctex } { engine-not-supported } { \c_sys_engine_str } }
+ { \msg_critical:nnx { ctex } { engine-not-supported } { \c_@@_engine_str } }
% \end{macrocode}
% \end{variable}
%
@@ -3414,7 +3142,8 @@ This package consists of the file ctex.dtx, and the derived files
% \end{macrocode}
%
% \begin{variable}[int]{\g_@@_font_size_flag}
-% |0| 表示修改默认字体大小为五号,|1| 为小四号,其它值则不作修改。
+% |0| 表示修改默认字体大小为五号,|1| 为小四号,大于 1 则不作修改。初始值 |-1|
+% 表示 \opt{zihao} 选项未初始化,会在将来根据文档类决定初值。
% \begin{macrocode}
%<*class|ctex|ctexsize>
\cs_new_eq:NN \g_@@_font_size_flag \c_minus_one
@@ -3438,10 +3167,11 @@ This package consists of the file ctex.dtx, and the derived files
% \changes{v2.0}{2015/05/06}{\opt{c5size}, \opt{cs4size} 是过时选项。}
%
% \begin{macro}{zihao}
+% \changes{v2.4.1}{2016/05/13}{不允许无参 \opt{zihao} 选项。}
% \begin{macrocode}
%<*class|ctex|ctexsize>
zihao .choice: ,
- zihao .default:n = { 5 } ,
+ zihao .value_required:n = true ,
zihao / 5 .code:n = { \cs_gset_eq:NN \g_@@_font_size_flag \c_zero } ,
zihao / -4 .code:n = { \cs_gset_eq:NN \g_@@_font_size_flag \c_one } ,
zihao / false .code:n = { \cs_gset_eq:NN \g_@@_font_size_flag \c_two } ,
@@ -3891,7 +3621,7 @@ This package consists of the file ctex.dtx, and the derived files
% 设置 \upTeX{} 字体映射,同时作用于 \tn{AtBeginDvi} 与
% \tn{AtBeginShipoutFirst}。该宏对 \pdfTeX{} 和 \upTeX{} 均有用。
% \begin{macrocode}
-%<*pdftex|uptex>
+%<*pdftex|uptex|aptex>
\cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1
{
\AtBeginDvi { #1 }
@@ -3899,7 +3629,7 @@ This package consists of the file ctex.dtx, and the derived files
{ \AtBeginShipoutFirst { #1 } }
}
\@onlypreamble \ctex_set_zhmap:n
-%</pdftex|uptex>
+%</pdftex|uptex|aptex>
% \end{macrocode}
% \end{macro}
%
@@ -5745,30 +5475,6 @@ This package consists of the file ctex.dtx, and the derived files
%
% \paragraph{其它设置}
%
-% \begin{macro}[int]{\ctex_ltj_update_xkanjiskip:,\l_@@_xkanjiskip_skip}
-% \tn{ltjsetparameter} 对 \opt{xkanjiskip} 是即时赋值。\tn{zw} 与字体相关,因此
-% 需要每次 \tn{selectfont} 的时候更新一次 \opt{xkanjiskip}。如果用户设置过
-% \opt{xkanjiskip},就不更新。注意,同 \TeX{} 的 \tn{baselineskip} 一样,如果在
-% 一个段落内多次设置了 \opt{kanjiskip} 或 \opt{xkanjiskip},最后的设置会影响
-% 全段。
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \ctex_ltj_update_xkanjiskip:
- {
- \skip_if_eq:nnT
- { \ltjgetparameter { xkanjiskip } } { \l_@@_xkanjiskip_skip }
- {
- \skip_set:Nn \l_@@_xkanjiskip_skip { .25 \zw plus 1pt minus 1pt }
- \ltjsetxkanjiskip \l_@@_xkanjiskip_skip
- }
- }
-% \end{macrocode}
-% 注意,此时还没有实际设置字体,所以 \tn{zw} 是 \opt{0pt}。
-% \begin{macrocode}
-\skip_new:N \l_@@_xkanjiskip_skip
-\skip_set:Nn \l_@@_xkanjiskip_skip { .25 \zw plus 1pt minus 1pt }
-% \end{macrocode}
-% \end{macro}
-%
% 在抄录环境中禁用 \opt{autospacing} 和 \opt{autoxspacing}。然而,\pkg{LuaTeX-ja}
% 还是会使 JAchar 自动折行。没有看到有简单的禁用折行的办法,可能需要设置所有的
% JAchar 的 \opt{prebreakpenalty} 或 \opt{postbreakpenalty} 为 \texttt{10000}:
@@ -5820,7 +5526,7 @@ This package consists of the file ctex.dtx, and the derived files
% \subsubsection{\pkg{ctex-engine-uptex.def}}
%
% \begin{macrocode}
-%<*uptex>
+%<*uptex|aptex>
% \end{macrocode}
%
% \changes{v2.4}{2016/02/28}{初步支持 \upLaTeX。}
@@ -5842,6 +5548,11 @@ This package consists of the file ctex.dtx, and the derived files
\tl_set:Nn \kanjifamilydefault { \CJKfamilydefault }
% \end{macrocode}
%
+% 在导言区末尾更新 \tn{CJKfamilydefault}。
+% \begin{macrocode}
+\ctex_at_end_preamble:n { \ctex_update_default_family: }
+% \end{macrocode}
+%
% \begin{macro}{\em}
% 取消 \upLaTeX{} 对 \tn{em} 使用 |\mcfamily|、|\gtfamily| 命令的重定义,恢复
% \LaTeXe{} 对 \tn{em} 的原始定义。如果用户已经重定义了 \tn{em},则新定义保持
@@ -5930,11 +5641,11 @@ This package consists of the file ctex.dtx, and the derived files
\@ifpackageloaded { tracefnt }
{
\EverySelectfont
- {
- \ifnum \tracingfonts > \tw@
- \@font@info { Switching~ to~ \font@name }
- \fi
- }
+ {
+ \ifnum \tracingfonts > \tw@
+ \@font@info { Switching~ to~ \font@name }
+ \fi
+ }
}
{ }
\let \@EverySelectfont@Init \undefined
@@ -5943,18 +5654,19 @@ This package consists of the file ctex.dtx, and the derived files
% \end{macro}
%
% \begin{macrocode}
-%</uptex>
+%</uptex|aptex>
% \end{macrocode}
%
% \subsubsection{调整 \tn{CJKfamilydefault}}
%
% \changes{v2.4}{2016/02/15}{正确更新 \pkg{CJK} 包的 \tn{CJKfamilydefault}。}
+% \changes{v2.4.1}{2016/04/26}{正确更新 \upLaTeX{} 的 \tn{CJKfamilydefault}。}
%
% \begin{macro}[int]{\ctex_update_default_family:}
% 在导言区结束,如果 \tn{CJKfamilydefault} 没有被更改,则在此时根据西文字体的情况
% 更新 \tn{CJKfamilydefault}。\pkg{xeCJK} 已经有这个功能,不需要再调整。
% \begin{macrocode}
-%<*pdftex|luatex>
+%<*pdftex|luatex|uptex|aptex>
\cs_new_protected_nopar:Npn \ctex_update_default_family:
{
\tl_if_eq:NNT \CJKfamilydefault \l_@@_family_default_init_tl
@@ -5974,8 +5686,9 @@ This package consists of the file ctex.dtx, and the derived files
\group_end:
}
% \end{macrocode}
-% 使用 \LuaLaTeX{} 时,自动调整得到的 \tn{CJKfamilydefault} 可能没有定义,需要确认
-% 它的存在性。使用 \pkg{CJK} 宏包时,\texttt{C19rm} 等总是有定义的,不需要确认。
+% 使用 \LuaLaTeX{} 时,自动调整得到的 \tn{CJKfamilydefault} 可能没有定义,需要
+% 确认它的存在性。使用 \pkg{CJK} 宏包或 \upLaTeX{}
+% 时,\texttt{C19rm}、\texttt{JY2rm} 等总是有定义的,不需要确认。
% \begin{macrocode}
%<*luatex>
\ctex_ltj_ensure_default_family:
@@ -5995,7 +5708,7 @@ This package consists of the file ctex.dtx, and the derived files
{ \exp_not:o { \CJKfamilydefault } }
}
\tl_gset_eq:NN \CJKfamilydefault \l_@@_family_default_init_tl
-%</pdftex|luatex>
+%</pdftex|luatex|uptex|aptex>
% \end{macrocode}
% \end{macro}
%
@@ -6025,6 +5738,26 @@ This package consists of the file ctex.dtx, and the derived files
}
%</luatex>
% \end{macrocode}
+%
+% \ApTeX{} 可以使用 \tn{ngostype} 来判断。
+% \begin{macrocode}
+%<*aptex>
+\cs_new_protected_nopar:Npn \ctex_detected_platform:
+ {
+ \tl_gset:Nx \g_@@_fontset_tl
+ {
+ \str_case:onF { \ngostype }
+ {
+ { Win32 } { windows }
+ { Win64 } { windows }
+ { Darwin } { mac }
+ }
+ { fandol }
+ }
+ }
+%</aptex>
+% \end{macrocode}
+%
% \pdfTeX{} 和 \XeTeX{} 下则依据 \file{/dev/null} 和 \file{nul:} 的存在性以及
% 文件系统的大小写敏感性来判断。Mac~OS~X 的大小写敏感性在安装时是可选的。为了
% 保险起见,这里的判断很繁琐,最多要进行 4 次文件操作!
@@ -6166,18 +5899,20 @@ This package consists of the file ctex.dtx, and the derived files
%</xetex|luatex>
% \end{macrocode}
%
+% 我们假定 \upTeX{} 使用 \dvipdfmx{} 驱动输出,于是使用与 \pdfTeX{} 类似的设
+% 置。注意 \upTeX{} 需要使用 UTF8-UTF16 的编码转换。
% \begin{macrocode}
-%<*uptex>
-\PassOptionsToPackage { dvipdfmx } { hyperref }
+%<*uptex|aptex>
+\ctex_hypersetup:n { driverfallback = dvipdfmx }
\ctex_at_end_package:nn { hyperref }
{
\AtBeginShipoutFirst{ \special{ pdf:tounicode~ UTF8-UTF16 } }
}
-%</uptex>
+%</uptex|aptex>
% \end{macrocode}
%
% \begin{macrocode}
-%<*pdftex|xetex|luatex|uptex>
+%<*pdftex|xetex|luatex|uptex|aptex>
% \end{macrocode}
%
% \subsubsection{\pkg{CJKfntef}、\pkg{xeCJKfntef} 相关设置}
@@ -6213,11 +5948,13 @@ This package consists of the file ctex.dtx, and the derived files
{ \tl_clear:c { CJK#1color } }
}
%</xetex>
-%<*luatex>
+%<*luatex|uptex|aptex>
\msg_new:nnn { ctex } { fntef-not-available }
- { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ LuaLaTeX. }
+%<luatex> { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ LuaLaTeX. }
+%<uptex> { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ upLaTeX. }
+%<aptex> { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ ApLaTeX. }
\msg_warning:nn { ctex } { fntef-not-available }
-%</luatex>
+%</luatex|uptex|aptex>
\clist_map_inline:nn
{ underdot , underline , underdblline , underwave , sout , xout }
%<*pdftex|xetex>
@@ -6238,11 +5975,11 @@ This package consists of the file ctex.dtx, and the derived files
}
\cs_new_protected_nopar:Npn { \endCTEXfilltwosides } { \endCJKfilltwosides }
%</pdftex|xetex>
-%<*luatex|uptex>
+%<*luatex|uptex|aptex>
{ \cs_new_eq:cN { CTEX#1 } \use:n }
\cs_new_eq:NN \CTEXfilltwosides \use_none:n
\cs_new_eq:NN \endCTEXfilltwosides \prg_do_nothing:
-%</luatex|uptex>
+%</luatex|uptex|aptex>
%<*pdftex>
\clist_map_inline:nn
{
@@ -6262,6 +5999,7 @@ This package consists of the file ctex.dtx, and the derived files
% \subsubsection{\tn{ccwd} 的更新}
%
% \begin{macro}[int]{\ctex_update_ccwd:,\ccwd}
+% \changes{v2.4.1}{2016/04/29}{正确设置 \upTeX{} 下的 \tn{ccwd}。}
% \begin{macrocode}
\cs_new_protected_nopar:Npn \ctex_update_ccwd:
%<*pdftex|xetex>
@@ -6273,9 +6011,9 @@ This package consists of the file ctex.dtx, and the derived files
%<*luatex>
{ \skip_set:Nn \ccwd { \ltjgetparameter { kanjiskip } + \zw } }
%</luatex>
-%<*uptex>
- { \skip_set:Nn \ccwd { 1zw } }
-%</uptex>
+%<*uptex|aptex>
+ { \skip_set:Nn \ccwd { 1zw + \ptex_kanjiskip:D } }
+%</uptex|aptex>
\dim_new:N \ccwd
% \end{macrocode}
% \end{macro}
@@ -6296,9 +6034,9 @@ This package consists of the file ctex.dtx, and the derived files
%<*luatex>
{ \ltjsetkanjiskip \l_@@_ccglue_skip }
%</luatex>
-%<*uptex>
- { \kanjiskip \l_@@_ccglue_skip }
-%</uptex>
+%<*uptex|aptex>
+ { \skip_set_eq:NN \ptex_kanjiskip:D \l_@@_ccglue_skip }
+%</uptex|aptex>
\skip_new:N \l_@@_ccglue_skip
% \end{macrocode}
% \end{macro}
@@ -6316,10 +6054,10 @@ This package consists of the file ctex.dtx, and the derived files
\skip_if_eq:nnTF { \l_@@_ccglue_skip } { \ltjgetparameter { kanjiskip } }
{ \prg_return_false: } { \prg_return_true: }
%</luatex>
-%<*uptex>
- \skip_if_eq:nnTF { \l_@@_ccglue_skip } { \kanjiskip }
+%<*uptex|aptex>
+ \skip_if_eq:nnTF { \l_@@_ccglue_skip } { \ptex_kanjiskip:D }
{ \prg_return_false: } { \prg_return_true: }
-%</uptex>
+%</uptex|aptex>
}
% \end{macrocode}
% 注意下面的标记不能用 \verb"%<pdftex|xetex>",它会导致旧版本的 \pkg{l3docstrip}
@@ -6332,8 +6070,8 @@ This package consists of the file ctex.dtx, and the derived files
% \end{macro}
%
% \begin{macro}[int]{\ctex_update_em_unit:}
-% 将当前汉字的宽度保存到 \tn{ccwd} 中备用。不采用 \texttt{1 em},因为这时的
-% \texttt{1 em} 实际上来自西文字体的信息,未必等于汉字的宽度,这似乎在传统的
+% 将当前汉字的宽度保存到 \tn{ccwd} 中备用。不采用 \texttt{1em},因为这时的
+% \texttt{1em} 实际上来自西文字体的信息,未必等于汉字的宽度,这似乎在传统的
% \file{.tfm} 字体上表现更明显。在 \pdfTeX{} 和 \XeTeX{} 下,直接使用 |\f@size\p@|
% 作为汉字的宽度,这应该对大多数汉字字体都成立,但不适用于诸如“方正兰亭黑长”之类
% 的特殊字体。在 \XeTeX{} 可以用 \tn{fontcharwd} 来改进。而在 \pdfTeX{} 下,若使用
@@ -6344,7 +6082,7 @@ This package consists of the file ctex.dtx, and the derived files
\cs_new_protected_nopar:Npn \ctex_update_em_unit:
%<pdftex|xetex> { \dim_set:Nn \ccwd { \f@size \p@ } }
%<luatex> { \dim_set:Nn \ccwd { \zw } }
-%<uptex> { \dim_set:Nn \ccwd { 1zw } }
+%<uptex|aptex> { \dim_set:Nn \ccwd { 1zw } }
% \end{macrocode}
% \end{macro}
%
@@ -6379,9 +6117,9 @@ This package consists of the file ctex.dtx, and the derived files
%<*pdftex>
\EverySelectfont { \cs_if_exist:NF \CJK@plane { \CTEX@selectfont@hook } }
%</pdftex>
-%<*xetex|luatex|uptex>
+%<*xetex|luatex|uptex|aptex>
\EverySelectfont { \CTEX@selectfont@hook }
-%</xetex|luatex|uptex>
+%</xetex|luatex|uptex|aptex>
% \end{macrocode}
%
% Attribute 寄存器 \tn{ltj@curjfnt} 的初始值是 $-1$,必须把它设置为一个有效的
@@ -6392,13 +6130,49 @@ This package consists of the file ctex.dtx, and the derived files
{
\ctex_ltj_select_font:
\ctex_ltj_select_alternate_font:
- \ctex_ltj_update_xkanjiskip:
}
\tl_set:Nn \CJK@family { song } \selectfont
\tl_clear:N \CJK@family
%</luatex>
% \end{macrocode}
%
+% \changes{v2.4.1}{2016/05/01}{随字体更新 \upTeX{} 的 \tn{xkanjiskip}。}
+%
+% \begin{macro}[int]{\ctex_update_xkanjiskip:,\l_@@_xkanjiskip_skip}
+% \upTeX{} 和 \pkg{LuaTeX-ja} 对 \tn{xkanjiskip} 都是即时赋值。单位 \opt{zw} 与字体相关,因此
+% 需要每次 \tn{selectfont} 的时候更新一次 \tn{xkanjiskip}。如果用户设置过
+% \tn{xkanjiskip},就不更新。注意,同 \TeX{} 的 \tn{baselineskip} 一样,如果在
+% 一个段落内多次设置了 \tn{kanjiskip} 或 \tn{xkanjiskip},只有最后的设置会影响
+% 全段。
+% \begin{macrocode}
+%<*luatex|uptex|aptex>
+\cs_new_protected_nopar:Npn \ctex_update_xkanjiskip:
+ {
+ \skip_if_eq:nnT
+%<luatex> { \ltjgetparameter { xkanjiskip } } { \l_@@_xkanjiskip_skip }
+%<uptex|aptex> { \ptex_xkanjiskip:D } { \l_@@_xkanjiskip_skip }
+ {
+ \skip_set:Nn \l_@@_xkanjiskip_skip { \l_@@_xkanjiskip_tl }
+%<luatex> \ltjsetxkanjiskip \l_@@_xkanjiskip_skip
+%<uptex|aptex> \skip_set_eq:NN \ptex_xkanjiskip:D \l_@@_xkanjiskip_skip
+ }
+ }
+\tl_new:N \l_@@_xkanjiskip_tl
+\tl_set:Nn \l_@@_xkanjiskip_tl
+%<luatex> { .25\zw plus 1pt minus 1pt }
+%<uptex|aptex> { .25zw plus 1pt minus 1pt }
+\skip_new:N \l_@@_xkanjiskip_skip
+\skip_set:Nn \l_@@_xkanjiskip_skip
+%<luatex> { \ltjgetparameter { xkanjiskip } }
+%<uptex|aptex> { \ptex_xkanjiskip:D }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\ctex_add_to_selectfont:n { \ctex_update_xkanjiskip: }
+%</luatex|uptex|aptex>
+% \end{macrocode}
+%
% \begin{macro}{space}
% 在导言区或正文中设置忽略空格方式。
% \pdfTeX{} 和 \XeTeX{} 下初始设置为 \opt{auto},\LuaTeX{}、\upTeX{} 下是无效
@@ -6420,10 +6194,10 @@ This package consists of the file ctex.dtx, and the derived files
space .default:n = { true } ,
space .initial:n = { auto }
%</pdftex|xetex>
-%<*luatex|uptex>
+%<*luatex|uptex|aptex>
space .code:n =
{ \msg_warning:nn { ctex } { invalid-option } }
-%</luatex|uptex>
+%</luatex|uptex|aptex>
}
% \end{macrocode}
% \end{macro}
@@ -6440,7 +6214,7 @@ This package consists of the file ctex.dtx, and the derived files
%<pdftex> \punctstyle { \l_@@_punct_tl }
%<xetex> \xeCJKsetup { PunctStyle = \l_@@_punct_tl }
%<luatex> \ctex_mono_jfm:o { \l_@@_punct_tl }
-%<uptex> \msg_warning:nn { ctex } { invalid-option }
+%<uptex|aptex> \msg_warning:nn { ctex } { invalid-option }
} ,
punct .default:n = { quanjiao } ,
}
@@ -6449,13 +6223,13 @@ This package consists of the file ctex.dtx, and the derived files
%
% \XeLaTeX{}、\LuaLaTeX{} 和 \upLaTeX{} 总是使用 \texttt{UTF8} 编码。
% \begin{macrocode}
-%<*xetex|luatex|uptex>
+%<*xetex|luatex|uptex|aptex>
\tl_set:Nn \l_@@_encoding_tl { UTF8 }
-%</xetex|luatex|uptex>
+%</xetex|luatex|uptex|aptex>
% \end{macrocode}
%
% \begin{macrocode}
-%</pdftex|xetex|luatex|uptex>
+%</pdftex|xetex|luatex|uptex|aptex>
%<*class|ctex>
% \end{macrocode}
%
@@ -6697,8 +6471,10 @@ This package consists of the file ctex.dtx, and the derived files
% \end{macrocode}
%
% \begin{macro}{\chinese}
+% \changes{v2.4.1}{2016/05/01}{支持 \tn{pagenumbering}。}
% \begin{macrocode}
-\cs_new_eq:NN \chinese \zhnum
+\cs_new_nopar:Npn \chinese { \zhnum_counter:n }
+\cs_new_eq:NN \@chinese \@zhnum
\cs_new_eq:NN \Chinese \chinese
\cs_new_eq:NN \CTEXcounter \use_none:n
% \end{macrocode}
@@ -6707,14 +6483,15 @@ This package consists of the file ctex.dtx, and the derived files
% \changes{v2.2}{2015/06/29}{给 \pkg{enumitem} 宏包注册 \tn{chinese} 和
% \tn{zhnum}。}
%
-% 给 \pkg{enumitem} 宏包注册 \tn{chinese} 和 \tn{zhnum}。
+% 给 \pkg{enumitem} 宏包注册 \tn{chinese}、\tn{zhnum} 和 \tn{zhdig}。
% \begin{macrocode}
\ctex_at_end_package:nn { enumitem }
{
\cs_if_free:NF \AddEnumerateCounter
{
- \AddEnumerateCounter * { \zhnum } { \zhnum_int:n } { 1 }
- \AddEnumerateCounter * { \chinese } { \zhnum_int:n } { 1 }
+ \AddEnumerateCounter * { \zhnum } { \@zhnum } { 1 }
+ \AddEnumerateCounter * { \zhdig } { \@zhdig } { 1 }
+ \AddEnumerateCounter * { \chinese } { \@chinese } { 1 }
}
}
% \end{macrocode}
@@ -6969,17 +6746,26 @@ This package consists of the file ctex.dtx, and the derived files
% \end{macro}
%
% \changes{v2.0}{2014/03/21}{标题设置新增 \opt{pagestyle} 选项。}
+% \changes{v2.4.1}{2016/05/10}{新的标题格式选项 \opt{part/fixbeforeskip} 和
+% \opt{chapter/fixbeforeskip}。}
%
-% \begin{macro}{part/pagestyle,chapter/pagestyle}
+% \begin{macro}{part/pagestyle,chapter/pagestyle,
+% part/fixbeforeskip,chapter/fixbeforeskip}
% 只在 \cls{ctexbook} 和 \cls{ctexrep} 下有定义。
% \begin{macrocode}
+\group_begin:
%<*book|report>
\tl_set:Nn \l_@@_tmp_tl
{
- part / pagestyle .tl_set:N = \CTEX@part@pagestyle ,
- chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle ,
+ part / pagestyle .tl_set:N = \CTEX@part@pagestyle ,
+ chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle ,
+ part / fixbeforeskip .bool_set:N = \CTEX@part@fixbeforeskip ,
+ chapter / fixbeforeskip .bool_set:N = \CTEX@chapter@fixbeforeskip ,
}
%</book|report>
+%<*article|beamer>
+\tl_clear:N \l_@@_tmp_tl
+%</article|beamer>
% \end{macrocode}
% \end{macro}
%
@@ -6990,8 +6776,11 @@ This package consists of the file ctex.dtx, and the derived files
\@@_initial_heading:n {#1}
\@@_def_heading_keys:n {#1}
}
-\use:x { \keys_define:nn { ctex } { \exp_not:o { \l_@@_tmp_tl } } }
-\tl_clear:N \l_@@_tmp_tl
+\use:x
+ {
+ \group_end:
+ \keys_define:nn { ctex } { \exp_not:o { \l_@@_tmp_tl } }
+ }
% \end{macrocode}
%
% \begin{macrocode}
@@ -7009,6 +6798,26 @@ This package consists of the file ctex.dtx, and the derived files
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[int]{\CTEX@fixbeforeskip}
+% 修正 \cls{book} 和 \cls{report} 类的 \tn{part} 和 \tn{chapter} 标题之前的多余空行。
+% 事实上,减掉 \tn{parskip} 有一定的风险。如果接下来的内容不会进入水平模式(例如在 \opt{format}
+% 选项中使用 \tn{hrule} 或者 \tn{hbox}),\TeX{} 就不会加上 \tn{parskip}。这时候就需要用户把
+% \tn{parskip} 加到 \opt{beforeskip} 上作为修正。
+% \begin{macrocode}
+%<*book|report>
+\cs_new_protected_nopar:Npn \CTEX@fixbeforeskip
+ {
+ \par
+ \ifdim \pagegoal = \maxdimen
+ \advance \@tempskipa -\topskip
+ \advance \@tempskipa -\parskip
+ \nointerlineskip
+ \fi
+ }
+%</book|report>
+% \end{macrocode}
+% \end{macro}
+%
% \changes{v2.2}{2015/06/27}{\opt{beforeskip}、\opt{afterskip} 和 \opt{indent}
% 选项支持表达式。}
%
@@ -7052,7 +6861,11 @@ This package consists of the file ctex.dtx, and the derived files
\@tempswafalse
\fi
% \null\vfil
- \null\vskip \glueexpr \CTEX@part@beforeskip \relax
+ \@tempskipa = \glueexpr \CTEX@part@beforeskip \relax
+ \ifodd \CTEX@part@fixbeforeskip
+ \CTEX@fixbeforeskip
+ \fi
+ \vspace*{\@tempskipa}%
\secdef\@part\@spart}
%</book|report>
% \end{macrocode}
@@ -7230,7 +7043,11 @@ This package consists of the file ctex.dtx, and the derived files
% \begin{macrocode}
\def\@makechapterhead#1{%
% \vspace*{50\p@}%
- \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}%
+ \@tempskipa = \glueexpr \CTEX@chapter@beforeskip \relax
+ \ifodd \CTEX@chapter@fixbeforeskip
+ \CTEX@fixbeforeskip
+ \fi
+ \vspace*{\@tempskipa}%
% {\normalfont \parindent \z@ \raggedright
{\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax
\CTEX@chapter@format
@@ -7257,7 +7074,11 @@ This package consists of the file ctex.dtx, and the derived files
% \begin{macrocode}
\def\@makeschapterhead#1{%
% \vspace*{50\p@}%
- \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}%
+ \@tempskipa = \glueexpr \CTEX@chapter@beforeskip \relax
+ \ifodd \CTEX@chapter@fixbeforeskip
+ \CTEX@fixbeforeskip
+ \fi
+ \vspace*{\@tempskipa}%
% {\normalfont \parindent \z@ \raggedright
{\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax
\CTEX@chapter@format
@@ -8320,51 +8141,21 @@ This package consists of the file ctex.dtx, and the derived files
%<article|book|report>\pagestyle { headings }
% \end{macrocode}
%
-% 汉化标题名字。
+% 日期格式。
% \begin{macrocode}
-%<*generic>
-\tl_if_exist:NTF \c_@@_std_class_tl
- {
- \str_if_eq:onTF { \c_@@_std_class_tl } { beamer }
- {
- \str_if_eq:onTF { \l_@@_encoding_tl } { GBK }
- {
- \uselanguage { ChineseGBK }
- \languagealias { chinese } { ChineseGBK }
- \ctex_file_input:n { ctex-name-gbk.cfg }
- }
- {
- \uselanguage { ChineseUTF8 }
- \languagealias { chinese } { ChineseUTF8 }
- \ctex_file_input:n { ctex-name-utf8.cfg }
- }
- \clist_put_left:Nn \trans@languagepath { chinese }
- }
- {
- \str_if_eq:onTF { \l_@@_encoding_tl } { GBK }
- { \ctex_file_input:n { ctex-name-gbk.cfg } }
- { \ctex_file_input:n { ctex-name-utf8.cfg } }
+\keys_set:nn { ctex } { today = small }
% \end{macrocode}
-% \changes{v2.0.2}{2015/05/16}{修复加载 \pkg{ctex} 宏包后章节标题后第一段
-% 无段首缩进的问题。}
-% 若 \pkg{ctex} 宏包与标准文档类及其衍生文档类联用,则将载入 \pkg{indentfirst} 宏包,
-% 实现章节标题后首个段落的段首缩进。
+%
+% 若用户未设置宏包选项 \opt{autoindent},则自动调整首行缩进。
+% \begin{macrocode}
+\ctex_if_autoindent_touched:F
+ { \keys_set:nn { ctex } { autoindent = true } }
+% \end{macrocode}
+%
+% 使用标题定义时的设置。首先是命题名字汉化。\cls{beamer} 需要汉化定理名称。
% \begin{macrocode}
- \RequirePackage { indentfirst }
- }
- }
- {
- \str_if_eq:onTF { \l_@@_encoding_tl } { GBK }
- { \ctex_file_input:n { ctex-name-gbk.cfg } }
- { \ctex_file_input:n { ctex-name-utf8.cfg } }
- }
-%</generic>
%<*!generic>
\str_if_eq:onTF { \l_@@_encoding_tl } { GBK }
-%<*article|book|report>
- { \ctex_file_input:n { ctex-name-gbk.cfg } }
- { \ctex_file_input:n { ctex-name-utf8.cfg } }
-%</article|book|report>
%<*beamer>
{
\uselanguage { ChineseGBK }
@@ -8376,33 +8167,71 @@ This package consists of the file ctex.dtx, and the derived files
\languagealias { chinese } { ChineseUTF8 }
\ctex_file_input:n { ctex-name-utf8.cfg }
}
-\clist_put_left:Nn \trans@languagepath { chinese }
-%</beamer>
-%</!generic>
% \end{macrocode}
-%
-% 日期格式。
+% 让 \pkg{translator} 包优先查找中文翻译。
% \begin{macrocode}
-\keys_set:nn { ctex } { today = small }
+\clist_put_left:Nn \trans@languagepath { chinese }
+%</beamer>
+%<*!beamer>
+ { \ctex_file_input:n { ctex-name-gbk.cfg } }
+ { \ctex_file_input:n { ctex-name-utf8.cfg } }
% \end{macrocode}
%
-% 若用户未设置宏包选项 \opt{zihao},则设置 \tn{normalsize} 为五号字。
+% \changes{v2.4.1}{2016/05/09}{\cls{beamer} 不调整默认字体大小。}
+% 对 \cls{beamer} 以外的文档类,若用户未设置宏包选项 \opt{zihao},则设置 \tn{normalsize}
+% 为五号字。\cls{beamer} 不调整默认字体大小。
% \begin{macrocode}
\int_compare:nNnF \g_@@_font_size_flag > \c_minus_one
{ \cs_gset_eq:NN \g_@@_font_size_flag \c_zero }
% \end{macrocode}
%
-% 若用户未设置宏包选项 \opt{linespread},则设置行距初始值为 $1.3\times 1.2=1.56$
-% 倍字体大小。
+% \changes{v2.4.1}{2016/05/09}{\cls{beamer} 不调整默认行距。}
+% 对 \cls{beamer} 以外的文档类,若用户未设置宏包选项 \opt{linespread},则设置行
+% 距初始值为 $1.3\times 1.2=1.56$ 倍字体大小。\cls{beamer} 不调整行距。
% \begin{macrocode}
\fp_compare:nNnT { \l_@@_line_spread_fp } ? { \c_zero_fp }
- { \keys_set:nn { ctex / option } { linespread = 1.3 } }
+ { \fp_set:Nn \l_@@_line_spread_fp { 1.3 } }
+%</!beamer>
+%</!generic>
% \end{macrocode}
%
-% 若用户未设置宏包选项 \opt{autoindent},则自动调整首行缩进。
+% 不使用标题定义时的通用设置。
% \begin{macrocode}
-\ctex_if_autoindent_touched:F
- { \keys_set:nn { ctex } { autoindent = true } }
+%<*generic>
+\tl_set:Nn \l_@@_tmp_tl { beamer }
+\tl_if_eq:NNTF \c_@@_std_class_tl \l_@@_tmp_tl
+ {
+ \str_if_eq:onTF { \l_@@_encoding_tl } { GBK }
+ {
+ \uselanguage { ChineseGBK }
+ \languagealias { chinese } { ChineseGBK }
+ \ctex_file_input:n { ctex-name-gbk.cfg }
+ }
+ {
+ \uselanguage { ChineseUTF8 }
+ \languagealias { chinese } { ChineseUTF8 }
+ \ctex_file_input:n { ctex-name-utf8.cfg }
+ }
+ \clist_put_left:Nn \trans@languagepath { chinese }
+ }
+ {
+ \str_if_eq:onTF { \l_@@_encoding_tl } { GBK }
+ { \ctex_file_input:n { ctex-name-gbk.cfg } }
+ { \ctex_file_input:n { ctex-name-utf8.cfg } }
+ \int_compare:nNnF \g_@@_font_size_flag > \c_minus_one
+ { \cs_gset_eq:NN \g_@@_font_size_flag \c_zero }
+ \fp_compare:nNnT { \l_@@_line_spread_fp } ? { \c_zero_fp }
+ { \fp_set:Nn \l_@@_line_spread_fp { 1.3 } }
+% \end{macrocode}
+% \changes{v2.0.2}{2015/05/16}{修复加载 \pkg{ctex} 宏包后章节标题后第一段
+% 无段首缩进的问题。}
+% 若 \pkg{ctex} 宏包与标准文档类及其衍生文档类联用,则将载入 \pkg{indentfirst} 宏包,
+% 实现章节标题后首个段落的段首缩进。
+% \begin{macrocode}
+ \tl_if_exist:NT \c_@@_std_class_tl
+ { \RequirePackage { indentfirst } }
+ }
+%</generic>
% \end{macrocode}
%
% \begin{macrocode}
@@ -8887,14 +8716,14 @@ This package consists of the file ctex.dtx, and the derived files
% \upTeX{} 使用的字体族。\upLaTeX 在 NFSS 下使用字体编码 |JY2| 和 |JT2| 来分别
% 表示横排与直排的日文。
% \begin{macrocode}
-%<*uptex>
+%<*uptex|aptex>
\DeclareKanjiFamily{JY2}{rm}{}
\DeclareKanjiFamily{JY2}{sf}{}
\DeclareKanjiFamily{JY2}{tt}{}
\DeclareKanjiFamily{JT2}{rm}{}
\DeclareKanjiFamily{JT2}{sf}{}
\DeclareKanjiFamily{JT2}{tt}{}
-%</uptex>
+%</uptex|aptex>
% \end{macrocode}
%
%
@@ -8923,14 +8752,14 @@ This package consists of the file ctex.dtx, and the derived files
\DeclareFontShape{C70}{rm}{bx}{it}{<-> CJKb * unikai}{\CJKbold}
%</c70>
%</rm>
-%<*uptex>
+%<*uptex|aptex>
\DeclareFontShape{JY2}{rm}{m}{n}{<-> upzhserif-h}{}
\DeclareFontShape{JY2}{rm}{m}{it}{<-> upzhserifit-h}{}
\DeclareFontShape{JY2}{rm}{bx}{n}{<-> upzhserifb-h}{}
\DeclareFontShape{JT2}{rm}{m}{n}{<-> upzhserif-v}{}
\DeclareFontShape{JT2}{rm}{m}{it}{<-> upzhserifit-v}{}
\DeclareFontShape{JT2}{rm}{bx}{n}{<-> upzhserifb-v}{}
-%</uptex>
+%</uptex|aptex>
% \end{macrocode}
%
% \begin{macrocode}
@@ -8958,12 +8787,12 @@ This package consists of the file ctex.dtx, and the derived files
\DeclareFontShape{C70}{sf}{bx}{it}{<-> CJKb * uniyou}{\CJKbold}
%</c70>
%</sf>
-%<*uptex>
+%<*uptex|aptex>
\DeclareFontShape{JY2}{sf}{m}{n}{<-> upzhsans-h}{}
\DeclareFontShape{JY2}{sf}{bx}{n}{<-> upzhsansb-h}{}
\DeclareFontShape{JT2}{sf}{m}{n}{<-> upzhsans-v}{}
\DeclareFontShape{JT2}{sf}{bx}{n}{<-> upzhsansb-v}{}
-%</uptex>
+%</uptex|aptex>
% \end{macrocode}
%
% \begin{macrocode}
@@ -8991,10 +8820,10 @@ This package consists of the file ctex.dtx, and the derived files
\DeclareFontShape{C70}{tt}{bx}{it}{<-> CJKb * unifs}{\CJKbold}
%</c70>
%</tt>
-%<*uptex>
+%<*uptex|aptex>
\DeclareFontShape{JY2}{tt}{m}{n}{<-> upzhmono-h}{}
\DeclareFontShape{JT2}{tt}{m}{n}{<-> upzhmono-v}{}
-%</uptex>
+%</uptex|aptex>
% \end{macrocode}
%
% \begin{macrocode}
@@ -9004,11 +8833,14 @@ This package consists of the file ctex.dtx, and the derived files
% \subsubsection{\pkg{ctex-fontset-windows.def},
% \pkg{ctex-fontset-windowsnew.def}, \pkg{ctex-fontset-windowsold.def}}
%
-% \pkg{ctex} 包利用 \path{C:\boot.ini} 文件的存在性来判断是否使用 Windows XP
-% 及以前的版本,分别载入新旧字体设置。
+% \changes{v2.4.1}{2016/05/14}{使用 \file{bootfont.bin} 判断 Windows XP 以避免
+% 权限问题。}
+% \pkg{ctex} 包利用 |C:\bootfont.bin| 文件的存在性来判断是否使用 Windows XP 版
+% 本,分别载入新旧字体设置。(注:\pkg{ctex} 包不支持 Windows 2000 以前使用
+% \file{simsun.ttf} 的旧宋体文件名。)
% \begin{macrocode}
%<*windows>
-\file_if_exist:nTF { C:/boot.ini }
+\file_if_exist:nTF { C:/bootfont.bin }
{ \ctex_file_input:n { ctex-fontset-windowsold.def } }
{ \ctex_file_input:n { ctex-fontset-windowsnew.def } }
%</windows>
@@ -9020,12 +8852,12 @@ This package consists of the file ctex.dtx, and the derived files
% 加以区分。
% \begin{macrocode}
%<*windowsnew>
-\tl_new:N \l_@@_msyh_suffix
-\tl_set:Nn \l_@@_msyh_suffix { .ttc }
+\tl_new:N \l_@@_msyh_suffix_tl
+\tl_set:Nn \l_@@_msyh_suffix_tl { .ttc }
\file_if_exist:nF { C:/Windows/Fonts/msyh.ttc }
{
\file_if_exist:nF { msyh.ttc }
- { \tl_set:Nn \l_@@_msyh_suffix { .ttf } }
+ { \tl_set:Nn \l_@@_msyh_suffix_tl { .ttf } }
}
%</windowsnew>
%<*windowsnew|windowsold>
@@ -9041,9 +8873,9 @@ This package consists of the file ctex.dtx, and the derived files
\ctex_punct_map_family:nn { \CJKsfdefault } { zhhei }
%</windowsold>
%<*windowsnew>
- \setCJKsansfont [ BoldFont = msyhbd\l_@@_msyh_suffix ] { msyh\l_@@_msyh_suffix }
+ \setCJKsansfont [ BoldFont = msyhbd\l_@@_msyh_suffix_tl ] { msyh\l_@@_msyh_suffix_tl }
\setCJKfamilyfont { zhyahei }
- [ BoldFont = msyhbd\l_@@_msyh_suffix ] { msyh\l_@@_msyh_suffix }
+ [ BoldFont = msyhbd\l_@@_msyh_suffix_tl ] { msyh\l_@@_msyh_suffix_tl }
\ctex_punct_map_family:nn { \CJKsfdefault } { zhyahei }
\ctex_punct_map_bfseries:nn { \CJKsfdefault , zhyahei } { zhyaheib }
%</windowsnew>
@@ -9077,7 +8909,7 @@ This package consists of the file ctex.dtx, and the derived files
{
\ctex_set_upfonts:nnnnnn
{simsun.ttc} {simhei.ttf} {simkai.ttf}
-%<windowsnew> {msyh\l_@@_msyh_suffix} {msyhbd\l_@@_msyh_suffix}
+%<windowsnew> {msyh\l_@@_msyh_suffix_tl} {msyhbd\l_@@_msyh_suffix_tl}
%<windowsold> {simhei.ttf} {simhei.ttf}
{simfang.ttf}
\ctex_set_upfamily:nnn { zhsong } { upzhserif } {}
@@ -10457,18 +10289,17 @@ This package consists of the file ctex.dtx, and the derived files
\ctex_get_macro_meaning:N ##1 { TF }
{
\exp_after:wN \@@_get_macro_meaning:w
- \token_to_meaning:N ##1 \q_mark #1 -> \q_no_value \q_mark \q_stop
+ \token_to_meaning:N ##1 \q_mark #1 -> \q_mark \q_stop
}
\cs_new_protected:Npn \@@_get_macro_meaning:w
##1 #1 ##2 -> ##3 \q_mark ##4 \q_stop
{
- \tl_set:Nn \l_@@_replacement_tl {##3}
- \quark_if_no_value:NTF \l_@@_replacement_tl
+ \tl_if_empty:nTF { ##4 }
{ \prg_return_false: }
{
- \str_set:Nn \l_@@_prefix_str {##1}
- \str_set:Nn \l_@@_parameter_str {##2}
- \str_set:Nn \l_@@_replacement_str {##3}
+ \str_set:Nn \l_@@_prefix_str { ##1 }
+ \str_set:Nn \l_@@_parameter_str { ##2 }
+ \str_set:Nn \l_@@_replacement_str { ##3 }
\prg_return_true:
}
}
@@ -10514,7 +10345,7 @@ This package consists of the file ctex.dtx, and the derived files
{
\str_if_empty:NTF #2
{ \tl_clear:N #1 }
- { \tl_set_rescan:Nnx #1 {#3} {#2} }
+ { \tl_set_rescan:Nno #1 {#3} {#2} }
}
\tl_new:N \l_@@_prefix_tl
\tl_new:N \l_@@_parameter_tl
@@ -10567,30 +10398,31 @@ This package consists of the file ctex.dtx, and the derived files
\ctex_get_macro_meaning:NTF #1
{
\str_if_empty:NTF \l_@@_parameter_str
- { \@@_hookto_cmd_parameterless:Nnnw #1 {#2} {#4} }
- { \@@_hookto_cmd_parameter:Nnnnw #1 {#2} {#3} {#4} }
+ { \@@_hookto_cmd_parameterless:Nnnnw }
+ { \@@_hookto_cmd_parameter:Nnnnw }
+ #1 {#2} {#3} {#4}
}
{ \@@_patch_false:w }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\@@_hookto_cmd_parameterless:Nnnw}
+% \begin{macro}[aux]{\@@_hookto_cmd_parameterless:Nnnnw}
% 如果宏没有参数,可以直接进行附加操作。注意保持宏的前缀。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_hookto_cmd_parameterless:Nnnw #1#2#3
+\cs_new_protected:Npn \@@_hookto_cmd_parameterless:Nnnnw #1#2#3#4
{
\str_if_empty:NF \l_@@_prefix_str
- { \tl_rescan:nx { } { \l_@@_prefix_str } }
+ { \tl_rescan:no {#3} { \l_@@_prefix_str } }
\tex_edef:D #1
{
\use:c { @@_ #2 _hook_aux:nn }
{ \exp_not:o {#1} }
- { \exp_not:n {#3} }
+ { \exp_not:n {#4} }
}
\@@_patch_true:w
}
-\cs_generate_variant:Nn \tl_rescan:nn { nx }
+\cs_generate_variant:Nn \tl_rescan:nn { no }
\cs_new:Npn \@@_left_hook_aux:nn #1#2 { #2#1 }
\cs_new_eq:NN \@@_right_hook_aux:nn \use:nn
% \end{macrocode}
@@ -10621,4 +10453,387 @@ This package consists of the file ctex.dtx, and the derived files
%
% \Finale
%
+% \endinput
+%
+% \DisableImplementation
+%
+% \begin{implementation}
+%
+% \subsection{\cls{ctxdoc}}
+%
+% \begin{macrocode}
+%<*ctxdoc>
+\ExplSyntaxOff
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{l3doc}}
+\PassOptionsToClass{a4paper,full}{l3doc}
+\ProcessOptions
+\@namedef{ver@thumbpdf.sty}{9999/99/99}
+\LoadClass{l3doc}
+\RequirePackage[UTF8, punct = kaiming, heading, fontset = none,
+ linespread = 1.2, sub3section]{ctex}
+\ifxetex
+ \xeCJKsetup{AutoFakeBold=false}
+\fi
+\ctexset{
+ fontset,
+ abstractname = 简介,
+ indexname = 代码索引,
+ section = {
+ format = \Large\bfseries\raggedright,
+ name = {第,节},
+ },
+}
+\RequirePackage[toc]{multitoc}
+\RequirePackage{geometry}
+\RequirePackage{tabularx}
+\RequirePackage{makecell}
+\RequirePackage{threeparttable}
+\RequirePackage{siunitx}
+\RequirePackage{unicode-math}
+\RequirePackage{xcolor}
+\RequirePackage{caption}
+\RequirePackage{fvrb-ex}
+\geometry{includemp,hmargin={0mm,15mm},vmargin={25mm,15mm},footskip=7mm}
+\hypersetup{pdfstartview=FitH,bookmarksdepth=subparagraph}
+\setcounter{secnumdepth}{4}
+\setcounter{tocdepth}{2}
+\newcommand*\email{\nolinkurl}
+\setmainfont{TeX Gyre Pagella}
+\setsansfont{TeX Gyre Heros}
+\setmonofont[
+ UprightFont=* Light, BoldFont=* Bold,
+ SlantedFont=* Light Oblique]{CMU Typewriter Text}
+\setmathfont{texgyrepagella-math.otf}
+\captionsetup{strut=off, labelsep=quad, labelfont+=bf}
+%% <--- http://tex.stackexchange.com/a/40896
+\patchcmd{\@addtocurcol}%
+ {\vskip \intextsep}%
+ {\edef\save@first@penalty{\the\lastpenalty}\unpenalty
+ \ifnum \lastpenalty = \@M % hopefully the OR penalty
+ \unpenalty
+ \else
+ \penalty \save@first@penalty \relax % put it back
+ \fi
+ \ifnum\outputpenalty <-\@Mii
+ \addvspace\intextsep
+ \vskip\parskip
+ \else
+ \addvspace\intextsep
+ \fi}%
+ {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
+\patchcmd{\@addtocurcol}%
+ {\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}%
+ {\ifnum\outputpenalty <-\@Mii
+ \aftergroup\vskip\aftergroup\intextsep
+ \aftergroup\nointerlineskip
+ \else
+ \vskip\intextsep
+ \fi}%
+ {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
+\patchcmd{\@getpen}{\@M}{\@Mi}
+ {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
+%% --->
+%% 不对代码实现的 \section 以下标题编目录。
+\AtBeginEnvironment{implementation}{%
+ \ifnum\value{tocdepth}>\@ne
+ \addtocontents{toc}{\protect\value{tocdepth}=1\relax}%
+ \fi}
+\ifxetex
+ \let\ctexdocverbaddon\xeCJKVerbAddon
+ \def\ctexdisableecglue{\xeCJKsetup{CJKecglue}}
+ \def\ctexplainps{\xeCJKsetup{PunctStyle=plain}}
+ \appto\meta@font@select{\ifinner\ctexdisableecglue\fi}
+\else
+ \let\ctexdocverbaddon\relax
+ \let\ctexplainps\relax
+ \def\ctexdisableecglue{\ltjsetparameter{autoxspacing=false}}
+ \appto\meta@font@select{\ctexdisableecglue}
+\fi
+\setlist{noitemsep,topsep=\smallskipamount}
+\setlist[1]{labelindent=\parindent}
+\setlist[enumerate]{leftmargin=*}
+\setlist[itemize]{leftmargin=*}
+\newlist{optdesc}{description}{3}
+%% 设置间距为 \marginparsep,与 l3doc 一致
+\setlist[optdesc]{%
+ font=\mdseries\small\ttfamily,align=right,listparindent=\parindent,
+ labelsep=\marginparsep,labelindent=-\marginparsep,leftmargin=*}
+%% 重新定义 threeparttable 包的 tablenotes 环境
+\renewlist{tablenotes}{description}{1}
+\setlist[tablenotes]{%
+ format=\normalfont\tnote@item,align=right,listparindent=\parindent,
+ labelindent=\tabcolsep,leftmargin=*,rightmargin=\tabcolsep,
+ after=\@noparlisttrue}
+\AtBeginEnvironment{tablenotes}{%
+ \setlength\parindent{2\ccwd}%
+ \normalfont\footnotesize}
+\AtBeginEnvironment{threeparttable}{%
+ \stepcounter{tpt@id}%
+ \edef\curr@tpt@id{tpt@\arabic{tpt@id}}}
+\newcounter{tpt@id}
+\def\tnote@item#1{%
+ \Hy@raisedlink{\hyper@anchor{\curr@tpt@id-#1}}#1}
+\def\TPTtagStyle#1{\hyperlink{\curr@tpt@id-#1}{#1}}
+\fvset{
+ fontsize=\small,baselinestretch=1,numbersep=5pt,
+ formatcom=\ctexdocverbaddon,
+ listparameters=\setlength\topsep{\MacrocodeTopsep}}
+\DefineVerbatimEnvironment{frameverb}{Verbatim}{%
+ gobble=4,
+ frame=single,framesep=8pt,
+ listparameters=
+ \setlength\topsep{\medskipamount}%
+ \appto\FV@EndList{\nointerlineskip}}
+\DefineVerbatimEnvironment{ctexexam}{Verbatim}{%
+ gobble=4,
+ frame=single,framesep=10pt,
+ label=\rule{0pt}{12pt}\textnormal{\bfseries 例 \arabic{ctexexam}},
+ listparameters=
+ \setlength\topsep{\bigskipamount}%
+ \refstepcounter{ctexexam}\ctexexamlabelref
+ \appto\FV@EndList{\nointerlineskip}}
+\define@key{FV}{labelref}{\def\ctexexamlabelref{\label{#1}}}
+\let\ctexexamlabelref\empty
+\newcounter{ctexexam}
+\BeforeBeginEnvironment{function}{\par\nointerlineskip}
+\AtEndEnvironment{function}{%
+ \par\xdef\ctexfixprevdepth{\prevdepth=\the\prevdepth\space}%
+ \ctexfixdescrcoffinyoffset}
+%% l3doc 会在 function 环境的 syntax 和 descr 盒子中间加上 \medskipamount 的距离。
+%% 但是若 syntax 盒子为空(未使用 syntax 环境),就会显得不好看。
+%% 此时我们通过将 \medskipamount 设置为零来修正。
+\def\ctexfixdescrcoffinyoffset{%
+ \aftergroup\aftergroup\aftergroup\ctexzeromedskipamount}
+\def\ctexzeromedskipamount{\setlength\medskipamount{\z@skip}}
+\AfterEndEnvironment{syntax}{\let\ctexfixdescrcoffinyoffset\relax}
+\AfterEndEnvironment{function}{\ctexfixprevdepth}
+\AtBeginEnvironment{syntax}{\linespread{1}\ctexplainps\ctexdisableecglue}
+\BeforeBeginEnvironment{SideBySideExample}{\par\addvspace{\medskipamount}}
+\preto\MacroFont{\linespread{1}}
+\appto\MacroFont{\hyphenchar\font\m@ne\ctexdocverbaddon}
+\preto\AltMacroFont{\linespread{1}}
+\appto\AltMacroFont{\hyphenchar\font\m@ne\ctexdocverbaddon}
+\def\Module#1{\mbox{%
+ \color{purple}\footnotesize\normalfont\sffamily\textlangle#1\textrangle}}
+\newcommand*\exptarget{\Hy@raisedlink{\hypertarget{expstar}{}}}
+\newcommand*\rexptarget{\Hy@raisedlink{\hypertarget{rexpstar}{}}}
+\newcommand*\expstar{\hyperlink{expstar}{$\star$}}
+\newcommand*\rexpstar{\hyperlink{rexpstar}{\ding{73}}}
+\ExplSyntaxOn
+%% l3doc 会设置列表环境中 \listparindent=\z@,我们在这里恢复它。
+\cs_set_eq:NN \list \__codedoc_oldlist:nn
+\cs_new_nopar:Npn \zihaopt #1
+ {
+ \exp_last_unbraced:Nf \tl_head:w
+ { \prop_item:Nn \c__ctex_font_size_prop {#1} } { } \q_stop
+ }
+%% 用 \vtop 让函数名字和语法盒子首行对齐
+\patchcmd \__codedoc_syntax:w
+ { { minipage } { \l__codedoc_syntax_dim } }
+ { { minipage } [t] { \l__codedoc_syntax_dim } }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+%% 左侧边注的函数列表采用单倍行距
+\cs_set_protected_nopar:Npx \__codedoc_typeset_names:
+ {
+ \exp_not:N \linespread { 1 }
+ \exp_not:o { \__codedoc_typeset_names: }
+ }
+\patchcmd \__codedoc_macro_typeset_one:n
+ { \vbox_unpack_clear:N }
+ { \linespread { 1 } \selectfont \vbox_unpack_clear:N }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+%% 不重复使用 \HD@target,避免索引出现重复页码
+\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 }
+ { \textbackslash \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_catcode_active:N \|
+ \char_set_active_eq:NN \| \orbar
+ \char_set_catcode_active:N \(
+ \char_set_active_eq:NN \( \defaultvalaux
+ }
+%% 不对目录中出现的 \cs 和 \tn 等编索引
+\DeclareDocumentCommand \StopSpecialIndexModule { }
+ { \cs_set_eq:NN \__codedoc_special_index_module:nnnn \use_none:nnnn }
+\tl_map_inline:nn { \actualchar \encapchar \levelchar }
+ { \exp_args:Nx \DoNotIndex { \bslash \tl_to_str:N #1 } }
+\DeclareDocumentCommand \package { o m }
+ {
+ \exp_args:Nx \href
+ {
+ http \c_colon_str //www.ctan.org/pkg/
+ \IfNoValueTF {#1} { \str_fold_case:n {#2} } {#1}
+ }
+ { \pkg {#2} }
+ }
+\DeclareDocumentCommand \GetFileId { m }
+ {
+ \GetFileInfo {#1}
+ \ior_open:NnTF \g_ctxdoc_ior { \c_sys_jobname_str .id }
+ {
+ \ior_get:NN \g_ctxdoc_ior \l_tmpa_tl
+ \ior_close:N \g_ctxdoc_ior
+ \exp_after:wN \GetIdInfo \l_tmpa_tl
+ }
+ { \GetIdInfo $Id$ }
+ { \fileinfo }
+ }
+\iow_new:N \g_ctxdoc_ior
+\ExplSyntaxOff
+\AtBeginDocument{\addtocontents{toc}{\StopSpecialIndexModule}}
+\pdfstringdefDisableCommands{%
+ \let\cs\bookmarkcstn
+ \let\tn\bookmarkcstn
+ \let\meta\bookmarkmeta
+ \let\path\meta
+ \let\opt\@firstofone}
+\preto\@thehead{\cslet{MakeUppercase\space}{\@iden}}
+\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}}
+\protected\def\opt{\texttt}
+\def\pdfTeX{\hologo{pdfTeX}}
+\def\XeTeX{\hologo{XeTeX}}
+\def\XeLaTeX{\hologo{XeLaTeX}}
+\def\LuaLaTeX{\hologo{LuaLaTeX}}
+\def\pdfLaTeX{\hologo{pdfLaTeX}}
+\def\LaTeX{\hologo{LaTeX}}
+\def\LaTeXe{\hologo{LaTeX2e}}
+\def\LaTeXiii{\hologo{LaTeX3}}
+\def\dvipdfmx{DVIPDFM\textit{x}}
+\def\TeX{\hologo{TeX}}
+\def\ApTeX{Ap\TeX}
+\def\ApLaTeX{Ap\LaTeX}
+\def\upTeX{up\TeX}
+\def\upLaTeX{up\LaTeX}
+\def\bashcmd{\texttt}
+\def\TeXLive{\TeX\ Live}
+\def\MiKTeX{\hologo{MiKTeX}}
+\def\BSTACK{\begin{tabular}[t]{@{}l@{}}}
+\def\ESTACK{\end{tabular}}
+\newenvironment{defaultcapconfig}{%
+ \MakePercentComment
+ \input{ctex-name-utf8.cfg}%
+ \ExplSyntaxOff
+ \MakePercentIgnore}{}
+\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}}
+\patchcmd\theCodelineNo{\sffamily\tiny}{\normalfont\sffamily\tiny}{}{}
+\appto\GlossaryParms{%
+ \def\@idxitem{\par\hangindent 2em }%
+ \def\subitem{\@idxitem\hspace*{1em}}%
+ \def\subsubitem{\@idxitem\hspace*{2em}}}
+\patchcmd\l@section{2.5em}{1.5em}{}{}
+\patchcmd\l@subsection{2.5em}{1.5em}{}{}
+\patchcmd\changes@{\space}{\lbrack}{}{}
+\patchcmd\@wrglossary{hdpindex}{%
+ \ifnum\c@HD@hypercount=\z@
+ hdpindex%
+ \else
+ hdclindex{\the\c@HD@hypercount}\fi}{}{}
+\def\glossaryname{版本历史}
+\GlossaryPrologue{\section{\glossaryname}}
+\IndexPrologue{%
+ \section{\indexname}
+ \textit{意大利体的数字表示描述对应索引项的页码;
+ 带下划线的数字表示定义对应索引项的代码行号;
+ 罗马字体的数字表示使用对应索引项的代码行号。}}
+\def\IndexLayout{%
+ \newgeometry{hmargin=15mm,vmargin={25mm,15mm},footskip=7mm}%
+ \setlength\IndexMin{.5\textheight}%
+ \ctexset{section/numbering=false}%
+ \StopSpecialIndexModule}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+%</ctxdoc>
+% \end{macrocode}
+%
+% \subsection{\pkg{ctxdocstrip}}
+%
+% \begin{macrocode}
+%<*docstrip>
+\csname ctxdocstriploaded\endcsname
+\let\ctxdocstriploaded\endinput
+\input l3docstrip %
+\edef\ctxresetcatcode{%
+ \catcode\number`\$=\the\catcode`\$\relax}
+\makeOther\$
+\def\plusOption+#1>#2$#3$\endLine{%
+ \maybeMsg{<+#1 . >}%
+ \Evaluate{#1}%
+ \def\ctxCMD{#2}%
+ \def\ctxID{$#3$}%
+ \def\do##1##2##3{%
+ \if1\Expr{##2}%
+ \readIDFile
+ \StreamPut##1{\inLine}%
+ \fi
+ }%
+ \activefiles
+}
+\def\readIDFile{%
+ \openin\inputcheck=\jobname.id\relax
+ \ifeof\inputcheck\else
+ \read \inputcheck to \inLine
+ \closein\inputcheck
+ \fi
+ \ifx\inLine\empty\else
+ \let\ctxID\inLine
+ \fi
+ \maybeMsg{^^J\ctxID^^J}%
+ \def\inLine{\ctxCMD\ctxID}%
+}
+\keepsilent
+\askforoverwritefalse
+\declarepreamble\emptypreamble
+\endpreamble
+\declarepostamble\emptypostamble
+\endpostamble
+\ctxresetcatcode
+%</docstrip>
+% \end{macrocode}
+%
+% \end{implementation}
+%
\endinput
diff --git a/Master/texmf-dist/source/latex/ctex/ctex.ins b/Master/texmf-dist/source/latex/ctex/ctex.ins
new file mode 100644
index 00000000000..aae0b8226ef
--- /dev/null
+++ b/Master/texmf-dist/source/latex/ctex/ctex.ins
@@ -0,0 +1,283 @@
+%%
+%% This is file `ctex.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% ctex.dtx (with options: `install')
+%%
+%% Copyright (C) 2003--2016
+%% CTEX.ORG and any individual authors listed in the documentation.
+%% ------------------------------------------------------------------------------
+%%
+%% 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, Qing Lee and Liam Huang.
+%%
+%% ------------------------------------------------------------------------------
+%%
+
+\input ctxdocstrip %
+
+\preamble
+
+ Copyright (C) 2003--2016
+ CTEX.ORG and any individual authors listed in the documentation.
+------------------------------------------------------------------------------
+
+ 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, Qing Lee and Liam Huang.
+
+------------------------------------------------------------------------------
+
+\endpreamble
+\postamble
+
+ This package consists of the file ctex.dtx,
+ and the derived files ctex.pdf,
+ ctex.ins,
+ ctex.sty,
+ ctexsize.sty,
+ ctexheading.sty,
+ ctexart.cls,
+ ctexbook.cls,
+ ctexrep.cls,
+ ctexbeamer.cls,
+ ctxdoc.cls,
+ ctexcap.sty,
+ ctexhook.sty,
+ ctexpatch.sty,
+ ctex-c5size.clo,
+ ctex-cs4size.clo,
+ ctex-article.def,
+ ctex-book.def,
+ ctex-report.def,
+ ctex-beamer.def,
+ ctex-scheme-plain.def,
+ ctex-scheme-plain-article.def,
+ ctex-scheme-plain-book.def,
+ ctex-scheme-plain-report.def,
+ ctex-scheme-plain-beamer.def,
+ ctex-scheme-chinese.def,
+ ctex-scheme-chinese-article.def,
+ ctex-scheme-chinese-book.def,
+ ctex-scheme-chinese-report.def,
+ ctex-scheme-chinese-beamer.def,
+ ctex-name-gbk.cfg,
+ ctex-name-utf8.cfg,
+ ctex.cfg,
+ ctexopts.cfg,
+ ctex-engine-pdftex.def,
+ ctex-engine-xetex.def,
+ ctex-engine-luatex.def,
+ ctex-engine-aptex.def,
+ ctex-engine-uptex.def,
+ c19rm.fd,
+ c19sf.fd,
+ c19tt.fd,
+ c70rm.fd,
+ c70sf.fd,
+ c70tt.fd,
+ ctex-fontset-windows.def,
+ ctex-fontset-windowsnew.def,
+ ctex-fontset-windowsold.def,
+ ctex-fontset-adobe.def,
+ ctex-fontset-fandol.def,
+ ctex-fontset-mac.def,
+ ctex-fontset-founder.def,
+ ctex-fontset-ubuntu.def,
+ ctexspa.def,
+ ctexpunct.spa,
+ ctexmakespa.tex,
+ ctexspamacro.tex,
+ ctxdocstrip.tex,
+ zhadobefonts.tex,
+ zhfandolfonts.tex,
+ zhfounderfonts.tex,
+ zhubuntufonts.tex,
+ zhwindowsfonts.tex,
+ translator-theorem-dictionary-ChineseGBK.dict,
+ translator-theorem-dictionary-ChineseUTF8.dict, and
+ README.md.
+\endpostamble
+
+\generate
+ {
+ \usedir{tex/latex/ctex}
+ \file{ctex.sty} {\from{\jobname.dtx}{style,ctex}}
+ \file{ctexsize.sty} {\from{\jobname.dtx}{style,ctexsize}}
+ \file{ctexheading.sty} {\from{\jobname.dtx}{style,ctexheading}}
+ \file{ctexart.cls} {\from{\jobname.dtx}{class,article}}
+ \file{ctexbook.cls} {\from{\jobname.dtx}{class,book}}
+ \file{ctexrep.cls} {\from{\jobname.dtx}{class,report}}
+ \file{ctexbeamer.cls} {\from{\jobname.dtx}{class,beamer}}
+ \usepostamble\emptypostamble
+ \file{ctxdoc.cls} {\from{\jobname.dtx}{ctxdoc}}
+ \file{ctexcap.sty} {\from{\jobname.dtx}{ctexcap}}
+ \file{ctexhook.sty} {\from{\jobname.dtx}{ctexhook}}
+ \file{ctexpatch.sty} {\from{\jobname.dtx}{ctexpatch}}
+ \file{ctex-c5size.clo} {\from{\jobname.dtx}{c5size}}
+ \file{ctex-cs4size.clo} {\from{\jobname.dtx}{cs4size}}
+ \file{ctex-article.def} {\from{\jobname.dtx}{heading,article}}
+ \file{ctex-book.def} {\from{\jobname.dtx}{heading,book}}
+ \file{ctex-report.def} {\from{\jobname.dtx}{heading,report}}
+ \file{ctex-beamer.def} {\from{\jobname.dtx}{heading,beamer}}
+ \file{ctex-scheme-plain.def} {\from{\jobname.dtx}{scheme,generic,plain}}
+ \file{ctex-scheme-plain-article.def} {\from{\jobname.dtx}{scheme,article,plain}}
+ \file{ctex-scheme-plain-book.def} {\from{\jobname.dtx}{scheme,book,plain}}
+ \file{ctex-scheme-plain-report.def} {\from{\jobname.dtx}{scheme,report,plain}}
+ \file{ctex-scheme-plain-beamer.def} {\from{\jobname.dtx}{scheme,beamer,plain}}
+ \file{ctex-scheme-chinese.def} {\from{\jobname.dtx}{scheme,generic,chinese}}
+ \file{ctex-scheme-chinese-article.def} {\from{\jobname.dtx}{scheme,article,chinese}}
+ \file{ctex-scheme-chinese-book.def} {\from{\jobname.dtx}{scheme,book,chinese}}
+ \file{ctex-scheme-chinese-report.def} {\from{\jobname.dtx}{scheme,report,chinese}}
+ \file{ctex-scheme-chinese-beamer.def} {\from{\jobname.dtx}{scheme,beamer,chinese}}
+ \file{ctex-name-gbk.cfg} {\from{\jobname.dtx}{name,GBK}}
+ \file{ctex-name-utf8.cfg} {\from{\jobname.dtx}{name,UTF8}}
+ \file{ctex.cfg} {\from{\jobname.dtx}{config}}
+ \file{ctexopts.cfg} {\from{\jobname.dtx}{ctexopts}}
+ \file{ctex-engine-pdftex.def} {\from{\jobname.dtx}{pdftex}}
+ \file{ctex-engine-xetex.def} {\from{\jobname.dtx}{xetex}}
+ \file{ctex-engine-luatex.def} {\from{\jobname.dtx}{luatex}}
+ \file{ctex-engine-aptex.def} {\from{\jobname.dtx}{aptex}}
+ \file{ctex-engine-uptex.def} {\from{\jobname.dtx}{uptex}}
+ \file{c19rm.fd} {\from{\jobname.dtx}{rm,c19}}
+ \file{c19sf.fd} {\from{\jobname.dtx}{sf,c19}}
+ \file{c19tt.fd} {\from{\jobname.dtx}{tt,c19}}
+ \file{c70rm.fd} {\from{\jobname.dtx}{rm,c70}}
+ \file{c70sf.fd} {\from{\jobname.dtx}{sf,c70}}
+ \file{c70tt.fd} {\from{\jobname.dtx}{tt,c70}}
+ \file{ctex-fontset-windows.def} {\from{\jobname.dtx}{fontset,windows}}
+ \file{ctex-fontset-windowsnew.def} {\from{\jobname.dtx}{fontset,windowsnew}}
+ \file{ctex-fontset-windowsold.def} {\from{\jobname.dtx}{fontset,windowsold}}
+ \file{ctex-fontset-adobe.def} {\from{\jobname.dtx}{fontset,adobe}}
+ \file{ctex-fontset-fandol.def} {\from{\jobname.dtx}{fontset,fandol}}
+ \file{ctex-fontset-mac.def} {\from{\jobname.dtx}{fontset,mac}}
+ \file{ctex-fontset-founder.def} {\from{\jobname.dtx}{fontset,founder}}
+ \file{ctex-fontset-ubuntu.def} {\from{\jobname.dtx}{fontset,ubuntu}}
+ \file{translator-theorem-dictionary-ChineseGBK.dict}
+ {\from{\jobname.dtx}{dict,theorem,GBK}}
+ \file{translator-theorem-dictionary-ChineseUTF8.dict}
+ {\from{\jobname.dtx}{dict,theorem,UTF8}}
+ \file{ctexspa.def}
+ {
+ \from{\jobname.dtx} {ctexspa}
+ \from{ctexpunct.spa} {}
+ }
+ \usedir{tex/generic/ctex}
+ \file{ctexmakespa.tex} {\from{\jobname.dtx}{spa,make}}
+ \file{ctexspamacro.tex} {\from{\jobname.dtx}{spa,macro}}
+ \file{zhadobefonts.tex} {\from{\jobname.dtx}{zhmap,adobe}}
+ \file{zhfandolfonts.tex} {\from{\jobname.dtx}{zhmap,fandol}}
+ \file{zhfounderfonts.tex} {\from{\jobname.dtx}{zhmap,founder}}
+ \file{zhubuntufonts.tex} {\from{\jobname.dtx}{zhmap,ubuntu}}
+ \file{zhwindowsfonts.tex} {\from{\jobname.dtx}{zhmap,windows}}
+ \file{ctxdocstrip.tex} {\from{\jobname.dtx}{docstrip}}
+ \nopreamble\nopostamble
+ \usedir{doc/latex/ctex}
+ \file{README.md} {\from{\jobname.dtx}{readme}}
+ }
+
+\catcode32=12\space
+
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into proper directories searched by TeX: *}
+\Msg{* *}
+\Msg{* The recommended directory is TDS:tex/latex/ctex *}
+\Msg{* *}
+\Msg{* ctex.sty *}
+\Msg{* ctexsize.sty *}
+\Msg{* ctexheading.sty *}
+\Msg{* ctexart.cls *}
+\Msg{* ctexbook.cls *}
+\Msg{* ctexrep.cls *}
+\Msg{* ctexbeamer.cls *}
+\Msg{* ctxdoc.cls *}
+\Msg{* ctexcap.sty *}
+\Msg{* ctexhook.sty *}
+\Msg{* ctexpatch.sty *}
+\Msg{* ctex-c5size.clo *}
+\Msg{* ctex-cs4size.clo *}
+\Msg{* ctex-article.def *}
+\Msg{* ctex-book.def *}
+\Msg{* ctex-report.def *}
+\Msg{* ctex-beamer.def *}
+\Msg{* ctex-scheme-plain.def *}
+\Msg{* ctex-scheme-plain-article.def *}
+\Msg{* ctex-scheme-plain-book.def *}
+\Msg{* ctex-scheme-plain-report.def *}
+\Msg{* ctex-scheme-plain-beamer.def *}
+\Msg{* ctex-scheme-chinese.def *}
+\Msg{* ctex-scheme-chinese-article.def *}
+\Msg{* ctex-scheme-chinese-book.def *}
+\Msg{* ctex-scheme-chinese-report.def *}
+\Msg{* ctex-scheme-chinese-beamer.def *}
+\Msg{* ctex-name-gbk.cfg *}
+\Msg{* ctex-name-utf8.cfg *}
+\Msg{* ctex.cfg *}
+\Msg{* ctexopts.cfg *}
+\Msg{* ctex-engine-pdftex.def *}
+\Msg{* ctex-engine-xetex.def *}
+\Msg{* ctex-engine-luatex.def *}
+\Msg{* ctex-engine-aptex.def *}
+\Msg{* ctex-engine-uptex.def *}
+\Msg{* c19rm.fd *}
+\Msg{* c19sf.fd *}
+\Msg{* c19tt.fd *}
+\Msg{* c70rm.fd *}
+\Msg{* c70sf.fd *}
+\Msg{* c70tt.fd *}
+\Msg{* ctex-fontset-windows.def *}
+\Msg{* ctex-fontset-windowsnew.def *}
+\Msg{* ctex-fontset-windowsold.def *}
+\Msg{* ctex-fontset-adobe.def *}
+\Msg{* ctex-fontset-fandol.def *}
+\Msg{* ctex-fontset-mac.def *}
+\Msg{* ctex-fontset-founder.def *}
+\Msg{* ctex-fontset-ubuntu.def *}
+\Msg{* ctexspa.def *}
+\Msg{* ctexmakespa.tex *}
+\Msg{* ctexspamacro.tex *}
+\Msg{* ctxdocstrip.tex *}
+\Msg{* zhadobefonts.tex *}
+\Msg{* zhfandolfonts.tex *}
+\Msg{* zhfounderfonts.tex *}
+\Msg{* zhubuntufonts.tex *}
+\Msg{* zhwindowsfonts.tex *}
+\Msg{* translator-theorem-dictionary-ChineseGBK.dict *}
+\Msg{* translator-theorem-dictionary-ChineseUTF8.dict *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file ctex.dtx *}
+\Msg{* through XeLaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
+%%
+%%
+%% End of file `ctex.ins'.