summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
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/tex/xelatex/xecjk/xeCJK.sty
parentf6f97a69d3847af9a8c49c35bd957fe0b35201e8 (diff)
xecjk (27feb18)
git-svn-id: svn://tug.org/texlive/trunk@46756 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty171
1 files changed, 94 insertions, 77 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
index 22598d0c915..69bea63c023 100644
--- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
+++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
@@ -29,10 +29,10 @@
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: xeCJK.dtx 54327e6 2018-01-28 19:10:14 +0800 Qing Lee <sobenlee@gmail.com> $
+\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $
{Typesetting CJK scripts with XeLaTeX}
\ProvidesExplPackage{\ExplFileName}
- {\ExplFileDate}{3.6.0}{\ExplFileDescription}
+ {\ExplFileDate}{3.6.1}{\ExplFileDescription}
\msg_new:nnn { xeCJK } { Require-XeTeX }
{
The~xeCJK~package~requires~XeTeX~to~function.\\\\
@@ -153,7 +153,7 @@
\tl_new:N \l__xeCJK_shipout_hook_tl
\bool_new:N \l__xeCJK_shipout_hook_bool
\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
@@ -161,11 +161,14 @@
}
\cs_new:Npn \__xeCJK_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}
}
\cs_new_protected:Npn \xeCJK_cs_clear:N #1
{ \cs_set_eq:NN #1 \prg_do_nothing: }
@@ -803,9 +806,9 @@
}
\cs_new_protected_nopar:Npn \__xeCJK_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 }
@@ -1506,6 +1509,7 @@
}
\cs_new_protected_nopar:Npn \__xeCJK_bound_glue_auxii:n #1
{
+ \skip_set_eq:NN \l__xeCJK_last_skip \tex_lastskip:D
\skip_if_eq:nnTF { \l__xeCJK_last_skip } { 1sp }
{ \__xeCJK_zero_glue: }
{
@@ -1591,34 +1595,58 @@
{ \use_ii:nn }
}
}
-\cs_new_protected:Npn \__xeCJK_if_last_punct_glue:TF #1#2
+\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_glue:TF
+ {
+ \prop_get:NoNTF \g__xeCJK_punct_skip_prop
+ { \skip_use:N \tex_lastskip:D } \l__xeCJK_tmp_tl
+ { \__xeCJK_if_last_punct_glue_auxi:TF }
+ { \__xeCJK_if_last_punct_glue_auxii:TF }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_glue_auxi:TF
{
\skip_set_eq:NN \l__xeCJK_last_skip \tex_lastskip:D
\tex_unskip:D
\int_compare:nNnTF \tex_lastpenalty:D = \c_ten_thousand
- { \__xeCJK_if_last_punct_auxi:TF }
+ { \__xeCJK_if_last_punct_auxi:TF { \use_i:nn } }
{
\xeCJK_if_last_node:TF
- { \__xeCJK_if_last_punct_auxii:TF }
- { \__xeCJK_if_last_punct_auxiii:TF }
+ { \__xeCJK_if_last_punct_auxii:TF { \use_i:nn } }
+ { \use:n }
}
- {#1}
- { \skip_horizontal:N \l__xeCJK_last_skip #2 }
+ { \skip_horizontal:N \l__xeCJK_last_skip \use_ii:nn }
}
-\cs_new_protected:Npn \__xeCJK_if_last_punct_penalty:TF #1#2
+\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_glue_auxii:TF
+ {
+ \int_gset_eq:NN \g__xeCJK_space_factor_int \tex_spacefactor:D
+ \skip_if_eq:nnTF { \tex_lastskip:D } { \c_xeCJK_space_skip_tl }
+ { \__xeCJK_if_last_punct_glue_auxiii:TF }
+ { \use_ii:nn }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_glue_auxiii:TF
+ {
+ \skip_set_eq:NN \l__xeCJK_tmp_skip \tex_lastskip:D
+ \tex_unskip:D
+ \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven
+ {
+ \prop_get:NoNTF \g__xeCJK_punct_skip_prop
+ { \skip_use:N \tex_lastskip:D } \l__xeCJK_tmp_tl
+ { \__xeCJK_if_last_punct_glue_auxi:TF { \use_i:nn } }
+ { \use:n }
+ }
+ { \use:n }
+ { \skip_horizontal:N \l__xeCJK_tmp_skip \use_ii:nn }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_penalty:TF
{
\int_set_eq:NN \l__xeCJK_last_penalty_int \tex_lastpenalty:D
\tex_unpenalty:D
\bool_set_true:N \l__xeCJK_last_penalty_bool
\int_compare:nNnTF \etex_lastnodetype:D = \c_eleven
- {
- \__xeCJK_if_last_punct_glue:TF
- {#1}
- { \tex_penalty:D \l__xeCJK_last_penalty_int #2 }
- }
- { \tex_penalty:D \l__xeCJK_last_penalty_int #2 }
+ { \__xeCJK_if_last_punct_glue:TF { \use_i:nn } }
+ { \use:n }
+ { \tex_penalty:D \l__xeCJK_last_penalty_int \use_ii:nn }
}
-\cs_new_protected:Npn \__xeCJK_if_last_punct_auxi:TF #1#2
+\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_auxi:TF
{
\tex_unpenalty:D
\bool_if:NF \l__xeCJK_last_penalty_bool
@@ -1626,11 +1654,18 @@
\bool_set_true:N \l__xeCJK_last_penalty_bool
\int_set_eq:NN \l__xeCJK_last_penalty_int \c_ten_thousand
}
- \__xeCJK_if_last_punct_auxiv:TF
- {#1}
- { \xeCJK_no_break: #2 }
+ \xeCJK_if_last_node:TF
+ { \__xeCJK_if_last_punct_auxii:TF { \use_i:nn } }
+ { \use:n }
+ { \xeCJK_no_break: \use_ii:nn }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_auxii:TF
+ {
+ \dim_compare:nNnTF \l__xeCJK_last_kern_dim > \c_zero_dim
+ { \__xeCJK_if_last_punct_auxiii:TF }
+ { \__xeCJK_make_node:N \l__xeCJK_last_kern_dim \use_ii:nn }
}
-\cs_new_protected:Npn \__xeCJK_if_last_punct_auxii:TF #1#2
+\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_auxiii:TF
{
\int_case:nnTF { \xetex_charclass:D \l__xeCJK_last_kern_dim }
{
@@ -1639,49 +1674,20 @@
{ \xeCJK_class_num:n { FullLeft } }
{ \tl_set_eq:NN \l__xeCJK_aligni_tl \c__xeCJK_left_tl }
}
- { \__xeCJK_if_last_punct_auxv:TF {#1} {#2} }
- { \__xeCJK_make_node:N \l__xeCJK_last_kern_dim #2 }
- }
-\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_auxiii:TF
- {
- \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven
- { \__xeCJK_if_last_punct_auxvi:TF }
+ { \__xeCJK_if_last_punct_auxiv:TF }
{ \use_ii:nn }
}
\cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_auxiv:TF
{
- \xeCJK_if_last_node:TF
- { \__xeCJK_if_last_punct_auxii:TF }
- { \use_ii:nn }
- }
-\cs_new_protected:Npn \__xeCJK_if_last_punct_auxv:TF #1#2
- {
\dim_set_eq:NN \l__xeCJK_tmp_dim \l__xeCJK_last_kern_dim
\xeCJK_if_last_node:TF
{
\tl_gset:Nx \g__xeCJK_last_punct_tl
{ \utex_char:D \l__xeCJK_tmp_dim }
\dim_set_eq:NN \l__xeCJK_last_bound_dim \l__xeCJK_last_kern_dim
- #1
+ \use_i:nn
}
- { \__xeCJK_make_node:N \l__xeCJK_tmp_dim #2 }
- }
-\cs_new_protected:Npn \__xeCJK_if_last_punct_auxvi:TF #1#2
- {
- \int_gset_eq:NN \g__xeCJK_space_factor_int \tex_spacefactor:D
- \skip_if_eq:nnTF
- { \l__xeCJK_last_skip }
- { \c_xeCJK_space_skip_tl }
- {
- \skip_set_eq:NN \l__xeCJK_tmp_skip \tex_lastskip:D
- \tex_unskip:D
- \int_compare:nNnTF \tex_lastpenalty:D = \c_ten_thousand
- { \__xeCJK_if_last_punct_auxi:TF }
- { \__xeCJK_if_last_punct_auxiv:TF }
- { \skip_set_eq:NN \l__xeCJK_last_skip \l__xeCJK_tmp_skip #1 }
- { \skip_horizontal:N \l__xeCJK_tmp_skip #2 }
- }
- {#2}
+ { \__xeCJK_make_node:N \l__xeCJK_tmp_dim \use_ii:nn }
}
\tl_new:N \l__xeCJK_aligni_tl
\tl_new:N \l__xeCJK_alignii_tl
@@ -2306,39 +2312,50 @@
\cs_new:Npn \__xeCJK_use_punct_skip_minus:nNN #1#2#3
{ \use:c { \__xeCJK_punct_csname:n { skip/minus/#1/#2/#3 } } }
\cs_new_protected:Npn \__xeCJK_save_punct_dim:nNn #1#2
- { \__xeCJK_save_punct_width_aux:nnn { dim } { #1/#2 } }
+ { \__xeCJK_save_punct_width_aux:nnnn { dim } {#1} { #1/#2 } }
\cs_new_protected:Npn \__xeCJK_save_punct_dim:nNNn #1#2#3
- { \__xeCJK_save_punct_width_aux:nnn { dim } { #1/#2/#3 } }
+ { \__xeCJK_save_punct_width_aux:nnnn { dim } {#1} { #1/#2/#3 } }
\cs_new_protected:Npn \__xeCJK_save_punct_skip:nNNn #1#2#3#4
{
- \__xeCJK_save_punct_width_aux:nnn { skip } { #1/#2/#3 } {#4}
- \__xeCJK_save_punct_width_aux:nnn { skip } { plus/#1/#2/#3 } {#4}
- \__xeCJK_save_punct_width_aux:nnn { skip } { minus/#1/#2/#3 } {#4}
+ \__xeCJK_save_punct_width_aux:nnnn { skip } {#1} { #1/#2/#3 } {#4}
+ \__xeCJK_save_punct_width_aux:nnnn { skip } {#1} { plus/#1/#2/#3 } {#4}
+ \__xeCJK_save_punct_width_aux:nnnn { skip } {#1} { minus/#1/#2/#3 } {#4}
}
\cs_new_protected:Npn \__xeCJK_save_punct_skip:nNNnnn #1#2#3#4#5#6
{
\use:x
{
- \__xeCJK_save_punct_skip_aux:nnnn { #1/#2/#3 }
+ \__xeCJK_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 \__xeCJK_save_punct_skip_aux:nnnn #1#2#3#4
+\cs_new_protected:Npn \__xeCJK_save_punct_skip_aux:nnnnn #1#2#3#4#5
{
- \__xeCJK_save_punct_width_aux:nnn { skip }
- {#1} { #2 ~ plus ~ #3 ~ minus ~ #4 ~ }
- \__xeCJK_save_punct_width_aux:nnn { skip }
- { plus/#1 } { #2 ~ plus ~ #3 ~ }
- \__xeCJK_save_punct_width_aux:nnn { skip }
- { minus/#1 } { #2 ~ minus ~ #4 ~ }
+ \__xeCJK_save_punct_width_aux:nnnn { skip } {#1}
+ {#2} { #3 ~ plus ~ #4 ~ minus ~ #5 ~ }
+ \__xeCJK_save_punct_width_aux:nnnn { skip } {#1}
+ { plus/#2 } { #3 ~ plus ~ #4 ~ }
+ \__xeCJK_save_punct_width_aux:nnnn { skip } {#1}
+ { minus/#2 } { #3 ~ minus ~ #5 ~ }
+ }
+\cs_new_protected:Npn \__xeCJK_save_punct_width_aux:nnnn #1#2#3#4
+ {
+ \__xeCJK_save_punct_width_aux:cxn
+ { \__xeCJK_punct_csname:n { #1/#3 } }
+ { \use:c { #1_eval:n } {#4} }
+ {#2}
}
-\cs_new_protected:Npn \__xeCJK_save_punct_width_aux:nnn #1#2#3
+\cs_new_protected:Npn \__xeCJK_save_punct_width_aux:Nnn #1#2#3
{
- \tl_const:cx { \__xeCJK_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__xeCJK_punct_skip_prop {#2} { } }
}
+\prop_new:N \g__xeCJK_punct_skip_prop
+\prop_gput:Non \g__xeCJK_punct_skip_prop { \skip_use:N \c_zero_skip } { }
+\cs_generate_variant:Nn \__xeCJK_save_punct_width_aux:Nnn { cx }
\cs_new_eq:NN \__xeCJK_use_dim_or_skip:nNN \__xeCJK_use_punct_skip:nNN
\DeclareObjectType { xeCJK / punctuation } { \c_zero }
\DeclareTemplateInterface { xeCJK / punctuation } { basic } { \c_zero }