diff options
Diffstat (limited to 'Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx')
-rw-r--r-- | Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx | 451 |
1 files changed, 398 insertions, 53 deletions
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx index a2c2c38fafe..5c19c51446a 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx @@ -90,7 +90,7 @@ CJK scripts fonts (TrueType or OpenType). \askforoverwritefalse \preamble -$Id: xeCJK.dtx 525 2013-11-11 06:32:00Z sobenlee $ +$Id: xeCJK.dtx 533 2013-12-05 10:52:12Z sobenlee $ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ ----------------------------------------------------------------- Author: @@ -189,7 +189,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} %</!config> -\GetIdInfo$Id: xeCJK.dtx 525 2013-11-11 06:32:00Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 533 2013-12-05 10:52:12Z sobenlee $ %<*driver|package> {Typesetting CJK scripts with XeLaTeX} %</driver|package> @@ -209,7 +209,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %<fntef> {xeCJKfntef} %<listings> {xeCJK-listings} %<xunicode> {xunicode-addon} - {\ExplFileDate}{3.2.7}{\ExplFileDescription} + {\ExplFileDate}{3.2.8}{\ExplFileDescription} %<*driver> \let\xeCJKrevnum\ExplFileVersion \ExplSyntaxOff @@ -340,7 +340,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \changes{v3.2.4}{2013/07/02}{遵循 \hologo{LaTeX3} 变量需要预先声明的原则。} % \changes{v3.2.6}{2013/07/29}{\texttt{case} 类函数的用法与 \hologo{LaTeX3} 同步。} % -% \CheckSum{5446} +% \CheckSum{5934} % \GetFileInfo{\jobname.dtx} % % \title{\bfseries\pkg{xeCJK} 宏包} @@ -687,7 +687,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % 在这些控制序列前面加上 \ref{subsec:others}~节介绍的 \cs{xeCJKnobreak}。 % \end{function} % -% \begin{function}[updated=2013-05-29]{Verb} +% \begin{function}[updated=2013-11-16]{Verb} % \begin{syntax} % Verb = \meta{\TF\orvar\defaultvar{env}\orvar{}env+} % \end{syntax} @@ -696,7 +696,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % 之间的间距,以便于保持代码的对齐;\texttt{env} 选项不调整 \cs{verb} 里的间距,^^A % \texttt{env+} 选项还将正文里设置的间距应用到 \cs{verb} 里。^^A % 这个选项对使用到 \cs{verbatim@font} 命令的情形均有效,更一般的情况可以使用 -% \ref{subsec:others}~节介绍的 \cs{xeCJKVerbAddon}。 +% \ref{subsec:others}~节介绍的 \cs{xeCJKVerbAddon}。\texttt{false} 表示不作任何 +% 处理。以上选项的值除 \texttt{false} 外,都禁止在汉字之间和汉字与西文之间自动换行。 % \end{function} % % \subsection{字体设置与选择} @@ -1286,7 +1287,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \subsection{其它} % \label{subsec:others} % -% \begin{function}[updated=2013-06-29]{\xeCJKVerbAddon,\xeCJKOffVerbAddon} +% \begin{function}[updated=2013-11-16]{\xeCJKVerbAddon,\xeCJKOffVerbAddon} % 调整文字间距以便于让 CJK 字符占的宽度等于西文等宽字体中两个空格的宽度。如果这两 % 个空格的宽度小于当前 CJK 正常文字的宽度,将对 CJK 字体进行适当地缩小。这有利于 % 等宽字体的代码对齐等情形。需要注意的是,\cs{xeCJKVerbAddon} 对 \pkg{xeCJK} 的内 @@ -1700,12 +1701,23 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macro} % % \begin{macro}[internal]{\xeCJK_glue_to_skip:nN} -% 取得一个 |glue| 的长度,包括伸展和收缩部分。 +% 取得一个 |glue| 的长度,包括伸展和收缩部分。如果参数不是 |glue|,则取其宽度。 % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_glue_to_skip:nN #1#2 { - \hbox_set:Nn \l_@@_tmp_box { #1 \scan_stop: \exp_after:wN } \exp_after:wN - \skip_set:Nn \exp_after:wN #2 \exp_after:wN { \skip_use:N \tex_lastskip:D } + \group_begin: + \hbox_set:Nw \l_@@_tmp_box #1 \scan_stop: + \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + { + \exp_after:wN \hbox_set_end: \exp_after:wN \group_end: \exp_after:wN + \skip_set:Nn \exp_after:wN #2 \exp_after:wN + { \skip_use:N \tex_lastskip:D } + } + { + \hbox_set_end: \exp_after:wN \group_end: \exp_after:wN + \skip_set:Nn \exp_after:wN #2 \exp_after:wN + { \dim_use:N \box_wd:N \l_@@_tmp_box } + } } % \end{macrocode} % \end{macro} @@ -5975,7 +5987,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \keys_define:nn { xeCJK / options } { Verb .choices:nn = - { true , env , env+ , false } + { true , env+ , env , false } { \int_set_eq:NN \l_@@_verb_case_int \l_keys_choice_int } , Verb .default:n = { env } } @@ -5983,18 +5995,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \if_case:w \l_@@_verb_case_int \or: - \cs_set_eq:NN \CJKglue \@@_zero_glue: - \cs_set_eq:NN \CJKecglue \@@_zero_glue: + \@@_nobreak_skip_zero: \or: \int_compare:nNnTF \etex_currentgrouptype:D = \c_fourteen { \xeCJKVerbAddon } - { - \cs_set_eq:NN \CJKglue \@@_zero_glue: - \cs_set_eq:NN \CJKecglue \@@_zero_glue: - } + { \@@_nobreak_skip: } \or: - \int_compare:nNnT \etex_currentgrouptype:D = \c_fourteen + \int_compare:nNnTF \etex_currentgrouptype:D = \c_fourteen { \xeCJKVerbAddon } + { \@@_nobreak_skip_zero: } \fi: } \@@_after_preamble:n @@ -6005,15 +6014,91 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\@@_nobreak_skip_zero:,\@@_nobreak_skip:} +% \changes{v3.2.8}{2013/11/16}{禁止在 \cs{verb} 中断行。} +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_nobreak_skip_zero: + { + \@@_reset_shipout_skip: + \cs_set_eq:NN \@@_shipout_check_for_glue: \xeCJK_check_for_glue: + \cs_set_eq:NN \@@_shipout_boundary:w \xeCJK_CJK_and_Boundary:w + \tl_put_right:Nn \l_@@_reset_shipout_skip_hook_tl + { + \cs_set_eq:NN \xeCJK_check_for_glue: \@@_shipout_check_for_glue: + \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \@@_shipout_boundary:w + } + \xeCJK_cs_clear:N \CJKglue + \xeCJK_cs_clear:N \CJKecglue + \xeCJK_cs_clear:N \xeCJK_check_for_glue: + \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \xeCJK_class_group_end: + \cs_set_eq:NN \@@_punct_hskip:n \@@_nobreak_hskip:n + \cs_set_eq:NN \@@_punct_breakable_kern:n \@@_nobreak_hskip:n + } +\cs_new_protected_nopar:Npn \@@_nobreak_skip: + { + \@@_reset_shipout_skip: + \xeCJK_glue_to_skip:nN { \CJKglue } \l_@@_ccglue_skip + \skip_if_eq:nnTF { \l_@@_ccglue_skip } { \c_zero_skip } + { \xeCJK_cs_clear:N \CJKglue } + { \cs_set_eq:NN \CJKglue \@@_nobreak_ccglue: } + \xeCJK_glue_to_skip:nN { \CJKecglue } \l_@@_ecglue_skip + \skip_if_eq:nnTF { \l_@@_ecglue_skip } { \c_zero_skip } + { \xeCJK_cs_clear:N \CJKecglue } + { \cs_set_eq:NN \CJKecglue \@@_nobreak_ecglue: } + \cs_set_eq:NN \@@_punct_hskip:n \@@_nobreak_hskip:n + \cs_set_eq:NN \@@_punct_breakable_kern:n \@@_nobreak_hskip:n + } +\cs_new_protected_nopar:Npn \@@_nobreak_ccglue: + { \xeCJK_no_break: \skip_horizontal:N \l_@@_ccglue_skip } +\cs_new_protected_nopar:Npn \@@_nobreak_ecglue: + { \xeCJK_no_break: \skip_horizontal:N \l_@@_ecglue_skip } +\cs_new_protected_nopar:Npn \@@_nobreak_hskip:n + { \xeCJK_no_break: \skip_horizontal:n } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\@@_reset_shipout_skip:} +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_reset_shipout_skip: + { + \cs_set_eq:NN \@@_shipout_CJKglue: \CJKglue + \cs_set_eq:NN \@@_shipout_CJKecglue: \CJKecglue + \cs_set_eq:NN \@@_shipout_punct_hskip:n \@@_punct_hskip:n + \cs_set_eq:NN + \@@_shipout_punct_breakable_kern:n \@@_punct_breakable_kern:n + \tl_set:Nx \l_@@_off_verb_addon_tl + { + \exp_not:c + { bool_set_ \bool_if:NTF \l_@@_xecglue_bool { true } { false } :N } + \l_@@_xecglue_bool + \exp_not:n + { + \cs_set_eq:NN \CJKglue \@@_shipout_CJKglue: + \cs_set_eq:NN \CJKecglue \@@_shipout_CJKecglue: + \cs_set_eq:NN \@@_punct_hskip:n \@@_shipout_punct_hskip:n + \cs_set_eq:NN + \@@_punct_breakable_kern:n \@@_shipout_punct_breakable_kern:n + \l_@@_reset_shipout_skip_hook_tl + } + } + \@@_add_to_shipout:n { \l_@@_off_verb_addon_tl } + \xeCJKsetup { xCJKecglue = false } + } +\tl_new:N \l_@@_reset_shipout_skip_hook_tl +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\xeCJKOffVerbAddon,\xeCJKVerbAddon} % \changes{v3.1.0}{2012/11/19}{新增 \cs{xeCJKVerbAddon} 用于抄录环境中的间距调整。} % \changes{v3.2.3}{2013/06/04} % {新增 \cs{xeCJKOffVerbAddon} 用于局部取消 \cs{xeCJKOffVerbAddon} 的影响;并解决 % 跨页使用时影响到页眉页脚的问题。} % \changes{v3.2.5}{2013/07/13}{禁止自动换行,与西文一致。} +% \changes{v3.2.8}{2013/11/16}{增加是否是等宽字体的判断。} % \cs{xeCJKVerbAddon} 进行了比较大的调整,应该只在分组环境里使用。为了方便调整间距 % 以利于对齐,这里只把字符分成了两类,并且在 CJK 类与边界(空格)之间也插入 -% \cs{CJKecglue}。当然,这样做之后,关于标点符号的禁则就没有了。 +% \cs{CJKecglue}。以字母“M”的宽度是否等于 \cs{fontdimen2} 来判断当前字体是否是 +% 等宽字体。如果不是等宽字体,则设置间距为零或正文间距。 % \begin{macrocode} \NewDocumentCommand \xeCJKVerbAddon { } { @@ -6021,13 +6106,26 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \bool_if:NF \l_@@_listings_env_bool { - \@@_set_verb_exspace: - \@@_verb_addon: + \dim_compare:nNnTF + { \tex_fontdimen:D \c_two \tex_font:D } = + { \etex_fontcharwd:D \tex_font:D \c_@@_mono_letter_int } + { + \@@_set_verb_exspace: + \@@_verb_addon: + } + { + \int_if_odd:nTF { \l_@@_verb_case_int } + { \@@_nobreak_skip_zero: } + { \@@_nobreak_skip: } + } } } } +\int_const:Nn \c_@@_mono_letter_int { 77 } \bool_new:N \l_@@_listings_env_bool -\NewDocumentCommand \xeCJKOffVerbAddon { } { } +\NewDocumentCommand \xeCJKOffVerbAddon { } + { \tl_use:N \l_@@_off_verb_addon_tl } +\tl_new:N \l_@@_off_verb_addon_tl \cs_new_protected_nopar:Npn \@@_verb_addon: { \bool_if:NF \l_@@_verb_addon_bool @@ -6038,10 +6136,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \@@_set_char_class_eq:nn { HalfLeft } { Default } \@@_set_char_class_eq:nn { HalfRight } { Default } \@@_set_char_class_eq:nn { NormalSpace } { Default } - \cs_set_eq:NN \@@_verb_CJKglue: \CJKglue - \cs_set_eq:NN \@@_verb_CJKecglue: \CJKecglue - \cs_set_eq:NN \@@_verb_check_for_glue: \xeCJK_check_for_glue: - \cs_set_eq:NN \@@_verb_boundary:w \xeCJK_CJK_and_Boundary:w + \cs_set_eq:NN \@@_shipout_CJKglue: \CJKglue + \cs_set_eq:NN \@@_shipout_CJKecglue: \CJKecglue + \cs_set_eq:NN \@@_shipout_check_for_glue: \xeCJK_check_for_glue: + \cs_set_eq:NN \@@_shipout_boundary:w \xeCJK_CJK_and_Boundary:w \cs_set_protected_nopar:Npx \xeCJKOffVerbAddon { \@@_reset_char_class:n { FullLeft } @@ -6054,10 +6152,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \l_@@_xecglue_bool \exp_not:n { - \cs_set_eq:NN \CJKglue \@@_verb_CJKglue: - \cs_set_eq:NN \CJKecglue \@@_verb_CJKecglue: - \cs_set_eq:NN \xeCJK_check_for_glue: \@@_verb_check_for_glue: - \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \@@_verb_boundary:w + \cs_set_eq:NN \CJKglue \@@_shipout_CJKglue: + \cs_set_eq:NN \CJKecglue \@@_shipout_CJKecglue: + \cs_set_eq:NN \xeCJK_check_for_glue: \@@_shipout_check_for_glue: + \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \@@_shipout_boundary:w } } \@@_add_to_shipout:n { \xeCJKOffVerbAddon } @@ -6069,18 +6167,16 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \xeCJK_cs_clear:N \CJKecglue } { - \cs_set_eq:NN \CJKglue \@@_verb_ccglue: - \cs_set_eq:NN \CJKecglue \@@_verb_ecglue: + \skip_set_eq:NN \l_@@_ccglue_skip \l_@@_verb_exspace_skip + \skip_set:Nn \l_@@_ecglue_skip { .5 \l_@@_verb_exspace_skip } + \cs_set_eq:NN \CJKglue \@@_nobreak_ccglue: + \cs_set_eq:NN \CJKecglue \@@_nobreak_ecglue: } \cs_set_eq:NN \xeCJK_check_for_glue: \CJKecglue \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \@@_verb_CJK_and_Boundary:w } \cs_new_protected_nopar:Npn \@@_verb_CJK_and_Boundary:w { \xeCJK_class_group_end: \CJKecglue } -\cs_new_protected_nopar:Npn \@@_verb_ccglue: - { \xeCJK_no_break: \skip_horizontal:N \l_@@_verb_exspace_skip } -\cs_new_protected_nopar:Npn \@@_verb_ecglue: - { \xeCJK_no_break: \skip_horizontal:n { 0.5 \l_@@_verb_exspace_skip } } \cs_new_protected_nopar:Npn \@@_reset_char_class:n #1 { \int_set:Nn \l_@@_tmp_int { \xeCJK_class_num:n {#1} } @@ -8070,7 +8166,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \subsection{\pkg{xunicode-addon}} % -% \changes{v3.2.5}{2012/07/18} +% \changes{v3.2.5}{2013/07/18} % {增加小宏包 \pkg{xunicode-addon},为 \pkg{xunicode} 提供判断字符是否存在的功能。} % % \begin{macrocode} @@ -8165,6 +8261,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \tl_set:Nx \UTFencname {##1} \clist_gput_right:Nx \g_@@_encname_clist {##1} \file_input:n { xunicode.sty } + \@@_declare_textcircled:n { \UTFencname } + \@@_declare_math_symbols:n { \UTFencname } } { \msg_error:nnn { xunicode-addon } { encoding-unknown } {##1} } } @@ -8173,7 +8271,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ } \clist_new:N \l_@@_encname_clist \msg_new:nnnn { xunicode-addon } { encoding-unknown } - {Encoding~scheme~"#1"~unknown.} + { Encoding~scheme~"#1"~unknown. } { You~may~use \\\\ \token_to_str:N \usepackage [ #1 , \encodingdefault ] {fontenc} \\\\ @@ -8182,6 +8280,71 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\@@_declare_math_symbols:} +% 几个特殊的数学符号对应的 Unicode 符号定义以 \cs{text} 打头的命令。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_declare_math_symbols:n #1 + { + \@@_declare_character:Nnn \textFinv {#1} { x2132 } + \@@_declare_character:Nnn \textaleph {#1} { x2135 } + \@@_declare_character:Nnn \textbeth {#1} { x2136 } + \@@_declare_character:Nnn \textgimel {#1} { x2137 } + \@@_declare_character:Nnn \textdaleth {#1} { x2138 } + \@@_declare_character:Nnn \textGame {#1} { x2141 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\DeclareUTFmathsymbols} +% \changes{v3.2.8}{2013/12/04}{修正 \cs{UseMathAsText} 的功能,恢复 \cs{hbar} +% 和增加以 \texttt{text} 打头的文本符号命令。} +% 将文本符号定义为 \cs{protected} 宏后,为了与 \pkg{hyperref} 的书签功能兼容 +% 需要作一点额外处理。 +% \begin{macrocode} +\RenewDocumentCommand \DeclareUTFmathsymbols { m } + { + \bool_if:NT \l_@@_math_as_UTF_text_bool + { + \seq_map_inline:Nn \l_@@_math_as_UTF_text_seq + { \@@_declare_math_as_UTF_text:n {##1} } + \bool_set_false:N \l_@@_math_as_UTF_text_bool + } + } +\seq_new:N \l_@@_math_as_UTF_text_seq +\seq_set_from_clist:Nn \l_@@_math_as_UTF_text_seq + { hbar , Finv , aleph , beth , gimel , daleth , Game } +\bool_new:N \l_@@_math_as_UTF_text_bool +\RenewDocumentCommand \UseMathAsText { } + { + \math@s@text@true + \bool_set_true:N \l_@@_math_as_UTF_text_bool + } +\@onlypreamble \UseMathAsText +\cs_new_protected_nopar:Npn \@@_declare_math_as_UTF_text:n #1 + { + \cs_if_exist:cTF {#1} + { + \cs_new_eq:cc { keepmathUTF #1 } {#1} + \cs_gset_protected_nopar:cpx {#1} + { + \exp_not:N \mode_if_math:TF + { \exp_not:c { keepmathUTF #1 } } + { \exp_not:c { text #1 } } + } + \tl_put_right:Nx \l_@@_hyperref_hook_tl + { \cs_set_eq:NN \exp_not:c {#1} \exp_not:c { text #1 } } + } + { \cs_new_nopar:cpx {#1} { \exp_not:c { text #1 } } } + } +\tl_new:N \l_@@_hyperref_hook_tl +\AtBeginDocument + { + \cs_if_free:NF \pdfstringdefDisableCommands + { \pdfstringdefDisableCommands { \l_@@_hyperref_hook_tl } } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[internal,pTF]{\@@_glyph_if_exist:n} % 判断字符在当前字体中是否存在。 % \begin{macrocode} @@ -8245,14 +8408,35 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \RenewDocumentCommand \DeclareUTFcharacter { O { \UTFencname } m m } { - \@@_if_csname:nTF {#3} - { \@@_declare_character:Nnn #3 } - { \@@_declare_character:cnn { \tl_to_str:n {#3} } } - {#1} {#2} + \str_if_eq:nnTF {#3} { \hbar } + { \@@_restore_hbar: } + { + \@@_if_csname:nTF {#3} + { \@@_declare_character:Nnn #3 } + { \@@_declare_character:cnn { \tl_to_str:n {#3} } } + {#1} {#2} + } } % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\@@_restore_hbar:} +% 恢复 \cs{hbar} 为原本定义。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_restore_hbar: + { + \cs_if_free:cF { ? - \token_to_str:N \hbar } + { \@@_restore_hbar:c { ? - \token_to_str:N \hbar } } + } +\cs_new_protected_nopar:Npn \@@_restore_hbar:N #1 + { + \cs_gset_eq:NN \hbar #1 + \cs_undefine:N #1 + } +\cs_generate_variant:Nn \@@_restore_hbar:N { c } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[internal]{\@@_declare_character:Nnn} % 通过 \texttt{lowercase} 技巧,直接由 Unicode |#3| 得到编码 |#2| 下的符号命令 % |#1| 对应的实际字符。 @@ -8408,7 +8592,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \begin{macro}[internal]{\DeclareEncodedCompositeCharacter} % |#1| 是编码,|#2| 是重音命令,|#3| 是组合重音符号的 Unicode,|#4| 是基本重音符号 -% 的 Unicode。当 |#2| 的参数为空时,输出 |#4|,否则是 |#2| 与 |#3| 的组合。 +% 的 Unicode。当 |#2| 的参数为空时,输出 |#4|,否则是 |#2| 的参数与 |#3| 的组合。 % \begin{macrocode} \RenewDocumentCommand \DeclareEncodedCompositeCharacter { m m m m } { @@ -8422,7 +8606,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \begin{macro}[internal]{\DeclareEncodedCompositeAccents} % |#1| 是编码,|#2| 是重音命令,|#3| 和 |#4| 都是组合重音的 Unicode。当 |#2| 的 -% 参数为空时,输出 |#3|,否则是 |#2| 与 |#4| 的组合。 +% 参数为空时,输出 |#3|,否则是 |#2| 的参数与 |#4| 的组合。 % \begin{macrocode} \RenewDocumentCommand \DeclareEncodedCompositeAccents { m m m m } { @@ -8502,27 +8686,69 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \@@_glyph_if_exist:nTF { `#4 } {#4} - { - \cs_if_exist_use:cTF { ? #2 } - { {#1} } {#4} - } + { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#4} } } { - \@@_glyph_if_exist:nTF { `#3 } - { #1#3 } + \bool_if:NTF \l_@@_add_circle_bool { + \bool_set_false:N \l_@@_add_circle_bool \@@_glyph_if_exist:nTF { `#4 } - { \add@accent { `#4 } {#1} } + { \@@_add_circle:nn {#4} {#1} } + } + { + \@@_glyph_if_exist:nTF { `#3 } + { #1#3 } { - \cs_if_exist_use:cTF { ? #2 } - { {#1} } {#1} + \@@_glyph_if_exist:nTF { `#4 } + { \add@accent { `#4 } {#1} } } } + { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#1} } } } % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\@@_add_circle:nn} +% 对圆圈中的数字或者字母适当缩小,以适合圆圈的大小。只有字体中存在 +% \texttt{U+25EF} 时,才使用这里的设置,否则还还是 \LaTeX\ 中的设置。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_circle:nn #1#2 + { + \hcoffin_set:Nn \l_@@_circle_coffin {#1} + \hcoffin_set:Nn \l_@@_tmp_coffin {#2} + \dim_set:Nn \l_@@_circle_width_dim + { \fp_use:N \l_@@_circle_ratio_fp \coffin_wd:N \l_@@_circle_coffin } + \coffin_resize:Nnn \l_@@_tmp_coffin + { \l_@@_circle_width_dim } + { + ( \coffin_ht:N \l_@@_tmp_coffin + \coffin_dp:N \l_@@_tmp_coffin ) + * \tex_number:D \l_@@_circle_width_dim + / \tex_number:D \coffin_wd:N \l_@@_tmp_coffin + } + \coffin_attach:NnnNnnnn + \l_@@_circle_coffin { hc } { vc } + \l_@@_tmp_coffin { hc } { vc } + { \c_zero_dim } { \c_zero_dim } + \coffin_typeset:Nnnnn \l_@@_circle_coffin + { H } { l } { \c_zero_dim } { \c_zero_dim } + } +\dim_new:N \l_@@_circle_width_dim +\coffin_new:N \l_@@_tmp_coffin +\coffin_new:N \l_@@_circle_coffin +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\settextcircledratio} +% 设置圆圈中文字的宽度与圆圈宽度的比例,预设为 \texttt{0.7}。 +% \begin{macrocode} +\NewDocumentCommand \settextcircledratio { m } + { \fp_set:Nn \l_@@_circle_ratio_fp {#1} } +\fp_new:N \l_@@_circle_ratio_fp +\settextcircledratio { 0.7 } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[internal]{\AtBeginUTFCommand,\AtEndUTFCommand} % 设置在符号命令前后使用的钩子,可选参数用于指定单个符号命名。可以用 |#1| % 引用带参数的组合符号命令的参数或者符号命令对应的符号。 @@ -8591,6 +8817,125 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % +% \changes{v3.2.8}{2013/12/05}{启用 \pkg{xunicode} 中的带圈数字和字母设置。} +% +% \begin{macro}[internal]{\@@_declare_textcircled:n} +% 启用 \pkg{xunicode} 中的带圈数字和字母设置。 +% \begin{macrocode} +\AtBeginUTFCommand [ \textcircled ] + { \bool_set_true:N \l_@@_add_circle_bool } +\bool_new:N \l_@@_add_circle_bool +\cs_new_protected_nopar:Npn \@@_declare_textcircled:n #1 + { + \@@_declare_character:Nnn \textbigcircle {#1} { x25EF } + \@@_declare_accent:Nnnn \textcircled {#1} { 20DD } { 25EF } + \@@_declare_composite:Nnnn \textcircled {#1} { 0 } { x24EA } + \@@_declare_composite:Nnnn \textcircled {#1} { 1 } { x2460 } + \@@_declare_composite:Nnnn \textcircled {#1} { 2 } { x2461 } + \@@_declare_composite:Nnnn \textcircled {#1} { 3 } { x2462 } + \@@_declare_composite:Nnnn \textcircled {#1} { 4 } { x2463 } + \@@_declare_composite:Nnnn \textcircled {#1} { 5 } { x2464 } + \@@_declare_composite:Nnnn \textcircled {#1} { 6 } { x2465 } + \@@_declare_composite:Nnnn \textcircled {#1} { 7 } { x2466 } + \@@_declare_composite:Nnnn \textcircled {#1} { 8 } { x2467 } + \@@_declare_composite:Nnnn \textcircled {#1} { 9 } { x2468 } + \@@_declare_composite:Nnnn \textcircled {#1} { 10 } { x2469 } + \@@_declare_composite:Nnnn \textcircled {#1} { 11 } { x246A } + \@@_declare_composite:Nnnn \textcircled {#1} { 12 } { x246B } + \@@_declare_composite:Nnnn \textcircled {#1} { 13 } { x246C } + \@@_declare_composite:Nnnn \textcircled {#1} { 14 } { x246D } + \@@_declare_composite:Nnnn \textcircled {#1} { 15 } { x246E } + \@@_declare_composite:Nnnn \textcircled {#1} { 16 } { x246F } + \@@_declare_composite:Nnnn \textcircled {#1} { 17 } { x2470 } + \@@_declare_composite:Nnnn \textcircled {#1} { 18 } { x2471 } + \@@_declare_composite:Nnnn \textcircled {#1} { 19 } { x2472 } + \@@_declare_composite:Nnnn \textcircled {#1} { 20 } { x2473 } + \@@_declare_composite:Nnnn \textcircled {#1} { 21 } { x3251 } + \@@_declare_composite:Nnnn \textcircled {#1} { 22 } { x3252 } + \@@_declare_composite:Nnnn \textcircled {#1} { 23 } { x3253 } + \@@_declare_composite:Nnnn \textcircled {#1} { 24 } { x3254 } + \@@_declare_composite:Nnnn \textcircled {#1} { 25 } { x3255 } + \@@_declare_composite:Nnnn \textcircled {#1} { 26 } { x3256 } + \@@_declare_composite:Nnnn \textcircled {#1} { 27 } { x3257 } + \@@_declare_composite:Nnnn \textcircled {#1} { 28 } { x3258 } + \@@_declare_composite:Nnnn \textcircled {#1} { 29 } { x3259 } + \@@_declare_composite:Nnnn \textcircled {#1} { 30 } { x325A } + \@@_declare_composite:Nnnn \textcircled {#1} { 31 } { x325B } + \@@_declare_composite:Nnnn \textcircled {#1} { 32 } { x325C } + \@@_declare_composite:Nnnn \textcircled {#1} { 33 } { x325D } + \@@_declare_composite:Nnnn \textcircled {#1} { 34 } { x325E } + \@@_declare_composite:Nnnn \textcircled {#1} { 35 } { x325F } + \@@_declare_composite:Nnnn \textcircled {#1} { 36 } { x32B1 } + \@@_declare_composite:Nnnn \textcircled {#1} { 37 } { x32B2 } + \@@_declare_composite:Nnnn \textcircled {#1} { 38 } { x32B3 } + \@@_declare_composite:Nnnn \textcircled {#1} { 39 } { x32B4 } + \@@_declare_composite:Nnnn \textcircled {#1} { 40 } { x32B5 } + \@@_declare_composite:Nnnn \textcircled {#1} { 41 } { x32B6 } + \@@_declare_composite:Nnnn \textcircled {#1} { 42 } { x32B7 } + \@@_declare_composite:Nnnn \textcircled {#1} { 43 } { x32B8 } + \@@_declare_composite:Nnnn \textcircled {#1} { 44 } { x32B9 } + \@@_declare_composite:Nnnn \textcircled {#1} { 45 } { x32BA } + \@@_declare_composite:Nnnn \textcircled {#1} { 46 } { x32BB } + \@@_declare_composite:Nnnn \textcircled {#1} { 47 } { x32BC } + \@@_declare_composite:Nnnn \textcircled {#1} { 48 } { x32BD } + \@@_declare_composite:Nnnn \textcircled {#1} { 49 } { x32BE } + \@@_declare_composite:Nnnn \textcircled {#1} { 50 } { x32BF } + \@@_declare_composite:Nnnn \textcircled {#1} { A } { x24B6 } + \@@_declare_composite:Nnnn \textcircled {#1} { B } { x24B7 } + \@@_declare_composite:Nnnn \textcircled {#1} { C } { x24B8 } + \@@_declare_composite:Nnnn \textcircled {#1} { D } { x24B9 } + \@@_declare_composite:Nnnn \textcircled {#1} { E } { x24BA } + \@@_declare_composite:Nnnn \textcircled {#1} { F } { x24BB } + \@@_declare_composite:Nnnn \textcircled {#1} { G } { x24BC } + \@@_declare_composite:Nnnn \textcircled {#1} { H } { x24BD } + \@@_declare_composite:Nnnn \textcircled {#1} { I } { x24BE } + \@@_declare_composite:Nnnn \textcircled {#1} { J } { x24BF } + \@@_declare_composite:Nnnn \textcircled {#1} { K } { x24C0 } + \@@_declare_composite:Nnnn \textcircled {#1} { L } { x24C1 } + \@@_declare_composite:Nnnn \textcircled {#1} { M } { x24C2 } + \@@_declare_composite:Nnnn \textcircled {#1} { N } { x24C3 } + \@@_declare_composite:Nnnn \textcircled {#1} { O } { x24C4 } + \@@_declare_composite:Nnnn \textcircled {#1} { P } { x24C5 } + \@@_declare_composite:Nnnn \textcircled {#1} { Q } { x24C6 } + \@@_declare_composite:Nnnn \textcircled {#1} { R } { x24C7 } + \@@_declare_composite:Nnnn \textcircled {#1} { S } { x24C8 } + \@@_declare_composite:Nnnn \textcircled {#1} { T } { x24C9 } + \@@_declare_composite:Nnnn \textcircled {#1} { U } { x24CA } + \@@_declare_composite:Nnnn \textcircled {#1} { V } { x24CB } + \@@_declare_composite:Nnnn \textcircled {#1} { W } { x24CC } + \@@_declare_composite:Nnnn \textcircled {#1} { X } { x24CD } + \@@_declare_composite:Nnnn \textcircled {#1} { Y } { x24CE } + \@@_declare_composite:Nnnn \textcircled {#1} { Z } { x24CF } + \@@_declare_composite:Nnnn \textcircled {#1} { a } { x24D0 } + \@@_declare_composite:Nnnn \textcircled {#1} { b } { x24D1 } + \@@_declare_composite:Nnnn \textcircled {#1} { c } { x24D2 } + \@@_declare_composite:Nnnn \textcircled {#1} { d } { x24D3 } + \@@_declare_composite:Nnnn \textcircled {#1} { e } { x24D4 } + \@@_declare_composite:Nnnn \textcircled {#1} { f } { x24D5 } + \@@_declare_composite:Nnnn \textcircled {#1} { g } { x24D6 } + \@@_declare_composite:Nnnn \textcircled {#1} { h } { x24D7 } + \@@_declare_composite:Nnnn \textcircled {#1} { i } { x24D8 } + \@@_declare_composite:Nnnn \textcircled {#1} { j } { x24D9 } + \@@_declare_composite:Nnnn \textcircled {#1} { k } { x24DA } + \@@_declare_composite:Nnnn \textcircled {#1} { l } { x24DB } + \@@_declare_composite:Nnnn \textcircled {#1} { m } { x24DC } + \@@_declare_composite:Nnnn \textcircled {#1} { n } { x24DD } + \@@_declare_composite:Nnnn \textcircled {#1} { o } { x24DE } + \@@_declare_composite:Nnnn \textcircled {#1} { p } { x24DF } + \@@_declare_composite:Nnnn \textcircled {#1} { q } { x24E0 } + \@@_declare_composite:Nnnn \textcircled {#1} { r } { x24E1 } + \@@_declare_composite:Nnnn \textcircled {#1} { s } { x24E2 } + \@@_declare_composite:Nnnn \textcircled {#1} { t } { x24E3 } + \@@_declare_composite:Nnnn \textcircled {#1} { u } { x24E4 } + \@@_declare_composite:Nnnn \textcircled {#1} { v } { x24E5 } + \@@_declare_composite:Nnnn \textcircled {#1} { w } { x24E6 } + \@@_declare_composite:Nnnn \textcircled {#1} { x } { x24E7 } + \@@_declare_composite:Nnnn \textcircled {#1} { y } { x24E8 } + \@@_declare_composite:Nnnn \textcircled {#1} { z } { x24E9 } + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</xunicode> % \end{macrocode} |