diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/ctex/ctex.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/ctex/ctex.dtx | 147 |
1 files changed, 105 insertions, 42 deletions
diff --git a/Master/texmf-dist/source/latex/ctex/ctex.dtx b/Master/texmf-dist/source/latex/ctex/ctex.dtx index 8a10831b690..c611e36ffba 100644 --- a/Master/texmf-dist/source/latex/ctex/ctex.dtx +++ b/Master/texmf-dist/source/latex/ctex/ctex.dtx @@ -413,7 +413,7 @@ Copyright and Licence %<*!(c19|c70|ctexspa|dict)> %<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\NeedsTeXFormat{LaTeX2e} %<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\RequirePackage{expl3} -%<+!driver>\GetIdInfo$Id: ctex.dtx c498d8c 2017-04-01 21:33:50 +0800 Qing Lee <sobenlee@gmail.com> $ +%<+!driver>\GetIdInfo$Id: ctex.dtx e177d82 2017-08-07 16:58:14 +0800 Qing Lee <sobenlee@gmail.com> $ %<ctxdoc> {ctex documentation (CTEX)} %<ctxdoc>\ProvidesExplClass{ctxdoc} %<ctex> {Chinese adapter in LaTeX (CTEX)} @@ -502,7 +502,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.9}{\ExplFileDescription} +%<!driver> {\ExplFileDate}{2.4.10}{\ExplFileDescription} %</!(c19|c70|ctexspa|dict)> %<c19&rm>\ProvidesFile{c19rm.fd}% %<c19&sf>\ProvidesFile{c19sf.fd}% @@ -513,9 +513,9 @@ Copyright and Licence %<ctexspa>\ProvidesFile{ctexspa.def}% %<dict&theorem&GBK>\ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}% %<dict&theorem&UTF8>\ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}% -%<c19|c70> [2017/04/01 v2.4.9 Chinese font definition (CTEX)] -%<ctexspa> [2017/04/01 v2.4.9 Space info for CJKpunct (CTEX)] -%<dict&theorem> [2017/04/01 v2.4.9 Chinese translation for theorem name (CTEX)] +%<c19|c70> [2017/08/07 v2.4.10 Chinese font definition (CTEX)] +%<ctexspa> [2017/08/07 v2.4.10 Space info for CJKpunct (CTEX)] +%<dict&theorem> [2017/08/07 v2.4.10 Chinese translation for theorem name (CTEX)] %</!(driver|readme|install|zhmap|spa|docstrip)> %<*driver> \documentclass{ctxdoc} @@ -537,7 +537,7 @@ Copyright and Licence % \changes{v2.4}{2015/02/19}{加强 \pkg{beamer} 宏包支持。} % % -% \CheckSum{5898} +% \CheckSum{5923} % % \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 @@ -3005,6 +3005,9 @@ Copyright and Licence % \end{macrocode} % % \changes{v2.3}{2015/12/20}{与 \LaTeXiii{} (2015/12/20) 同步。} +% \changes{v2.4.10}{2017/07/19}{常数 \cs{c_minus_one} 已过时。} +% \changes{v2.4.10}{2017/07/22}{使用 \texttt{lazy} 函数对 Boolean 表达式 +% 进行最小化运算(\hologo{LaTeX3} 2017/07/19)。} % % 检查 \pkg{expl3} 和 \pkg{l3keys2e} 的版本。 % \begin{macrocode} @@ -3015,7 +3018,7 @@ Copyright and Licence `l3kernel'~and~`l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2015/12/20 } { } +\@ifpackagelater { expl3 } { 2017/07/19 } { } { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } %<*class> \@ifpackagelater { l3keys2e } { 2015/12/20 } { } @@ -3058,7 +3061,7 @@ Copyright and Licence % \begin{variable}[int]{\l_@@_tmp_tl,\l_@@_tmp_int,\l_@@_tmp_box,\l_@@_tmp_dim} % 临时变量。 % \begin{macrocode} -\tl_new:N \l_@@_tmp_tl +\tl_clear_new:N \l_@@_tmp_tl \int_new:N \l_@@_tmp_int \box_new:N \l_@@_tmp_box %<!ctexheading>\dim_new:N \l_@@_tmp_dim @@ -3276,7 +3279,8 @@ Copyright and Licence % 表示 \opt{zihao} 选项未初始化,会在将来根据文档类决定初值。 % \begin{macrocode} %<*class|ctex|ctexsize> -\cs_new_eq:NN \g_@@_font_size_flag \c_minus_one +\int_new:N \g_@@_font_size_flag +\int_set:Nn \g_@@_font_size_flag { -1 } %</class|ctex|ctexsize> % \end{macrocode} % \end{variable} @@ -3620,7 +3624,7 @@ Copyright and Licence % 使 \pkg{ctex} 和 \pkg{ctexsize} 可以接受文档类的全局选项,不修改默认字体大小。 % 在文档类下还将参数传给标准文档类。 % \begin{macrocode} -\tl_clear:N \l_@@_tmp_tl +\tl_clear_new:N \l_@@_tmp_tl \clist_map_inline:nn { 10pt , 11pt , 12pt , @@ -3898,7 +3902,7 @@ Copyright and Licence { \char_set_catcode_other:n { 60 } % < \char_set_catcode_math_superscript:n { 94 } % ^ - \int_set_eq:NN \tex_endlinechar:D \c_minus_one + \int_set:Nn \tex_endlinechar:D { -1 } } { \file_input:n {#1} } { @@ -4278,9 +4282,11 @@ Copyright and Licence % \begin{macrocode} \cs_set_protected:Npn \fontspec_visible_space: { - \font_glyph_if_exist:NnTF \font { "2423 } - { \ltjalchar "2423 \exp_stop_f: } - { \fontspec_visible_space_fallback: } + \etex_iffontchar:D \tex_font:D "2423 \exp_stop_f: + \ltjalchar "2423 \exp_stop_f: + \else: + \fontspec_visible_space_fallback: + \fi: } % \end{macrocode} % \end{macro} @@ -4847,7 +4853,7 @@ Copyright and Licence { \ctex_ltj_switch_family:x {#1} \tex_ignorespaces:D } \cs_new_protected_nopar:Npn \ctex_ltj_switch_family:n #1 { - \ctex_ltj_family_if_exist:xNTF {#1} \CJK@family + \ctex_ltj_family_if_exist:nNTF {#1} \CJK@family { \tl_set:Nn \l_ctex_ltj_family_tl {#1} \selectfont @@ -4859,12 +4865,12 @@ Copyright and Licence % \end{macrocode} % \end{macro} % -% \begin{macro}[int,TF]{\ctex_ltj_family_if_exist:n} +% \begin{macro}[int,TF]{\ctex_ltj_family_if_exist:nN} % 判断 CJK 字体族 |#1| 是否存在,若存在则把实际族名保存到 |#2| 中。 % \begin{macrocode} -\prg_new_protected_conditional:Npnn \ctex_ltj_family_if_exist:xN #1#2 { T , F , TF } +\prg_new_protected_conditional:Npnn \ctex_ltj_family_if_exist:nN #1#2 { T , F , TF } { - \prop_get:NxNTF \g_@@_family_name_prop {#1} #2 + \prop_get:NnNTF \g_@@_family_name_prop {#1} #2 { \prg_return_true: } { \cs_if_exist_use:cTF { \@@_family_csname:n {#1} } @@ -4875,7 +4881,9 @@ Copyright and Licence { \prg_return_false: } } } -\cs_generate_variant:Nn \prop_get:NnNTF { Nx } +\cs_generate_variant:Nn \ctex_ltj_family_if_exist:nNT { x } +\cs_generate_variant:Nn \ctex_ltj_family_if_exist:nNF { x } +\cs_generate_variant:Nn \ctex_ltj_family_if_exist:nNTF { x } % \end{macrocode} % \end{macro} % @@ -6345,6 +6353,42 @@ Copyright and Licence %</luatex|uptex|aptex> % \end{macrocode} % +% \changes{v2.4.10}{2017/07/23}{定义 \tn{cht},\tn{cdp} 和 \tn{cwd}。} +% +% \begin{macro}[int]{\cht,\cdp,\cwd} +% 分别从 \file{.jfm} 中读取字符高度、深度和宽度,目前仅考虑横排的情况。 +% \begin{macrocode} +%<*luatex> +\dim_new:N \cht +\dim_new:N \cdp +\dim_new:N \cwd +\newluafunction \g_@@_kanjisize_func +\group_begin: +\char_set_catcode_space:n { 32 } +\lua_now_x:n + { + local nulltable = { } + local t = lua.get_functions_table() + local fmt = luatexja.jfont.font_metric_table + local getattribute = tex.getattribute + local setdimen = tex.setdimen + t[\int_use:N \g_@@_kanjisize_func] = function () + local ft = fmt[getattribute('ltj@curjfnt')] or nulltable + local ft = ft and ft.char_type or nulltable + local fk = ft and ft[0] or nulltable + setdimen('cht', fk.height or 0) + setdimen('cdp', fk.depth or 0) + setdimen('cwd', fk.width or ft.zw or 0) + end + } +\group_end: +\cs_new_protected_nopar:Npn \ctex_update_kanjisize: + { \luatex_luafunction:D \g_@@_kanjisize_func } +\ctex_add_to_selectfont:n { \ctex_update_kanjisize: } +%</luatex> +% \end{macrocode} +% \end{macro} +% % \begin{macro}{space} % 在导言区或正文中设置忽略空格方式。 % \pdfTeX{} 和 \XeTeX{} 下初始设置为 \opt{auto},\LuaTeX{}、\upTeX{} 下是无效 @@ -8141,7 +8185,8 @@ Copyright and Licence \defbeamertemplate*{part page}{CTEX}[1][]{ \begingroup % \centering -% {\usebeamerfont{part name}\usebeamercolor[fg]{part name}\partname~\insertromanpartnumber} +% {\usebeamerfont{part name}% +% \usebeamercolor[fg]{part name}\partname~\insertromanpartnumber} % \vskip1em\par \par \addvspace{\glueexpr\CTEX@part@beforeskip\relax}% \parindent \dimexpr \CTEX@part@indent \relax @@ -8163,7 +8208,8 @@ Copyright and Licence \defbeamertemplate*{section page}{CTEX}[1][]{ \begingroup % \centering -% {\usebeamerfont{section name}\usebeamercolor[fg]{section name}\sectionname~\insertsectionnumber} +% {\usebeamerfont{section name}% +% \usebeamercolor[fg]{section name}\sectionname~\insertsectionnumber} % \vskip1em\par \par \addvspace{\glueexpr\CTEX@section@beforeskip\relax}% \parindent \dimexpr \CTEX@section@indent \relax @@ -8185,7 +8231,8 @@ Copyright and Licence \defbeamertemplate*{subsection page}{CTEX}[1][]{ \begingroup % \centering -% {\usebeamerfont{subsection name}\usebeamercolor[fg]{subsection name}\subsectionname~\insertsubsectionnumber} +% {\usebeamerfont{subsection name}% +% \usebeamercolor[fg]{subsection name}\subsectionname~\insertsubsectionnumber} % \vskip1em\par \par \addvspace{\glueexpr\CTEX@subsection@beforeskip\relax}% \parindent \dimexpr \CTEX@subsection@indent \relax @@ -8726,7 +8773,7 @@ Copyright and Licence % 对 \cls{beamer} 以外的文档类,若用户未设置宏包选项 \opt{zihao},则设置 \tn{normalsize} % 为五号字。\cls{beamer} 不调整默认字体大小。 % \begin{macrocode} -\int_compare:nNnF \g_@@_font_size_flag > \c_minus_one +\int_compare:nNnF \g_@@_font_size_flag > { -1 } { \cs_gset_eq:NN \g_@@_font_size_flag \c_zero } % \end{macrocode} % @@ -8763,7 +8810,7 @@ Copyright and Licence \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 + \int_compare:nNnF \g_@@_font_size_flag > { -1 } { \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 } } @@ -9375,8 +9422,7 @@ Copyright and Licence %<*fontset> % \end{macrocode} % -% \subsubsection{\pkg{ctex-fontset-windows.def}, -% \pkg{ctex-fontset-windowsnew.def}, \pkg{ctex-fontset-windowsold.def}} +% \subsubsection{\pkg{ctex-fontset-windows.def} 等} % % \changes{v2.4.1}{2016/05/14}{使用 \file{bootfont.bin} 判断 Windows XP 以避免 % 权限问题。} @@ -9418,7 +9464,8 @@ Copyright and Licence \ctex_punct_map_family:nn { \CJKsfdefault } { zhhei } %</windowsold> %<*windowsnew> - \setCJKsansfont [ BoldFont = msyhbd\l_@@_msyh_suffix_tl ] { msyh\l_@@_msyh_suffix_tl } + \setCJKsansfont + [ BoldFont = msyhbd\l_@@_msyh_suffix_tl ] { msyh\l_@@_msyh_suffix_tl } \setCJKfamilyfont { zhyahei } [ BoldFont = msyhbd\l_@@_msyh_suffix_tl ] { msyh\l_@@_msyh_suffix_tl } \ctex_punct_map_family:nn { \CJKsfdefault } { zhyahei } @@ -9648,9 +9695,13 @@ Copyright and Licence } { \setCJKmainfont - [ Extension = .otf , BoldFont = FandolSong-Bold , ItalicFont = FandolKai-Regular ] + [ + Extension = .otf , + BoldFont = FandolSong-Bold , ItalicFont = FandolKai-Regular + ] { FandolSong-Regular } - \setCJKsansfont [ Extension = .otf , BoldFont = FandolHei-Bold ] { FandolHei-Regular } + \setCJKsansfont + [ Extension = .otf , BoldFont = FandolHei-Bold ] { FandolHei-Regular } \setCJKmonofont [ Extension = .otf ] { FandolFang-Regular } \setCJKfamilyfont { zhsong } [ Extension = .otf , BoldFont = FandolSong-Bold ] { FandolSong-Regular } @@ -9997,7 +10048,7 @@ Copyright and Licence % \begin{macrocode} %<*windows> \ProvidesFile{zhwindowsfonts.tex}% - [2017/04/01 v2.4.9 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2017/08/07 v2.4.10 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)] \ifzhmappdf \pdfmapline{=gbk@UGBK@ <simsun.ttc} @@ -10069,7 +10120,7 @@ Copyright and Licence % \begin{macrocode} %<*adobe> \ProvidesFile{zhadobefonts.tex}% - [2017/04/01 v2.4.9 Adobe font map loader for DVIPDFMx (CTEX)] + [2017/08/07 v2.4.10 Adobe font map loader for DVIPDFMx (CTEX)] \ifzhmappdf %% pdfTeX does not support OTF fonts @@ -10105,7 +10156,7 @@ Copyright and Licence % \begin{macrocode} %<*fandol> \ProvidesFile{zhfandolfonts.tex}% - [2017/04/01 v2.4.9 Fandol font map loader for DVIPDFMx (CTEX)] + [2017/08/07 v2.4.10 Fandol font map loader for DVIPDFMx (CTEX)] \ifzhmappdf %% pdfTeX does not support OTF fonts @@ -10141,7 +10192,7 @@ Copyright and Licence % \begin{macrocode} %<*founder> \ProvidesFile{zhfounderfonts.tex}% - [2017/04/01 v2.4.9 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2017/08/07 v2.4.10 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)] \ifzhmappdf \pdfmapline{=gbk@UGBK@ <FZSSK.TTF} @@ -10213,7 +10264,7 @@ Copyright and Licence % \begin{macrocode} %<*ubuntu> \ProvidesFile{zhubuntufonts.tex}% - [2017/04/01 v2.4.9 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2017/08/07 v2.4.10 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)] \ifzhmappdf \pdfmapline{=gbk@UGBK@ <uming.ttc} @@ -10753,11 +10804,9 @@ Copyright and Licence { \cs_new_protected:Npn \ctex_parse_name:NNn ##1##2##3 { - \bool_if:nTF - { - \cs_if_exist_p:c { ##3 ~ } || - \cs_if_exist_p:c { #1##3 } - } + \bool_lazy_or:nnTF + { \cs_if_exist_p:c { ##3 ~ } } + { \cs_if_exist_p:c { #1##3 } } { \group_begin: \use:x @@ -11421,7 +11470,7 @@ Copyright and Licence { \if@inlabel \leavevmode \fi } { \partopsep \z@skip } \group_begin: - \int_set_eq:NN \tex_endlinechar:D \c_minus_one + \int_set:Nn \tex_endlinechar:D { -1 } \use:n { \char_set_catcode_active:n { 32 } @@ -11459,6 +11508,13 @@ Copyright and Licence \@@_verbatim_read_line:w } } + \cs_new_protected:Npn \@@_swap_cr: + { \exp_after:wN \@@_swap_cr:w \l_@@_verbatim_line_tl } + \cs_new_protected:Npn \@@_swap_cr:w #1 ^^M + { + \group_insert_after:N ^^M + \tl_set:Nn \l_@@_verbatim_line_tl {#1} + } \tl_const:Nn \c_@@_active_cr_tl { ^^M } \group_end: \tl_new:N \l_@@_verbatim_line_tl @@ -11479,7 +11535,10 @@ Copyright and Licence \cs_gset_eq:NN \@@_verbatim_process_line: \@@_process_normal_line: \@@_output_module:nn { \color { verb@guard } } - { \@@_module_pop:n { \l_@@_verbatim_line_tl } } + { + \@@_swap_cr: + \@@_module_pop:n { \l_@@_verbatim_line_tl } + } } { \tl_use:N \l_@@_verbatim_line_tl } } @@ -11556,7 +11615,10 @@ Copyright and Licence { \c_percent_str \tl_tail:n {#1} } \@@_output_module:nn { \color { verb@guard } } - { \@@_module_push:n { \l_@@_verbatim_line_tl } } + { + \@@_swap_cr: + \@@_module_push:n { \l_@@_verbatim_line_tl } + } } \group_end: \cs_new_protected_nopar:Npn \@@_output_line: @@ -11596,6 +11658,7 @@ Copyright and Licence \tex_noindent:D \group_begin: \color { code@gray } + \@@_swap_cr: \str_if_eq_x:nnTF { \f@shape } { \updefault } { \slshape } { \upshape } |