Skip to content

Commit

Permalink
ctex: 正确关闭和恢复 LaTeX3 语法环境
Browse files Browse the repository at this point in the history
fixed #518
  • Loading branch information
qinglee committed Jun 6, 2020
1 parent 1ae6354 commit 013c38a
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions ctex/ctex.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ Copyright and Licence
% \changes{v2.4.15}{2019/03/23}{同步 \LaTeXiii{} 2019/03/05。}
% \changes{v2.5.1}{2020/05/02}{\pkg{zhconv} 更名为 \pkg{ctex-zhconv}。}
%
% \CheckSum{6218}
% \CheckSum{6222}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
Expand Down Expand Up @@ -3420,25 +3420,36 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
% \changes{v2.5.3}{2020/06/06}{正确关闭和恢复 \LaTeXiii 语法环境。}
%
% \begin{macro}[int]{\ctex_file_wrapper:nnn}
% 设置文件操作的 \tn{catcode} 环境,参数 |#1| 是设置,|#2| 是文件操作,|#3| 是恢复。
% 默认关闭 \LaTeXiii{} 语法环境,并设置 |@| 的 \tn{catcode} 为 $11$。
% 这里最自然的使用 \pkg{l3cctab} 来实现,但目前 \pkg{l3cctab} 还属于
% \pkg{l3experimental},我们暂时不依赖它。
% \begin{macrocode}
%</!ctexsize>
\cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3
\cs_new_protected:Npn \ctex_file_wrapper:nnn
{
\use:x
\exp_args:NNx \ExplSyntaxOff
\@@_file_wrapper_aux:nnnn
{
\ExplSyntaxOff
\char_set_catcode_letter:n { 64 }
#1
\exp_not:n {#2}
\bool_if:NTF \l__kernel_expl_bool
{ \ExplSyntaxOn }
{ \ExplSyntaxOff }
}
}
\cs_new_protected:Npn \@@_file_wrapper_aux:nnnn #1#2#3#4
{
\use:x
{
\char_set_catcode_letter:n { 64 }
#2
\exp_not:n {#3}
\char_set_catcode:nn { 64 } { \char_value_catcode:n { 64 } }
#3
#4
}
#1
}
% \end{macrocode}
% \end{macro}
Expand Down

0 comments on commit 013c38a

Please sign in to comment.