summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/ctex/ctex.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/ctex/ctex.dtx')
-rw-r--r--Master/texmf-dist/source/latex/ctex/ctex.dtx128
1 files changed, 79 insertions, 49 deletions
diff --git a/Master/texmf-dist/source/latex/ctex/ctex.dtx b/Master/texmf-dist/source/latex/ctex/ctex.dtx
index fd0a8bea23c..d4a80e43448 100644
--- a/Master/texmf-dist/source/latex/ctex/ctex.dtx
+++ b/Master/texmf-dist/source/latex/ctex/ctex.dtx
@@ -445,7 +445,7 @@ Copyright and Licence
%<*!(fd|ctexspa|dict)>
%<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\NeedsTeXFormat{LaTeX2e}
%<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\RequirePackage{expl3}
-%<+!driver>\GetIdInfo$Id: ctex.dtx cb8bf3c 2019-04-07 23:32:09 +0800 Qing Lee <sobenlee@gmail.com> $
+%<+!driver>\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $
%<ctxdoc> {ctex documentation (CTEX)}
%<ctxdoc>\ProvidesExplClass{ctxdoc}
%<ctex> {Chinese adapter in LaTeX (CTEX)}
@@ -538,7 +538,7 @@ Copyright and Licence
%<founder>\ProvidesExplFile{ctex-fontset-founder.def}
%<ubuntu> {Ubuntu fonts definition (CTEX)}
%<ubuntu>\ProvidesExplFile{ctex-fontset-ubuntu.def}
-%<!driver> {\ExplFileDate}{2.4.15}{\ExplFileDescription}
+%<!driver> {\ExplFileDate}{2.4.16}{\ExplFileDescription}
%</!(fd|ctexspa|dict)>
%<c19&rm>\ProvidesFile{c19rm.fd}%
%<c19&sf>\ProvidesFile{c19sf.fd}%
@@ -555,9 +555,9 @@ Copyright and Licence
%<ctexspa>\ProvidesFile{ctexspa.def}%
%<dict&theorem&GBK>\ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}%
%<dict&theorem&UTF8>\ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}%
-%<fd> [2019/04/07 v2.4.15 Chinese font definition (CTEX)]
-%<ctexspa> [2019/04/07 v2.4.15 Space info for CJKpunct (CTEX)]
-%<dict&theorem> [2019/04/07 v2.4.15 Chinese translation for theorem name (CTEX)]
+%<fd> [2019/05/29 v2.4.16 Chinese font definition (CTEX)]
+%<ctexspa> [2019/05/29 v2.4.16 Space info for CJKpunct (CTEX)]
+%<dict&theorem> [2019/05/29 v2.4.16 Chinese translation for theorem name (CTEX)]
%</!(driver|readme|install|zhmap|spa|docstrip)>
%<*driver>
\documentclass{ctxdoc}
@@ -581,7 +581,7 @@ Copyright and Licence
% \changes{v2.4.15}{2019/03/23}{同步 \LaTeXiii{} 2019/03/05。}
%
%
-% \CheckSum{5914}
+% \CheckSum{5934}
%
% \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
@@ -3257,36 +3257,24 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\ctex_set_default_ccwd:Nn}
-% 若参数 |#2| 带长度单位,则设置它为 |tl| 变量 |#1| 的值,否则以 \tn{ccwd} 为单位。
-% \begin{macrocode}
-\cs_new:Npn \ctex_set_default_ccwd:Nn #1#2
- {
- \dim_compare:nNnTF
- { \ctex_default_pt:n {#2} } = { \ctex_default_pt:n { #2 ~ mm } }
- { \tl_set:Nn #1 {#2} }
- { \tl_set:Nn #1 { #2 \ccwd } }
- }
-% \end{macrocode}
-% \end{macro}
-%
% \changes{v2.3}{2015/09/17}{代码实现避免使用 \tn{lowercase} 技巧(Joseph Wright)。}
%
-% \begin{macro}[int]{\ctex_default_pt:n}
-% 最新版本的 \pkg{expl3} 已经不允许 \cs{dim_to_decimal:n} 的参数带额外的单位。
-% 然而我们需要这个特性实现可展的 \tn{@defaultunits}。
+% \changes{v2.4.16}{2019/05/11}{允许设置 \texttt{autoindent} 为 $0$。}
+%
+% \begin{macro}[int]{\ctex_set_default_ccwd:Nn}
+% 若参数 |#2| 带长度单位,则设置它为 |tl| 变量 |#1| 的值,否则以 \tn{ccwd} 为单位。
% \begin{macrocode}
-\cs_new:Npn \ctex_default_pt:n #1
+\cs_new_protected:Npn \ctex_set_default_ccwd:Nn #1#2
+ { \tl_set:Nx #1 { \@@_default_ccwd_aux:n {#2} } }
+\cs_new:Npn \@@_default_ccwd_aux:n #1
{
- \exp_after:wN \@@_default_pt:w
+ \exp_not:n {#1}
+ \exp_after:wN \@@_default_ccwd_aux:w
\dim_use:N \tex_dimexpr:D #1 pt \scan_stop: \q_stop
}
-\use:x
- {
- \cs_new:Npn \exp_not:N \@@_default_pt:w
- ##1 \tl_to_str:n { pt } ##2 \exp_not:N \q_stop
- { ##1 \tl_to_str:n { pt } }
- }
+\exp_last_unbraced:NNNNo
+ \cs_new:Npn \@@_default_ccwd_aux:w #1 { \tl_to_str:n { pt } } #2 \q_stop
+ { \tl_if_empty:nT {#2} { \ccwd } }
% \end{macrocode}
% \end{macro}
%
@@ -7301,10 +7289,20 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[int]{\CTEX@disableautoindent}
+% 禁用自动调整首行缩进。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \CTEX@disableautoindent
+ { \tl_clear:N \l_@@_autoindent_tl }
+% \end{macrocode}
+% \end{macro}
+%
% \changes{v2.2}{2015/06/27}{\opt{beforeskip}、\opt{afterskip} 和 \opt{indent}
% 选项支持表达式。}
% \changes{v2.4.15}{2019/03/31}{修正 \opt{part/indent} 和 \opt{chapter/indent} 的实现方法。}
% \changes{v2.4.15}{2019/03/31}{定义 \opt{part/hang} 和 \opt{chapter/hang}。}
+% \changes{v2.4.16}{2019/05/11}{修正 \opt{part/indent} 和 \opt{chapter/indent}
+% 的实现方法,在其标题内部禁用 \opt{autoindent}。}
%
% \paragraph{part 的标题}
%
@@ -7377,9 +7375,11 @@ Copyright and Licence
\CTEX@makeanchor{part*}%
% \addcontentsline{toc}{part}{#1}%
\fi
+ \CTEX@gettitle{#1}%
\CTEX@addtocline{part}{#1}%
{\interlinepenalty \@M
% \normalfont \parindent \z@ \raggedright
+ \CTEX@disableautoindent
\normalfont \CTEX@part@format
% \ifnum \c@secnumdepth >\m@ne
% \Large\bfseries\partname\nobreakspace\thepart\par\nobreak
@@ -7415,11 +7415,13 @@ Copyright and Licence
\CTEX@makeanchor{part*}%
% \addcontentsline{toc}{part}{#1}%
\fi
+ \CTEX@gettitle{#1}%
\CTEX@addtocline{part}{#1}%
% \markboth{}{}%
\partmark{#1}%
{\interlinepenalty \@M
% \normalfont \centering
+ \CTEX@disableautoindent
\normalfont \CTEX@part@format
% \ifnum \c@secnumdepth >-2\relax
% \huge\bfseries\partname\nobreakspace\thepart\par\vskip 20\p@
@@ -7440,8 +7442,10 @@ Copyright and Licence
\def\@spart#1{%
\CTEX@ifnamefalse
\CTEX@makeanchor@spart{part*}%
+ \CTEX@gettitle{#1}%
{\interlinepenalty \@M
% \normalfont \parindent \z@ \raggedright
+ \CTEX@disableautoindent
\normalfont \CTEX@part@format
\CTEX@hangindent{part}{}%
% \huge \bfseries #1\par}%
@@ -7458,8 +7462,10 @@ Copyright and Licence
\def\@spart#1{%
\CTEX@ifnamefalse
\CTEX@makeanchor@spart{part*}%
+ \CTEX@gettitle{#1}%
{\interlinepenalty \@M
% \normalfont \centering
+ \CTEX@disableautoindent
\normalfont \CTEX@part@format
\CTEX@hangindent{part}{}%
% \Huge \bfseries #1\par}%
@@ -7548,6 +7554,7 @@ Copyright and Licence
\CTEX@makeanchor@chapter{\Hy@chapapp*}%
% \addcontentsline{toc}{chapter}{#1}%
\fi
+ \CTEX@gettitle{#1}%
\CTEX@addtocline{chapter}{#1}%
\chaptermark{#1}%
% \addtocontents{lof}{\protect\addvspace{10\p@}}%
@@ -7567,6 +7574,7 @@ Copyright and Licence
\def\@schapter#1{%
\CTEX@ifnamefalse
\CTEX@makeanchor@schapter{\Hy@chapapp*}%
+ \CTEX@gettitle{#1}%
\if@twocolumn
\@topnewpage[\@makeschapterhead{#1}]%
\else
@@ -7584,7 +7592,8 @@ Copyright and Licence
\ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi
\vspace*{\CTEX@headingskip}%
% {\normalfont \parindent \z@ \raggedright
- {\normalfont \CTEX@chapter@format
+ {\CTEX@disableautoindent
+ \normalfont \CTEX@chapter@format
\interlinepenalty\@M
% \ifnum \c@secnumdepth >\m@ne
% \if@mainmatter
@@ -7613,7 +7622,8 @@ Copyright and Licence
\ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi
\vspace*{\CTEX@headingskip}%
% {\normalfont \parindent \z@ \raggedright
- {\normalfont \CTEX@chapter@format
+ {\CTEX@disableautoindent
+ \normalfont \CTEX@chapter@format
\interlinepenalty\@M
\CTEX@hangindent{chapter}{}%
% \Huge \bfseries #1\par\nobreak
@@ -7692,6 +7702,7 @@ Copyright and Licence
\let\@svsec\@empty
\fi
\fi
+ \CTEX@gettitle{#7}%
% \@tempskipa #5\relax
% \ifdim \@tempskipa>\z@
\unless \ifodd \CTEX@runin
@@ -7733,6 +7744,7 @@ Copyright and Licence
% \begin{macrocode}
\def\@ssect#1#2#3#4#5{%
\CTEX@ifnamefalse
+ \CTEX@gettitle{#5}%
% \@tempskipa #3\relax
% \ifdim \@tempskipa>\z@
\unless \ifodd \CTEX@runin
@@ -7796,18 +7808,15 @@ Copyright and Licence
% \begin{macrocode}
\cs_new_protected:Npn \CTEX@hangindent #1#2
{
+ \dim_set:Nn \parindent { \use:c { CTEX@#1@indent } }
\bool_if:cTF { CTEX@#1@hang }
- { \@hangfrom }
- { \noindent \use:n }
- { \@@_indent_aux:n {#1} #2 }
+ { \@hangfrom { \@@_indent_aux: #2 } }
+ {#2}
}
-\cs_new_protected:Npn \@@_indent_aux:n #1
+\cs_new_protected_nopar:Npn \@@_indent_aux:
{
- \group_begin:
- \skip_set:Nn \l_@@_heading_skip { \use:c { CTEX@#1@indent } }
- \dim_compare:nNnF \l_@@_heading_skip = \c_zero_dim
- { \skip_horizontal:N \l_@@_heading_skip }
- \group_end:
+ \dim_compare:nNnF \parindent = \c_zero_dim
+ { \skip_horizontal:n { \parindent } }
}
% \end{macrocode}
% \end{macro}
@@ -8005,6 +8014,27 @@ Copyright and Licence
}
% \end{macrocode}
%
+% \paragraph{兼容 \pkg{nameref} 宏包}
+%
+% \changes{v2.4.16}{2019/05/29}{更好地兼容 \pkg{nameref} 宏包。}
+%
+% \begin{macro}[int]{\CTEX@gettitle}
+% 在 \pkg{nameref} 载入后才有意义,与上述 \pkg{hyperref} 的处理类似。
+% \begin{macrocode}
+\cs_new_protected:Npn \CTEX@gettitle #1
+ { }
+\ctex_at_end_package:nn { nameref }
+ {
+ \cs_gset_protected_nopar:Npn \CTEX@gettitle { \NR@gettitle }
+ \seq_map_inline:Nn \c_@@_headings_cs_seq
+ {
+ \cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 }
+ { \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \paragraph{兼容 \pkg{titlesec} 宏包}
%
% 我们修改了 \tn{@startsection} 的定义,它的第四个(\meta{beforeskip})和
@@ -8355,7 +8385,7 @@ Copyright and Licence
% \begin{macrocode}
\defbeamertemplate*{part page}{CTEX}[1][]{%
\begingroup
- \ctexset{autoindent=false}%
+ \CTEX@disableautoindent
% \centering
% {\usebeamerfont{part name}%
% \usebeamercolor[fg]{part name}\partname~\insertromanpartnumber}
@@ -8379,7 +8409,7 @@ Copyright and Licence
% \begin{macrocode}
\defbeamertemplate*{section page}{CTEX}[1][]{%
\begingroup
- \ctexset{autoindent=false}%
+ \CTEX@disableautoindent
% \centering
% {\usebeamerfont{section name}%
% \usebeamercolor[fg]{section name}\sectionname~\insertsectionnumber}
@@ -8403,7 +8433,7 @@ Copyright and Licence
% \begin{macrocode}
\defbeamertemplate*{subsection page}{CTEX}[1][]{%
\begingroup
- \ctexset{autoindent=false}%
+ \CTEX@disableautoindent
% \centering
% {\usebeamerfont{subsection name}%
% \usebeamercolor[fg]{subsection name}\subsectionname~\insertsubsectionnumber}
@@ -10242,7 +10272,7 @@ Copyright and Licence
% \begin{macrocode}
%<*windows>
\ProvidesFile{zhwindowsfonts.tex}%
- [2019/04/07 v2.4.15 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
+ [2019/05/29 v2.4.16 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
\ifzhmappdf
\pdfmapline{=gbk@UGBK@ <simsun.ttc}
@@ -10314,7 +10344,7 @@ Copyright and Licence
% \begin{macrocode}
%<*adobe>
\ProvidesFile{zhadobefonts.tex}%
- [2019/04/07 v2.4.15 Adobe font map loader for DVIPDFMx (CTEX)]
+ [2019/05/29 v2.4.16 Adobe font map loader for DVIPDFMx (CTEX)]
\ifzhmappdf
%% pdfTeX does not support OTF fonts
@@ -10350,7 +10380,7 @@ Copyright and Licence
% \begin{macrocode}
%<*fandol>
\ProvidesFile{zhfandolfonts.tex}%
- [2019/04/07 v2.4.15 Fandol font map loader for DVIPDFMx (CTEX)]
+ [2019/05/29 v2.4.16 Fandol font map loader for DVIPDFMx (CTEX)]
\ifzhmappdf
%% pdfTeX does not support OTF fonts
@@ -10386,7 +10416,7 @@ Copyright and Licence
% \begin{macrocode}
%<*founder>
\ProvidesFile{zhfounderfonts.tex}%
- [2019/04/07 v2.4.15 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
+ [2019/05/29 v2.4.16 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
\ifzhmappdf
\pdfmapline{=gbk@UGBK@ <FZSSK.TTF}
@@ -10458,7 +10488,7 @@ Copyright and Licence
% \begin{macrocode}
%<*ubuntu>
\ProvidesFile{zhubuntufonts.tex}%
- [2019/04/07 v2.4.15 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)]
+ [2019/05/29 v2.4.16 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)]
\ifzhmappdf
\pdfmapline{=gbk@UGBK@ <uming.ttc}