summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/xelatex/xecjk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-02-27 20:36:43 +0000
committerKarl Berry <karl@freefriends.org>2018-02-27 20:36:43 +0000
commitbc4c88bdc361d0d84a2c28a7d78467ecaa072e25 (patch)
treee57c0abefb8f72114c1ff90e351b3916909359b5 /Master/texmf-dist/source/xelatex/xecjk
parentf6f97a69d3847af9a8c49c35bd957fe0b35201e8 (diff)
xecjk (27feb18)
git-svn-id: svn://tug.org/texlive/trunk@46756 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/xelatex/xecjk')
-rw-r--r--Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx223
1 files changed, 123 insertions, 100 deletions
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
index 45161aaa47c..47ffa072f5a 100644
--- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
+++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
@@ -194,7 +194,7 @@ Copyright and Licence
%<*package|config|fntef|listings|xunicode|xunextra>
%<!(config|xunextra)>\NeedsTeXFormat{LaTeX2e}
%<!(config|xunextra)>\RequirePackage{expl3}
-%<+!driver>\GetIdInfo$Id: xeCJK.dtx 54327e6 2018-01-28 19:10:14 +0800 Qing Lee <sobenlee@gmail.com> $
+%<+!driver>\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $
%<package> {Typesetting CJK scripts with XeLaTeX}
%<config> {Configuration file for xeCJK package}
%<fntef> {xeCJK font effect}
@@ -207,7 +207,7 @@ Copyright and Licence
%<listings>\ProvidesExplPackage{xeCJK-listings}
%<xunicode>\ProvidesExplPackage{xunicode-addon}
%<xunextra>\ProvidesExplFile{xunicode-extra.def}
-%<!driver> {\ExplFileDate}{3.6.0}{\ExplFileDescription}
+%<!driver> {\ExplFileDate}{3.6.1}{\ExplFileDescription}
%</package|config|fntef|listings|xunicode|xunextra>
%<*driver>
\documentclass{ctxdoc}
@@ -278,8 +278,9 @@ Copyright and Licence
% \changes{v3.5.0}{2017/07/22}{使用 \texttt{lazy} 函数对 Boolean 表达式
% 进行最小化运算(\LaTeXiii{} 2017/07/19)。}
% \changes{v3.6.0}{2018/01/13}{同步 \LaTeXiii{} 2017/12/16。}
+% \changes{v3.6.1}{2018/02/27}{减少 \texttt{bool} 运算。}
%
-% \CheckSum{10769}
+% \CheckSum{10801}
% \GetFileId{xeCJK.sty}
%
% \title{\bfseries\pkg{xeCJK} 宏包}
@@ -1781,7 +1782,7 @@ Copyright and Licence
% 去掉 |#1| 外层的分组括号。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_tl_remove_outer_braces:N #1
- { \tl_set:Nx #1 { \exp_args:NV \xeCJK_tl_remove_outer_braces:n #1 } }
+ { \tl_set:Nx #1 { \exp_args:No \xeCJK_tl_remove_outer_braces:n {#1} } }
\cs_new:Npn \xeCJK_tl_remove_outer_braces:n #1
{
\exp_last_unbraced:Nf
@@ -1789,11 +1790,14 @@ Copyright and Licence
}
\cs_new:Npn \@@_tl_remove_outer_braces:w #1 \s__stop
{
- \bool_lazy_and:nnTF
- { \tl_if_single_p:n {#1} }
- { ! ( \tl_if_head_is_N_type_p:n {#1} ) }
- { \xeCJK_tl_remove_outer_braces:n {#1} }
- { \tl_trim_spaces:n {#1} }
+ \tl_if_single:nTF {#1}
+ {
+ \tl_if_head_is_N_type:nTF {#1}
+ { \tl_trim_spaces:n }
+ { \xeCJK_tl_remove_outer_braces:n }
+ }
+ { \tl_trim_spaces:n }
+ {#1}
}
% \end{macrocode}
% \end{macro}
@@ -3185,9 +3189,9 @@ Copyright and Licence
}
\cs_new_protected_nopar:Npn \@@_check_for_ecglue:
{
- \bool_lazy_or:nnTF
- { \xeCJK_if_last_node_p:n { CJK } }
- { \xeCJK_if_last_node_p:n { CJK-widow } }
+ \xeCJK_if_last_node:nTF { CJK }
+ { \use_i:nn }
+ { \xeCJK_if_last_node:nTF { CJK-widow } }
{ \xeCJK_remove_node: \CJKecglue }
{
\xeCJK_if_last_node:nT { CJK-space }
@@ -4175,6 +4179,7 @@ Copyright and Licence
}
\cs_new_protected_nopar:Npn \@@_bound_glue_auxii:n #1
{
+ \skip_set_eq:NN \l_@@_last_skip \tex_lastskip:D
\skip_if_eq:nnTF { \l_@@_last_skip } { 1sp }
{ \@@_zero_glue: }
{
@@ -4284,6 +4289,7 @@ Copyright and Licence
% \changes{v3.6.0}{2018/01/23}{解决标点中间被隔开的禁则与压缩问题。}
%
% \begin{macro}{\xeCJK_if_last_punct:TF}
+% \changes{v3.6.1}{2018/02/25}{细化判断。}
% 判断之前是否是一个标点符号。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_if_last_punct:TF
@@ -4297,34 +4303,58 @@ Copyright and Licence
{ \use_ii:nn }
}
}
-\cs_new_protected:Npn \@@_if_last_punct_glue:TF #1#2
+\cs_new_protected_nopar:Npn \@@_if_last_punct_glue:TF
+ {
+ \prop_get:NoNTF \g_@@_punct_skip_prop
+ { \skip_use:N \tex_lastskip:D } \l_@@_tmp_tl
+ { \@@_if_last_punct_glue_auxi:TF }
+ { \@@_if_last_punct_glue_auxii:TF }
+ }
+\cs_new_protected_nopar:Npn \@@_if_last_punct_glue_auxi:TF
{
\skip_set_eq:NN \l_@@_last_skip \tex_lastskip:D
\tex_unskip:D
\int_compare:nNnTF \tex_lastpenalty:D = \c_ten_thousand
- { \@@_if_last_punct_auxi:TF }
+ { \@@_if_last_punct_auxi:TF { \use_i:nn } }
{
\xeCJK_if_last_node:TF
- { \@@_if_last_punct_auxii:TF }
- { \@@_if_last_punct_auxiii:TF }
+ { \@@_if_last_punct_auxii:TF { \use_i:nn } }
+ { \use:n }
}
- {#1}
- { \skip_horizontal:N \l_@@_last_skip #2 }
+ { \skip_horizontal:N \l_@@_last_skip \use_ii:nn }
+ }
+\cs_new_protected_nopar:Npn \@@_if_last_punct_glue_auxii:TF
+ {
+ \int_gset_eq:NN \g_@@_space_factor_int \tex_spacefactor:D
+ \skip_if_eq:nnTF { \tex_lastskip:D } { \c_xeCJK_space_skip_tl }
+ { \@@_if_last_punct_glue_auxiii:TF }
+ { \use_ii:nn }
+ }
+\cs_new_protected_nopar:Npn \@@_if_last_punct_glue_auxiii:TF
+ {
+ \skip_set_eq:NN \l_@@_tmp_skip \tex_lastskip:D
+ \tex_unskip:D
+ \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven
+ {
+ \prop_get:NoNTF \g_@@_punct_skip_prop
+ { \skip_use:N \tex_lastskip:D } \l_@@_tmp_tl
+ { \@@_if_last_punct_glue_auxi:TF { \use_i:nn } }
+ { \use:n }
+ }
+ { \use:n }
+ { \skip_horizontal:N \l_@@_tmp_skip \use_ii:nn }
}
-\cs_new_protected:Npn \@@_if_last_punct_penalty:TF #1#2
+\cs_new_protected_nopar:Npn \@@_if_last_punct_penalty:TF
{
\int_set_eq:NN \l_@@_last_penalty_int \tex_lastpenalty:D
\tex_unpenalty:D
\bool_set_true:N \l_@@_last_penalty_bool
\int_compare:nNnTF \etex_lastnodetype:D = \c_eleven
- {
- \@@_if_last_punct_glue:TF
- {#1}
- { \tex_penalty:D \l_@@_last_penalty_int #2 }
- }
- { \tex_penalty:D \l_@@_last_penalty_int #2 }
+ { \@@_if_last_punct_glue:TF { \use_i:nn } }
+ { \use:n }
+ { \tex_penalty:D \l_@@_last_penalty_int \use_ii:nn }
}
-\cs_new_protected:Npn \@@_if_last_punct_auxi:TF #1#2
+\cs_new_protected_nopar:Npn \@@_if_last_punct_auxi:TF
{
\tex_unpenalty:D
\bool_if:NF \l_@@_last_penalty_bool
@@ -4332,11 +4362,18 @@ Copyright and Licence
\bool_set_true:N \l_@@_last_penalty_bool
\int_set_eq:NN \l_@@_last_penalty_int \c_ten_thousand
}
- \@@_if_last_punct_auxiv:TF
- {#1}
- { \xeCJK_no_break: #2 }
+ \xeCJK_if_last_node:TF
+ { \@@_if_last_punct_auxii:TF { \use_i:nn } }
+ { \use:n }
+ { \xeCJK_no_break: \use_ii:nn }
}
-\cs_new_protected:Npn \@@_if_last_punct_auxii:TF #1#2
+\cs_new_protected_nopar:Npn \@@_if_last_punct_auxii:TF
+ {
+ \dim_compare:nNnTF \l_@@_last_kern_dim > \c_zero_dim
+ { \@@_if_last_punct_auxiii:TF }
+ { \@@_make_node:N \l_@@_last_kern_dim \use_ii:nn }
+ }
+\cs_new_protected_nopar:Npn \@@_if_last_punct_auxiii:TF
{
\int_case:nnTF { \xetex_charclass:D \l_@@_last_kern_dim }
{
@@ -4345,49 +4382,20 @@ Copyright and Licence
{ \xeCJK_class_num:n { FullLeft } }
{ \tl_set_eq:NN \l_@@_aligni_tl \c_@@_left_tl }
}
- { \@@_if_last_punct_auxv:TF {#1} {#2} }
- { \@@_make_node:N \l_@@_last_kern_dim #2 }
- }
-\cs_new_protected_nopar:Npn \@@_if_last_punct_auxiii:TF
- {
- \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven
- { \@@_if_last_punct_auxvi:TF }
+ { \@@_if_last_punct_auxiv:TF }
{ \use_ii:nn }
}
\cs_new_protected_nopar:Npn \@@_if_last_punct_auxiv:TF
{
- \xeCJK_if_last_node:TF
- { \@@_if_last_punct_auxii:TF }
- { \use_ii:nn }
- }
-\cs_new_protected:Npn \@@_if_last_punct_auxv:TF #1#2
- {
\dim_set_eq:NN \l_@@_tmp_dim \l_@@_last_kern_dim
\xeCJK_if_last_node:TF
{
\tl_gset:Nx \g_@@_last_punct_tl
{ \utex_char:D \l_@@_tmp_dim }
\dim_set_eq:NN \l_@@_last_bound_dim \l_@@_last_kern_dim
- #1
+ \use_i:nn
}
- { \@@_make_node:N \l_@@_tmp_dim #2 }
- }
-\cs_new_protected:Npn \@@_if_last_punct_auxvi:TF #1#2
- {
- \int_gset_eq:NN \g_@@_space_factor_int \tex_spacefactor:D
- \skip_if_eq:nnTF
- { \l_@@_last_skip }
- { \c_xeCJK_space_skip_tl }
- {
- \skip_set_eq:NN \l_@@_tmp_skip \tex_lastskip:D
- \tex_unskip:D
- \int_compare:nNnTF \tex_lastpenalty:D = \c_ten_thousand
- { \@@_if_last_punct_auxi:TF }
- { \@@_if_last_punct_auxiv:TF }
- { \skip_set_eq:NN \l_@@_last_skip \l_@@_tmp_skip #1 }
- { \skip_horizontal:N \l_@@_tmp_skip #2 }
- }
- {#2}
+ { \@@_make_node:N \l_@@_tmp_dim \use_ii:nn }
}
\tl_new:N \l_@@_aligni_tl
\tl_new:N \l_@@_alignii_tl
@@ -5295,39 +5303,50 @@ Copyright and Licence
\cs_new:Npn \@@_use_punct_skip_minus:nNN #1#2#3
{ \use:c { \@@_punct_csname:n { skip/minus/#1/#2/#3 } } }
\cs_new_protected:Npn \@@_save_punct_dim:nNn #1#2
- { \@@_save_punct_width_aux:nnn { dim } { #1/#2 } }
+ { \@@_save_punct_width_aux:nnnn { dim } {#1} { #1/#2 } }
\cs_new_protected:Npn \@@_save_punct_dim:nNNn #1#2#3
- { \@@_save_punct_width_aux:nnn { dim } { #1/#2/#3 } }
+ { \@@_save_punct_width_aux:nnnn { dim } {#1} { #1/#2/#3 } }
\cs_new_protected:Npn \@@_save_punct_skip:nNNn #1#2#3#4
{
- \@@_save_punct_width_aux:nnn { skip } { #1/#2/#3 } {#4}
- \@@_save_punct_width_aux:nnn { skip } { plus/#1/#2/#3 } {#4}
- \@@_save_punct_width_aux:nnn { skip } { minus/#1/#2/#3 } {#4}
+ \@@_save_punct_width_aux:nnnn { skip } {#1} { #1/#2/#3 } {#4}
+ \@@_save_punct_width_aux:nnnn { skip } {#1} { plus/#1/#2/#3 } {#4}
+ \@@_save_punct_width_aux:nnnn { skip } {#1} { minus/#1/#2/#3 } {#4}
}
\cs_new_protected:Npn \@@_save_punct_skip:nNNnnn #1#2#3#4#5#6
{
\use:x
{
- \@@_save_punct_skip_aux:nnnn { #1/#2/#3 }
+ \@@_save_punct_skip_aux:nnnnn {#1} { #1/#2/#3 }
{ \dim_eval:n {#4} }
{ \dim_max:nn { \c_zero_dim } {#5} }
{ \dim_max:nn { \c_zero_dim } {#6} }
}
}
-\cs_new_protected:Npn \@@_save_punct_skip_aux:nnnn #1#2#3#4
+\cs_new_protected:Npn \@@_save_punct_skip_aux:nnnnn #1#2#3#4#5
+ {
+ \@@_save_punct_width_aux:nnnn { skip } {#1}
+ {#2} { #3 ~ plus ~ #4 ~ minus ~ #5 ~ }
+ \@@_save_punct_width_aux:nnnn { skip } {#1}
+ { plus/#2 } { #3 ~ plus ~ #4 ~ }
+ \@@_save_punct_width_aux:nnnn { skip } {#1}
+ { minus/#2 } { #3 ~ minus ~ #5 ~ }
+ }
+\cs_new_protected:Npn \@@_save_punct_width_aux:nnnn #1#2#3#4
{
- \@@_save_punct_width_aux:nnn { skip }
- {#1} { #2 ~ plus ~ #3 ~ minus ~ #4 ~ }
- \@@_save_punct_width_aux:nnn { skip }
- { plus/#1 } { #2 ~ plus ~ #3 ~ }
- \@@_save_punct_width_aux:nnn { skip }
- { minus/#1 } { #2 ~ minus ~ #4 ~ }
+ \@@_save_punct_width_aux:cxn
+ { \@@_punct_csname:n { #1/#3 } }
+ { \use:c { #1_eval:n } {#4} }
+ {#2}
}
-\cs_new_protected:Npn \@@_save_punct_width_aux:nnn #1#2#3
+\cs_new_protected:Npn \@@_save_punct_width_aux:Nnn #1#2#3
{
- \tl_const:cx { \@@_punct_csname:n { #1/#2 } }
- { \use:c { #1_eval:n } {#3} }
+ \tl_const:Nn #1 {#2}
+ \str_if_eq:nnT {#3} { glue }
+ { \prop_gput:Nnn \g_@@_punct_skip_prop {#2} { } }
}
+\prop_new:N \g_@@_punct_skip_prop
+\prop_gput:Non \g_@@_punct_skip_prop { \skip_use:N \c_zero_skip } { }
+\cs_generate_variant:Nn \@@_save_punct_width_aux:Nnn { cx }
\cs_new_eq:NN \@@_use_dim_or_skip:nNN \@@_use_punct_skip:nNN
% \end{macrocode}
%
@@ -10472,14 +10491,12 @@ Copyright and Licence
\lst@whitespacefalse
\bool_if:NTF \l_@@_listings_letter_bool
{
- \bool_lazy_or:nnF
- { \int_compare_p:nNn \l_@@_listings_flag_int = \c_two }
+ \int_compare:nNnF \l_@@_listings_flag_int = \c_two
{
- \bool_lazy_and_p:nn
- { \int_compare_p:nNn \l_@@_listings_flag_int = \c_three }
- { ! \l_@@_punct_breakable_bool }
+ \int_compare:nNnTF \l_@@_listings_flag_int = \c_three
+ { \bool_if:NT \l_@@_punct_breakable_bool { \lst@Output } }
+ { \lst@Output }
}
- { \lst@Output }
\lst@lettertrue
}
{
@@ -10494,10 +10511,8 @@ Copyright and Licence
\lst@whitespacefalse
\bool_if:NTF \l_@@_listings_letter_bool
{
- \bool_lazy_and:nnT
- { \int_compare_p:nNn \l_@@_listings_flag_int < \c_two }
- { \@@_punct_if_long_p:N #2 }
- { \lst@Output }
+ \int_compare:nNnT \l_@@_listings_flag_int < \c_two
+ { \@@_punct_if_long:NT #2 { \lst@Output } }
\lst@lettertrue
}
{
@@ -10890,9 +10905,9 @@ Copyright and Licence
% \begin{macro}{\@@_composite_cs:Nnn,\@@_composite_cs:nnn}
% \begin{macrocode}
\cs_new:Npx \@@_composite_cs:Nnn #1#2#3
- { \cs_to_str:N \\ #2 \exp_not:N \token_to_str:N #1 - \exp_not:N \tl_to_str:n {#3} }
+ { \c_backslash_str #2 \exp_not:N \token_to_str:N #1 - \exp_not:N \tl_to_str:n {#3} }
\cs_new:Npx \@@_composite_cs:nnn #1#2#3
- { \cs_to_str:N \\ #2 #1 - \exp_not:N \tl_to_str:n {#3} }
+ { \c_backslash_str #2 #1 - \exp_not:N \tl_to_str:n {#3} }
% \end{macrocode}
% \end{macro}
%
@@ -10906,9 +10921,13 @@ Copyright and Licence
{
\tl_if_single_token:nTF {#1}
{
- \if_predicate:w
- \bool_if_p:n { \token_if_cs_p:N #1 || \token_if_active_p:N #1 }
- \prg_return_true: \else: \prg_return_false: \fi:
+ \token_if_cs:NTF #1
+ { \prg_return_true: }
+ {
+ \token_if_active:NTF #1
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
}
{ \prg_return_false: }
}
@@ -11007,10 +11026,14 @@ Copyright and Licence
% \begin{macrocode}
\cs_new_protected:Npn \@@_provide_text_command_default:N #1
{
- \bool_lazy_or:nnF
- { \cs_if_exist_p:c { ? \token_to_str:N #1 } }
- { \cs_if_free_p:c { ? - \token_to_str:N #1 } }
- { \exp_args:NNv \ProvideTextCommandDefault #1 { ? - \token_to_str:N #1 } }
+ \cs_if_exist:cF { ? \token_to_str:N #1 }
+ {
+ \cs_if_free:cF { ? - \token_to_str:N #1 }
+ {
+ \exp_args:NNv \ProvideTextCommandDefault #1
+ { ? - \token_to_str:N #1 }
+ }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -11321,9 +11344,9 @@ Copyright and Licence
\tl_if_blank:nTF {#1}
{ \cs_if_exist_use:cTF { ? #2 } { {#1} } {#1} }
{
- \bool_lazy_and:nnTF
- { \@@_glyph_if_exist_p:n { `#3 } }
- { \@@_glyph_if_exist_p:n { `#4 } }
+ \@@_glyph_if_exist:nTF { `#3 }
+ { \@@_glyph_if_exist:nTF { `#4 } }
+ { \use_ii:nn }
{ #1#3#4 }
{ \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3#4 } }
}