%%
%% This is file `xunicode-addon.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xeCJK.dtx  (with options: `xunicode')
%% 
%% -----------------------------------------------------------------
%%    Author:
%%             Wenchang Sun    <sunwch@nankai.edu.cn>
%%    Current Maintainers:
%%             Leo Liu         <leoliu.pku@gmail.com>
%%             Qing Lee        <sobenlee@gmail.com>
%% 
%%    Copyright (C) 2007--2015 Wenchang Sun
%%              (C) 2009--2015 Leo Liu
%%              (C) 2012--2015 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 7321d12 2015-05-15 23:07:58 +0800 Qing Lee <sobenlee@gmail.com> $
  {addon file for xunicode}
\ProvidesExplPackage
  {xunicode-addon}
  {\ExplFileDate}{3.3.2}{\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
      {
        \ExplSyntaxOff
        \char_set_catcode_letter:n { 64 }
        \__xunadd_reload:N \exp_not:N \l__xunadd_encname_clist
        \bool_if:NTF \l__kernel_expl_bool
          { \ExplSyntaxOn }
          { \ExplSyntaxOff }
        \char_set_catcode:nn { 64 } { \char_value_catcode:n { 64 } }
      }
  }
\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 }
            \file_input:n { xunicode-extra.def }
          }
          { \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.
  }
