diff options
author | Karl Berry <karl@freefriends.org> | 2013-07-26 23:10:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-07-26 23:10:53 +0000 |
commit | 81f3a7b776ea8fe83f4dbbe5ebf2d78648af9497 (patch) | |
tree | ddb69942c2476f9e4046260ea9f11e01df130516 /Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty | |
parent | 70387bf1fd37feeb2be25de8b7b23d129b360c86 (diff) |
xecjk (26jul13)
git-svn-id: svn://tug.org/texlive/trunk@31290 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty | 326 |
1 files changed, 326 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty new file mode 100644 index 00000000000..d013fea26d2 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty @@ -0,0 +1,326 @@ +%% +%% This is file `xunicode-addon.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xeCJK.dtx (with options: `xunicode') +%% +%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ +%% ----------------------------------------------------------------- +%% Author: +%% Wenchang Sun <sunwch@nankai.edu.cn> +%% Current Maintainers: +%% Leo Liu <leoliu.pku@gmail.com> +%% Qing Lee <sobenlee@gmail.com> +%% +%% Copyright (C) 2007--2013 Wenchang Sun +%% (C) 2009--2013 Leo Liu +%% (C) 2012--2013 Qing Lee +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% The Current Maintainer of this work are Leo Liu and Qing Lee. +%% ----------------------------------------------------------------- +%% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ + {addon file for xunicode} +\ProvidesExplPackage + {xunicode-addon} + {\ExplFileDate}{3.2.5}{\ExplFileDescription} +\pdftex_if_engine:T + { + \msg_new:nnnn { xunicode-addon } { cannot-use-pdftex } + { This~package~requires~either~XeTeX~or~LuaTeX~to~function.} + { + You~must~change~your~typesetting~engine~to,~e.g.,\\ + "xelatex"~or~"lualatex"~instead~of~plain~"latex"~or~"pdflatex". + } + \msg_critical:nn { xunicode-addon } { cannot-use-pdftex } + } +\RequirePackage { xparse } +\clist_new:N \g__xunadd_encname_clist +\DeclareOption* + { \clist_gput_left:NV \g__xunadd_encname_clist \CurrentOption } +\ProcessOptions \scan_stop: +\tl_if_exist:NT \UTFencname + { \clist_gput_left:Nx \g__xunadd_encname_clist { \UTFencname } } +\@ifpackageloaded { xunicode } { } + { + \clist_get:NNF \g__xunadd_encname_clist \UTFencname + { + \xetex_if_engine:TF + { \tl_set:Nn \UTFencname { EU1 } } + { \tl_set:Nn \UTFencname { EU2 } } + \clist_set_eq:NN \g__xunadd_encname_clist \UTFencname + } + \xetex_if_engine:TF + { \RequirePackage { xunicode } } + { + \cs_set_eq:NN \__xunadd_tmp:w \XeTeXpicfile + \cs_set_eq:NN \XeTeXpicfile \prg_do_nothing: + \RequirePackage { xunicode } + \cs_set_eq:NN \XeTeXpicfile \__xunadd_tmp:w + } + } +\AtEndOfPackage { \ReloadXunicode { \g__xunadd_encname_clist } } +\RenewDocumentCommand \ReloadXunicode { m } + { + \clist_set:Nx \l__xunadd_encname_clist {#1} + \clist_remove_duplicates:N \l__xunadd_encname_clist + \use:x + { + \bool_if:NT \l__kernel_expl_bool { \ExplSyntaxOff } + \char_set_catcode_letter:n { 64 } + \__xunadd_reload:N \exp_not:N \l__xunadd_encname_clist + \char_set_catcode:nn { 64 } { \char_value_catcode:n { 64 } } + \bool_if:NT \l__kernel_expl_bool { \ExplSyntaxOn } + } + } +\cs_new_protected:Npn \__xunadd_reload:N #1 + { + \cs_set_eq:NN \__xunadd_tmp:w \iftipaonetoken + \cs_set_eq:NN \iftipaonetoken \scan_stop: + \clist_map_inline:Nn #1 + { + \cs_if_exist:cTF { T@ ##1 } + { + \tl_set:Nx \UTFencname {##1} + \clist_gput_right:Nx \g__xunadd_encname_clist {##1} + \file_input:n { xunicode.sty } + } + { \msg_error:nnn { xunicode-addon } { encoding-unknown } {##1} } + } + \cs_set_eq:NN \iftipaonetoken \__xunadd_tmp:w + \clist_gremove_duplicates:N \g__xunadd_encname_clist + } +\clist_new:N \l__xunadd_encname_clist +\msg_new:nnnn { xunicode-addon } { encoding-unknown } + {Encoding~scheme~"#1"~unknown.} + { + You~may~use \\\\ + \token_to_str:N \usepackage [ #1 , \encodingdefault ] {fontenc} \\\\ + before~xunicode-addon~or~xunicode. + } +\prg_new_conditional:Npnn \__xunadd_glyph_if_exist:n #1 { p , T , F , TF } + { + \etex_iffontchar:D \tex_font:D \etex_numexpr:D #1 \scan_stop: + \prg_return_true: \else: \prg_return_false: \fi: + } +\RenewDocumentCommand \UndeclareUTFcharacter { O { \UTFencname } m m } + { + \__xunadd_if_csname:nTF {#3} + { \UndeclareTextCommand {#3} } + { \exp_args:Nc \UndeclareTextCommand { \tl_to_str:n {#3} } } + {#1} + } +\RenewDocumentCommand \UndeclareUTFcomposite { O { \UTFencname } m m m } + { + \__xunadd_if_csname:nTF {#3} + { \__xunadd_undeclare_composite:Nnnn #3 } + { \exp_args:Nc \__xunadd_undeclare_composite:Nnnn { \tl_to_str:n {#3} } } + {#1} {#4} {#2} + } +\cs_new_protected:Npn \__xunadd_undeclare_composite:Nnnn #1#2#3#4 + { \cs_undefine:c { \token_to_str:c {#2} \token_to_str:N #1 - \tl_to_str:n {#3} } } +\prg_new_conditional:Npnn \__xunadd_if_csname:n #1 { TF } + { + \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: + } + { \prg_return_false: } + } +\RenewDocumentCommand \DeclareUTFcharacter { O { \UTFencname } m m } + { + \__xunadd_if_csname:nTF {#3} + { \__xunadd_declare_character:Nnn #3 } + { \exp_args:Nc \__xunadd_declare_character:Nnn { \tl_to_str:n {#3} } } + {#1} {#2} + } +\cs_new_protected:Npn \__xunadd_declare_character:Nnn #1#2#3 + { + \__xunadd_provide_text_command_default:N #1 + \group_begin: + \char_set_lccode:nn { `0 } { \__xunadd_check_slot:n {#3} } + \tl_to_lowercase:n + { + \group_end: + \__xunadd_declare_character:NNxn 0 + } + #1 { \token_to_str:N #1 } {#2} + } +\cs_new_protected:Npn \__xunadd_provide_text_command_default:N #1 + { + \bool_if:nF + { + \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_new_protected:Npn \__xunadd_declare_character:NNnn #1#2#3#4 + { \DeclareTextCommand #2 {#4} { \__xunadd_text_character:nN {#3} {#1} } } +\cs_new_protected:Npn \__xunadd_text_character:nN #1#2 + { + \tl_use:N \l__xunadd_begin_hook_tl + \__xunadd_glyph_if_exist:nTF { `#2 } + {#2} { \cs_if_exist_use:cF { ? #1 } {#2} } + \tl_use:N \l__xunadd_end_hook_tl + } +\cs_generate_variant:Nn \__xunadd_declare_character:NNnn { NNx } +\cs_new_nopar:Npn \__xunadd_check_slot:n #1 + { + \int_eval:n + { + \tl_if_head_eq_charcode:nNTF {#1} x + { " \use_none:n #1 } {#1} + } + } +\RenewDocumentCommand \DeclareUTFcomposite { O { \UTFencname } m m m } + { + \__xunadd_if_csname:nTF {#3} + { \__xunadd_declare_composite:Nnnn #3 } + { \exp_args:Nc \__xunadd_declare_composite:Nnnn { \tl_to_str:n {#3} } } + {#1} {#4} {#2} + } +\cs_new_protected:Npn \__xunadd_declare_composite:Nnnn #1#2#3#4 + { + \tex_afterassignment:D \use_none_delimit_by_q_stop:w + \__xunadd_chardef:cn + { \token_to_str:c {#2} \token_to_str:N #1 - \tl_to_str:n {#3} } + { \__xunadd_check_slot:n {#4} } + \q_stop + } +\cs_new_protected:Npn \__xunadd_chardef:Nn #1#2 + { \tex_chardef:D #1 = \etex_numexpr:D #2 \scan_stop: } +\cs_generate_variant:Nn \__xunadd_chardef:Nn { c } +\RenewDocumentCommand \DeclareEncodedCompositeCharacter { m m m m } + { + \__xunadd_if_csname:nTF {#2} + { \__xunadd_declare_accent:Nnnn #2 } + { \exp_args:Nc \__xunadd_declare_accent:Nnnn { \tl_to_str:n {#2} } } + {#1} {#3} {#4} + } +\RenewDocumentCommand \DeclareEncodedCompositeAccents { m m m m } + { + \__xunadd_if_csname:nTF {#2} + { \__xunadd_declare_accent:Nnnn #2 } + { \exp_args:Nc \__xunadd_declare_accent:Nnnn { \tl_to_str:n {#2} } } + {#1} {#4} {#3} + } +\cs_new_protected:Npn \__xunadd_declare_accent:Nnnn #1#2#3#4 + { + \group_begin: + \char_set_lccode:nn { `3 } { "#3 } + \char_set_lccode:nn { `4 } { \tl_if_blank:nTF {#4} { "#3 } { "#4 } } + \tl_to_lowercase:n + { + \group_end: + \__xunadd_declare_accent:NNNxxn 3 4 + } + #1 { \token_to_str:c {#2} } { \token_to_str:N #1 } {#2} + } +\cs_new_protected:Npn \__xunadd_declare_accent:NNNnnn #1#2#3#4#5#6 + { + \DeclareTextCommand #3 {#6} + { \__xunadd_text_composite:nnNNn {#4} {#5} {#1} {#2} } + } +\cs_generate_variant:Nn \__xunadd_declare_accent:NNNnnn { NNNxx } +\cs_new_protected:Npn \__xunadd_text_composite:nnNNn #1#2#3#4#5 + { + \tl_use:N \l__xunadd_begin_hook_tl + \cs_if_exist:cTF { #1#2 - \tl_to_str:n {#5} } + { + \token_if_chardef:cTF { #1#2 - \tl_to_str:n {#5} } + { + \__xunadd_glyph_if_exist:nTF { \use:c { #1#2 - \tl_to_str:n {#5} } } + { \use:c { #1#2 - \tl_to_str:n {#5} } } + { \__xunadd_add_accent:nnNN {#5} {#2} #3#4 } + } + { \use:c { #1#2 - \tl_to_str:n {#5} } } + } + { \__xunadd_add_accent:nnNN {#5} {#2} #3#4 } + \tl_use:N \l__xunadd_end_hook_tl + } +\cs_generate_variant:Nn \token_if_chardef:NTF { c } +\cs_new_protected:Npn \__xunadd_add_accent:nnNN #1#2#3#4 + { + \tl_if_blank:nTF {#1} + { + \__xunadd_glyph_if_exist:nTF { `#4 } + {#4} + { + \cs_if_exist_use:cTF { ? #2 } + { {#1} } {#4} + } + } + { + \__xunadd_glyph_if_exist:nTF { `#3 } + { #1#3 } + { + \__xunadd_glyph_if_exist:nTF { `#4 } + { \add@accent { `#4 } {#1} } + { + \cs_if_exist_use:cTF { ? #2 } + { {#1} } {#1} + } + } + } + } +\NewDocumentCommand \AtBeginUTFCommand { s +m } + { + \IfBooleanTF {#1} + { \tl_set:Nn \l__xunadd_begin_hook_tl {#2} } + { \tl_put_right:Nn \l__xunadd_begin_hook_tl {#2} } + } +\NewDocumentCommand \AtEndUTFCommand { s +m } + { + \IfBooleanTF {#1} + { \tl_set:Nn \l__xunadd_end_hook_tl {#2} } + { \tl_put_right:Nn \l__xunadd_end_hook_tl {#2} } + } +\tl_new:N \l__xunadd_begin_hook_tl +\tl_new:N \l__xunadd_end_hook_tl +%% +%% This package consists of the file xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.cfg, +%% xeCJK.ins, +%% xeCJKfntef.sty, +%% xeCJK-listings.sty, +%% xunicode-addon.sty, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex, +%% xeCJK-example-CJKfntef.tex, +%% xeCJK-example-punctstyle.tex, +%% xeCJK-example-verbatim.tex, +%% xeCJK-example-IVS.tex, +%% xeCJK-example-listings.tex, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and +%% README.txt. +%% +%% End of file `xunicode-addon.sty'. |