From 24a26d6f89a97e7ba548a2c42c0e6a6c80e6fb2a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 19 Jun 2015 22:32:36 +0000 Subject: ctex (19jun15) git-svn-id: svn://tug.org/texlive/trunk@37615 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/ctex/ctex.dtx | 1414 ++++++++++++++++---------- 1 file changed, 879 insertions(+), 535 deletions(-) (limited to 'Master/texmf-dist/source/latex/ctex') diff --git a/Master/texmf-dist/source/latex/ctex/ctex.dtx b/Master/texmf-dist/source/latex/ctex/ctex.dtx index af7f077cb5b..b635785a8d9 100644 --- a/Master/texmf-dist/source/latex/ctex/ctex.dtx +++ b/Master/texmf-dist/source/latex/ctex/ctex.dtx @@ -57,6 +57,7 @@ This package consists of the file ctex.dtx, and the derived files ctex.sty, ctexcap.sty, ctexsize.sty, + ctexheading.sty, ctexart.cls, ctexbook.cls, ctexrep.cls, @@ -192,6 +193,7 @@ This package consists of the file ctex.dtx, and the derived files ctex.sty, ctexcap.sty, ctexsize.sty, + ctexheading.sty, ctexart.cls, ctexbook.cls, ctexrep.cls, @@ -248,9 +250,10 @@ This package consists of the file ctex.dtx, and the derived files \generate { \usedir{tex/latex/ctex} - \file{ctex.sty} {\from{\jobname.dtx}{package,style}} - \file{ctexcap.sty} {\from{\jobname.dtx}{package,ctexcap}} - \file{ctexsize.sty} {\from{\jobname.dtx}{package,ctexsize}} + \file{ctex.sty} {\from{\jobname.dtx}{style,ctex}} + \file{ctexcap.sty} {\from{\jobname.dtx}{ctexcap}} + \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}} @@ -320,6 +323,7 @@ This package consists of the file ctex.dtx, and the derived files \Msg{* ctex.sty *} \Msg{* ctexcap.sty *} \Msg{* ctexsize.sty *} +\Msg{* ctexheading.sty *} \Msg{* ctexart.cls *} \Msg{* ctexbook.cls *} \Msg{* ctexrep.cls *} @@ -380,10 +384,10 @@ This package consists of the file ctex.dtx, and the derived files % %<*!(readme|install|zhmap|spa)> %<*!(c19|c70|ctexspa)> -%<*driver|package|class> +%<*driver|class|style|ctexcap> \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -% +% %<.!(readme|install|zhmap|spa|c19|c70|ctexspa)>\ctexPutVersion %<*driver> \InputIfFileExists{ctex.ver}{}{ @@ -392,12 +396,14 @@ This package consists of the file ctex.dtx, and the derived files {ctex source file} \ProvidesExplFile{\ExplFileName.\ExplFileExtension} % -% % \end{macrocode} % % \subsection{用户设置接口} @@ -3554,8 +3734,9 @@ This package consists of the file ctex.dtx, and the derived files % % \begin{macro}{\ctexset} % \begin{macrocode} -\NewDocumentCommand \ctexset { +m } - { \keys_set:nn { ctex } {#1} } +%<*class|ctex|ctexheading> +\NewDocumentCommand \ctexset { } { \keys_set:nn { ctex } } +% % \end{macrocode} % \end{macro} % @@ -3563,6 +3744,7 @@ This package consists of the file ctex.dtx, and the derived files % \begin{macro}{\CTEXsetup,\CTEXoptions} % 过时命令。 % \begin{macrocode} +%<*class|ctex> \NewDocumentCommand \CTEXsetup { +o > { \TrimSpaces } m } { \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXsetup } @@ -3575,13 +3757,10 @@ This package consists of the file ctex.dtx, and the derived files { \ctexset~ {~ #1~ }~ is~ set. } \IfNoValueF {#1} { \keys_set:nn { ctex } {#1} } } +% % \end{macrocode} % \end{macro} % -% \begin{macrocode} -% -% \end{macrocode} -% % \subsection{特定引擎支持与设置} % % \subsubsection{\pkg{ctex-engine-pdftex.def}} @@ -3590,6 +3769,81 @@ This package consists of the file ctex.dtx, and the derived files %<*pdftex> % \end{macrocode} % +% \changes{v2.1}{2015/05/18}{给 \pdfLaTeX{} 下的非 UTF8 编码 CJK 字体族加上 CMap。} +% +% \begin{variable}[int]{\c_@@_cmap_encoding_seq} +% 需要加上 CMap 的 CJK 字体编码。 +% \begin{macrocode} +\seq_new:N \c_@@_cmap_encoding_seq +\seq_set_from_clist:Nn \c_@@_cmap_encoding_seq + { C19 , C10 , C00 , C09 , C40 , C60 } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[int]{\ctex_family_cmap:nn} +% 在 \tn{DeclareFontFamily} 的 \meta{loading-settings} 中给 CJK 字体族加上 CMap。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \ctex_family_cmap:nn #1#2 + { + \cs_if_free:cF { #1 + #2 } + { + \seq_if_in:NnT \c_@@_cmap_encoding_seq {#1} + { \tl_gput_right:cn { #1 + #2 } { \ctex_add_cmap:n {#1} } } + } + } +\cs_generate_variant:Nn \ctex_family_cmap:nn { x } +\cs_new_eq:NN \CTEX@Family@CMap \ctex_family_cmap:xn +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\ctex_add_cmap:n} +% 给 |#1| 编码的 CJK 字体加上 CMap。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \ctex_add_cmap:n #1 + { + \cs_if_free:NF \CJK@plane + { \ctex_add_cmap:cn { @@_add_cmap_ #1 \CJK@plane : } {#1} } + } +\cs_new_protected_nopar:Npn \ctex_add_cmap:Nn #1#2 + { + \cs_if_exist:NF #1 { \@@_save_cmap:Nn #1 {#2} } + #1 + } +\cs_generate_variant:Nn \ctex_add_cmap:Nn { c } +\cs_new_protected_nopar:Npn \@@_save_cmap:Nn #1#2 + { + \tex_lowercase:D { \tl_set:Nx \l_@@_tmp_tl { #2 \CJK@plane } } + \tex_immediate:D \pdfobj stream ~ file { \l_@@_tmp_tl .cmap } + \cs_new_protected_nopar:Npx #1 + { + \exp_not:N \pdffontattr \exp_not:N \font + { /ToUnicode ~ \int_use:N \pdflastobj \c_space_tl 0 ~ R } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\DeclareFontFamily} +% 只在 \pdfLaTeX{} 下加 CMap。如 \pkg{cmap} 宏包被引入,则不重复设置。 +% \begin{macrocode} +\group_begin: +\char_set_catcode_other:N \# +\ctex_if_pdfmode:TF + { + \group_end: + \ExplSyntaxOff + \ctex_appto_cmd:NnTF \DeclareFontFamily { \CTEX@Family@CMap {#1} {#2} } + { + \ctex_at_end_package:nn { cmap } + { \cs_gset_eq:NN \CTEX@Family@CMap \use_none:nn } + } + { \ctex_patch_failure:N \DeclareFontFamily } + \ExplSyntaxOn + } + { \group_end: } +% \end{macrocode} +% \end{macro} +% % 首先检查选项,决定是否载入 \pkg{zhmCJK} 宏包。 % \begin{macrocode} \if_bool:N \g_@@_zhmCJK_bool @@ -3605,7 +3859,7 @@ This package consists of the file ctex.dtx, and the derived files \RequirePackage { CJKpunct , CJKspace } % \end{macrocode} % -% \begin{macro}[internal]{\ctex_load_zhmap:nnnn} +% \begin{macro}[int]{\ctex_load_zhmap:nnnn} % 载入 \pkg{zhmetrics} 的字体映射文件,同时设置 \tn{CJKrmdefault} 等。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_load_zhmap:nnnn #1#2#3#4 @@ -3643,7 +3897,7 @@ This package consists of the file ctex.dtx, and the derived files \fi: % \end{macrocode} % -% \begin{macro}[internal]{\ctex_CJK_input:n,\CJK@input} +% \begin{macro}[int]{\ctex_CJK_input:n,\CJK@input} % \pkg{breqn} 包可能会在正文中将 |^| 的 \tn{catcode} 改为 $12$ 或 $13$,这将 % 破坏 \pkg{CJK} 对汉字的首字节的定义(\tn{CJK@loadBinding} 和 % \tn{CJK@loadEncoding})。因此需要确保载入 \file{.enc} 和 \file{.bdg} 文件时, @@ -3668,7 +3922,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_plane_to_utfxvibe:Nn,\CJK@surr} +% \begin{macro}[int]{\ctex_plane_to_utfxvibe:Nn,\CJK@surr} % \changes{v2.0}{2014/04/08}{解决与 \tn{nouppercase} 的冲突。} % \pkg{fancyhdr} 宏包的 \tn{nouppercase} 会将 \tn{uppercase} 定义为 \tn{relax},而 % \tn{CJK@surr} 需要用它将 \tn{CJK@plane} 转化成大写字母,这就造成了冲突^^A @@ -3765,7 +4019,7 @@ This package consists of the file ctex.dtx, and the derived files \fi: % \end{macrocode} % -% \begin{macro}[internal]{\ctex_auto_ignorespaces:} +% \begin{macro}[int]{\ctex_auto_ignorespaces:} % 关闭名字空间,保存 \tn{CJK@@ignorespaces} 的定义,方便使用。 % \begin{macrocode} %<@@=> @@ -3777,7 +4031,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ignorespaces_case:N,\ctex_set_ignorespaces:} +% \begin{macro}[int]{\ctex_ignorespaces_case:N,\ctex_set_ignorespaces:} % 设置忽略空格的的方式。根据 \opt{space} 选项的值重定义 \tn{CJK@ignorespaces}, % 并保存起来供 \tn{CJKhook} 备用。 % \begin{macrocode} @@ -3792,16 +4046,16 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\CJKhook} +% \begin{macro}[int]{\CJKhook} % \env{CJK} 和 \env{CJK*} 环境都会重新定义 \tn{CJK@ignorespaces}。我们在 \pkg{CJK} % 宏包提供的 \tn{CJKhook} 里重新设置它,让这两个环境忽略空格的方式都受 \opt{space} % 选项的控制。这对 \pkg{zhmCJK} 是必要的。 % \begin{macrocode} -\ctex_add_hook:Nn \CJKhook { \ctex_set_ignorespaces: } +\ctex_gadd_hook:Nn \CJKhook { \ctex_set_ignorespaces: } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_punct_set:n} +% \begin{macro}[int]{\ctex_punct_set:n} % 设置 CJK 族对应到实际的字体。|#1| 是 \opt{fontset} 的名字。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_punct_set:n #1 @@ -3824,7 +4078,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_punct_map_family:nn} +% \begin{macro}[int]{\ctex_punct_map_family:nn} % CJK 族 |#1| 使用族 |#2| 的边界信息。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_punct_map_family:nn #1#2 @@ -3835,7 +4089,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_punct_map_bfseries:nn} +% \begin{macro}[int]{\ctex_punct_map_bfseries:nn} % CJK 族 |#1| 的 \tn{bfseries} 使用族 |#2| 的边界信息。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_punct_map_bfseries:nn #1#2 @@ -3858,7 +4112,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_punct_map_itshape:nn} +% \begin{macro}[int]{\ctex_punct_map_itshape:nn} % CJK 族 |#1| 的 \tn{itshape} 使用族 |#2| 的边界信息。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_punct_map_itshape:nn #1#2 @@ -3873,7 +4127,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_punct_space:nn,\ctexspadef} +% \begin{macro}[int]{\ctex_punct_space:nn,\ctexspadef} % 定义标点的边界信息。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_punct_space:nn #1#2 @@ -4069,7 +4323,7 @@ This package consists of the file ctex.dtx, and the derived files % % \paragraph{字体切换方式} % -% \begin{macro}[internal]{\ctex_ltj_select_font:,\CJK@family} +% \begin{macro}[int]{\ctex_ltj_select_font:,\CJK@family} % \tn{CJK@family} 保存的是当前 CJK 实际的字体族名,如果为空表示没有设置过字体。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_select_font: @@ -4084,7 +4338,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_select_font_aux:} +% \begin{macro}[int]{\@@_select_font_aux:} % 使用 \tn{pickup@font} 取得字体名称前,总需要先设置 \tn{font@name}。在这里将 % \tn{f@family} 换成 CJK 字体族,并确保编码正确。 % \begin{macrocode} @@ -4117,7 +4371,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_pickup_font:} +% \begin{macro}[int]{\ctex_ltj_pickup_font:} % 替换 \tn{define@newfont} 内部调用的 \tn{extract@font} 和 \tn{do@subst@correction}。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_pickup_font: @@ -4135,7 +4389,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_extract_font:} +% \begin{macro}[int]{\ctex_ltj_extract_font:} % \pkg{LuaTeX-ja} 的 \tn{globaljfont} 在 \pkg{luatexja-core} 中定义: % \begin{verbatim} % %%%%%%%% \jfont\CS={...:...;jfm=metric;...}, \globaljfont @@ -4170,14 +4424,14 @@ This package consists of the file ctex.dtx, and the derived files % 赋值总是全局的,不会受到分组的影响。 % \begin{macrocode} \font@name - \ctex_lua_now_x:n { font.current(tex.attribute['ltj@curjfnt']) } + \ctex_lua_now_x:n { font.current(tex.getattribute('ltj@curjfnt')) } \use:c { \f@encoding + \f@family } \use:c { \curr@fontshape } } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_subst_font:} +% \begin{macro}[int]{\ctex_ltj_subst_font:} % \tn{do@subst@correction} 在设置通过 \texttt{sub} 或者 \texttt{ssub} 函数定义的 % 字体时会用到。如果没有设置 \opt{SlantedFont},\pkg{fontspec} 会设置 % \tn{itdefault} 作为 \tn{sldefault} 的替代字形,因而会用到这个函数。它的本来定义是: @@ -4217,7 +4471,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal,TF]{\ctex_ltj_if_alternate_shape_exist:n} +% \begin{macro}[int,TF]{\ctex_ltj_if_alternate_shape_exist:n} % 即 \pkg{LuaTeX-ja} 中的 \tn{ltj@@does@alt@set},判断是否存在替代字体。 % \begin{macrocode} \prg_new_conditional:Npnn \ctex_ltj_if_alternate_shape_exist:n #1 { T , F , TF } @@ -4245,7 +4499,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_select_alternate_font:} +% \begin{macro}[int]{\ctex_ltj_select_alternate_font:} % 在 \tn{selectfont} 中更新替代字体。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_select_alternate_font: @@ -4266,7 +4520,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ltj@pickup@altfont@auxy} +% \begin{macro}[int]{\ltj@pickup@altfont@auxy} % 被用在函数 |output_alt_font_cmd| 中,作用是定义替代字体。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ltj@pickup@altfont@auxy #1 @@ -4288,7 +4542,7 @@ This package consists of the file ctex.dtx, and the derived files %<@@=> % \end{macrocode} % -% \begin{macro}[internal]{\ltj@pickup@altfont@copy} +% \begin{macro}[int]{\ltj@pickup@altfont@copy} % 被用在函数 |pickup_alt_font_a| 中。\tn{ltj@@getjfontnumber} 的作用是将字体命令 % |#1| 对应的 \texttt{font.id} 保存到 \tn{ltj@tempcntc} 中。 % \begin{macrocode} @@ -4355,7 +4609,7 @@ This package consists of the file ctex.dtx, and the derived files \ExplSyntaxOn % \end{macrocode} % -% \begin{macro}[internal]{\ctex_mono_jfm:n,\l_@@_jfm_tl} +% \begin{macro}[int]{\ctex_mono_jfm:n,\l_@@_jfm_tl} % \pkg{LuaTeX-ja} 中与标点格式 \opt{plain} 对应的 \texttt{JFM} 是 \opt{mono}。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_mono_jfm:n #1 @@ -4370,7 +4624,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\CJK@encoding,\@@_change_encoding:} +% \begin{macro}[int]{\CJK@encoding,\@@_change_encoding:} % 在 \LaTeX 下,\pkg{LuaTeX-ja} 依赖字体编码来实现特殊设置。例如上述的 % \tn{ltj@@IsFontJapanese} 就是通过判断编码来实现的,它在设置数学字体时会用到。所以 % 不应该与西文共用 \texttt{EU2}。定义字体族 song 为 \tn{CJK@encoding} 的默认替换 @@ -4416,7 +4670,7 @@ This package consists of the file ctex.dtx, and the derived files \cs_new:Npn \@@_noembed_wrap:n #1 { psft: #1 } % \end{macrocode} % -% \begin{macro}[internal]{\ctex_ltj_set_family:nnn} +% \begin{macro}[int]{\ctex_ltj_set_family:nnn} % 将自定义的字体族名与 \pkg{fontspec} 实际设置的名字对应起来。 % \begin{macrocode} \cs_new_protected:Npn \ctex_ltj_set_family:nnn #1#2#3 @@ -4450,7 +4704,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{variable}[internal] +% \begin{variable}[int] % {\g_@@_family_name_prop,\g_@@_family_font_name_prop,\g_@@_family_font_options_prop} % 分别保存 \pkg{fontspec} 设置的字体族名、字体名称和字体选项。 % \begin{macrocode} @@ -4460,7 +4714,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{variable} % -% \begin{macro}[internal]{\@@_check_family:n} +% \begin{macro}[int]{\@@_check_family:n} % 删除重复的定义,清除替代字体的先前设置。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_check_family:n #1 @@ -4485,7 +4739,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_gset_family_cs:nn} +% \begin{macro}[int]{\@@_gset_family_cs:nn} % 在设置字体时,实际上并不是马上就定义。而是只保存相关参数,在通过 \tn{CJKfamily} % 第一次使用时才定义。需要注意将编码改为 \tn{CJK@encoding}。 % \begin{macrocode} @@ -4520,7 +4774,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\CJKfamily} +% \begin{macro}[int]{\CJKfamily} % 切换字体。 % \begin{macrocode} \NewDocumentCommand \CJKfamily { m } @@ -4539,7 +4793,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal,TF]{\ctex_ltj_family_if_exist:n} +% \begin{macro}[int,TF]{\ctex_ltj_family_if_exist:n} % 判断 CJK 字体族 |#1| 是否存在,若存在则把实际族名保存到 |#2| 中。 % \begin{macrocode} \prg_new_protected_conditional:Npnn \ctex_ltj_family_if_exist:xN #1#2 { T , F , TF } @@ -4559,7 +4813,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_family_unknown_warning:n} +% \begin{macro}[int]{\@@_family_unknown_warning:n} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_family_unknown_warning:n #1 { @@ -4602,7 +4856,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_fontspec:nn} +% \begin{macro}[int]{\ctex_ltj_fontspec:nn} % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_fontspec:nn #1#2 { @@ -4643,7 +4897,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal] +% \begin{macro}[int] % {\ctex_ltj_add_font_features:n,\ctex_ltj_add_font_features:nn} % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_add_font_features:n #1 @@ -4674,7 +4928,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal] +% \begin{macro}[int] % {\setCJKfamilyfont,\newCJKfontfamily,\CJKfontspec,\addCJKfontfeatures} % \begin{macrocode} \NewDocumentCommand \setCJKfamilyfont { m O { } m } @@ -4701,7 +4955,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal] +% \begin{macro}[int] % {\setCJKmainfont,\setCJKsansfont,\setCJKmonofont, % \setCJKmathfont,\defaultCJKfontfeatures} % \begin{macrocode} @@ -4752,7 +5006,7 @@ This package consists of the file ctex.dtx, and the derived files { \ctex_patch_failure:N \normalfont } % \end{macrocode} % -% \begin{macro}[internal]{\ctex_ltj_ensure_default_family:} +% \begin{macro}[int]{\ctex_ltj_ensure_default_family:} % 在导言区结束确认 \tn{CJKfamilydefault} 确实存在。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_ensure_default_family: @@ -4783,7 +5037,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_update_mathfont:} +% \begin{macro}[int]{\ctex_ltj_update_mathfont:} % 更新数学字体为实际的字体。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_update_mathfont: @@ -4829,7 +5083,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_set_alternate_seq:n} +% \begin{macro}[int]{\ctex_ltj_set_alternate_seq:n} % 我们使用 \verb=||= 作为替代字体序列的分隔标志。它可能被设置为活动字符,为此 % 需要先“消毒”,同时过滤掉空元素。 % \begin{macrocode} @@ -4858,7 +5112,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_set_alternate_family:nnF} +% \begin{macro}[int]{\ctex_ltj_set_alternate_family:nnF} % 如果在字体的选项中设置了 \opt{CharRange},则只设置替代字体。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:nnF #1#2#3 @@ -4875,7 +5129,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal] +% \begin{macro}[int] % {\ctex_ltj_save_alternate_seq:Nn,\ctex_ltj_save_alternate_seq:Nnnwn} % 保存由 \opt{AlternateFont} 设置的替代字体序列。 % \begin{macrocode} @@ -4909,7 +5163,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_set_alternate_family:nn} +% \begin{macro}[int]{\ctex_ltj_set_alternate_family:nn} % 设置选项 \opt{CharRange} 范围内的替代字体。如果已经定义了主字体,我们也马上 % 定义替代字体,否则只保存起来备用。 % \begin{macrocode} @@ -4932,7 +5186,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_save_alternate_family:Nnnn} +% \begin{macro}[int]{\ctex_ltj_save_alternate_family:Nnnn} % 保存替代字体序列的定义,以备定义主字体时使用。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_save_alternate_family:Nnnn #1#2#3#4 @@ -4944,7 +5198,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_set_alternate_family:nnn} +% \begin{macro}[int]{\ctex_ltj_set_alternate_family:nnn} % 实际定义替代字体族。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:nnn #1#2#3 @@ -4962,7 +5216,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_swap_cs:NN} +% \begin{macro}[int]{\ctex_ltj_swap_cs:NN} % 交换两个控制序列的意义。 % \begin{macrocode} \cs_new_protected:Npn \ctex_ltj_swap_cs:NN #1#2 @@ -4975,7 +5229,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{LTJFONTUID,\@@_update_family_uid:N} +% \begin{macro}[int]{LTJFONTUID,\@@_update_family_uid:N} % \pkg{fontspec} 在一个字体族的选项和字体名称相同的时候,就不定义新字体。为了 % 避免混淆替代字体的设置,我们新定义一个虚拟的选项 \opt{LTJFONTUID},确保 % \pkg{fontspec} 对 CJK 字体族总是定义新字体。 @@ -4990,7 +5244,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_declare_alternate_shape:nnnnnn} +% \begin{macro}[int]{\ctex_ltj_declare_alternate_shape:nnnnnn} % 在定义替代字体的字形时,通过字符范围与主字体的对应字形关联起来。 % \tn{DeclareFontShape@} 一个有六个参数,我们只需要使用它的第三个参数 \meta{series} % 和第四个参数 \meta{shape}。 @@ -5005,7 +5259,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_set_alternate_shape:Nnnnnnn} +% \begin{macro}[int]{\ctex_ltj_set_alternate_shape:Nnnnnnn} % 与 \pkg{LuaTeX-ja} 的 \tn{DeclareAlternateKanjiFont} 的功能类似,区别是固定编码 % 为 \tn{CJK@encoding}。这个设置总是全局的。 % \begin{macrocode} @@ -5028,7 +5282,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_set_alternate_shape:nnn} +% \begin{macro}[int]{\ctex_ltj_set_alternate_shape:nnn} % 我们使用 \texttt{->} 而不是像 \pkg{LuaTeX-ja} 一样使用 \texttt{-} 作为区间的 % 分隔符。\pkg{LuaTeX-ja} 支持使用负数来引用由 \texttt{JFM} 设置的字符类。如果 % 使用 \texttt{-} 作为分隔符,那么负数单独使用时,就需要把它放在两层花括号之内 @@ -5061,7 +5315,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_set_alternate_shape:nnN} +% \begin{macro}[int]{\ctex_ltj_set_alternate_shape:nnN} % 若字符范围预先由 \texttt{declarecharrange} 声明,则可以直接使用。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_shape:nnN #1#2#3 @@ -5158,7 +5412,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_declare_char_range:nn,\g_@@_char_range_prop} +% \begin{macro}[int]{\ctex_ltj_declare_char_range:nn,\g_@@_char_range_prop} % |#1| 是名字,|#2| 是范围。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_declare_char_range:nn #1#2 @@ -5174,7 +5428,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_save_char_range:n} +% \begin{macro}[int]{\ctex_ltj_save_char_range:n} % 预先解释字符区间的意义。 % \begin{macrocode} \NewDocumentCommand \ctex_ltj_save_char_range:n @@ -5195,7 +5449,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_def_char_range_key:n} +% \begin{macro}[int]{\ctex_ltj_def_char_range_key:n} % 在字体设置选项中定义字符范围键。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_ltj_def_char_range_key:n #1 @@ -5209,7 +5463,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_ltj_char_range_key:nn} +% \begin{macro}[int]{\ctex_ltj_char_range_key:nn} % 如果字符范围键没有值,则只设置的这个字符范围内的替代字体。 % \begin{macrocode} \cs_new_protected:Npn \ctex_ltj_char_range_key:nn #1#2 @@ -5227,7 +5481,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_char_range_parse_feature:w} +% \begin{macro}[int]{\@@_char_range_parse_feature:w} % 可以使用加方括号的方式,通过文件名来调用字体。这容易与字体选项混淆。例如,需要 % 将 |[simsun.ttc]| 设置为 \opt{range} 的主字体,就需要使用 % |range={{[simsun.ttc]}}| 或者 |[]{[simsun.ttc]}|。下面的目的是,支持直接使用 @@ -5252,7 +5506,7 @@ This package consists of the file ctex.dtx, and the derived files % % \paragraph{其它设置} % -% \begin{macro}[internal]{\ctex_ltj_update_xkanjiskip:,\l_@@_xkanjiskip_skip} +% \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} 一样,如果在 @@ -5312,7 +5566,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsubsection{调整 \tn{CJKfamilydefault}} % -% \begin{macro}[internal]{\ctex_update_default_family:} +% \begin{macro}[int]{\ctex_update_default_family:} % 在导言区结束,如果 \tn{CJKfamilydefault} 没有被更改,则在此时根据西文字体的情况 % 更新 \tn{CJKfamilydefault}。\pkg{xeCJK} 已经有这个功能,不需要再调整。 % \begin{macrocode} @@ -5347,7 +5601,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\l_@@_family_default_init_tl} +% \begin{macro}[int]{\l_@@_family_default_init_tl} % 往 \tn{CJKfamilydefault} 中加入标志,用于判断它是否被更改。 % \begin{macrocode} \tl_new:N \l_@@_family_default_init_tl @@ -5366,7 +5620,7 @@ This package consists of the file ctex.dtx, and the derived files % % \changes{v2.0}{2014/04/16}{自动检测操作系统,载入对应的字体配置。} % -% \begin{macro}[internal]{\ctex_detected_platform:} +% \begin{macro}[int]{\ctex_detected_platform:} % 在 \LuaTeX{} 下直接用调用 |os.name| 来判断。 % \begin{macrocode} %<*luatex> @@ -5415,8 +5669,9 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_if_macosx:TF} -% 以 \file{/mach_kernel} 为特征文件判断 Mac~OS~X。 +% \begin{macro}[int]{\ctex_if_macosx:TF} +% \changes{v2.1}{2015/06/17}{改用 \file{/Library/Fonts/Songti.ttc} 为特征文件。} +% 以 \file{/Library/Fonts/Songti.ttc} 为特征文件判断 Mac~OS~X。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_if_macosx:TF #1#2 { @@ -5424,23 +5679,25 @@ This package consists of the file ctex.dtx, and the derived files { \tl_gset:Nn \g_@@_fontset_tl {#1} } { \tl_gset:Nn \g_@@_fontset_tl {#2} } } -\tl_const:Nn \c_@@_macosx_file_tl { /mach_kernel } +\tl_const:Nn \c_@@_macosx_file_tl { /Library/Fonts/Songti.ttc } % % \end{macrocode} % \end{macro} % % \subsubsection{\pkg{hyperref} 兼容性处理} % +% \changes{v2.1}{2015/06/16}{不再设置 \pkg{hyperref} 宏包的 \opt{colorlinks} 选项。} +% % 现在处理各个引擎下的 PDF 中文书签问题。根据编译引擎与文件编码的不 % 同,\pkg{ctex} 向 \pkg{hyperref} 传递适当的参数,完成中文书签的正确设置。用 % 户仍需要自己载入 \pkg{hyperref} 宏包。 % -% \begin{macro}[internal]{\ctex_hypersetup:n} +% \begin{macro}[int]{\ctex_hypersetup:n} % 如果已经载入 \pkg{hyperref} 宏包,则直接使用其定义设置选项;否则 % \cs{ctex_hypersetup:n} 的效果与 \tn{PassOptionsToPackage} 一致,只传递宏包参 % 数。如果用户不载入 \pkg{hyperref} 宏包,相关参数即被丢弃。 % \begin{macrocode} -%<*class|style> +%<*class|ctex> \@ifpackageloaded { hyperref } { \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 @@ -5450,8 +5707,7 @@ This package consists of the file ctex.dtx, and the derived files \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 { \PassOptionsToPackage {#1} { hyperref } } } -\ctex_hypersetup:n { colorlinks = true } -% +% % \end{macrocode} % \end{macro} % @@ -5536,7 +5792,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsubsection{\pkg{CJKfntef}、\pkg{xeCJKfntef} 相关设置} % -% \CTeX{} 套件对 \pdfTeX{} 与 \XeTeX{} 引擎,分别载入 \pkg{CJKfntef} 或 +% \CTeX{} 宏集对 \pdfTeX{} 与 \XeTeX{} 引擎,分别载入 \pkg{CJKfntef} 或 % \pkg{xeCJKfntef} 宏包,并关闭宏包默认的彩色等多余格式。 % % \changes{v2.0}{2015/03/25}{默认关闭 \pkg{CJKfntef} 或 \pkg{xeCJKfntef} 的彩 @@ -5549,8 +5805,25 @@ This package consists of the file ctex.dtx, and the derived files % 的宏定义是过时命令,仅做兼容性保留。 % % \begin{macrocode} -%\RequirePackage { CJKfntef } \normalem -%\RequirePackage { xeCJKfntef } +%<*pdftex> +\RequirePackage { CJKfntef } +\normalem +\cs_new_protected_nopar:Npn \@@_clear_fntef_color:n #1 + { \tl_clear:c { CJK#1color } } +% +%<*xetex> +\RequirePackage { xeCJKfntef } +\@ifpackagelater { xeCJKfntef } { 2014/11/04 } + { + + \cs_new_protected_nopar:Npn \@@_clear_fntef_color:n #1 + { \xeCJKsetup { #1 / format = { } } } + } + { + \cs_new_protected_nopar:Npn \@@_clear_fntef_color:n #1 + { \tl_clear:c { CJK#1color } } + } +% %<*luatex> \msg_new:nnn { ctex } { fntef-not-available } { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ LuaLaTeX. } @@ -5560,8 +5833,7 @@ This package consists of the file ctex.dtx, and the derived files { underdot , underline , underdblline , underwave , sout , xout } %<*pdftex|xetex> { -% \tl_clear:c { CJK#1color } -% \keys_set:nn { xeCJK / options } { #1 / format = { } } + \@@_clear_fntef_color:n {#1} \cs_new_protected_nopar:cpx { CTEX#1 } { \msg_warning:nnnn { ctex } { deprecated-command } { \exp_not:c { CTEX#1 } } @@ -5600,7 +5872,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsubsection{\tn{ccwd} 的更新} % -% \begin{macro}[internal]{\ctex_update_ccwd:,\ccwd} +% \begin{macro}[int]{\ctex_update_ccwd:,\ccwd} % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_update_ccwd: %<*pdftex|xetex> @@ -5616,7 +5888,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_update_ccglue:} +% \begin{macro}[int]{\ctex_update_ccglue:} % 更新字间距。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_update_ccglue: @@ -5636,7 +5908,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal,pTF]{\ctex_if_ccglue_touched:} +% \begin{macro}[int,pTF]{\ctex_if_ccglue_touched:} % 检查用户是否修改过汉字间距。 % \begin{macrocode} \prg_new_conditional:Npnn \ctex_if_ccglue_touched: { TF } @@ -5660,7 +5932,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_update_em_unit:} +% \begin{macro}[int]{\ctex_update_em_unit:} % 将当前汉字的宽度保存到 \tn{ccwd} 中备用。不采用 \texttt{1 em},因为这时的 % \texttt{1 em} 实际上来自西文字体的信息,未必等于汉字的宽度,这似乎在传统的 % \file{.tfm} 字体上表现更明显。在 \pdfTeX{} 和 \XeTeX{} 下,直接使用 |\f@size\p@| @@ -5678,7 +5950,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsubsection{其它} % -% \begin{macro}[internal]{\ctex_add_to_selectfont:n,\CTEX@selectfont@hook} +% \begin{macro}[int]{\ctex_add_to_selectfont:n,\CTEX@selectfont@hook} % \tn{EverySelectfont} 直到文档开始时才有效。为了 \tn{ccwd} 和 \pkg{LuaTeX-ja} 的 % 字体设置在导言区也可用,我们还需要在这里手工修改 \tn{selectfont}。\pkg{everysel} % 宏包会用 \tn{CheckCommand} 来检查 \tn{selectfont} 是否为标准定义。我们修改了 @@ -5779,7 +6051,7 @@ This package consists of the file ctex.dtx, and the derived files % % \begin{macrocode} % -%<*class|style> +%<*class|ctex> % \end{macrocode} % % \subsubsection{载入引擎定义文件} @@ -5833,7 +6105,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_update_size:} +% \begin{macro}[int]{\ctex_update_size:} % 在字号变化时更新 \tn{ccwd}、\tn{parindent} 和汉字间距。字距为零则恢复正常设置。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_update_size: @@ -5876,7 +6148,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_update_stretch:} +% \begin{macro}[int]{\ctex_update_stretch:} % 首先计算一行上汉字的字数,\tn{CJKglue} 相当于将 \tn{linewidth} 与汉字总宽度之差 % 均匀地填充到汉字之间。\hologo{eTeX} 的除法是四舍五入,而我们这里应该用截断。由于 % 没有可展性的要求,直接用原语 \cs{tex_divide:D} 要比 \cs{int_div_truncate:nn} @@ -5923,7 +6195,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_update_parindent:} +% \begin{macro}[int]{\ctex_update_parindent:} % 更新段落首行缩进。此函数在字号变化时调用。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_update_parindent: @@ -5950,7 +6222,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_update_ziju:} +% \begin{macro}[int]{\ctex_update_ziju:} % 更新字距。若字距不大于 $-1$,即 \tn{ccwd} 为非正值,则不计算伸缩值。 % 否则,首先假定汉字的宽度为正常宽度加上字距,看一行上能正常放下多少个汉字。 % \begin{macrocode} @@ -6092,7 +6364,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % % \begin{macrocode} -%<*style> +%<*ctex> \msg_new:nnn { ctex } { ctexbibname } { Neither~`\token_to_str:N \bibname'~nor~`\token_to_str:N \refname'~can~be~found.\\ @@ -6108,11 +6380,11 @@ This package consists of the file ctex.dtx, and the derived files \keys_define:nn { ctex } { bibname .tl_set:N = \ctexbibname } } } -% +% % \end{macrocode} % % \begin{macrocode} -% +% % \end{macrocode} % % \subsection{中文化的标题结构} @@ -6124,7 +6396,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsubsection{定义标题格式选项} % -% \begin{variable}[internal]{\c_@@_headings_seq} +% \begin{variable}[int]{\c_@@_headings_seq} % \begin{macrocode} \seq_new:N \c_@@_headings_seq \seq_gset_from_clist:Nn \c_@@_headings_seq @@ -6136,7 +6408,9 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{variable} % -% \begin{macro}[internal]{\@@_initial_heading:n} +% \changes{v2.1}{2015/06/19}{\opt{nameformat} 可以接受章节名字为参数。} +% +% \begin{macro}[int]{\@@_initial_heading:n} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_initial_heading:n #1 { @@ -6151,23 +6425,29 @@ This package consists of the file ctex.dtx, and the derived files \tl_const:cx { CTEX@#1name } { \exp_not:c { CTEX@#1@nameformat } - \exp_not:c { CTEX@pre#1 } - \exp_not:N \tl_if_empty:NTF \exp_not:c { CTEX@#1@numberformat } - { \exp_not:c { CTEX@the#1 } } { - \group_begin: - \exp_not:c { CTEX@#1@numberformat } - \exp_not:c { CTEX@the#1 } - \group_end: + \exp_not:c { CTEX@pre#1 } + \exp_not:N \tl_if_empty:NTF \exp_not:c { CTEX@#1@numberformat } + { \exp_not:c { CTEX@the#1 } } + { + \group_begin: + \exp_not:c { CTEX@#1@numberformat } + \exp_not:c { CTEX@the#1 } + \group_end: + } + \exp_not:c { CTEX@post#1 } } - \exp_not:c { CTEX@post#1 } \exp_not:c { CTEX@#1@aftername } } } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_def_heading_keys:n} +% \changes{v2.1}{2015/05/22}{\opt{format+}, \opt{nameformat+} 等带加号的选项, +% 加号与前面的文字之间可以有可选的空格。} +% \changes{v2.1}{2015/06/19}{新的标题格式选项 \opt{aftertitle}。} +% +% \begin{macro}[int]{\@@_def_heading_keys:n} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_def_heading_keys:n #1 { @@ -6182,19 +6462,34 @@ This package consists of the file ctex.dtx, and the derived files #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , + #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , #1 / format+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , + #1 / format~+ .code:n = + { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , #1 / nameformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , + #1 / nameformat~+ .code:n = + { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , #1 / numberformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , + #1 / numberformat~+ .code:n = + { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , #1 / aftername+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , + #1 / aftername~+ .code:n = + { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , #1 / titleformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , + #1 / titleformat~+ .code:n = + { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , + #1 / aftertitle+ .code:n = + { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , + #1 / aftertitle~+ .code:n = + { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , #1 / beforeskip .initial:n = \c_zero_skip , #1 / afterskip .initial:n = \c_zero_skip , #1 / indent .initial:n = \c_zero_dim , @@ -6206,7 +6501,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_assign_heading_name:nn,\@@_assign_heading_name:nnn} +% \begin{macro}[int]{\ctex_assign_heading_name:nn,\@@_assign_heading_name:nnn} % \opt{name} 的值是一个至多两个元素的逗号分隔列表。由于 \LTXIII{} 的 % \texttt{clist} 总是会自动忽略空元素,所以设置 |name={,章}| 后,第一个元素将会 % 是“章”,必须用空的分组保护空元素:|name={{},章}|,这在使用中有些许不便。我们 @@ -6226,32 +6521,32 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macrocode} -\tl_clear:N \l_@@_tmp_tl -\seq_map_inline:Nn \c_@@_headings_seq - { - \@@_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 -% \end{macrocode} -% % \changes{v2.0}{2014/03/21}{标题设置新增 \opt{pagestyle} 选项。} % -% \begin{macro}{pagestyle} +% \begin{macro}{part/pagestyle,chapter/pagestyle} % 只在 \cls{ctexbook} 和 \cls{ctexrep} 下有定义。 % \begin{macrocode} %<*book|report> -\keys_define:nn { ctex } +\tl_set:Nn \l_@@_tmp_tl { part / pagestyle .tl_set:N = \CTEX@part@pagestyle , - chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle + chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle , } % % \end{macrocode} % \end{macro} % +% 定义标题键值选项。 +% \begin{macrocode} +\seq_map_inline:Nn \c_@@_headings_seq + { + \@@_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 +% \end{macrocode} +% % % \subsubsection{标准标题命令的修改} % @@ -6261,7 +6556,7 @@ This package consists of the file ctex.dtx, and the derived files %<@@=> % \end{macrocode} % -% \begin{macro}[internal]{\part} +% \begin{macro}[int]{\part} % \begin{macrocode} %<*article> \renewcommand\part{% @@ -6280,7 +6575,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@part} +% \begin{macro}[int]{\@part} % \begin{macrocode} %<*article> \def\@part[#1]#2{% @@ -6300,7 +6595,8 @@ This package consists of the file ctex.dtx, and the derived files \fi % \huge\bfseries #2% \CTEX@part@titleformat{#2}% - \markboth{}{}\par}% + \markboth{}{}% + \CTEX@part@aftertitle}% \nobreak % \vskip 3ex \vskip \CTEX@part@afterskip @@ -6330,13 +6626,14 @@ This package consists of the file ctex.dtx, and the derived files \CTEX@partname \fi % \Huge\bfseries #2\par}% - \CTEX@part@titleformat{#2}\par}% + \CTEX@part@titleformat{#2}% + \CTEX@part@aftertitle}% \@endpart} % % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@spart} +% \begin{macro}[int]{\@spart} % \begin{macrocode} %<*article> \def\@spart#1{% @@ -6344,7 +6641,8 @@ This package consists of the file ctex.dtx, and the derived files % \normalfont \parindent \z@ \raggedright \normalfont \parindent \CTEX@part@indent \CTEX@part@format % \huge \bfseries #1\par}% - \CTEX@part@titleformat{#1}\par}% + \CTEX@part@titleformat{#1}% + \CTEX@part@aftertitle}% \nobreak % \vskip 3ex \vskip \CTEX@part@afterskip @@ -6356,7 +6654,8 @@ This package consists of the file ctex.dtx, and the derived files % \normalfont \centering \normalfont \CTEX@part@format % \Huge \bfseries #1\par}% - \CTEX@part@titleformat{#1}\par}% + \CTEX@part@titleformat{#1}% + \CTEX@part@aftertitle}% \@endpart} % % \end{macrocode} @@ -6368,7 +6667,7 @@ This package consists of the file ctex.dtx, and the derived files %<*book|report> % \end{macrocode} % -% \begin{macro}[internal]{\@chapter} +% \begin{macro}[int]{\@chapter} % \begin{macrocode} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne @@ -6397,7 +6696,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@makechapterhead} +% \begin{macro}[int]{\@makechapterhead} % \begin{macrocode} \def\@makechapterhead#1{% \thispagestyle{\CTEX@chapter@pagestyle}% @@ -6419,14 +6718,16 @@ This package consists of the file ctex.dtx, and the derived files \fi \interlinepenalty\@M % \Huge \bfseries #1\par\nobreak - \CTEX@chapter@titleformat{#1}\par\nobreak + \CTEX@chapter@titleformat{#1}% + \CTEX@chapter@aftertitle + \nobreak % \vskip 40\p@ \vskip \CTEX@chapter@afterskip }} % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@makeschapterhead} +% \begin{macro}[int]{\@makeschapterhead} % \begin{macrocode} \def\@makeschapterhead#1{% \thispagestyle{\CTEX@chapter@pagestyle}% @@ -6442,7 +6743,9 @@ This package consists of the file ctex.dtx, and the derived files {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format \interlinepenalty\@M % \Huge \bfseries #1\par\nobreak - \CTEX@chapter@titleformat{#1}\par\nobreak + \CTEX@chapter@titleformat{#1} + \CTEX@chapter@aftertitle + \nobreak % \vskip 40\p@ \vskip \CTEX@chapter@afterskip }} @@ -6455,7 +6758,7 @@ This package consists of the file ctex.dtx, and the derived files % % \paragraph{section 类的标题} % -% \begin{macro}[internal]{\@seccntformat} +% \begin{macro}[int]{\@seccntformat} % \begin{macrocode} \def\@seccntformat#1{% \@ifundefined{CTEX@#1name}% @@ -6464,7 +6767,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@sect} +% \begin{macro}[int]{\@sect} % \begin{macrocode} \def\@sect#1#2#3#4#5#6[#7]#8{% \ifnum #2>\c@secnumdepth @@ -6480,7 +6783,8 @@ This package consists of the file ctex.dtx, and the derived files \@hangfrom{\hskip #3\relax\@svsec}% % \interlinepenalty \@M #8\@@par}% \interlinepenalty \@M - \csname CTEX@#1@titleformat\endcsname{#8}\@@par}% + \csname CTEX@#1@titleformat\endcsname{#8}% + \csname CTEX@#1@aftertitle\endcsname}% \endgroup \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% @@ -6495,7 +6799,9 @@ This package consists of the file ctex.dtx, and the derived files \def\@svsechd{% #6{\hskip #3\relax % \@svsec #8}% - \@svsec \csname CTEX@#1@titleformat\endcsname{#8}}% + \@svsec + \csname CTEX@#1@titleformat\endcsname{#8}% + \csname CTEX@#1@aftertitle\endcsname}% \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else @@ -6510,7 +6816,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@ssect} +% \begin{macro}[int]{\@ssect} % \tn{@ssect} 并没有参数给出当前标题的名字,扩展它的参数会与 \pkg{hyperref} 冲突。 % 它的第二个参数是 BEFORESKIP(\tn{@startsection} 的第四个参数),在定义中并没有 % 被用到,应该可以用它来传递名字。我们这里通过函数 \tn{CTEX@titleformat@n} 来传递, @@ -6524,11 +6830,12 @@ This package consists of the file ctex.dtx, and the derived files \@hangfrom{\hskip #1}% % \interlinepenalty \@M #5\@@par}% \interlinepenalty \@M - \CTEX@titleformat@n{#5}\@@par}% + \CTEX@titleformat@n{#5}% + \CTEX@aftertitle}% \endgroup \else % \def\@svsechd{#4{\hskip #1\relax #5}}% - \def\@svsechd{#4{\hskip #1\relax \CTEX@titleformat@n{#5}}}% + \def\@svsechd{#4{\hskip #1\relax \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} % \end{macrocode} @@ -6538,12 +6845,16 @@ This package consists of the file ctex.dtx, and the derived files %<@@=ctex> % \end{macrocode} % -% \begin{macro}[internal]{\CTEX@set@titleformat@n, \CTEX@titleformat@n} +% \begin{macro}[int]{\CTEX@set@titleformat@n, \CTEX@titleformat@n} % 在 \tn{@startsection} 中设置 \tn{CTEX@titleformat@n} 为相应函数。 % \begin{macrocode} \cs_new_protected_nopar:Npn \CTEX@set@titleformat@n #1 - { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } } + { + \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } + \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } + } \cs_new_eq:NN \CTEX@titleformat@n \use:n +\cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing: % \end{macrocode} % \end{macro} % @@ -6571,19 +6882,21 @@ This package consists of the file ctex.dtx, and the derived files % % \paragraph{附录标题} % +% \begin{macro}[int]{appendix/name,appendix/number} % \begin{macrocode} -\tl_new:N \CTEX@preappendix -\tl_new:N \CTEX@postappendix \keys_define:nn { ctex } - { appendix .meta:nn = { ctex / appendix } {#1} } -\keys_define:nn { ctex / appendix } { - name .code:n = { \ctex_assign_heading_name:nn { appendix } {#1} } , - number .tl_set:N = \CTEX@appendixnumber + appendix .meta:nn = { ctex / appendix } {#1} , + appendix / name .code:n = + { \ctex_assign_heading_name:nn { appendix } {#1} } , + appendix / number .tl_set:N = \CTEX@appendixnumber } +\tl_new:N \CTEX@preappendix +\tl_new:N \CTEX@postappendix % \end{macrocode} +% \end{macro} % -% \begin{macro}[internal]{\appendix} +% \begin{macro}[int]{\appendix} % \begin{macrocode} \cs_new_eq:NN \CTEX@save@appendix \appendix \cs_gset_protected_nopar:Npn \appendix @@ -6605,7 +6918,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsubsection{目录标签的宽度} % -% \begin{macro}[internal]{\numberline} +% \begin{macro}[int]{\numberline} % \begin{macrocode} \cs_new_protected:Npn \CTEX@toc@width@n #1 { @@ -6640,7 +6953,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsubsection{页眉信息的修改} % -% \begin{macro}[internal]{\ps@headings} +% \begin{macro}[int]{\ps@headings} % \begin{macrocode} %<*article> \ctex_patch_cmd:Nnn \ps@headings { \thesection } { \CTEXthesection } @@ -6659,7 +6972,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macro} % % -% \begin{macro}[internal]{\ps@fancy} +% \begin{macro}[int]{\ps@fancy} % 这里对 \pkg{fancyhdr} 宏包打补丁。原来 \pkg{fancyhdr} 宏包中使用 % \tn{thesection} 等宏表示页眉中的章节编号,这里改用 \pkg{ctex} 包所用的 % \tn{CTEXthesection} 系列宏。 @@ -6685,7 +6998,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsubsection{标签引用数字的汉化} % -% \begin{macro}[internal]{\refstepcounter} +% \begin{macro}[int]{\refstepcounter} % 对标题进行引用时,设置标签为通过 \opt{number} 选项设置的形式。 % \begin{macrocode} \cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 @@ -6700,7 +7013,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_varioref_hook:} +% \begin{macro}[int]{\ctex_varioref_hook:} % 关于标签引用的宏包可能会修改 \tn{refstepcounter}。其中 \pkg{cleveref} 和 % \pkg{hyperref} 宏包都会保存之前的定义,并且它们都要求尽可能晚的被载入,所以 % 对我们上述的修改影响不大。需要注意的是 \pkg{varioref} 宏包,如果它在 @@ -6714,7 +7027,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_fix_varioref_label:n} +% \begin{macro}[int]{\@@_fix_varioref_label:n} % \pkg{varioref} 宏包的 \tn{labelformat} 实际上是定义一个以 |\the<#1>| 为参数的宏 % |\p@<#1>|。\LaTeX{} 在定义计数器 |<#1>| 时,都会将 |\p@<#1>| 初始化为 \tn{@empty}。 % 如果这个宏非空,说明用户自定义了标签格式,我们就不再修改。这里不能使用 @@ -6767,13 +7080,19 @@ This package consists of the file ctex.dtx, and the derived files %<*scheme&(article|book|report)> % \end{macrocode} % +% \changes{v2.1}{2015/05/30}{修复 \cls{ctexbook} 和 \cls{ctexrep} 类的中文 +% \opt{part/number} 选项初值为空的错误。} % \begin{macrocode} \keys_set:nn { ctex / part } { + aftertitle = \par , %<*plain> name = \partname \space , number = \thepart , % +%<*chinese> + number = \chinese { part } , +% %<*article> nameformat = \Large \bfseries , afterskip = 3ex , @@ -6784,7 +7103,6 @@ This package consists of the file ctex.dtx, and the derived files beforeskip = -4ex % %<*chinese> - number = \chinese { part } , format = \centering , aftername = \quad , titleformat = \Large \bfseries , @@ -6812,6 +7130,7 @@ This package consists of the file ctex.dtx, and the derived files { pagestyle = plain , nameformat = \huge \bfseries , + aftertitle = \par , afterskip = 40 \p@ , %<*plain> name = \chaptername \space , @@ -6833,10 +7152,15 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % % \begin{macrocode} +%<@@=> +% \end{macrocode} +% +% \begin{macrocode} \keys_set:nn { ctex / section } { number = \thesection , aftername = \quad , + aftertitle = \@@par , afterskip = 2.3ex \@plus .2ex , %<*plain> format = \Large \bfseries , @@ -6855,6 +7179,7 @@ This package consists of the file ctex.dtx, and the derived files number = \thesubsection , format = \large \bfseries , aftername = \quad , + aftertitle = \@@par , afterskip = 1.5ex \@plus .2ex , %<*plain> beforeskip = -3.25ex \@plus -1ex \@minus -.2ex @@ -6871,6 +7196,7 @@ This package consists of the file ctex.dtx, and the derived files number = \thesubsubsection , format = \normalsize \bfseries , aftername = \quad , + aftertitle = \@@par , afterskip = 1.5ex \@plus .2ex , %<*plain> beforeskip = -3.25ex \@plus -1ex \@minus -.2ex @@ -6901,10 +7227,11 @@ This package consists of the file ctex.dtx, and the derived files % % 处理 \opt{sub3section} 与 \opt{sub4section} 的格式。 % \begin{macrocode} -\int_compare:nNnTF \g_@@_section_depth_flag > \c_two +\int_compare:nNnTF \g__ctex_section_depth_flag > \c_two { \keys_set:nn { ctex / paragraph } { + aftertitle = \@@par , %<*plain> beforeskip = -3.25ex \@plus -1ex \@minus -.2ex , % @@ -6921,10 +7248,11 @@ This package consists of the file ctex.dtx, and the derived files afterskip = -1em } } -\int_compare:nNnTF \g_@@_section_depth_flag > \c_three +\int_compare:nNnTF \g__ctex_section_depth_flag > \c_three { \keys_set:nn { ctex / subparagraph } { + aftertitle = \@@par , %<*plain> beforeskip = -3.25ex \@plus -1ex \@minus -.2ex , % @@ -6941,11 +7269,15 @@ This package consists of the file ctex.dtx, and the derived files afterskip = -1em } } -\int_compare:nNnTF \g_@@_section_depth_flag > \c_two +\int_compare:nNnTF \g__ctex_section_depth_flag > \c_two { \keys_set:nn { ctex / subparagraph } { indent = \c_zero_dim } } { \keys_set:nn { ctex / subparagraph } { indent = \parindent } } % \end{macrocode} % +% \begin{macrocode} +%<@@=ctex> +% \end{macrocode} +% % 处理附录的格式。 % \begin{macrocode} \keys_set:nn { ctex / appendix } @@ -6967,9 +7299,23 @@ This package consists of the file ctex.dtx, and the derived files % \subsubsection{\pkg{ctex.sty} 的 \opt{heading} 选项} % % \begin{macrocode} -%<*style> +%<*ctex|ctexheading> +% \end{macrocode} +% +% \begin{variable}[int]{\c_@@_std_class_tl} +% 用于记录被引入的标准文档类。 +% \begin{macrocode} +\clist_map_inline:nn { article , book , report } + { + \@ifclassloaded {#1} + { \clist_map_break:n { \tl_const:Nn \c_@@_std_class_tl {#1} } } + { } + } % \end{macrocode} +% \end{variable} % +% 若标准文档类被引入,则载入对应的标题定义文件。否则视 \tn{chapter} 是否有定义来 +% 引入 \cls{book} 或者 \cls{article}。 % \begin{macrocode} \msg_new:nnn { ctex } { not-standard-class } { @@ -6977,14 +7323,11 @@ This package consists of the file ctex.dtx, and the derived files Heading~`#1'~is~selected.\\ ctex~may~not~work~as~expected. } -\bool_if:NTF \l_@@_heading_bool +%\bool_if:NTF \l_@@_heading_bool +%\use:n { - \clist_map_inline:nn { article , book , report } - { - \@ifclassloaded {#1} - { \clist_map_break:n { \tl_const:Nn \c_@@_class_tl {#1} } } { } - } - \tl_if_exist:NF \c_@@_class_tl + \tl_if_exist:NTF \c_@@_std_class_tl + { \cs_new_eq:NN \c_@@_class_tl \c_@@_std_class_tl } { \cs_if_exist:NTF \chapter { @@ -6997,11 +7340,11 @@ This package consists of the file ctex.dtx, and the derived files } \ctex_file_input:n { ctex- \c_@@_class_tl .def } } - { \ctex_scheme_input:o { \l_@@_scheme_tl } } +% { \ctex_scheme_input:o { \l_@@_scheme_tl } } % \end{macrocode} % % \begin{macrocode} -% +% % \end{macrocode} % % \subsubsection{标题配置文件} @@ -7081,17 +7424,14 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % % \changes{v2.0.2}{2015/05/16}{修复加载 \pkg{ctex} 宏包后章节标题后第一段 -% 无段首缩进的问题} +% 无段首缩进的问题。} % 若 \pkg{ctex} 宏包与标准文档类及其衍生文档类联用,则将载入 \pkg{indentfirst} 宏包, % 实现章节标题后首个段落的段首缩进。 % \begin{macrocode} -%<*!(article|book|report)> -\clist_map_inline:nn { article , book , report } - { - \@ifclassloaded {#1} - { \RequirePackage{ indentfirst } } { } - } -% +%<*generic> +\tl_if_exist:NT \c_@@_std_class_tl + { \RequirePackage{ indentfirst } } +% % \end{macrocode} % % \begin{macrocode} @@ -7101,7 +7441,7 @@ This package consists of the file ctex.dtx, and the derived files % \subsection{中文字号} % % \begin{macrocode} -%<*class|style|ctexsize> +%<*class|ctex|ctexsize> % \end{macrocode} % % \changes{v2.0}{2014/03/08}{将中文字号功能提取到可以独立使用的 \pkg{ctexsize}。} @@ -7113,7 +7453,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_zihao:n} +% \begin{macro}[int]{\ctex_zihao:n} % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_zihao:n #1 { @@ -7135,7 +7475,7 @@ This package consists of the file ctex.dtx, and the derived files % % \changes{v2.0}{2014/03/08}{中文字号不再采用近似值。} % -% \begin{variable}[internal]{\c_@@_font_size_prop} +% \begin{variable}[int]{\c_@@_font_size_prop} % \begin{macro}[aux]{\@@_save_font_size:nn} % 基础行距是字号的 $1.2$ 倍,采用 \hologo{eTeX} 的 scaling 运算得到的结果 % 要比简单的 |1.2\dimexpr| 精确^^A @@ -7179,7 +7519,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macro} % \end{variable} % -% \begin{macro}[internal]{\ctex_declare_math_sizes:nnnn} +% \begin{macro}[int]{\ctex_declare_math_sizes:nnnn} % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 { @@ -7229,7 +7569,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsubsection{修改默认字号大小} % -% \begin{macro}[internal]{\ctex_set_font_size:Nnn} +% \begin{macro}[int]{\ctex_set_font_size:Nnn} % \begin{macrocode} \cs_new_protected:Npn \ctex_set_font_size:Nnn #1#2#3 { @@ -7251,7 +7591,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % % \begin{macrocode} -% +% % \end{macrocode} % % \begin{macrocode} @@ -7340,7 +7680,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % % \begin{macrocode} -%<*class|style> +%<*class|ctex> % \end{macrocode} % % \subsection{更新行距} @@ -7354,7 +7694,7 @@ This package consists of the file ctex.dtx, and the derived files % % \changes{v2.0}{2014/04/23}{调整 \tn{footnotesep} 的大小,以适合行距的变化。} % -% \begin{variable}[internal]{\footnotesep} +% \begin{variable}[int]{\footnotesep} % 我们调整了行距,可能导致脚注的间距与行距不协调,需要调整 \tn{footnotesep}。标准 % 文档类对 \tn{footnotesep} 的设置是,字体大小为 \tn{footnotesize} 时 \tn{strutbox} % 的高度(默认值是 |.7\baselineskip|)。我们沿用这个设置方法,只需要更新具体的大小。 @@ -7382,16 +7722,13 @@ This package consists of the file ctex.dtx, and the derived files % \begin{macrocode} \NewDocumentCommand \CTeX { } { \ifincsname CTeX \else: C \TeX \fi: } -\AtBeginDocument - { - \cs_if_exist_use:NT \pdfstringdefDisableCommands - { { \tl_set:Nn \CTeX { CTeX } } } - } +\ctex_at_end_package:nn { hyperref } + { \pdfstringdefDisableCommands { \tl_set:Nn \CTeX { CTeX } } } % \end{macrocode} % \end{macro} % % \changes{v2.0}{2014/03/28}{\opt{captiondelimiter} 是过时选项。} -% \begin{macro}[internal]{captiondelimiter} +% \begin{macro}{captiondelimiter} % 过时选项。 % \begin{macrocode} \keys_define:nn { ctex } @@ -7406,12 +7743,12 @@ This package consists of the file ctex.dtx, and the derived files % \end{macro} % % \begin{macrocode} -% +% % \end{macrocode} % % \subsubsection{列表环境的缩进} % -% \begin{macro}[internal]{\verse,\quotation} +% \begin{macro}[int]{\verse,\quotation} % 只在使用文档类的时候修改诗歌和引用环境的缩进。 % \begin{macrocode} %<*scheme&!generic&chinese> @@ -7423,12 +7760,12 @@ This package consists of the file ctex.dtx, and the derived files % \end{macro} % % \begin{macrocode} -%<*class|style> +%<*class|ctex> % \end{macrocode} % % \subsubsection{其他兼容性修改} % -% \begin{macro}[internal]{\end} +% \begin{macro}[int]{\end} % \changes{v2.0}{2014/03/09} % {解决 \pkg{etoolbox} 与 \pkg{breqn} 关于 \tn{end} 的冲突。} % \pkg{breqn} 宏包对 \tn{end} 作了如下处理,然而这个处理并不保险。 @@ -7469,7 +7806,7 @@ This package consists of the file ctex.dtx, and the derived files % % \subsection{载入中文字体} % -% \begin{macro}[internal]{\ctex_fontset_error:n} +% \begin{macro}[int]{\ctex_fontset_error:n} % 字库不可用时给出紧急错误信息,停止读取定义文件。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 @@ -7479,7 +7816,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ctex_load_fontset:} +% \begin{macro}[int]{\ctex_load_fontset:} % 如果用户没有指定字体,则探测操作系统,载入相应的字体配置。 % \begin{macrocode} \cs_new_protected_nopar:Npn \ctex_load_fontset: @@ -7567,7 +7904,7 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % % \begin{macrocode} -% +% % \end{macrocode} % % \begin{macrocode} @@ -7712,7 +8049,7 @@ This package consists of the file ctex.dtx, and the derived files % 旧的 Windows 字体设置使用黑体作为无衬线体,楷体和仿宋是 GB2312 编码;新的 % Windows 字体设置使用微软雅黑作为无衬线体,楷体和仿宋是大字库。 % \begin{macrocode} -%<*windowsnew,windowsold> +%<*windowsnew|windowsold> \pdftex_if_engine:TF { \ctex_zhmap_case:nnn @@ -7795,7 +8132,7 @@ This package consists of the file ctex.dtx, and the derived files [ BoldFont = { *~Bold } ] { Microsoft~YaHei } % } -% +% % \end{macrocode} % % \subsubsection{\pkg{ctex-fontset-adobe.def}} @@ -8130,7 +8467,8 @@ This package consists of the file ctex.dtx, and the derived files { \ctex_fontset_error:n { ubuntu } } } { - \setCJKmainfont [ ItalicFont = AR~PL~UKai~CN ] { AR~PL~UMing~CN } + \setCJKmainfont + [ BoldFont = WenQuanYi~Zen~Hei , ItalicFont = AR~PL~UKai~CN ] { AR~PL~UMing~CN } \setCJKsansfont { WenQuanYi~Zen~Hei } \setCJKmonofont { AR~PL~UMing~CN } \setCJKfamilyfont { zhsong } { AR~PL~UMing~CN } @@ -8207,7 +8545,13 @@ This package consists of the file ctex.dtx, and the derived files % \end{macrocode} % % \begin{macrocode} -\input ifpdf.sty\relax +\begingroup\expandafter\endgroup +\expandafter\let\csname ifzhmappdf\expandafter\endcsname\csname + \expandafter\ifx\csname ifctexpdf\endcsname\relax + \expandafter\ifx\csname pdfoutput\endcsname\relax + iffalse\else\ifnum\pdfoutput < 1 iffalse\else iftrue\fi\fi + \else ifctexpdf\fi +\endcsname % \end{macrocode} % % 提供非 \LaTeX{} 格式下的 \tn{ProvidesFile}。 @@ -8228,9 +8572,9 @@ This package consists of the file ctex.dtx, and the derived files % \begin{macrocode} %<*windows> \ProvidesFile{zhwindowsfonts.tex}% - [2014/06/03 v2.0 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2015/05/25 v2.1 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)] -\ifpdf +\ifzhmappdf \pdfmapline{=gbk@UGBK@ \ProvidesFile{zhadobefonts.tex}% - [2014/06/03 v2.0 Adobe font map loader for DVIPDFMx (CTEX)] + [2015/05/25 v2.1 Adobe font map loader for DVIPDFMx (CTEX)] -\ifpdf +\ifzhmappdf %% pdfTeX does not support OTF fonts \else @@ -8336,9 +8680,9 @@ This package consists of the file ctex.dtx, and the derived files % \begin{macrocode} %<*fandol> \ProvidesFile{zhfandolfonts.tex}% - [2014/06/03 v2.0 Fandol font map loader for DVIPDFMx (CTEX)] + [2015/05/25 v2.1 Fandol font map loader for DVIPDFMx (CTEX)] -\ifpdf +\ifzhmappdf %% pdfTeX does not support OTF fonts \else @@ -8372,9 +8716,9 @@ This package consists of the file ctex.dtx, and the derived files % \begin{macrocode} %<*founder> \ProvidesFile{zhfounderfonts.tex}% - [2014/06/03 v2.0 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2015/05/25 v2.1 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)] -\ifpdf +\ifzhmappdf \pdfmapline{=gbk@UGBK@ \ProvidesFile{zhubuntufonts.tex}% - [2014/06/03 v2.0 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2015/05/25 v2.1 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)] -\ifpdf +\ifzhmappdf \pdfmapline{=gbk@UGBK@