\RenewDocumentCommand \DeclareUTFmathsymbols { m }
  {
    \bool_if:NT \l__xunadd_math_as_UTF_text_bool
      {
        \seq_map_inline:Nn \l__xunadd_math_as_UTF_text_seq
          { \__xunadd_declare_math_as_UTF_text:n {##1} }
        \bool_set_false:N \l__xunadd_math_as_UTF_text_bool
      }
  }
\seq_new:N \l__xunadd_math_as_UTF_text_seq
\seq_set_from_clist:Nn \l__xunadd_math_as_UTF_text_seq
  { hbar , Finv , aleph , beth , gimel , daleth , Game }
\bool_new:N \l__xunadd_math_as_UTF_text_bool
\RenewDocumentCommand \UseMathAsText { }
  {
    \math@s@text@true
    \bool_set_true:N \l__xunadd_math_as_UTF_text_bool
  }
\@onlypreamble \UseMathAsText
\cs_new_protected_nopar:Npn \__xunadd_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__xunadd_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__xunadd_hyperref_hook_tl
\AtBeginDocument
  {
    \cs_if_free:NF \pdfstringdefDisableCommands
      { \pdfstringdefDisableCommands { \l__xunadd_hyperref_hook_tl } }
  }
\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 { \__xunadd_composite_cs:Nnn #1 {#2} {#3} } }
\cs_new:Npx \__xunadd_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} }
\cs_new:Npx \__xunadd_composite_cs:nnn #1#2#3
  { \cs_to_str:N \\ #2 #1 - \exp_not:N \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 }
  {
    \str_if_eq:nnTF {#3} { \hbar }
      { \__xunadd_restore_hbar: }
      {
        \__xunadd_if_csname:nTF {#3}
          { \__xunadd_declare_character:Nnn #3 }
          { \__xunadd_declare_character:cnn { \tl_to_str:n {#3} } }
        {#1} {#2}
      }
  }
\cs_new_protected_nopar:Npn \__xunadd_restore_hbar:
  {
    \cs_if_free:cF { ? - \token_to_str:N \hbar }
      { \__xunadd_restore_hbar:c { ? - \token_to_str:N \hbar } }
  }
\cs_new_protected_nopar:Npn \__xunadd_restore_hbar:N #1
  {
    \cs_gset_eq:NN \hbar #1
    \cs_undefine:N #1
  }
\cs_generate_variant:Nn \__xunadd_restore_hbar:N { c }
\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} }
    \tex_lowercase:D
      {
        \group_end:
        \__xunadd_declare_character:NNxn 0
      }
      #1 { \token_to_str:N #1 } {#2}
  }
\cs_generate_variant:Nn \__xunadd_declare_character:Nnn { c }
\NewDocumentCommand \DeclareUTFSymbol { m O { \UTFencname } m }
  { \__xunadd_declare_character:Nnn #1 {#2} {#3} }
\NewDocumentCommand \DeclareUTFCommand { m O { \UTFencname } m }
  { \__xunadd_text_command:Nonn #1 { \token_to_str:N #1 } {#2} {#3} }
\cs_new_protected:Npn \__xunadd_text_command:Nnnn #1#2#3#4
  { \DeclareTextCommand #1 {#3} { \__xunadd_text_command:nn {#2} {#4} } }
\cs_generate_variant:Nn \__xunadd_text_command:Nnnn { No }
\cs_new_protected:Npn \__xunadd_text_command:nn #1#2
  {
    \__xunadd_begin_hook:nn {#1} {#2}
    #2
    \__xunadd_end_hook:nn {#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
  {
    \__xunadd_begin_hook:nn {#1} {#2}
    \__xunadd_glyph_if_exist:nTF { `#2 }
      {#2} { \cs_if_exist_use:cF { ? #1 } {#2} }
    \__xunadd_end_hook:nn {#1} {#2}
  }
\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 }
      { \__xunadd_declare_composite:cnnn { \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 { \__xunadd_composite_cs:Nnn #1 {#2} {#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 }
\cs_generate_variant:Nn \__xunadd_declare_composite:Nnnn { c }
\NewDocumentCommand \DeclareUTFCompositeCommand { m O { \UTFencname } m m }
  { \cs_set_protected:cpn { \__xunadd_composite_cs:Nnn #1 {#2} {#3} } {#4} }
\NewDocumentCommand \DeclareUTFCompositeSymbol { m O { \UTFencname } m m }
  {
    \__xunadd_chardef:cn { \__xunadd_composite_cs:Nnn #1 {#2} {#3} }
      { \__xunadd_check_slot:n {#4} }
  }
\NewDocumentCommand \DeclareUTFComposite { m O { \UTFencname } }
  { \use:x { \__xunadd_declare_composite:Nnn \exp_not:N #1 { \token_to_str:N #1 } {#2} } }
\NewDocumentCommand \DeclareUTFEncodedAccent { m O { \UTFencname } m m }
  { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_accent:nnNNn #1 {#2} {#3} {#4} }
\NewDocumentCommand \DeclareUTFEncodedAccents { m O { \UTFencname } m m }
  { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_accents:nnNNn #1 {#2} {#3} {#4} }
\NewDocumentCommand \DeclareUTFEncodedSymbol { m O { \UTFencname } m m }
  { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_symbol:nnNNn #1 {#2} {#3} {#4} }
\NewDocumentCommand \DeclareUTFEncodedCircle { m O { \UTFencname } m m }
  { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_circle:nnNNn #1 {#2} {#3} {#4} }
\RenewDocumentCommand \DeclareEncodedCompositeCharacter { m m m m }
  { \DeclareUTFEncodedSymbol #2 [#1] { "#3 } { "0#4 } }
\RenewDocumentCommand \DeclareEncodedCompositeAccents { m m m m }
  { \DeclareUTFEncodedAccents #2 [#1] { "#4 } { "#3 } }
\NewDocumentCommand \DeclareUTFDoubleEncodedAccent { m O { \UTFencname } m m }
  { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_double_accent:nnNNn #1 {#2} {#3} {#4} }
\NewDocumentCommand \DeclareUTFDoubleEncodedSymbol { m O { \UTFencname } m m }
  { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_double_symbol:nnNNn #1 {#2} {#3} {#4} }
\cs_new_protected:Npn \__xunadd_declare_composite:Nnn #1#2#3
  { \DeclareTextCommand #1 {#3} { \__xunadd_text_composite:nnn {#2} {#3} } }
\cs_new_protected:Npn \__xunadd_text_composite:nnn #1#2#3
  {
    \__xunadd_begin_hook:nn {#1} {#3}
    \cs_if_exist:cTF { \__xunadd_composite_cs:nnn {#1} {#2} {#3} }
      {
        \__xunadd_text_composite:cnn
          { \__xunadd_composite_cs:nnn {#1} {#2} {#3} } {#1} {#3}
      }
      { \cs_if_exist_use:cTF { ? #1 } { {#3} } {#3} }
    \__xunadd_end_hook:nn {#1} {#3}
  }
\cs_new_protected:Npn \__xunadd_text_composite:Nnn #1#2#3
  {
    \token_if_chardef:NTF #1
      {
        \__xunadd_glyph_if_exist:nTF {#1}
          {#1} { \cs_if_exist_use:cTF { ? #2 } { {#3} } {#3} }
      }
      {#1}
  }
\cs_generate_variant:Nn \__xunadd_text_composite:Nnn { c }
\cs_new_protected:Npn \__xunadd_declare_encoded:NNnnn #1#2#3#4#5
  {
    \group_begin:
    \char_set_lccode:nn { `4 } { \__xunadd_check_slot:n {#4} }
    \char_set_lccode:nn { `5 } { \__xunadd_check_slot:n {#5} }
    \tex_lowercase:D
      {
        \group_end:
        \__xunadd_declare_encoded:NNNNxx 4 5
      }
      #1 #2 { \token_to_str:N #2 } {#3}
  }
\cs_new_protected:Npn \__xunadd_declare_encoded:NNNNnn #1#2#3#4#5#6
  { \DeclareTextCommand #4 {#6} { #3 {#5} {#6} {#1} {#2} } }
\cs_generate_variant:Nn \__xunadd_declare_encoded:NNnnn { c }
\cs_generate_variant:Nn \__xunadd_declare_encoded:NNNNnn { NNNNxx }
\cs_new_protected:Npn \__xunadd_text_combine:NnnNNn #1#2#3#4#5#6
  {
    \__xunadd_begin_hook:nn {#2} {#6}
    \cs_if_exist:cTF { \__xunadd_composite_cs:nnn {#2} {#3} {#6} }
      {
        \__xunadd_text_combine:cNnNNn
          { \__xunadd_composite_cs:nnn {#2} {#3} {#6} } #1 {#2} {#4} {#5} {#6}
      }
      { #1 {#6} {#2} {#4} {#5} }
    \__xunadd_end_hook:nn {#2} {#6}
  }
\cs_new_protected:Npn \__xunadd_text_combine:NNnNNn #1#2#3#4#5#6
  {
    \token_if_chardef:NTF #1
      { \__xunadd_glyph_if_exist:nTF {#1} {#1} { #2 {#6} {#3} {#4} {#5} } }
      {#1}
  }
\cs_generate_variant:Nn \__xunadd_text_combine:NNnNNn { c }
\cs_new_protected:Npn \__xunadd_combine_symbol:nnNNn
  { \__xunadd_text_combine:NnnNNn \__xunadd_add_symbol:nnNN }
\cs_new_protected:Npn \__xunadd_add_symbol: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 }
          { \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3 } }
      }
  }
\cs_new_protected:Npn \__xunadd_combine_accent:nnNNn
  { \__xunadd_text_combine:NnnNNn \__xunadd_add_accent:nnNN }
\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#3 } }
          }
      }
  }
\cs_new_protected:Npn \__xunadd_combine_accents:nnNNn
  { \__xunadd_text_combine:NnnNNn \__xunadd_add_accents:nnNN }
\cs_new_protected:Npn \__xunadd_add_accents:nnNN #1#2#3#4
  {
    \tl_if_blank:nTF {#1}
      { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#1} }
      {
        \bool_if:nTF
          {
            \__xunadd_glyph_if_exist_p:n { `#3 } &&
            \__xunadd_glyph_if_exist_p:n { `#4 }
          }
          { #1#3#4 }
          { \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3#4 } }
      }
  }
\cs_new_protected:Npn \__xunadd_combine_circle:nnNNn
  { \__xunadd_text_combine:NnnNNn \__xunadd_add_circle:nnNN }
\cs_new_protected:Npn \__xunadd_add_circle: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 { `#4 }
          { \__xunadd_add_circle:nN {#1} #4 }
          { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#1} }
      }
  }
\cs_new_protected:Npn \__xunadd_add_circle:nN #1#2
  {
    \hcoffin_set:Nn \l__xunadd_tmp_coffin {#1}
    \hcoffin_set:Nn \l__xunadd_circle_coffin {#2}
    \fp_set:Nn \l__xunadd_circle_scale_fp
      {
        \dim_to_decimal_in_unit:nn
          {
            \fp_use:N \l__xunadd_circle_ratio_fp
            \coffin_wd:N \l__xunadd_circle_coffin
          }
          { \coffin_wd:N \l__xunadd_tmp_coffin }
      }
    \coffin_scale:Nnn \l__xunadd_tmp_coffin
      { \l__xunadd_circle_scale_fp } { \l__xunadd_circle_scale_fp }
    \coffin_attach:NnnNnnnn
      \l__xunadd_circle_coffin { hc } { vc }
      \l__xunadd_tmp_coffin    { hc } { vc } { \c_zero_dim } { \c_zero_dim }
    \coffin_typeset:Nnnnn \l__xunadd_circle_coffin
      { H } { l } { \c_zero_dim } { \c_zero_dim }
  }
\fp_new:N \l__xunadd_circle_scale_fp
\coffin_new:N \l__xunadd_tmp_coffin
\coffin_new:N \l__xunadd_circle_coffin
\NewDocumentCommand \settextcircledratio { m }
  { \fp_set:Nn \l__xunadd_circle_ratio_fp {#1} }
\fp_new:N \l__xunadd_circle_ratio_fp
\settextcircledratio { 0.7 }
\cs_new_protected:Npn \__xunadd_combine_double_accent:nnNNn
  { \__xunadd_text_combine:NnnNNn \__xunadd_add_double_accent:nnNN }
\cs_new_protected:Npn \__xunadd_add_double_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 }
          { \__xunadd_add_double_symbol:nN {#1} #3 }
          {
            \__xunadd_glyph_if_exist:nTF { `#4 }
              { \add@accent { `#4 } {#1} }
              { \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3 } }
          }
      }
  }
\cs_new_protected:Npn \__xunadd_combine_double_symbol:nnNNn
  { \__xunadd_text_combine:NnnNNn \__xunadd_add_double_symbol:nnNN }
\cs_new_protected:Npn \__xunadd_add_double_symbol: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 }
          { \__xunadd_add_double_symbol:nN {#1} #3 }
          { \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3 } }
      }
  }
\cs_new_protected:Npn \__xunadd_add_double_symbol:nN #1#2
  {
    \tl_if_head_is_N_type:nTF {#1}
      {
        \exp_after:wN \exp_after:wN \exp_after:wN
        \__xunadd_add_double_symbol_aux:NnN \exp_after:wN \exp_after:wN
          \tl_head:w #1 \q_stop \exp_after:wN { \use_none:n #1 } #2
      }
      { #1#2 }
  }
\cs_new_protected:Npn \__xunadd_add_double_symbol_aux:NnN #1#2#3
  {
    \bool_if:nTF
      {
        \token_if_letter_p:N #1 ||
        \token_if_other_p:N #1  ||
        \token_if_chardef_p:N #1
      }
      { #1#3#2 }
      { #1#2#3 }
  }
\NewDocumentCommand \AtBeginUTFCommand { s O { } +m }
  {
    \tl_if_blank:nTF {#2}
      {
        \IfBooleanTF {#1}
          { \tl_set:Nn \l__xunadd_begin_hook_tl {#3} }
          { \tl_put_right:Nn \l__xunadd_begin_hook_tl {#3} }
      }
      { \__xunadd_set_cmd_hook:nnn { begin } {#2} {#3} }
  }
\NewDocumentCommand \AtEndUTFCommand { s O { } +m }
  {
    \tl_if_blank:nTF {#2}
      {
        \IfBooleanTF {#1}
          { \tl_set:Nn \l__xunadd_end_hook_tl {#3} }
          { \tl_put_right:Nn \l__xunadd_end_hook_tl {#3} }
      }
      { \__xunadd_set_cmd_hook:nnn { end } {#2} {#3} }
  }
\tl_new:N \l__xunadd_begin_hook_tl
\tl_new:N \l__xunadd_end_hook_tl
\cs_new_protected:Npn \__xunadd_set_cmd_hook:nnn #1#2#3
  {
    \cs_set_protected:cpn
      {
        \tl_if_single:nTF {#2}
          { \use:c { __xunadd_#1_csname:n } { \token_to_str:N #2 } }
          { \__xunadd_set_cmd_hook_aux:Nnwn #2 \q_stop {#1} }
      } ##1
      {#3}
  }
\cs_new:Npn \__xunadd_set_cmd_hook_aux:Nnwn #1#2 \q_stop #3
  { \use:c { __xunadd_#3_csname:n } { \token_to_str:N #1 - \tl_to_str:n {#2} } }
\cs_new_nopar:Npn \__xunadd_begin_csname:n #1 { __xunadd_begin_#1_hook:n }
\cs_new_nopar:Npn \__xunadd_end_csname:n #1   { __xunadd_end_#1_hook:n }
\cs_new_protected:Npn \__xunadd_begin_hook:nn #1#2
  {
    \tl_use:N \l__xunadd_begin_hook_tl
    \cs_if_exist_use:cF { \__xunadd_begin_csname:n { #1 - \tl_to_str:n {#2} } }
      { \cs_if_exist_use:cF { \__xunadd_begin_csname:n {#1} } { \use_none:n } }
      {#2}
  }
\cs_new_protected:Npn \__xunadd_end_hook:nn #1#2
  {
    \cs_if_exist_use:cF { \__xunadd_end_csname:n { #1 - \tl_to_str:n {#2} } }
      { \cs_if_exist_use:cF { \__xunadd_end_csname:n {#1} } { \use_none:n } }
      {#2}
    \tl_use:N \l__xunadd_end_hook_tl
  }
\NewDocumentCommand \DeclareUTFTIPACommand { O { \UTFencname } m }
  { \use:x { \__xunadd_text_tipa_command:Nnn \exp_not:N #2 { \token_to_str:N #2 } {#1} } }
\cs_new_protected:Npn \__xunadd_text_tipa_command:Nnn #1#2#3
  {
    \cs_set_eq:cc { UTF/#3#2 } { #3#2 }
    \DeclareTextCommand #1 {#3} { \__xunadd_text_tipa_command:nnn {#3} {#2} }
  }
\cs_new_protected:Npn \__xunadd_text_tipa_command:nnn #1#2#3
  {
    \exp_after:wN \__xunadd_check_for_tipa:NNn
      \cs:w \use_none:n #2 \exp_after:wN \cs_end:
      \cs:w UTF/#1#2 \cs_end: {#3}
  }
\cs_new_protected:Npn \__xunadd_check_for_tipa:NNn #1#2#3
  {
    \tl_if_head_eq_meaning:nNTF {#3} \textipa
      {
        \exp_after:wN \tipacatchonechar \exp_after:wN
          { \exp_after:wN #1 \use_none:n #3 }
      }
      { #2 {#3} }
  }
%% 
%%    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,
%%                                       xunicode-extra.def,
%%                                       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-CM.tex,
%%                                       xeCJK-example-listings.tex,
%%                                       xunicode-symbols.tex,
%%                                       xunicode-commands.tex,
%%                                       xunicode-combine-marks.tex,
%%                                       xunicode-symbols.pdf,
%%                                       full-stop.tec,
%%                                       fullwidth-stop.tec,
%%                                       han-simp.tec,
%%                                       han-trad.tec, and
%%                                       README.txt.
%%
%% End of file `xunicode-addon.sty'.
