summaryrefslogtreecommitdiff
path: root/language/chinese
diff options
context:
space:
mode:
Diffstat (limited to 'language/chinese')
-rw-r--r--language/chinese/ctex/ctex.dtx175
-rw-r--r--language/chinese/ctex/ctex.pdfbin1149510 -> 1152148 bytes
-rw-r--r--language/chinese/ctex/ctxdoc.cls6
3 files changed, 96 insertions, 85 deletions
diff --git a/language/chinese/ctex/ctex.dtx b/language/chinese/ctex/ctex.dtx
index 81488b12ef..adc4440bc7 100644
--- a/language/chinese/ctex/ctex.dtx
+++ b/language/chinese/ctex/ctex.dtx
@@ -443,7 +443,7 @@ Copyright and Licence
%<class|style|ctexcap|ctexhook|ctexpatch>\NeedsTeXFormat{LaTeX2e}
%<class>\input{ctexbackend.cfg}
%<class|style|ctexcap|ctexhook|ctexpatch>\RequirePackage{expl3}
-%<+!driver>\GetIdInfo$Id: ctex.dtx 6604451 2021-06-20 17:08:49 +0800 Qing Lee <sobenlee@gmail.com> $
+%<+!driver>\GetIdInfo$Id: ctex.dtx fcbe2c0 2021-12-12 18:20:54 +0800 Qing Lee <sobenlee@gmail.com> $
%<ctex> {Chinese adapter in LaTeX (CTEX)}
%<ctex>\ProvidesExplPackage{\ExplFileName}
%<ctexsize> {Chinese font size definition (CTEX)}
@@ -530,7 +530,7 @@ Copyright and Licence
%<founder>\ProvidesExplFile{ctex-fontset-founder.def}
%<ubuntu> {Ubuntu fonts definition (CTEX)}
%<ubuntu>\ProvidesExplFile{ctex-fontset-ubuntu.def}
-%<!driver> {\ExplFileDate}{2.5.7}{\ExplFileDescription}
+%<!driver> {\ExplFileDate}{2.5.8}{\ExplFileDescription}
%</!(fd|ctexspa|dict|backend)>
%<c19&rm>\ProvidesFile{c19rm.fd}%
%<c19&sf>\ProvidesFile{c19sf.fd}%
@@ -548,10 +548,10 @@ Copyright and Licence
%<backend>\ProvidesFile{ctexbackend.cfg}%
%<dict&theorem&GBK>\ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}%
%<dict&theorem&UTF8>\ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}%
-%<fd> [2021/06/20 v2.5.7 Chinese font definition (CTEX)]
-%<ctexspa> [2021/06/20 v2.5.7 Space info for CJKpunct (CTEX)]
-%<backend> [2021/06/20 v2.5.7 Backend configuration file (CTEX)]
-%<dict&theorem> [2021/06/20 v2.5.7 Chinese translation for theorem name (CTEX)]
+%<fd> [2021/12/12 v2.5.8 Chinese font definition (CTEX)]
+%<ctexspa> [2021/12/12 v2.5.8 Space info for CJKpunct (CTEX)]
+%<backend> [2021/12/12 v2.5.8 Backend configuration file (CTEX)]
+%<dict&theorem> [2021/12/12 v2.5.8 Chinese translation for theorem name (CTEX)]
%</!(driver|readme|install|zhmap|spa|docstrip)>
%<*driver>
\documentclass{ctxdoc}
@@ -575,7 +575,7 @@ Copyright and Licence
% \changes{v2.4.15}{2019/03/23}{同步 \LaTeXiii{} 2019/03/05。}
% \changes{v2.5.1}{2020/05/02}{\pkg{zhconv} 更名为 \pkg{ctex-zhconv}。}
%
-% \CheckSum{6400}
+% \CheckSum{6420}
%
% \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
@@ -4782,33 +4782,53 @@ Copyright and Licence
%
% \paragraph{\pkg{Lua} 函数}
%
+% \changes{v2.5.8}{2021/11/29}{简化部分 \pkg{Lua} 函数。}
+%
% 直接用 |token.set_lua| 定义,不是传统意义上的 \TeX \ 宏。
% \begin{macrocode}
\group_begin:
\char_set_catcode_space:n { 32 }
\lua_now:e
{
- local func = lua.get_functions_table()
+% \end{macrocode}
+% \begin{macro}{ctex.newluacmd}
+% 定义新的 \pkg{Lua} 函数。
+% \begin{macrocode}
+ ctex = ctex or { }
+ local ctex = ctex
+ local functions = lua.get_functions_table()
+ local new_luafunction = luatexbase.new_luafunction
+ local create, set_lua = token.create, token.set_lua
+ local lua_cmds = {
+ lua_call = true ,
+ lua_expandable_call = true ,
+ }
+ local newluacmd = function (name, func, ...)
+ local tok = create(name)
+ local id = lua_cmds[tok.cmdname] and tok.index
+ local id = id or new_luafunction(name)
+ set_lua(name, id, ...)
+ functions[id] = func
+ end
+ ctex.newluacmd = newluacmd
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
local ltjfont = luatexja.jfont
local getattribute = tex.getattribute
- local set_lua = token.set_lua
+ local tex_set, sprint = tex.set, tex.sprint
local scan_int, scan_arg = token.scan_int, token.scan_argument
- local new_luafunction = luatexbase.new_luafunction
% \end{macrocode}
% \begin{macro}{\ctex_ltj_add_kyenc:n}
% 保存 jfont 的编码,用于判断。
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = ltjfont.add_kyenc_list
- set_lua("ctex_ltj_add_kyenc:n", id, "global", "protected")
+ newluacmd("ctex_ltj_add_kyenc:n", ltjfont.add_kyenc_list, "global", "protected")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ctex_ltj_is_kenc:n}
% 判断编码是否属于 jfont。
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = ltjfont.is_kenc
- set_lua("ctex_ltj_is_kenc:n", id, "global")
+ newluacmd("ctex_ltj_is_kenc:n", ltjfont.is_kenc, "global")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ctex_ltj_patch_external_font:n}
@@ -4823,8 +4843,7 @@ Copyright and Licence
% 主要目的是,如果当前字形有替代字体,则往字形的定义中加入一些标志,确保
% \texttt{font.id} 唯一。
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = function ()
+ newluacmd("ctex_ltj_patch_external_font:n", function ()
local s = scan_arg()
local is_braced, is_quoted
if s:sub(1,1) == '{' and s:sub(-1)=='}' then
@@ -4837,108 +4856,75 @@ Copyright and Licence
if is_braced then s = '{'..s..'}'
elseif is_quoted then s = '"'..s..'"'
end
- tex.sprint(-2, s)
- end
- set_lua("ctex_ltj_patch_external_font:n", id, "global")
+ sprint(-2, s)
+ end, "global")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ctex_ltj_use_jfont:}
% 使用 jfont,确保当前的 \tn{font} 是 jfont。
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = function ()
+ newluacmd("ctex_ltj_use_jfont:", function ()
font.current(getattribute("ltj@curjfnt"))
- end
- set_lua("ctex_ltj_use_jfont:", id, "global", "protected")
+ end, "global", "protected")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ctex_ltj_set_alt_font:nnnn}
% |#1| 和 |#2| 分别是字符区间的首末,|#3| 是基础字体,|#4| 是替代字体。
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = function ()
+ newluacmd("ctex_ltj_set_alt_font:nnnn", function ()
local b = tonumber(scan_arg())
local e = tonumber(scan_arg())
local alt = scan_arg()
local base = scan_arg()
ltjfont.set_alt_font_latex(b, e, alt, base)
- end
- set_lua("ctex_ltj_set_alt_font:nnnn", id, "global", "protected")
+ end, "global", "protected")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ctex_ltj_clear_alt_font:n}
% 清除 |#1| 的替代字体。
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = function ()
+ newluacmd("ctex_ltj_clear_alt_font:n", function ()
local base = scan_arg()
ltjfont.clear_alt_font_latex(base)
- end
- set_lua("ctex_ltj_clear_alt_font:n", id, "global", "protected")
+ end, "global", "protected")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ctex_ltj_pickup_alt_font:nn}
% 定义 |#1| 的替代字体,|#2| 是字体大小。\\
% 会在内部执行 \tn{ltj@pickup@altfont@auxy} 和 \tn{ltj@pickup@altfont@copy}。
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = function ()
+ newluacmd("ctex_ltj_pickup_alt_font:nn", function ()
local base = scan_arg()
local size = scan_arg()
ltjfont.output_alt_font_cmd("y", base)
ltjfont.pickup_alt_font_a(size)
- end
- set_lua("ctex_ltj_pickup_alt_font:nn", id, "global", "protected")
+ end, "global", "protected")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\@@_pickup_alt_font:Nn}
% |#1| 是 \texttt{font.id},|#2| 是字体名称。
% 在 \tn{ltj@pickup@altfont@copy} 之中使用。
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = function ()
+ newluacmd("@@_pickup_alt_font:Nn", function ()
local num = scan_int()
local base = scan_arg()
ltjfont.pickup_alt_font_b(num, base)
- end
- set_lua("@@_pickup_alt_font:Nn", id, "global", "protected")
+ end, "global", "protected")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\@@_if_alt_set:nT}
% 判断是否存在替代字体。会设置变量 |aftl_base| 和返回 \tn{@firstofone} 或 \tn{@gobble}。
-% \begin{verbatim}
-% function luatexja.jfont.does_alt_set(bbase)
-% aftl_base = alt_font_table_latex[bbase]
-% tex.sprint(cat_lp, aftl_base and '\\@firstofone' or '\\@gobble')
-% end
-% \end{verbatim}
-% \pkg{luatexja} 20200412.0 以后的定义为:
-% \begin{verbatim}
-% function luatexja.jfont.does_alt_set()
-% aftl_base = alt_font_table_latex[scan_arg()]
-% tex.sprint(cat_lp, aftl_base and '\\@firstofone' or '\\@gobble')
-% end
-% \end{verbatim}
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = \LuaTeXjaversion > 20200412.0
- and ltjfont.does_alt_set
- or function ()
- local base = scan_arg()
- ltjfont.does_alt_set(base)
- end
- set_lua("@@_if_alt_set:nT", id, "global")
+ newluacmd("@@_if_alt_set:nT", ltjfont.does_alt_set, "global")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ctex_ltj_zero_globaldefs:}
% 设置 \tn{globaldefs} 为 $0$,避免全局设置,应当在分组中使用。
% 这里通过 Lua 设置,可以不受外部 \TeX\ 环境中的 \tn{globaldefs} 的影响。
% \begin{macrocode}
- local id = new_luafunction("ctex")
- func[id] = function ()
- tex.set("globaldefs", 0)
- end
- set_lua("ctex_ltj_zero_globaldefs:", id, "global", "protected")
+ newluacmd("ctex_ltj_zero_globaldefs:", function ()
+ tex_set("globaldefs", 0)
+ end, "global", "protected")
}
\group_end:
% \end{macrocode}
@@ -4962,6 +4948,8 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
+% \changes{v2.5.8}{2021/11/18}{兼容 \pkg{microtype}。}
+%
% \begin{macro}{\@@_select_font_aux:}
% 使用 \tn{pickup@font} 取得字体名称前,总需要先设置 \tn{font@name}。在这里将
% \tn{f@family} 换成 CJK 字体族,并确保编码正确。
@@ -4971,7 +4959,8 @@ Copyright and Licence
\group_begin:
\tl_set_eq:NN \f@encoding \CJK@encoding
\tl_set_eq:NN \f@family \CJK@family
- \@@_push_fontname:n { \use:c { \curr@fontshape / \f@size } }
+ \cs_set_eq:NN \pickup@font \ctex_ltj_pickup_font:
+ \@@_push_fontname:n { \curr@fontshape / \f@size }
\ctex_ltj_pickup_font:
\group_end:
\font@name
@@ -4988,12 +4977,12 @@ Copyright and Licence
\cs_new_protected:Npn \@@_push_fontname:n #1
{
\seq_gpush:No \g_@@_fontname_seq { \font@name }
- \cs_gset_nopar:Npx \font@name {#1}
+ \tl_gset:Nx \font@name { \exp_not:c {#1} }
}
\cs_new_protected:Npn \@@_pop_fontname:
{
\seq_gpop:NNT \g_@@_fontname_seq \l_@@_tmp_tl
- { \cs_gset_eq:NN \font@name \l_@@_tmp_tl }
+ { \tl_gset_eq:NN \font@name \l_@@_tmp_tl }
}
\seq_new:N \g_@@_fontname_seq
% \end{macrocode}
@@ -5152,7 +5141,7 @@ Copyright and Licence
{
\group_begin:
\use:e { \exp_not:N \split@name #1 / \f@size } \@nil
- \@@_push_fontname:n { \use:c { \curr@fontshape / \f@size } }
+ \@@_push_fontname:n { \curr@fontshape / \f@size }
\ctex_ltj_pickup_font:
\group_end:
\@@_pop_fontname:
@@ -6922,17 +6911,14 @@ Copyright and Licence
local fmt = luatexja.jfont.font_metric_table
local getattribute = tex.getattribute
local setdimen = tex.setdimen
- local func = lua.get_functions_table()
- local id = luatexbase.new_luafunction("ctex")
- func[id] = function ()
+ ctex.newluacmd("ctex_update_kanjisize:", 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
- token.set_lua("ctex_update_kanjisize:", id, "global", "protected")
+ end, "global", "protected")
}
\group_end:
\ctex_add_to_selectfont:n { \ctex_update_kanjisize: }
@@ -8635,6 +8621,22 @@ Copyright and Licence
}
% \end{macrocode}
%
+% \changes{v2.5.8}{2021/12/04}{兼容 \pkg{titlesec} 包和 \tn{CTEXifname}。}
+% 在 \pkg{titlesec} 包定义的标题中更新 \tn{CTEXifname}。
+% \begin{macrocode}
+\ctex_at_end_package:nn { titlesec }
+ {
+ \ctex_patch_cmd:Nnn \ttl@labelling
+ { \let \ifttl@toclabel \ifttl@label }
+ {
+ \let \ifttl@toclabel \ifttl@label
+ \CTEX@updatettlifname
+ }
+ \cs_new_protected:Npn \CTEX@updatettlifname
+ { \ifttl@label \CTEX@ifnametrue \else: \CTEX@ifnamefalse \fi: }
+ }
+% \end{macrocode}
+%
% \paragraph{兼容 \pkg{titleps} 宏包}
%
% \changes{v2.3}{2015/12/25}{兼容 \pkg{titleps} 宏包。}
@@ -10918,17 +10920,17 @@ Copyright and Licence
% 文件标识信息。
% \begin{macrocode}
%<adobe>\ProvidesFile{ctex-zhmap-adobe.tex}%
-%<adobe> [2021/06/20 v2.5.7 Adobe font map loader for DVIPDFMx (CTEX)]
+%<adobe> [2021/12/12 v2.5.8 Adobe font map loader for DVIPDFMx (CTEX)]
%<fandol>\ProvidesFile{ctex-zhmap-fandol.tex}%
-%<fandol> [2021/06/20 v2.5.7 Fandol font map loader for DVIPDFMx (CTEX)]
+%<fandol> [2021/12/12 v2.5.8 Fandol font map loader for DVIPDFMx (CTEX)]
%<founder>\ProvidesFile{ctex-zhmap-founder.tex}%
-%<founder> [2021/06/20 v2.5.7 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
+%<founder> [2021/12/12 v2.5.8 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
%<mac>\ProvidesFile{ctex-zhmap-mac.tex}%
-%<mac> [2021/06/20 v2.5.7 Mac font map loader for DVIPDFMx (CTEX)]
+%<mac> [2021/12/12 v2.5.8 Mac font map loader for DVIPDFMx (CTEX)]
%<ubuntu>\ProvidesFile{ctex-zhmap-ubuntu.tex}%
-%<ubuntu> [2021/06/20 v2.5.7 Ubuntu font map loader for DVIPDFMx (CTEX)]
+%<ubuntu> [2021/12/12 v2.5.8 Ubuntu font map loader for DVIPDFMx (CTEX)]
%<windows>\ProvidesFile{ctex-zhmap-windows.tex}%
-%<windows> [2021/06/20 v2.5.7 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
+%<windows> [2021/12/12 v2.5.8 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
% \end{macrocode}
%
% \paragraph{\pkg{ctex-zhmap-adobe.tex}}
@@ -11630,6 +11632,7 @@ Copyright and Licence
% \end{macro}
%
% \changes{v2.5.6}{2021/02/16}{使用正确的导言区末尾钩子。}
+% \changes{v2.5.8}{2021/11/18}{兼容 \LaTeX \ 2021/11/15。}
%
% \LaTeX \ 2020/10/01 开始提供常用钩子管理机制。在新机制下,我们只需要做简单的包装。
% \begin{macrocode}
@@ -11641,8 +11644,12 @@ Copyright and Licence
{ \ctex_gadd_ltxhook:nn { begindocument/before } }
\cs_new_protected:Npn \ctex_after_end_preamble:n
{ \ctex_gadd_ltxhook:nn { begindocument/end } }
- \cs_new_protected:Npn \ctex_gadd_package_hook:nnn #1#2
- { \ctex_gadd_ltxhook:nn { package/#1/#2 } }
+ \cs_new_protected:Npx \ctex_gadd_package_hook:nnn #1#2
+ {
+ \ctex_if_format_at_least:nTF { 2021/11/15 }
+ { \ctex_gadd_ltxhook:nn { package/#2/#1 } }
+ { \ctex_gadd_ltxhook:nn { package/#1/#2 } }
+ }
\file_input_stop:
}
{ }
diff --git a/language/chinese/ctex/ctex.pdf b/language/chinese/ctex/ctex.pdf
index 073c674a84..e4e02e6d8b 100644
--- a/language/chinese/ctex/ctex.pdf
+++ b/language/chinese/ctex/ctex.pdf
Binary files differ
diff --git a/language/chinese/ctex/ctxdoc.cls b/language/chinese/ctex/ctxdoc.cls
index 49a29d92a1..9e5d39f97d 100644
--- a/language/chinese/ctex/ctxdoc.cls
+++ b/language/chinese/ctex/ctxdoc.cls
@@ -21,7 +21,7 @@
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: ctxdoc.cls 1769321 2020-05-06 19:54:31 +0800 Qing Lee <sobenlee@gmail.com> $
+\GetIdInfo$Id: ctxdoc.cls 838ebab 2021-11-19 14:11:35 +0800 Qing Lee <sobenlee@gmail.com> $
{ctex documentation (CTEX)}
\ProvidesExplClass{ctxdoc}{\ExplFileDate}{}{\ExplFileDescription}
\ExplSyntaxOff
@@ -123,6 +123,10 @@
\setlist[1]{labelindent=\parindent}
\setlist[enumerate]{leftmargin=*}
\setlist[itemize]{leftmargin=*}
+\renewlist{arguments}{enumerate}{1}
+\setlist[arguments]{nolistsep,
+ leftmargin=\parindent, labelindent=0pt, labelsep=*,
+ label=\texttt{\#\arabic*}\,:}
\newlist{optdesc}{description}{3}
%% 设置间距为 \marginparsep,与 l3doc 一致
\setlist[optdesc]{%