summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty256
1 files changed, 256 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty
new file mode 100644
index 00000000000..9bafa15d860
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty
@@ -0,0 +1,256 @@
+%%
+%% This is file `xeCJK-listings.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% xeCJK.dtx (with options: `listings')
+%%
+%% $Id: xeCJK.dtx 438 2013-06-11 14:17:42Z 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 438 2013-06-11 14:17:42Z sobenlee $
+ {xeCJK patch file for listings}
+\ProvidesExplPackage
+ {xeCJK-listings}
+ {\ExplFileDate}{3.2.3}{\ExplFileDescription}
+\DeclareOption* { \PassOptionsToPackage { \CurrentOption } { xeCJK } }
+\ProcessOptions \scan_stop:
+\RequirePackage { xeCJK }
+\RequirePackage { listings }
+\lst@AddToHook { Init } { \__xeCJK_listings_initial_hook: }
+\lst@AddToHook { SelectCharTable } { \__xeCJK_listings_toks_hook: }
+\lst@AddToHook { OutputBox }
+ {
+ \l__xeCJK_restore_listings_toks_tl
+ \__xeCJK_listings_output_IVS:
+ }
+\lst@AddToHook { PreSet } { \bool_set_true:N \l__xeCJK_listings_env_bool }
+\cs_new_protected_nopar:Npn \__xeCJK_listings_initial_hook:
+ {
+ \tex_noindent:D
+ \bool_gset_false:N \g__xeCJK_listings_IVS_bool
+ \tl_put_left:Nn \lst@numberstyle { \l__xeCJK_restore_listings_toks_tl }
+ \tex_output:D \exp_after:wN \exp_after:wN \exp_after:wN
+ {
+ \exp_after:wN \exp_after:wN
+ \exp_after:wN \l__xeCJK_restore_listings_toks_tl
+ \exp_after:wN \use:n
+ \tex_the:D \tex_output:D
+ }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_listings_toks_hook:
+ {
+ \tl_set:Nx \l__xeCJK_restore_listings_toks_tl
+ {
+ \__xeCJK_backup_inter_class_toks:nn { Boundary } { Default }
+ \__xeCJK_backup_inter_class_toks:nn { Boundary } { CJK }
+ \__xeCJK_backup_inter_class_toks:nn { Boundary } { IVS }
+ \__xeCJK_backup_inter_class_toks:nn { Boundary } { FullLeft }
+ \__xeCJK_backup_inter_class_toks:nn { Boundary } { FullRight }
+ }
+ \seq_map_inline:Nn \g__xeCJK_CJK_sub_class_seq
+ {
+ \tl_put_right:Nx \l__xeCJK_restore_listings_toks_tl
+ { \__xeCJK_backup_inter_class_toks:nn { Boundary } { CJK/##1 } }
+ }
+ \xeCJK_inter_class_toks:nnn { Boundary } { Default }
+ { \__xeCJK_listings_process_Default:N }
+ \xeCJK_inter_class_toks:nnn { Boundary } { CJK }
+ { \__xeCJK_listings_process_CJK:nN { \c_two } }
+ \xeCJK_inter_class_toks:nnn { Boundary } { IVS }
+ { \__xeCJK_listings_process_IVS:nN { \c_zero } }
+ \xeCJK_inter_class_toks:nnn { Boundary } { FullLeft }
+ { \__xeCJK_listings_process_CJK:nN { \c_two } }
+ \xeCJK_inter_class_toks:nnn { Boundary } { FullRight }
+ { \__xeCJK_listings_process_CJK:nN { \c_two } }
+ \seq_map_inline:Nn \g__xeCJK_CJK_sub_class_seq
+ {
+ \xeCJK_inter_class_toks:nnn { Boundary } { CJK/##1 }
+ { \__xeCJK_listings_process_CJK:nN { \c_two } }
+ }
+ }
+\tl_new:N \l__xeCJK_restore_listings_toks_tl
+\cs_new_nopar:Npn \__xeCJK_backup_inter_class_toks:nn #1#2
+ {
+ \xeCJK_inter_class_toks:nnn {#1} {#2}
+ { \xeCJK_get_inter_class_toks:nn {#1} {#2} }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_listings_process_Default:N #1
+ {
+ \token_if_letter:NTF #1
+ { \lst@ProcessLetter #1 }
+ { \lst@ProcessOther #1 }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_listings_process_CJK:nN #1#2
+ {
+ \token_if_letter:NTF #2
+ { \__xeCJK_listings_process_letter:nN {#1} #2 }
+ { \__xeCJK_listings_process_other:nN {#1} #2 }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_listings_append:nN #1#2
+ {
+ \int_add:Nn \lst@length { #1 - \c_one }
+ \lst@Append #2
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_listings_process_letter:nN
+ {
+ \lst@whitespacefalse
+ \bool_if:NTF \l__xeCJK_listings_letter_bool
+ { \lst@lettertrue }
+ {
+ \lst@ifletter
+ \lst@Output
+ \else:
+ \lst@OutputOther
+ \lst@lettertrue
+ \fi:
+ \bool_set_true:N \l__xeCJK_listings_letter_bool
+ }
+ \__xeCJK_listings_append:nN
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_listings_process_other:nN #1#2
+ {
+ \lst@whitespacefalse
+ \bool_if:NTF \l__xeCJK_listings_letter_bool
+ {
+ \lst@Output
+ \bool_set_false:N \l__xeCJK_listings_letter_bool
+ \lst@letterfalse
+ }
+ { \lst@ifletter \lst@Output \lst@letterfalse \fi: }
+ \cs_set_eq:NN \lst@lastother #2
+ \__xeCJK_listings_append:nN {#1} #2
+ }
+\bool_new:N \l__xeCJK_listings_letter_bool
+\cs_set_protected_nopar:Npn \lst@AppendLetter
+ {
+ \bool_if:NTF \l__xeCJK_listings_letter_bool
+ {
+ \lst@Output
+ \bool_set_false:N \l__xeCJK_listings_letter_bool
+ \lst@lettertrue
+ }
+ { \reverse_if:N \lst@ifletter \lst@OutputOther \lst@lettertrue \fi: }
+ \lst@Append
+ }
+\cs_set_protected_nopar:Npn \lst@AppendOther
+ {
+ \bool_if:NTF \l__xeCJK_listings_letter_bool
+ {
+ \lst@Output
+ \bool_set_false:N \l__xeCJK_listings_letter_bool
+ \lst@letterfalse
+ }
+ { \lst@ifletter \lst@Output \lst@letterfalse \fi: }
+ \tex_futurelet:D \lst@lastother \lst@Append
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_listings_process_IVS:nN
+ {
+ \reverse_if:N \lst@ifflexible
+ \bool_gset_true:N \g__xeCJK_listings_IVS_bool
+ \fi:
+ \__xeCJK_listings_process_letter:nN
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_listings_output_IVS:
+ {
+ \reverse_if:N \lst@ifflexible
+ \bool_if:NT \g__xeCJK_listings_IVS_bool
+ {
+ \bool_gset_false:N \g__xeCJK_listings_IVS_bool
+ \xeCJK_cs_clear:N \lst@FillOutputBox
+ \cs_set_eq:NN \CJKglue \tex_hss:D
+ }
+ \fi:
+ }
+\bool_new:N \g__xeCJK_listings_IVS_bool
+\cs_new_protected:Npn \__xeCJK_listings_peek_active_loop:TF #1#2#3
+ {
+ \token_if_active:NTF #3
+ { #1#3 }
+ {
+ \token_if_cs:NTF #3
+ { #2#3 }
+ {
+ \int_compare:nNnTF { `#3 } > { \lst@ifec 255 \else: 127 \fi: }
+ { \__xeCJK_listings_peek_active_loop:TF { #1#3 } { #2#3 } }
+ { #2#3 }
+ }
+ }
+ }
+\cs_set_eq:NN \lst@IfNextCharActive \__xeCJK_listings_peek_active_loop:TF
+\cs_new_protected:Npn \__xeCJK_listings_inside_convert:nw #1 ~ \@empty
+ {
+ \tl_set_rescan:Nnn \l__xeCJK_tmpa_tl { } {#1}
+ \__xeCJK_set_listings_escape:
+ \tl_put_right:NV \lst@arg \l__xeCJK_tmpa_tl
+ }
+\cs_set_eq:NN \lst@InsideConvert@ \__xeCJK_listings_inside_convert:nw
+\cs_new_protected_nopar:Npn \__xeCJK_listings_inline_group:w
+ {
+ \exp_after:wN \__xeCJK_listings_inline_group:n
+ \exp_after:wN { \if_false: } \fi:
+ }
+\cs_set_eq:NN \lst@InlineGJ \__xeCJK_listings_inline_group:w
+\cs_new_protected:Npn \__xeCJK_listings_inline_group:n #1
+ {
+ \tl_set_rescan:Nnn \lst@arg { } {#1}
+ \__xeCJK_set_listings_escape:
+ \lst@InlineGJEnd
+ }
+\group_begin:
+\char_set_catcode_active:N \/
+\char_set_lccode:nn { `\/ } { `\\ }
+\tl_to_lowercase:n
+ {
+ \group_end:
+ \cs_new_protected:Npn \__xeCJK_set_listings_escape:
+ { \xeCJK_swap_cs:NN / \__xeCJK_listings_escape:N }
+ \cs_new_protected:Npn \__xeCJK_listings_escape:N #1
+ { \cs_if_eq:NNTF / #1 { \__xeCJK_listings_escape:N } {#1} }
+ }
+%%
+%% This package consists of the file xeCJK.dtx
+%% and the derived files xeCJK.pdf,
+%% xeCJK.sty,
+%% xeCJK.cfg,
+%% xeCJK.ins,
+%% xeCJKfntef.sty,
+%% xeCJK-listings.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, and
+%% README.txt.
+%%
+%% End of file `xeCJK-listings.sty'.