summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-01-16 00:10:56 +0000
committerKarl Berry <karl@freefriends.org>2014-01-16 00:10:56 +0000
commit7d39f6050ecfeed0e08b40464871a9b7f5ffaa12 (patch)
tree8695e8d1a94ab629f197a921e79d3001a93c39c0 /Master
parente29414766d9839222ab5ea36f953729a00a373c5 (diff)
xpinyin (15jan14)
git-svn-id: svn://tug.org/texlive/trunk@32684 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/xpinyin/xpinyin.pdfbin211772 -> 222597 bytes
-rw-r--r--Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx177
-rw-r--r--Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty130
3 files changed, 221 insertions, 86 deletions
diff --git a/Master/texmf-dist/doc/latex/xpinyin/xpinyin.pdf b/Master/texmf-dist/doc/latex/xpinyin/xpinyin.pdf
index 03b9b341e0c..c32e9354696 100644
--- a/Master/texmf-dist/doc/latex/xpinyin/xpinyin.pdf
+++ b/Master/texmf-dist/doc/latex/xpinyin/xpinyin.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx b/Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx
index 0b17b767ef5..d744c55993e 100644
--- a/Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx
+++ b/Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx
@@ -119,13 +119,13 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
%<*driver|package>
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: xpinyin.dtx 539 2014-01-04 08:07:32Z sobenlee $
+\GetIdInfo$Id: xpinyin.dtx 542 2014-01-13 18:19:08Z sobenlee $
{Automatically add pinyin to Chinese characters}
%<*driver>
\ProvidesExplFile{\ExplFileName.\ExplFileExtension}
%</driver>
%<package>\ProvidesExplPackage{\ExplFileName}
- {\ExplFileDate}{1.6}{\ExplFileDescription}
+ {\ExplFileDate}{1.7}{\ExplFileDescription}
%<*driver>
\ExplSyntaxOff
%</driver>
@@ -186,7 +186,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
%</driver>
% \fi
%
-% \CheckSum{623}
+% \CheckSum{670}
% \GetFileInfo{\jobname.dtx}
%
% \title{\bfseries\pkg{xpinyin} 宏包}
@@ -373,6 +373,19 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
% \end{verbatim}
% \end{function}
%
+% \begin{function}[added=2014/01/12]{footnote}
+% \begin{syntax}
+% footnote = \meta{\TFF}
+% \end{syntax}
+% 是否对拼音环境中的脚注(\cs{footnote})汉字加上拼音。缺省值为 \texttt{false}。
+% 更一般的情况,请使用 \cs{disablepinyin}。
+% \end{function}
+%
+% \begin{function}[added=2014/01/12]{\disablepinyin,\enablepinyin}
+% \cs{disablepinyin} 用于在拼音环境(\env{pinyinscope})中临时取消对汉字的注音,而
+% \cs{enablepinyin} 用于其后的恢复。
+% \end{function}
+%
% \end{documentation}
%
% \StopEventually{}
@@ -604,10 +617,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
\NewDocumentEnvironment { pinyinscope } { O { } }
{
\keys_set:nn { xpinyin } {#1}
- \tl_if_empty:NF \l_@@_hsep_tl
- { \cs_set_nopar:Npn \CJKglue { \skip_horizontal:n { \l_@@_hsep_tl } } }
- \settowidth \l_@@_CJKglue_dim { \CJKglue }
- \@@_replace_CJKsymbol:
+ \enablepinyin
}
{ }
% \end{macrocode}
@@ -621,17 +631,15 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
{
\group_begin:
\keys_set:nn { xpinyin } {#2}
- \tl_if_empty:NF \l_@@_hsep_tl
- { \cs_set_nopar:Npn \CJKglue { \skip_horizontal:n { \l_@@_hsep_tl } } }
- \settowidth \l_@@_CJKglue_dim { \CJKglue }
- \@@_replace_CJKsymbol:
+ \enablepinyin
#3
\group_end:
}
{
\group_begin:
\keys_set:nn { xpinyin } {#2}
- \settowidth \l_@@_CJKglue_dim { \CJKglue }
+ \bool_if:NF \l_@@_enable_bool
+ { \settowidth \l_@@_CJKglue_dim { \CJKglue } }
\leavevmode
\@@_single_aux:nn {#3}
}
@@ -639,6 +647,75 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[internal]{\l_@@_enable_bool}
+% \begin{macrocode}
+\bool_new:N \l_@@_enable_bool
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\@@_CJKglue:}
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_CJKglue:
+ { \skip_horizontal:n { \l_@@_hsep_tl } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\enablepinyin}
+% \begin{macrocode}
+\NewDocumentCommand \enablepinyin { }
+ {
+ \bool_if:NF \l_@@_enable_bool
+ {
+ \tl_if_empty:NF \l_@@_hsep_tl
+ {
+ \cs_set_eq:NN \@@_save_CJKglue: \CJKglue
+ \cs_set_eq:NN \CJKglue \@@_CJKglue:
+ }
+ \settowidth \l_@@_CJKglue_dim { \CJKglue }
+ \@@_replace_CJKsymbol:
+ \@@_restore_footnote:
+ \bool_set_true:N \l_@@_enable_bool
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\disablepinyin}
+% \begin{macrocode}
+\NewDocumentCommand \disablepinyin { }
+ {
+ \bool_if:NT \l_@@_enable_bool
+ {
+ \cs_if_eq:NNT \CJKglue \@@_CJKglue:
+ { \cs_set_eq:NN \CJKglue \@@_save_CJKglue: }
+ \@@_restore_CJKsymbol:
+ \bool_set_false:N \l_@@_enable_bool
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\@@_restore_footnote:}
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_restore_footnote:
+ {
+ \bool_if:NF \l_@@_footnote_bool
+ { \tl_put_left:Nn \@parboxrestore { \l_@@_restore_footnote_tl } }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\l_@@_restore_footnote_tl}
+% \begin{macrocode}
+\tl_new:N \l_@@_restore_footnote_tl
+\tl_set:Nn \l_@@_restore_footnote_tl
+ {
+ \int_compare:nNnT \etex_currentgrouptype:D = \c_eleven
+ { \disablepinyin }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}[internal,var]{\l_@@_CJKglue_dim}
% \begin{macrocode}
\dim_new:N \l_@@_CJKglue_dim
@@ -649,13 +726,13 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_single_aux:nn #1#2
{
- \@@_single_hook:n { \@@_replace_CJKsymbol: }
\@@_replace_CJKsymbol_single:n {#2}
#1
\group_end:
}
\cs_new_protected_nopar:Npn \@@_replace_CJKsymbol_single_aux:n #1
{
+ \bool_if:NF \l_@@_enable_bool { \@@_replace_CJKsymbol: }
\cs_set_protected_nopar:Npn \CJKsymbol ##1
{ \@@_single_CJKsymbol:nn {##1} {#1} }
}
@@ -672,19 +749,16 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_replace_CJKsymbol_aux:
{
- \cs_if_eq:NNF \CJKsymbol \@@_CJKsymbol:n
- {
- \cs_set_eq:NN \@@_save_CJKsymbol:n \CJKsymbol
- \cs_set_eq:NN \CJKsymbol \@@_CJKsymbol:n
- }
+ \cs_set_eq:NN \@@_save_CJKsymbol:n \CJKsymbol
+ \cs_set_eq:NN \CJKsymbol \@@_CJKsymbol:n
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\@@_single_hook_aux:n}
+% \begin{macro}[internal]{\@@_restore_CJKsymbol_aux:}
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_single_hook_aux:n
- { \cs_if_eq:NNF \CJKsymbol \@@_CJKsymbol:n }
+\cs_new_protected_nopar:Npn \@@_restore_CJKsymbol_aux:
+ { \cs_set_eq:NN \CJKsymbol \@@_save_CJKsymbol:n }
% \end{macrocode}
% \end{macro}
%
@@ -760,16 +834,32 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
\cs_new_eq:NN \@@_select_font: \@@_select_font_xetex:
\cs_new_eq:NN \@@_to_unicode:n \@@_to_unicode_xetex:n
\cs_new_eq:NN \@@_char_to_unicode:n \@@_to_unicode:n
+ \cs_new_eq:NN \@@_restore_CJKsymbol: \@@_restore_CJKsymbol_aux:
\cs_new_eq:NN \@@_replace_CJKsymbol: \@@_replace_CJKsymbol_aux:
\cs_new_eq:NN \@@_replace_CJKsymbol_single:n
\@@_replace_CJKsymbol_single_aux:n
- \tl_gset:Nn \l_@@_coor_tl
- { (\cs_meaning:N \l_@@_font_tl)/\l_xeCJK_current_font_tl/\l_@@_ratio_tl }
+ \tl_if_exist:NTF \l_xeCJK_current_font_tl
+ {
+ \tl_set:Nn \l_@@_coor_tl
+ {
+ ( \tl_to_str:N \l_@@_font_tl ) /
+ \l_xeCJK_current_font_tl/\l_@@_ratio_tl
+ }
+ }
+ {
+ \tl_set:Nn \l_@@_coor_tl
+ {
+ ( \tl_to_str:N \l_@@_font_tl ) /
+ \xeCJK@family/\f@series/\f@shape/\f@size/\l_@@_ratio_tl
+ }
+ }
\cs_new_eq:NN \@@_leavevmode: \prg_do_nothing:
- \cs_new_protected_nopar:Npn \@@_CJKsymbol_hook:
- { \makexeCJKinactive \xeCJK_select_font: }
- \cs_new_protected_nopar:Npn \@@_single_hook:n
- { \cs_if_eq:NNF \CJKsymbol \@@_CJKsymbol:n }
+ \cs_new_protected_nopar:Npx \@@_CJKsymbol_hook:
+ {
+ \exp_not:N \makexeCJKinactive
+ \cs_if_exist_use:NF \xeCJK_select_font:
+ { \exp_not:N \xeCJK@setfont }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -793,7 +883,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
\@ifpackageloaded { CJKpunct }
{ \@@_adjust_CJKpunct_hook: }
{
- \cs_new_eq:NN \@@_single_hook:n \@@_single_hook_aux:n
+ \cs_new_eq:NN \@@_restore_CJKsymbol: \@@_restore_CJKsymbol_aux:
\cs_new_eq:NN \@@_replace_CJKsymbol: \@@_replace_CJKsymbol_aux:
\cs_new_eq:NN \@@_replace_CJKsymbol_single:n
\@@_replace_CJKsymbol_single_aux:n
@@ -801,7 +891,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
{
\@ifpackageloaded { CJKpunct }
{
- \cs_undefine:N \@@_single_hook:n
+ \cs_undefine:N \@@_restore_CJKsymbol:
\cs_undefine:N \@@_replace_CJKsymbol:
\cs_undefine:N \@@_replace_CJKsymbol_single:n
\@@_adjust_CJKpunct_hook:
@@ -816,33 +906,30 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_adjust_CJKpunct_hook:
{
+ \cs_new_protected_nopar:Npn \@@_restore_CJKsymbol:
+ {
+ \int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain }
+ { \@@_restore_CJKsymbol_aux: }
+ { \cs_set_eq:NN \CJKosymbol \@@_save_CJKsymbol:n }
+ }
\cs_new_protected_nopar:Npn \@@_replace_CJKsymbol:
{
\int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain }
{ \@@_replace_CJKsymbol_aux: }
{
- \cs_if_eq:NNF \CJKosymbol \@@_CJKsymbol:n
- {
- \cs_set_eq:NN \@@_save_CJKsymbol:n \CJKosymbol
- \cs_set_eq:NN \CJKosymbol \@@_CJKsymbol:n
- }
+ \cs_set_eq:NN \@@_save_CJKsymbol:n \CJKosymbol
+ \cs_set_eq:NN \CJKosymbol \@@_CJKsymbol:n
}
}
\cs_new_protected_nopar:Npn \@@_replace_CJKsymbol_single:n ##1
{
\int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain }
- { \@@_replace_CJKsymbol_single_aux:n {##1} }
+ { \@@_replace_CJKsymbol_single_aux:n { ##1 } }
{
\cs_set_protected_nopar:Npn \CJKosymbol ####1
- { \@@_single_CJKsymbol:nn {####1} {##1} }
+ { \@@_single_CJKsymbol:nn { ####1 } { ##1 } }
}
}
- \cs_new_protected_nopar:Npn \@@_single_hook:n
- {
- \int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain }
- { \@@_single_hook_aux:n }
- { \cs_if_eq:NNF \CJKosymbol \@@_CJKsymbol:n }
- }
}
% \end{macrocode}
% \end{macro}
@@ -854,7 +941,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
\group_begin:
\keys_set:nn { xpinyin } {#1}
\l_@@_font_tl
- \l_@@_format_tl
+ \l_@@_format_tl { }
\selectfont
\c_@@_reset_UTF_cs_tl
\@@_pinyin:n {#2}
@@ -1008,8 +1095,10 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
% \begin{macro}{ratio,vsep,hsep,pysep,font,format,multiple}
% \begin{macrocode}
\clist_map_inline:nn
- { ratio , vsep , hsep , pysep , font , format , multiple }
+ { ratio , vsep , hsep , pysep , font , format , multiple , footnote }
{ \keys_define:nn { xpinyin } { #1 .tl_set:c = { l_@@_ #1 _tl } } }
+\keys_define:nn { xpinyin }
+ { footnote .bool_set:N = \l_@@_footnote_bool }
\keys_set:nn { xpinyin }
{
ratio = .4 ,
diff --git a/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty b/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty
index 0d75f6be182..61ae931166a 100644
--- a/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty
+++ b/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty
@@ -21,10 +21,10 @@
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: xpinyin.dtx 539 2014-01-04 08:07:32Z sobenlee $
+\GetIdInfo$Id: xpinyin.dtx 542 2014-01-13 18:19:08Z sobenlee $
{Automatically add pinyin to Chinese characters}
\ProvidesExplPackage{\ExplFileName}
- {\ExplFileDate}{1.6}{\ExplFileDescription}
+ {\ExplFileDate}{1.7}{\ExplFileDescription}
\msg_new:nnn { xpinyin } { no-LuaTeX }
{
The~xpinyin~package~is~not~supported~in~LuaTeX.\\\\
@@ -190,10 +190,7 @@
\NewDocumentEnvironment { pinyinscope } { O { } }
{
\keys_set:nn { xpinyin } {#1}
- \tl_if_empty:NF \l__xpinyin_hsep_tl
- { \cs_set_nopar:Npn \CJKglue { \skip_horizontal:n { \l__xpinyin_hsep_tl } } }
- \settowidth \l__xpinyin_CJKglue_dim { \CJKglue }
- \__xpinyin_replace_CJKsymbol:
+ \enablepinyin
}
{ }
\NewDocumentCommand \xpinyin { s O { } m }
@@ -202,31 +199,68 @@
{
\group_begin:
\keys_set:nn { xpinyin } {#2}
- \tl_if_empty:NF \l__xpinyin_hsep_tl
- { \cs_set_nopar:Npn \CJKglue { \skip_horizontal:n { \l__xpinyin_hsep_tl } } }
- \settowidth \l__xpinyin_CJKglue_dim { \CJKglue }
- \__xpinyin_replace_CJKsymbol:
+ \enablepinyin
#3
\group_end:
}
{
\group_begin:
\keys_set:nn { xpinyin } {#2}
- \settowidth \l__xpinyin_CJKglue_dim { \CJKglue }
+ \bool_if:NF \l__xpinyin_enable_bool
+ { \settowidth \l__xpinyin_CJKglue_dim { \CJKglue } }
\leavevmode
\__xpinyin_single_aux:nn {#3}
}
}
+\bool_new:N \l__xpinyin_enable_bool
+\cs_new_protected_nopar:Npn \__xpinyin_CJKglue:
+ { \skip_horizontal:n { \l__xpinyin_hsep_tl } }
+\NewDocumentCommand \enablepinyin { }
+ {
+ \bool_if:NF \l__xpinyin_enable_bool
+ {
+ \tl_if_empty:NF \l__xpinyin_hsep_tl
+ {
+ \cs_set_eq:NN \__xpinyin_save_CJKglue: \CJKglue
+ \cs_set_eq:NN \CJKglue \__xpinyin_CJKglue:
+ }
+ \settowidth \l__xpinyin_CJKglue_dim { \CJKglue }
+ \__xpinyin_replace_CJKsymbol:
+ \__xpinyin_restore_footnote:
+ \bool_set_true:N \l__xpinyin_enable_bool
+ }
+ }
+\NewDocumentCommand \disablepinyin { }
+ {
+ \bool_if:NT \l__xpinyin_enable_bool
+ {
+ \cs_if_eq:NNT \CJKglue \__xpinyin_CJKglue:
+ { \cs_set_eq:NN \CJKglue \__xpinyin_save_CJKglue: }
+ \__xpinyin_restore_CJKsymbol:
+ \bool_set_false:N \l__xpinyin_enable_bool
+ }
+ }
+\cs_new_protected_nopar:Npn \__xpinyin_restore_footnote:
+ {
+ \bool_if:NF \l__xpinyin_footnote_bool
+ { \tl_put_left:Nn \@parboxrestore { \l__xpinyin_restore_footnote_tl } }
+ }
+\tl_new:N \l__xpinyin_restore_footnote_tl
+\tl_set:Nn \l__xpinyin_restore_footnote_tl
+ {
+ \int_compare:nNnT \etex_currentgrouptype:D = \c_eleven
+ { \disablepinyin }
+ }
\dim_new:N \l__xpinyin_CJKglue_dim
\cs_new_protected_nopar:Npn \__xpinyin_single_aux:nn #1#2
{
- \__xpinyin_single_hook:n { \__xpinyin_replace_CJKsymbol: }
\__xpinyin_replace_CJKsymbol_single:n {#2}
#1
\group_end:
}
\cs_new_protected_nopar:Npn \__xpinyin_replace_CJKsymbol_single_aux:n #1
{
+ \bool_if:NF \l__xpinyin_enable_bool { \__xpinyin_replace_CJKsymbol: }
\cs_set_protected_nopar:Npn \CJKsymbol ##1
{ \__xpinyin_single_CJKsymbol:nn {##1} {#1} }
}
@@ -238,14 +272,11 @@
}
\cs_new_protected_nopar:Npn \__xpinyin_replace_CJKsymbol_aux:
{
- \cs_if_eq:NNF \CJKsymbol \__xpinyin_CJKsymbol:n
- {
- \cs_set_eq:NN \__xpinyin_save_CJKsymbol:n \CJKsymbol
- \cs_set_eq:NN \CJKsymbol \__xpinyin_CJKsymbol:n
- }
+ \cs_set_eq:NN \__xpinyin_save_CJKsymbol:n \CJKsymbol
+ \cs_set_eq:NN \CJKsymbol \__xpinyin_CJKsymbol:n
}
-\cs_new_protected_nopar:Npn \__xpinyin_single_hook_aux:n
- { \cs_if_eq:NNF \CJKsymbol \__xpinyin_CJKsymbol:n }
+\cs_new_protected_nopar:Npn \__xpinyin_restore_CJKsymbol_aux:
+ { \cs_set_eq:NN \CJKsymbol \__xpinyin_save_CJKsymbol:n }
\cs_new_protected_nopar:Npn \__xpinyin_select_font_xetex:
{
\cs_if_exist_use:cF { \l__xpinyin_coor_tl }
@@ -291,16 +322,32 @@
\cs_new_eq:NN \__xpinyin_select_font: \__xpinyin_select_font_xetex:
\cs_new_eq:NN \__xpinyin_to_unicode:n \__xpinyin_to_unicode_xetex:n
\cs_new_eq:NN \__xpinyin_char_to_unicode:n \__xpinyin_to_unicode:n
+ \cs_new_eq:NN \__xpinyin_restore_CJKsymbol: \__xpinyin_restore_CJKsymbol_aux:
\cs_new_eq:NN \__xpinyin_replace_CJKsymbol: \__xpinyin_replace_CJKsymbol_aux:
\cs_new_eq:NN \__xpinyin_replace_CJKsymbol_single:n
\__xpinyin_replace_CJKsymbol_single_aux:n
- \tl_gset:Nn \l__xpinyin_coor_tl
- { (\cs_meaning:N \l__xpinyin_font_tl)/\l_xeCJK_current_font_tl/\l__xpinyin_ratio_tl }
+ \tl_if_exist:NTF \l_xeCJK_current_font_tl
+ {
+ \tl_set:Nn \l__xpinyin_coor_tl
+ {
+ ( \tl_to_str:N \l__xpinyin_font_tl ) /
+ \l_xeCJK_current_font_tl/\l__xpinyin_ratio_tl
+ }
+ }
+ {
+ \tl_set:Nn \l__xpinyin_coor_tl
+ {
+ ( \tl_to_str:N \l__xpinyin_font_tl ) /
+ \xeCJK@family/\f@series/\f@shape/\f@size/\l__xpinyin_ratio_tl
+ }
+ }
\cs_new_eq:NN \__xpinyin_leavevmode: \prg_do_nothing:
- \cs_new_protected_nopar:Npn \__xpinyin_CJKsymbol_hook:
- { \makexeCJKinactive \xeCJK_select_font: }
- \cs_new_protected_nopar:Npn \__xpinyin_single_hook:n
- { \cs_if_eq:NNF \CJKsymbol \__xpinyin_CJKsymbol:n }
+ \cs_new_protected_nopar:Npx \__xpinyin_CJKsymbol_hook:
+ {
+ \exp_not:N \makexeCJKinactive
+ \cs_if_exist_use:NF \xeCJK_select_font:
+ { \exp_not:N \xeCJK@setfont }
+ }
}
\cs_new_protected_nopar:Npn \__xpinyin_adjust_CJK_hook:
{
@@ -319,7 +366,7 @@
\@ifpackageloaded { CJKpunct }
{ \__xpinyin_adjust_CJKpunct_hook: }
{
- \cs_new_eq:NN \__xpinyin_single_hook:n \__xpinyin_single_hook_aux:n
+ \cs_new_eq:NN \__xpinyin_restore_CJKsymbol: \__xpinyin_restore_CJKsymbol_aux:
\cs_new_eq:NN \__xpinyin_replace_CJKsymbol: \__xpinyin_replace_CJKsymbol_aux:
\cs_new_eq:NN \__xpinyin_replace_CJKsymbol_single:n
\__xpinyin_replace_CJKsymbol_single_aux:n
@@ -327,7 +374,7 @@
{
\@ifpackageloaded { CJKpunct }
{
- \cs_undefine:N \__xpinyin_single_hook:n
+ \cs_undefine:N \__xpinyin_restore_CJKsymbol:
\cs_undefine:N \__xpinyin_replace_CJKsymbol:
\cs_undefine:N \__xpinyin_replace_CJKsymbol_single:n
\__xpinyin_adjust_CJKpunct_hook:
@@ -337,40 +384,37 @@
}
\cs_new_protected_nopar:Npn \__xpinyin_adjust_CJKpunct_hook:
{
+ \cs_new_protected_nopar:Npn \__xpinyin_restore_CJKsymbol:
+ {
+ \int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain }
+ { \__xpinyin_restore_CJKsymbol_aux: }
+ { \cs_set_eq:NN \CJKosymbol \__xpinyin_save_CJKsymbol:n }
+ }
\cs_new_protected_nopar:Npn \__xpinyin_replace_CJKsymbol:
{
\int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain }
{ \__xpinyin_replace_CJKsymbol_aux: }
{
- \cs_if_eq:NNF \CJKosymbol \__xpinyin_CJKsymbol:n
- {
- \cs_set_eq:NN \__xpinyin_save_CJKsymbol:n \CJKosymbol
- \cs_set_eq:NN \CJKosymbol \__xpinyin_CJKsymbol:n
- }
+ \cs_set_eq:NN \__xpinyin_save_CJKsymbol:n \CJKosymbol
+ \cs_set_eq:NN \CJKosymbol \__xpinyin_CJKsymbol:n
}
}
\cs_new_protected_nopar:Npn \__xpinyin_replace_CJKsymbol_single:n ##1
{
\int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain }
- { \__xpinyin_replace_CJKsymbol_single_aux:n {##1} }
+ { \__xpinyin_replace_CJKsymbol_single_aux:n { ##1 } }
{
\cs_set_protected_nopar:Npn \CJKosymbol ####1
- { \__xpinyin_single_CJKsymbol:nn {####1} {##1} }
+ { \__xpinyin_single_CJKsymbol:nn { ####1 } { ##1 } }
}
}
- \cs_new_protected_nopar:Npn \__xpinyin_single_hook:n
- {
- \int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain }
- { \__xpinyin_single_hook_aux:n }
- { \cs_if_eq:NNF \CJKosymbol \__xpinyin_CJKsymbol:n }
- }
}
\NewDocumentCommand \pinyin { O { } m }
{
\group_begin:
\keys_set:nn { xpinyin } {#1}
\l__xpinyin_font_tl
- \l__xpinyin_format_tl
+ \l__xpinyin_format_tl { }
\selectfont
\c__xpinyin_reset_UTF_cs_tl
\__xpinyin_pinyin:n {#2}
@@ -468,8 +512,10 @@
}
\NewDocumentCommand \xpinyinsetup { m } { \keys_set:nn { xpinyin } {#1} }
\clist_map_inline:nn
- { ratio , vsep , hsep , pysep , font , format , multiple }
+ { ratio , vsep , hsep , pysep , font , format , multiple , footnote }
{ \keys_define:nn { xpinyin } { #1 .tl_set:c = { l__xpinyin_ #1 _tl } } }
+\keys_define:nn { xpinyin }
+ { footnote .bool_set:N = \l__xpinyin_footnote_bool }
\keys_set:nn { xpinyin }
{
ratio = .4 ,