diff options
author | Karl Berry <karl@freefriends.org> | 2015-06-30 21:26:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-06-30 21:26:14 +0000 |
commit | aaec8ff3cf7236ae9429a6d9238b1838af2441d6 (patch) | |
tree | 7d00cf0ec8459200ac8e721eed28d09e155012c9 /Master/texmf-dist/tex/latex/ctex | |
parent | 56e4ae7a5ecbbf9bf7b858d20cb0c3e0d21edc8a (diff) |
ctex (30jun15)
git-svn-id: svn://tug.org/texlive/trunk@37720 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex')
44 files changed, 2217 insertions, 1477 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg b/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg index 445383b47fd..e7b67910cf2 100644 --- a/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg +++ b/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Caption with encoding GBK (CTEX)} \ProvidesExplFile{ctex-name-gbk.cfg} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \keys_set:nn { ctex } { contentsname = Ŀ¼ , diff --git a/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg b/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg index 28f8903bb40..7b7304d527c 100644 --- a/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg +++ b/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Caption with encoding UTF8 (CTEX)} \ProvidesExplFile{ctex-name-utf8.cfg} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \keys_set:nn { ctex } { contentsname = 目录 , diff --git a/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg b/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg index 9441ebf9045..b27c064532a 100644 --- a/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg +++ b/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Configuration file (CTEX)} \ProvidesExplFile{\ExplFileName.cfg} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} %% %% %% diff --git a/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg b/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg index 0d1bf614b7e..82074e82836 100644 --- a/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg +++ b/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Option configuration file (CTEX)} \ProvidesExplFile{ctexopts.cfg} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} %% %% \keys_set:nn { ctex / option } { fontset = windowsnew } %% diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-article.def b/Master/texmf-dist/tex/latex/ctex/ctex-article.def index be98bfc12e0..c1dfb48076e 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-article.def +++ b/Master/texmf-dist/tex/latex/ctex/ctex-article.def @@ -26,16 +26,17 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Heading modification for article (CTEX)} \ProvidesExplFile{ctex-article.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} + +\seq_new:N \c__ctex_section_headings_seq +\seq_gset_from_clist:Nn \c__ctex_section_headings_seq + { section , subsection , subsubsection , paragraph , subparagraph } \seq_new:N \c__ctex_headings_seq -\seq_gset_from_clist:Nn \c__ctex_headings_seq - { - part , section , subsection , subsubsection , - paragraph , subparagraph - } +\seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq +\seq_gput_left:Nn \c__ctex_headings_seq { part } \cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } @@ -68,49 +69,53 @@ { \tl_put_right:Nx \l__ctex_tmp_tl { - #1 .meta:nn = { ctex / #1 } { ####1 } , - #1 / name .code:n = + #1 .meta:nn = { ctex / #1 } { ####1 } , + #1 / name .code:n = { \ctex_assign_heading_name:nn {#1} { ####1 } } , - #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , - #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , - #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , - #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , - #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , - #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , - #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , - #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , - #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , - #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , - #1 / format+ .code:n = + #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , + #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , + #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , + #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , + #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , + #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , + #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , + #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , + #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , + #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , + #1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , + #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1@afterindent } , + #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , + #1 / format+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / format~+ .code:n = + #1 / format~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / nameformat+ .code:n = + #1 / nameformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / nameformat~+ .code:n = + #1 / nameformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / numberformat+ .code:n = + #1 / numberformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / numberformat~+ .code:n = + #1 / numberformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / aftername+ .code:n = + #1 / aftername+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / aftername~+ .code:n = + #1 / aftername~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / titleformat+ .code:n = + #1 / titleformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / titleformat~+ .code:n = + #1 / titleformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / aftertitle+ .code:n = + #1 / aftertitle+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / aftertitle~+ .code:n = + #1 / aftertitle~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / beforeskip .initial:n = \c_zero_skip , - #1 / afterskip .initial:n = \c_zero_skip , - #1 / indent .initial:n = \c_zero_dim , - #1 / beforeskip .value_required: , - #1 / afterskip .value_required: , - #1 / indent .value_required: , + #1 / numbering .initial:n = true , + #1 / beforeskip .initial:n = \c_zero_skip , + #1 / afterskip .initial:n = \c_zero_skip , + #1 / indent .initial:n = \c_zero_dim , + #1 / beforeskip .value_required: , + #1 / afterskip .value_required: , + #1 / indent .value_required: , } } \NewDocumentCommand \ctex_assign_heading_name:nn @@ -130,43 +135,68 @@ } \use:x { \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } } \tl_clear:N \l__ctex_tmp_tl +\cs_new_protected_nopar:Npn \CTEX@makeheadinganchor { } +\ctex_at_end_package:nn { hyperref } + { \cs_gset_protected_nopar:Npn \CTEX@makeheadinganchor { \phantomsection } } \renewcommand\part{% \if@noskipsec \leavevmode \fi \par - \@tempskipa \CTEX@part@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else + \addvspace{\glueexpr\CTEX@part@beforeskip\relax}% + \ifodd \CTEX@part@afterindent \@afterindenttrue + \else + \@afterindentfalse \fi - \addvspace{\@tempskipa}% \secdef\@part\@spart} \def\@part[#1]#2{% \ifnum \c@secnumdepth >\m@ne - \refstepcounter{part}% - \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \ifodd \CTEX@part@numbering + \refstepcounter{part}% + \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{part}{#1}% + \fi \else \addcontentsline{toc}{part}{#1}% \fi {\interlinepenalty \@M - \normalfont \parindent \CTEX@part@indent \CTEX@part@format - \ifnum \c@secnumdepth >\m@ne + \normalfont \parindent \dimexpr \CTEX@part@indent \relax \CTEX@part@format + \ifnum \c@secnumdepth >\m@ne \ifodd \CTEX@part@numbering \CTEX@partname - \fi + \fi \fi \CTEX@part@titleformat{#2}% \markboth{}{}% \CTEX@part@aftertitle}% \nobreak - \vskip \CTEX@part@afterskip + \vskip \glueexpr \CTEX@part@afterskip \relax \@afterheading} \def\@spart#1{% {\interlinepenalty \@M - \normalfont \parindent \CTEX@part@indent \CTEX@part@format + \normalfont \parindent \dimexpr \CTEX@part@indent \relax + \CTEX@part@format \CTEX@part@titleformat{#1}% \CTEX@part@aftertitle}% \nobreak - \vskip \CTEX@part@afterskip + \vskip \glueexpr \CTEX@part@afterskip \relax \@afterheading} +\def\@startsection#1#2#3#4#5#6{% + \if@noskipsec \leavevmode \fi + \par + \CTEX@update@sectionformat@n{#1}% + \ifodd \CTEX@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \if@nobreak + \everypar{}% + \else + \addpenalty\@secpenalty\addvspace{\glueexpr #4\relax}% + \fi + \@ifstar + {\@ssect{#3}{#4}{#5}{#6}}% + {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} \def\@seccntformat#1{% \@ifundefined{CTEX@#1name}% {\csname the#1\endcsname\quad}% @@ -175,14 +205,18 @@ \ifnum #2>\c@secnumdepth \let\@svsec\@empty \else - \refstepcounter{#1}% - \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \ifodd \csname CTEX@#1@numbering\endcsname + \refstepcounter{#1}% + \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \else + \CTEX@makeheadinganchor + \let\@svsec\@empty + \fi \fi - \@tempskipa #5\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #6{% - \@hangfrom{\hskip #3\relax\@svsec}% + \@hangfrom{\hskip\glueexpr #3\relax\@svsec}% \interlinepenalty \@M \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% @@ -190,51 +224,80 @@ \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}% \else \def\@svsechd{% - #6{\hskip #3\relax + #6{\hskip\glueexpr #3\relax \@svsec \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% - \@tempskipa #3\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #4{% - \@hangfrom{\hskip #1}% + \@hangfrom{\hskip\glueexpr #1\relax}% \interlinepenalty \@M \CTEX@titleformat@n{#5}% \CTEX@aftertitle}% \endgroup \else - \def\@svsechd{#4{\hskip #1\relax \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{\hskip\glueexpr #1\relax + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} -\cs_new_protected_nopar:Npn \CTEX@set@titleformat@n #1 +\def\@xsect#1{% + \unless \ifodd \CTEX@runin + \par \nobreak + \vskip\glueexpr #1\relax + \@afterheading + \else + \@nobreakfalse + \global\@noskipsectrue + \everypar{% + \if@noskipsec + \global\@noskipsecfalse + {\setbox\z@\lastbox}% + \clubpenalty\@M + \begingroup \@svsechd \endgroup + \unskip + \hskip\glueexpr #1\relax + \else + \clubpenalty \@clubpenalty + \everypar{}% + \fi}% + \fi + \ignorespaces} +\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } + \cs_set_eq:Nc \CTEX@afterindent { CTEX@#1@afterindent } + \cs_set_eq:Nc \CTEX@runin { CTEX@#1@runin } } \cs_new_eq:NN \CTEX@titleformat@n \use:n \cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing: +\cs_new_eq:NN \CTEX@afterindent \c_true_bool +\cs_new_eq:NN \CTEX@runin \c_false_bool \int_zero:N \l__ctex_tmp_int -\clist_map_inline:nn - { section , subsection , subsubsection , paragraph , subparagraph } +\seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int \cs_gset_protected_nopar:cpx {#1} @@ -244,18 +307,17 @@ { \exp_not:c { CTEX@#1@indent } } { \exp_not:c { CTEX@#1@beforeskip } } { \exp_not:c { CTEX@#1@afterskip } } - { - \CTEX@set@titleformat@n {#1} - \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } - } + { \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } } } } \keys_define:nn { ctex } { - appendix .meta:nn = { ctex / appendix } {#1} , - appendix / name .code:n = + appendix .meta:nn = { ctex / appendix } {#1} , + appendix / name .code:n = { \ctex_assign_heading_name:nn { appendix } {#1} } , - appendix / number .tl_set:N = \CTEX@appendixnumber + appendix / number .tl_set:N = \CTEX@appendix@number , + appendix / numbering .bool_set:N = \CTEX@appendix@numbering , + appendix / numbering .initial:n = true } \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix @@ -264,8 +326,76 @@ { \CTEX@save@appendix \gdef \CTEX@presection { \CTEX@preappendix } - \gdef \CTEX@thesection { \CTEX@appendixnumber } + \gdef \CTEX@thesection { \CTEX@appendix@number } \gdef \CTEX@postsection { \CTEX@postappendix } + \gdef \CTEX@section@numbering { \CTEX@appendix@numbering } + } +\cs_new_protected_nopar:Npn \ctex_titlesec_hook: + { + \@ifpackagewith { titlesec } { explicit } + { + \cs_set_eq:NN \__ctex_titlesec_format:Nn + \__ctex_titlesec_format_explicit:Nn + } + { } + \clist_map_inline:nn + { indentafter , noindentafter , indentfirst , nonindentfirst } + { + \@ifpackagewith { titlesec } { ##1 } + { + \clist_map_break:n + { \cs_set_eq:NN \__ctex_titlesec_hook:n \__ctex_titlesec_format:n } + } + { } + } + \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 + { + \__ctex_titlesec_format:n {#1} + \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 + { + \cs_if_free:cF { ttlf@#1 } + { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 + { + \tl_set:Nx #1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \tl_tail:N #1 + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 + { + \cs_set_nopar:Npx #1 ##1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \exp_args:No \tl_tail:n { #1 { } } + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 + { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } +\cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 + { + \exp_not:n { {#1} {#2} {#3} {#4} } + { \bool_if:cTF { CTEX@#6@afterindent } { \@ne } { \z@ } } + } +\@ifpackageloaded { titlesec } + { } + { + \ctex_at_end_package:nn { titlesec } + { + \@ifpackagewith { titlesec } { loadonly } + { } + { \ctex_titlesec_hook: } + } } \cs_new_protected:Npn \CTEX@toc@width@n #1 { @@ -281,30 +411,39 @@ \use:n { \group_end: - \ExplSyntaxOff - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline { \ExplSyntaxOff } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } \@ifpackageloaded { tocloft } { } { \ctex_at_end_package:nn { tocloft } { - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } } } - \ExplSyntaxOn } -\ctex_patch_cmd:Nnn \ps@headings { \thesection } { \CTEXthesection } +\ctex_patch_cmd:Nnn \ps@headings + { \thesection \quad } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } \if@twoside - \ctex_patch_cmd:Nnn \ps@headings { \thesubsection } { \CTEXthesubsection } + \ctex_patch_cmd:Nnn \ps@headings + { \thesubsection \quad } + { \ifodd \CTEX@subsection@numbering \CTEXthesubsection \quad \fi } \fi: \ctex_at_end_package:nn { fancyhdr } { \ctex_patch_cmd:Nnn \ps@fancy - { \thesection \hskip 1em \relax } { \CTEXthesection \quad } + { \thesection \hskip 1em \relax } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } \ctex_patch_cmd:Nnn \ps@fancy - { \thesubsection \hskip 1em \relax } { \CTEXthesubsection \quad } + { \thesubsection \hskip 1em \relax } + { \ifodd \CTEX@subsection@numbering \CTEXthesubsection \quad \fi } } \cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 { diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-book.def b/Master/texmf-dist/tex/latex/ctex/ctex-book.def index 43125e9a69b..5978f8e9c95 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-book.def +++ b/Master/texmf-dist/tex/latex/ctex/ctex-book.def @@ -26,16 +26,18 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Heading modification for book (CTEX)} \ProvidesExplFile{ctex-book.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} + +\seq_new:N \c__ctex_section_headings_seq +\seq_gset_from_clist:Nn \c__ctex_section_headings_seq + { section , subsection , subsubsection , paragraph , subparagraph } \seq_new:N \c__ctex_headings_seq -\seq_gset_from_clist:Nn \c__ctex_headings_seq - { - part , chapter , section , subsection , subsubsection , - paragraph , subparagraph - } +\seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq +\seq_gput_left:Nn \c__ctex_headings_seq { chapter } +\seq_gput_left:Nn \c__ctex_headings_seq { part } \cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } @@ -68,49 +70,53 @@ { \tl_put_right:Nx \l__ctex_tmp_tl { - #1 .meta:nn = { ctex / #1 } { ####1 } , - #1 / name .code:n = + #1 .meta:nn = { ctex / #1 } { ####1 } , + #1 / name .code:n = { \ctex_assign_heading_name:nn {#1} { ####1 } } , - #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , - #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , - #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , - #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , - #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , - #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , - #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , - #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , - #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , - #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , - #1 / format+ .code:n = + #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , + #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , + #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , + #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , + #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , + #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , + #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , + #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , + #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , + #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , + #1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , + #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1@afterindent } , + #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , + #1 / format+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / format~+ .code:n = + #1 / format~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / nameformat+ .code:n = + #1 / nameformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / nameformat~+ .code:n = + #1 / nameformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / numberformat+ .code:n = + #1 / numberformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / numberformat~+ .code:n = + #1 / numberformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / aftername+ .code:n = + #1 / aftername+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / aftername~+ .code:n = + #1 / aftername~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / titleformat+ .code:n = + #1 / titleformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / titleformat~+ .code:n = + #1 / titleformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / aftertitle+ .code:n = + #1 / aftertitle+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / aftertitle~+ .code:n = + #1 / aftertitle~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / beforeskip .initial:n = \c_zero_skip , - #1 / afterskip .initial:n = \c_zero_skip , - #1 / indent .initial:n = \c_zero_dim , - #1 / beforeskip .value_required: , - #1 / afterskip .value_required: , - #1 / indent .value_required: , + #1 / numbering .initial:n = true , + #1 / beforeskip .initial:n = \c_zero_skip , + #1 / afterskip .initial:n = \c_zero_skip , + #1 / indent .initial:n = \c_zero_dim , + #1 / beforeskip .value_required: , + #1 / afterskip .value_required: , + #1 / indent .value_required: , } } \NewDocumentCommand \ctex_assign_heading_name:nn @@ -135,20 +141,42 @@ } \use:x { \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } } \tl_clear:N \l__ctex_tmp_tl -\def\@part[#1]#2{% +\cs_new_protected_nopar:Npn \CTEX@makeheadinganchor { } +\ctex_at_end_package:nn { hyperref } + { \cs_gset_protected_nopar:Npn \CTEX@makeheadinganchor { \phantomsection } } +\renewcommand\part{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi \thispagestyle{\CTEX@part@pagestyle}% + \if@twocolumn + \onecolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \null\vskip \glueexpr \CTEX@part@beforeskip \relax + \secdef\@part\@spart} +\def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax - \refstepcounter{part}% - \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \ifodd \CTEX@part@numbering + \refstepcounter{part}% + \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{part}{#1}% + \fi \else \addcontentsline{toc}{part}{#1}% \fi \markboth{}{}% {\interlinepenalty \@M \normalfont \CTEX@part@format - \ifnum \c@secnumdepth >-2\relax + \ifnum \c@secnumdepth >-2\relax \ifodd \CTEX@part@numbering \CTEX@partname - \fi + \fi \fi \CTEX@part@titleformat{#2}% \CTEX@part@aftertitle}% \@endpart} @@ -158,13 +186,40 @@ \CTEX@part@titleformat{#1}% \CTEX@part@aftertitle}% \@endpart} +\def\@endpart{% + \vskip \glueexpr \CTEX@part@afterskip \relax + \newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi} +\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi + \thispagestyle{\CTEX@chapter@pagestyle}% + \global\@topnum\z@ + \ifodd \CTEX@chapter@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter - \refstepcounter{chapter}% - \typeout{\CTEXthechapter}% - \addcontentsline{toc}{chapter} - {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}% + \ifodd \CTEX@chapter@numbering + \refstepcounter{chapter}% + \typeout{\CTEXthechapter}% + \addcontentsline{toc}{chapter} + {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{chapter}{#1}% + \fi \else \addcontentsline{toc}{chapter}{#1}% \fi @@ -181,42 +236,49 @@ \@afterheading \fi} \def\@makechapterhead#1{% - \thispagestyle{\CTEX@chapter@pagestyle}% - \@tempskipa \CTEX@chapter@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else - \@afterindenttrue - \fi - \vspace*{\@tempskipa}% - {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format + \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax + \CTEX@chapter@format \ifnum \c@secnumdepth >\m@ne \if@mainmatter - \CTEX@chaptername + \ifodd \CTEX@chapter@numbering + \CTEX@chaptername + \fi \fi \fi \interlinepenalty\@M \CTEX@chapter@titleformat{#1}% \CTEX@chapter@aftertitle \nobreak - \vskip \CTEX@chapter@afterskip + \vskip \glueexpr \CTEX@chapter@afterskip \relax }} \def\@makeschapterhead#1{% - \thispagestyle{\CTEX@chapter@pagestyle}% - \@tempskipa \CTEX@chapter@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else - \@afterindenttrue - \fi - \vspace*{\@tempskipa}% - {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format + \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax + \CTEX@chapter@format \interlinepenalty\@M \CTEX@chapter@titleformat{#1} \CTEX@chapter@aftertitle \nobreak - \vskip \CTEX@chapter@afterskip + \vskip \glueexpr \CTEX@chapter@afterskip \relax }} +\def\@startsection#1#2#3#4#5#6{% + \if@noskipsec \leavevmode \fi + \par + \CTEX@update@sectionformat@n{#1}% + \ifodd \CTEX@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \if@nobreak + \everypar{}% + \else + \addpenalty\@secpenalty\addvspace{\glueexpr #4\relax}% + \fi + \@ifstar + {\@ssect{#3}{#4}{#5}{#6}}% + {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} \def\@seccntformat#1{% \@ifundefined{CTEX@#1name}% {\csname the#1\endcsname\quad}% @@ -225,14 +287,18 @@ \ifnum #2>\c@secnumdepth \let\@svsec\@empty \else - \refstepcounter{#1}% - \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \ifodd \csname CTEX@#1@numbering\endcsname + \refstepcounter{#1}% + \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \else + \CTEX@makeheadinganchor + \let\@svsec\@empty + \fi \fi - \@tempskipa #5\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #6{% - \@hangfrom{\hskip #3\relax\@svsec}% + \@hangfrom{\hskip\glueexpr #3\relax\@svsec}% \interlinepenalty \@M \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% @@ -240,51 +306,80 @@ \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}% \else \def\@svsechd{% - #6{\hskip #3\relax + #6{\hskip\glueexpr #3\relax \@svsec \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% - \@tempskipa #3\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #4{% - \@hangfrom{\hskip #1}% + \@hangfrom{\hskip\glueexpr #1\relax}% \interlinepenalty \@M \CTEX@titleformat@n{#5}% \CTEX@aftertitle}% \endgroup \else - \def\@svsechd{#4{\hskip #1\relax \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{\hskip\glueexpr #1\relax + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} -\cs_new_protected_nopar:Npn \CTEX@set@titleformat@n #1 +\def\@xsect#1{% + \unless \ifodd \CTEX@runin + \par \nobreak + \vskip\glueexpr #1\relax + \@afterheading + \else + \@nobreakfalse + \global\@noskipsectrue + \everypar{% + \if@noskipsec + \global\@noskipsecfalse + {\setbox\z@\lastbox}% + \clubpenalty\@M + \begingroup \@svsechd \endgroup + \unskip + \hskip\glueexpr #1\relax + \else + \clubpenalty \@clubpenalty + \everypar{}% + \fi}% + \fi + \ignorespaces} +\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } + \cs_set_eq:Nc \CTEX@afterindent { CTEX@#1@afterindent } + \cs_set_eq:Nc \CTEX@runin { CTEX@#1@runin } } \cs_new_eq:NN \CTEX@titleformat@n \use:n \cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing: +\cs_new_eq:NN \CTEX@afterindent \c_true_bool +\cs_new_eq:NN \CTEX@runin \c_false_bool \int_zero:N \l__ctex_tmp_int -\clist_map_inline:nn - { section , subsection , subsubsection , paragraph , subparagraph } +\seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int \cs_gset_protected_nopar:cpx {#1} @@ -294,18 +389,17 @@ { \exp_not:c { CTEX@#1@indent } } { \exp_not:c { CTEX@#1@beforeskip } } { \exp_not:c { CTEX@#1@afterskip } } - { - \CTEX@set@titleformat@n {#1} - \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } - } + { \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } } } } \keys_define:nn { ctex } { - appendix .meta:nn = { ctex / appendix } {#1} , - appendix / name .code:n = + appendix .meta:nn = { ctex / appendix } {#1} , + appendix / name .code:n = { \ctex_assign_heading_name:nn { appendix } {#1} } , - appendix / number .tl_set:N = \CTEX@appendixnumber + appendix / number .tl_set:N = \CTEX@appendix@number , + appendix / numbering .bool_set:N = \CTEX@appendix@numbering , + appendix / numbering .initial:n = true } \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix @@ -314,8 +408,76 @@ { \CTEX@save@appendix \gdef \CTEX@prechapter { \CTEX@preappendix } - \gdef \CTEX@thechapter { \CTEX@appendixnumber } + \gdef \CTEX@thechapter { \CTEX@appendix@number } \gdef \CTEX@postchapter { \CTEX@postappendix } + \gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering } + } +\cs_new_protected_nopar:Npn \ctex_titlesec_hook: + { + \@ifpackagewith { titlesec } { explicit } + { + \cs_set_eq:NN \__ctex_titlesec_format:Nn + \__ctex_titlesec_format_explicit:Nn + } + { } + \clist_map_inline:nn + { indentafter , noindentafter , indentfirst , nonindentfirst } + { + \@ifpackagewith { titlesec } { ##1 } + { + \clist_map_break:n + { \cs_set_eq:NN \__ctex_titlesec_hook:n \__ctex_titlesec_format:n } + } + { } + } + \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 + { + \__ctex_titlesec_format:n {#1} + \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 + { + \cs_if_free:cF { ttlf@#1 } + { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 + { + \tl_set:Nx #1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \tl_tail:N #1 + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 + { + \cs_set_nopar:Npx #1 ##1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \exp_args:No \tl_tail:n { #1 { } } + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 + { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } +\cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 + { + \exp_not:n { {#1} {#2} {#3} {#4} } + { \bool_if:cTF { CTEX@#6@afterindent } { \@ne } { \z@ } } + } +\@ifpackageloaded { titlesec } + { } + { + \ctex_at_end_package:nn { titlesec } + { + \@ifpackagewith { titlesec } { loadonly } + { } + { \ctex_titlesec_hook: } + } } \cs_new_protected:Npn \CTEX@toc@width@n #1 { @@ -331,31 +493,39 @@ \use:n { \group_end: - \ExplSyntaxOff - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline { \ExplSyntaxOff } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } \@ifpackageloaded { tocloft } { } { \ctex_at_end_package:nn { tocloft } { - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } } } - \ExplSyntaxOn } \ctex_patch_cmd:Nnn \ps@headings - { \@chapapp\ \thechapter.~\ } { \CTEXthechapter \quad } + { \@chapapp\ \thechapter.~\ } + { \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi } \if@twoside - \ctex_patch_cmd:Nnn \ps@headings { \thesection.~\ } { \CTEXthesection \quad } + \ctex_patch_cmd:Nnn \ps@headings + { \thesection.~\ } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } \fi: \ctex_at_end_package:nn { fancyhdr } { \ctex_patch_cmd:Nnn \ps@fancy - { \@chapapp\ \thechapter.~\ } { \if@mainmatter \CTEXthechapter \quad \fi } + { \@chapapp\ \thechapter.~\ } + { \if@mainmatter \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi \fi } \ctex_patch_cmd:Nnn \ps@fancy - { \thesection.~\ } { \CTEXthesection \quad } + { \thesection.~\ } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } } \cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 { diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo b/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo index 963071bf90b..26993a98cf9 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo +++ b/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {c5size option (CTEX)} \ProvidesExplFile{ctex-c5size.clo} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \ctex_set_font_size:Nnn \normalsize { 5 } { \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@ diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo b/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo index 36ea15530d6..0aa0c4088b8 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo +++ b/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {cs4size option (CTEX)} \ProvidesExplFile{ctex-cs4size.clo} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \ctex_set_font_size:Nnn \normalsize { -4 } { \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@ diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-report.def b/Master/texmf-dist/tex/latex/ctex/ctex-report.def index 42b4b0b15bd..629360a2279 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-report.def +++ b/Master/texmf-dist/tex/latex/ctex/ctex-report.def @@ -26,16 +26,18 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Heading modification for report (CTEX)} \ProvidesExplFile{ctex-report.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} + +\seq_new:N \c__ctex_section_headings_seq +\seq_gset_from_clist:Nn \c__ctex_section_headings_seq + { section , subsection , subsubsection , paragraph , subparagraph } \seq_new:N \c__ctex_headings_seq -\seq_gset_from_clist:Nn \c__ctex_headings_seq - { - part , chapter , section , subsection , subsubsection , - paragraph , subparagraph - } +\seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq +\seq_gput_left:Nn \c__ctex_headings_seq { chapter } +\seq_gput_left:Nn \c__ctex_headings_seq { part } \cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } @@ -68,49 +70,53 @@ { \tl_put_right:Nx \l__ctex_tmp_tl { - #1 .meta:nn = { ctex / #1 } { ####1 } , - #1 / name .code:n = + #1 .meta:nn = { ctex / #1 } { ####1 } , + #1 / name .code:n = { \ctex_assign_heading_name:nn {#1} { ####1 } } , - #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , - #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , - #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , - #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , - #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , - #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , - #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , - #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , - #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , - #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , - #1 / format+ .code:n = + #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , + #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , + #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , + #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , + #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , + #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , + #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , + #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , + #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , + #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , + #1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , + #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1@afterindent } , + #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , + #1 / format+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / format~+ .code:n = + #1 / format~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / nameformat+ .code:n = + #1 / nameformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / nameformat~+ .code:n = + #1 / nameformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / numberformat+ .code:n = + #1 / numberformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / numberformat~+ .code:n = + #1 / numberformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / aftername+ .code:n = + #1 / aftername+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / aftername~+ .code:n = + #1 / aftername~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / titleformat+ .code:n = + #1 / titleformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / titleformat~+ .code:n = + #1 / titleformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / aftertitle+ .code:n = + #1 / aftertitle+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / aftertitle~+ .code:n = + #1 / aftertitle~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / beforeskip .initial:n = \c_zero_skip , - #1 / afterskip .initial:n = \c_zero_skip , - #1 / indent .initial:n = \c_zero_dim , - #1 / beforeskip .value_required: , - #1 / afterskip .value_required: , - #1 / indent .value_required: , + #1 / numbering .initial:n = true , + #1 / beforeskip .initial:n = \c_zero_skip , + #1 / afterskip .initial:n = \c_zero_skip , + #1 / indent .initial:n = \c_zero_dim , + #1 / beforeskip .value_required: , + #1 / afterskip .value_required: , + #1 / indent .value_required: , } } \NewDocumentCommand \ctex_assign_heading_name:nn @@ -135,20 +141,42 @@ } \use:x { \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } } \tl_clear:N \l__ctex_tmp_tl -\def\@part[#1]#2{% +\cs_new_protected_nopar:Npn \CTEX@makeheadinganchor { } +\ctex_at_end_package:nn { hyperref } + { \cs_gset_protected_nopar:Npn \CTEX@makeheadinganchor { \phantomsection } } +\renewcommand\part{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi \thispagestyle{\CTEX@part@pagestyle}% + \if@twocolumn + \onecolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \null\vskip \glueexpr \CTEX@part@beforeskip \relax + \secdef\@part\@spart} +\def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax - \refstepcounter{part}% - \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \ifodd \CTEX@part@numbering + \refstepcounter{part}% + \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{part}{#1}% + \fi \else \addcontentsline{toc}{part}{#1}% \fi \markboth{}{}% {\interlinepenalty \@M \normalfont \CTEX@part@format - \ifnum \c@secnumdepth >-2\relax + \ifnum \c@secnumdepth >-2\relax \ifodd \CTEX@part@numbering \CTEX@partname - \fi + \fi \fi \CTEX@part@titleformat{#2}% \CTEX@part@aftertitle}% \@endpart} @@ -158,12 +186,39 @@ \CTEX@part@titleformat{#1}% \CTEX@part@aftertitle}% \@endpart} +\def\@endpart{% + \vskip \glueexpr \CTEX@part@afterskip \relax + \newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi} +\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi + \thispagestyle{\CTEX@chapter@pagestyle}% + \global\@topnum\z@ + \ifodd \CTEX@chapter@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne - \refstepcounter{chapter}% - \typeout{\CTEXthechapter}% - \addcontentsline{toc}{chapter} - {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}% + \ifodd \CTEX@chapter@numbering + \refstepcounter{chapter}% + \typeout{\CTEXthechapter}% + \addcontentsline{toc}{chapter} + {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{chapter}{#1}% + \fi \else \addcontentsline{toc}{chapter}{#1}% \fi @@ -177,40 +232,47 @@ \@afterheading \fi} \def\@makechapterhead#1{% - \thispagestyle{\CTEX@chapter@pagestyle}% - \@tempskipa \CTEX@chapter@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else - \@afterindenttrue - \fi - \vspace*{\@tempskipa}% - {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format + \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax + \CTEX@chapter@format \ifnum \c@secnumdepth >\m@ne - \CTEX@chaptername + \ifodd \CTEX@chapter@numbering + \CTEX@chaptername + \fi \fi \interlinepenalty\@M \CTEX@chapter@titleformat{#1}% \CTEX@chapter@aftertitle \nobreak - \vskip \CTEX@chapter@afterskip + \vskip \glueexpr \CTEX@chapter@afterskip \relax }} \def\@makeschapterhead#1{% - \thispagestyle{\CTEX@chapter@pagestyle}% - \@tempskipa \CTEX@chapter@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else - \@afterindenttrue - \fi - \vspace*{\@tempskipa}% - {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format + \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax + \CTEX@chapter@format \interlinepenalty\@M \CTEX@chapter@titleformat{#1} \CTEX@chapter@aftertitle \nobreak - \vskip \CTEX@chapter@afterskip + \vskip \glueexpr \CTEX@chapter@afterskip \relax }} +\def\@startsection#1#2#3#4#5#6{% + \if@noskipsec \leavevmode \fi + \par + \CTEX@update@sectionformat@n{#1}% + \ifodd \CTEX@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \if@nobreak + \everypar{}% + \else + \addpenalty\@secpenalty\addvspace{\glueexpr #4\relax}% + \fi + \@ifstar + {\@ssect{#3}{#4}{#5}{#6}}% + {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} \def\@seccntformat#1{% \@ifundefined{CTEX@#1name}% {\csname the#1\endcsname\quad}% @@ -219,14 +281,18 @@ \ifnum #2>\c@secnumdepth \let\@svsec\@empty \else - \refstepcounter{#1}% - \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \ifodd \csname CTEX@#1@numbering\endcsname + \refstepcounter{#1}% + \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \else + \CTEX@makeheadinganchor + \let\@svsec\@empty + \fi \fi - \@tempskipa #5\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #6{% - \@hangfrom{\hskip #3\relax\@svsec}% + \@hangfrom{\hskip\glueexpr #3\relax\@svsec}% \interlinepenalty \@M \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% @@ -234,51 +300,80 @@ \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}% \else \def\@svsechd{% - #6{\hskip #3\relax + #6{\hskip\glueexpr #3\relax \@svsec \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% - \@tempskipa #3\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #4{% - \@hangfrom{\hskip #1}% + \@hangfrom{\hskip\glueexpr #1\relax}% \interlinepenalty \@M \CTEX@titleformat@n{#5}% \CTEX@aftertitle}% \endgroup \else - \def\@svsechd{#4{\hskip #1\relax \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{\hskip\glueexpr #1\relax + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} -\cs_new_protected_nopar:Npn \CTEX@set@titleformat@n #1 +\def\@xsect#1{% + \unless \ifodd \CTEX@runin + \par \nobreak + \vskip\glueexpr #1\relax + \@afterheading + \else + \@nobreakfalse + \global\@noskipsectrue + \everypar{% + \if@noskipsec + \global\@noskipsecfalse + {\setbox\z@\lastbox}% + \clubpenalty\@M + \begingroup \@svsechd \endgroup + \unskip + \hskip\glueexpr #1\relax + \else + \clubpenalty \@clubpenalty + \everypar{}% + \fi}% + \fi + \ignorespaces} +\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } + \cs_set_eq:Nc \CTEX@afterindent { CTEX@#1@afterindent } + \cs_set_eq:Nc \CTEX@runin { CTEX@#1@runin } } \cs_new_eq:NN \CTEX@titleformat@n \use:n \cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing: +\cs_new_eq:NN \CTEX@afterindent \c_true_bool +\cs_new_eq:NN \CTEX@runin \c_false_bool \int_zero:N \l__ctex_tmp_int -\clist_map_inline:nn - { section , subsection , subsubsection , paragraph , subparagraph } +\seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int \cs_gset_protected_nopar:cpx {#1} @@ -288,18 +383,17 @@ { \exp_not:c { CTEX@#1@indent } } { \exp_not:c { CTEX@#1@beforeskip } } { \exp_not:c { CTEX@#1@afterskip } } - { - \CTEX@set@titleformat@n {#1} - \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } - } + { \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } } } } \keys_define:nn { ctex } { - appendix .meta:nn = { ctex / appendix } {#1} , - appendix / name .code:n = + appendix .meta:nn = { ctex / appendix } {#1} , + appendix / name .code:n = { \ctex_assign_heading_name:nn { appendix } {#1} } , - appendix / number .tl_set:N = \CTEX@appendixnumber + appendix / number .tl_set:N = \CTEX@appendix@number , + appendix / numbering .bool_set:N = \CTEX@appendix@numbering , + appendix / numbering .initial:n = true } \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix @@ -308,8 +402,76 @@ { \CTEX@save@appendix \gdef \CTEX@prechapter { \CTEX@preappendix } - \gdef \CTEX@thechapter { \CTEX@appendixnumber } + \gdef \CTEX@thechapter { \CTEX@appendix@number } \gdef \CTEX@postchapter { \CTEX@postappendix } + \gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering } + } +\cs_new_protected_nopar:Npn \ctex_titlesec_hook: + { + \@ifpackagewith { titlesec } { explicit } + { + \cs_set_eq:NN \__ctex_titlesec_format:Nn + \__ctex_titlesec_format_explicit:Nn + } + { } + \clist_map_inline:nn + { indentafter , noindentafter , indentfirst , nonindentfirst } + { + \@ifpackagewith { titlesec } { ##1 } + { + \clist_map_break:n + { \cs_set_eq:NN \__ctex_titlesec_hook:n \__ctex_titlesec_format:n } + } + { } + } + \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 + { + \__ctex_titlesec_format:n {#1} + \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 + { + \cs_if_free:cF { ttlf@#1 } + { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 + { + \tl_set:Nx #1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \tl_tail:N #1 + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 + { + \cs_set_nopar:Npx #1 ##1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \exp_args:No \tl_tail:n { #1 { } } + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 + { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } +\cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 + { + \exp_not:n { {#1} {#2} {#3} {#4} } + { \bool_if:cTF { CTEX@#6@afterindent } { \@ne } { \z@ } } + } +\@ifpackageloaded { titlesec } + { } + { + \ctex_at_end_package:nn { titlesec } + { + \@ifpackagewith { titlesec } { loadonly } + { } + { \ctex_titlesec_hook: } + } } \cs_new_protected:Npn \CTEX@toc@width@n #1 { @@ -325,31 +487,39 @@ \use:n { \group_end: - \ExplSyntaxOff - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline { \ExplSyntaxOff } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } \@ifpackageloaded { tocloft } { } { \ctex_at_end_package:nn { tocloft } { - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } } } - \ExplSyntaxOn } \ctex_patch_cmd:Nnn \ps@headings - { \@chapapp\ \thechapter.~\ } { \CTEXthechapter \quad } + { \@chapapp\ \thechapter.~\ } + { \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi } \if@twoside - \ctex_patch_cmd:Nnn \ps@headings { \thesection.~\ } { \CTEXthesection \quad } + \ctex_patch_cmd:Nnn \ps@headings + { \thesection.~\ } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } \fi: \ctex_at_end_package:nn { fancyhdr } { \ctex_patch_cmd:Nnn \ps@fancy - { \@chapapp\ \thechapter.~\ } { \CTEXthechapter \quad } + { \@chapapp\ \thechapter.~\ } + { \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi } \ctex_patch_cmd:Nnn \ps@fancy - { \thesection.~\ } { \CTEXthesection \quad } + { \thesection.~\ } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } } \cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 { diff --git a/Master/texmf-dist/tex/latex/ctex/ctex.sty b/Master/texmf-dist/tex/latex/ctex/ctex.sty index 615e615d807..82a943cb854 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctex.sty @@ -28,10 +28,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter in LaTeX (CTEX)} \ProvidesExplPackage{\ExplFileName} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \tl_const:Nx \c__ctex_version_tl { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } } \msg_new:nnnn { ctex } { subpackage-loaded } @@ -47,35 +47,12 @@ { \msg_error:nnn { ctex } { subpackage-loaded } { ctexheading } } { \cs_new_eq:cN { ver@ctexheading. \@pkgextension } \c__ctex_version_tl } \RequirePackage { xparse , l3keys2e } -\RequirePackage { etoolbox } +\RequirePackage { ctexhook , ctexpatch } \RequirePackage { fix-cm , everysel } \tl_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \dim_new:N \l__ctex_tmp_dim \box_new:N \l__ctex_tmp_box -\cs_new_protected:Npn \ctex_at_end_package:nn #1#2 - { - \@ifpackageloaded {#1} - {#2} - { \ctex_gadd_hook:cn { g__ctex_at_end_ #1 _hook_tl } {#2} } - } -\cs_new_protected:Npn \ctex_gadd_hook:Nn #1#2 - { - \tl_if_exist:NF #1 { \tl_new:N #1 } - \tl_gput_right:Nn #1 {#2} - } -\cs_generate_variant:Nn \ctex_gadd_hook:Nn { c } -\cs_new_protected_nopar:Npn \ctex_package_end_hook:n #1 - { - \cs_if_exist_use:cT { g__ctex_at_end_ #1 _hook_tl } - { \cs_undefine:c { g__ctex_at_end_ #1 _hook_tl } } - } -\cs_generate_variant:Nn \ctex_package_end_hook:n { o } -\tl_put_left:Nn \@popfilename - { - \cs_if_eq:NNT \@currext \@pkgextension - { \ctex_package_end_hook:o { \@currname } } - } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -108,90 +85,6 @@ { } } \cs_generate_variant:Nn \ctex_scheme_input:n { o } -\cs_new_protected:Npn \ctex_parse_name:NN #1#2 - { \ctex_parse_name:NNx #1#2 { \cs_to_str:N #2 } } -\group_begin: -\char_set_lccode:nn { `\< } { `\{ } -\char_set_lccode:nn { `\/ } { `\\ } -\char_set_lccode:nn { `\A } { `\t } -\tl_map_function:nN { \A \E \S \O \P } \char_set_catcode_other:N -\tex_lowercase:D - { - \group_end: - \cs_new_protected:Npn \ctex_parse_name:NNn #1#2#3 - { - \bool_if:nTF { \cs_if_exist_p:c { #3 ~ } || \cs_if_exist_p:c { /#3 } } - { - \group_begin: - \use:x - { - \group_end: - \__ctex_parse_name:nNNNnN { \token_get_replacement_spec:N #2 } - \exp_not:N #2 \exp_not:c { #3 ~ } \exp_not:c { /#3 } - } {#3} #1 - } - { #1#2 } - } - \cs_new_protected:Npn \__ctex_parse_name:nNNNnN #1#2#3#4#5#6 - { - \exp_args:Nc #6 - { - \str_case:nnTF {#1} - { - { \protect #3 } { } - { \x@protect #2 \protect #3 } { } - } - { - \str_if_eq_x:nnTF { \exp_not:n { /@protected@ #3 /#3 } } - { - \exp_last_unbraced:Nf \__ctex_parse_name:w - \token_get_replacement_spec:N #3 AESAOPA ~ < \q_stop - } - { /#5 ~ } { #5 ~ } - } - { - \str_case:onTF { \__ctex_parse_name:w #1 AESAOPA ~ < \q_stop } - { - { /@protected@ #2 #4 } { } - { /@ #4 } { } - } - { /#5 } {#5} - } - } - } - \cs_new:Npn \__ctex_parse_name:w #1 AESAOPA ~ #2 < #3 \q_stop { #1#2 } - } -\cs_generate_variant:Nn \ctex_parse_name:NNn { NNx } -\cs_new_protected_nopar:Npn \ctex_patch_cmd:NnnTF { \ctex_parse_name:NN \patchcmd } -\cs_new_protected_nopar:Npn \ctex_preto_cmd:NnTF { \ctex_parse_name:NN \pretocmd } -\cs_new_protected_nopar:Npn \ctex_appto_cmd:NnTF { \ctex_parse_name:NN \apptocmd } -\cs_new_protected:Npn \ctex_patch_cmd:Nnn - { - \group_begin: - \char_set_catcode_other:N \# - \__ctex_patch_cmd:Nnn - } -\cs_new_protected:Npn \__ctex_patch_cmd:Nnn #1#2#3 - { - \group_end: - \group_begin: - \ExplSyntaxOff - \ctex_patch_cmd:NnnTF #1 {#2} {#3} - { - \cs_gset_eq:NN \__ctex_tmp:w #1 - \group_end: - \cs_set_eq:NN #1 \__ctex_tmp:w - \cs_undefine:N \__ctex_tmp:w - } - { \group_end: \ctex_patch_failure:N #1 } - } -\cs_new_protected:Npn \ctex_patch_failure:N #1 - { \msg_warning:nnx { ctex } { patch-failure } { \token_to_str:N #1 } } -\msg_new:nnn { ctex } { patch-failure } - { - Patching~command~`#1'~failed.\\ - ctex~may~not~work~as~expected. - } \cs_new_eq:NN \g__ctex_section_depth_flag \c_two \msg_new:nnnn { ctex } { package-too-old } { Support~package~`#1'~too~old. } @@ -214,7 +107,7 @@ \cs_new_eq:NN \ctex_if_pdfmode:TF \use_ii:nn } \cs_new_eq:NN \ctex_if_preamble:TF \use_i:nn -\AfterEndPreamble { \cs_set_eq:NN \ctex_if_preamble:TF \use_ii:nn } +\ctex_after_end_preamble:n { \cs_set_eq:NN \ctex_if_preamble:TF \use_ii:nn } \cs_new:Npn \ctex_set_default_ccwd:Nn #1#2 { \dim_compare:nNnTF @@ -299,8 +192,8 @@ { \msg_warning:nnn { ctex } { deprecated-option } { - The~ functionality~ has~ been~ removed.~ - It's~ better~ to~ set~ the~ heading~ styles~ via~ beforeskip~ + The~ functionality~ has~ been~ removed.\\ + It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ options.~ } } , @@ -309,8 +202,8 @@ { \msg_warning:nnn { ctex } { deprecated-option } { - The~ functionality~ has~ been~ removed.~ - It's~ better~ to~ set~ the~ heading~ styles~ via~ beforeskip~ + The~ functionality~ has~ been~ removed.\\ + It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ options. } } , @@ -442,7 +335,7 @@ \cs_if_exist:NF \hypersetup { \cs_new_eq:NN \hypersetup \ctex_hypersetup:n } } - \AtEndPreamble { \RequirePackage { hyperref } } + \ctex_at_end_preamble:n { \RequirePackage { hyperref } } } , } \tl_clear:N \l__ctex_tmp_tl @@ -638,6 +531,14 @@ \cs_new_eq:NN \chinese \zhnum \cs_new_eq:NN \Chinese \chinese \cs_new_eq:NN \CTEXcounter \use_none:n +\ctex_at_end_package:nn { enumitem } + { + \cs_if_free:NF \AddEnumerateCounter + { + \AddEnumerateCounter * { \zhnum } { \zhnum_int:n } { 1 } + \AddEnumerateCounter * { \chinese } { \zhnum_int:n } { 1 } + } + } \NewDocumentCommand \CTEXnumber { m m } { \protected@edef #1 { \zhnumber {#2} } } \NewDocumentCommand \CTEXdigits { m m } @@ -818,7 +719,7 @@ \fi: \fp_compare:nNnF { \l__ctex_line_spread_fp } ? { \c_zero_fp } { - \linespread { \fp_use:N \l__ctex_line_spread_fp } + \exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } \group_begin: \footnotesize \exp_args:NNNo \group_end: \dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox } } @@ -835,26 +736,6 @@ { You~can~load~the~package~`caption'~to~get~its~functionality. } } } -\group_begin: -\char_set_catcode_other:N \# -\use:n - { - \group_end: - \ExplSyntaxOff - \ctex_at_end_package:nn { breqn } - { - \ctex_patch_cmd:NnnTF \end { \csname end#1 \endcsname } - { - \csuse { @end@#1@hook } - \csname end#1 \endcsname - } { } - { - \ctex_preto_cmd:NnTF \end { \csuse { @end@#1@hook } } - { } { \ctex_patch_failure:N \end } - } - } - \ExplSyntaxOn - } \cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 { \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } \msg_new:nnn { ctex } { fontset-unavailable } @@ -928,12 +809,14 @@ %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, -%% ctexcap.sty, %% ctexsize.sty, %% ctexheading.sty, %% ctexart.cls, %% ctexbook.cls, %% ctexrep.cls, +%% ctexcap.sty, +%% ctexhook.sty, +%% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, %% ctex-article.def, diff --git a/Master/texmf-dist/tex/latex/ctex/ctexart.cls b/Master/texmf-dist/tex/latex/ctex/ctexart.cls index 0af93272ce1..85cd0e3f0ab 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexart.cls +++ b/Master/texmf-dist/tex/latex/ctex/ctexart.cls @@ -28,10 +28,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter for class article (CTEX)} \ProvidesExplClass{ctexart} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \tl_const:Nx \c__ctex_version_tl { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } } \cs_new_eq:cN { ver@ctex. \@pkgextension } \c__ctex_version_tl @@ -50,35 +50,12 @@ { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } \@ifpackagelater { l3keys2e } { 2014/05/05 } { } { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } } -\RequirePackage { etoolbox } +\RequirePackage { ctexhook , ctexpatch } \RequirePackage { fix-cm , everysel } \tl_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \dim_new:N \l__ctex_tmp_dim \box_new:N \l__ctex_tmp_box -\cs_new_protected:Npn \ctex_at_end_package:nn #1#2 - { - \@ifpackageloaded {#1} - {#2} - { \ctex_gadd_hook:cn { g__ctex_at_end_ #1 _hook_tl } {#2} } - } -\cs_new_protected:Npn \ctex_gadd_hook:Nn #1#2 - { - \tl_if_exist:NF #1 { \tl_new:N #1 } - \tl_gput_right:Nn #1 {#2} - } -\cs_generate_variant:Nn \ctex_gadd_hook:Nn { c } -\cs_new_protected_nopar:Npn \ctex_package_end_hook:n #1 - { - \cs_if_exist_use:cT { g__ctex_at_end_ #1 _hook_tl } - { \cs_undefine:c { g__ctex_at_end_ #1 _hook_tl } } - } -\cs_generate_variant:Nn \ctex_package_end_hook:n { o } -\tl_put_left:Nn \@popfilename - { - \cs_if_eq:NNT \@currext \@pkgextension - { \ctex_package_end_hook:o { \@currname } } - } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -111,90 +88,6 @@ { } } \cs_generate_variant:Nn \ctex_scheme_input:n { o } -\cs_new_protected:Npn \ctex_parse_name:NN #1#2 - { \ctex_parse_name:NNx #1#2 { \cs_to_str:N #2 } } -\group_begin: -\char_set_lccode:nn { `\< } { `\{ } -\char_set_lccode:nn { `\/ } { `\\ } -\char_set_lccode:nn { `\A } { `\t } -\tl_map_function:nN { \A \E \S \O \P } \char_set_catcode_other:N -\tex_lowercase:D - { - \group_end: - \cs_new_protected:Npn \ctex_parse_name:NNn #1#2#3 - { - \bool_if:nTF { \cs_if_exist_p:c { #3 ~ } || \cs_if_exist_p:c { /#3 } } - { - \group_begin: - \use:x - { - \group_end: - \__ctex_parse_name:nNNNnN { \token_get_replacement_spec:N #2 } - \exp_not:N #2 \exp_not:c { #3 ~ } \exp_not:c { /#3 } - } {#3} #1 - } - { #1#2 } - } - \cs_new_protected:Npn \__ctex_parse_name:nNNNnN #1#2#3#4#5#6 - { - \exp_args:Nc #6 - { - \str_case:nnTF {#1} - { - { \protect #3 } { } - { \x@protect #2 \protect #3 } { } - } - { - \str_if_eq_x:nnTF { \exp_not:n { /@protected@ #3 /#3 } } - { - \exp_last_unbraced:Nf \__ctex_parse_name:w - \token_get_replacement_spec:N #3 AESAOPA ~ < \q_stop - } - { /#5 ~ } { #5 ~ } - } - { - \str_case:onTF { \__ctex_parse_name:w #1 AESAOPA ~ < \q_stop } - { - { /@protected@ #2 #4 } { } - { /@ #4 } { } - } - { /#5 } {#5} - } - } - } - \cs_new:Npn \__ctex_parse_name:w #1 AESAOPA ~ #2 < #3 \q_stop { #1#2 } - } -\cs_generate_variant:Nn \ctex_parse_name:NNn { NNx } -\cs_new_protected_nopar:Npn \ctex_patch_cmd:NnnTF { \ctex_parse_name:NN \patchcmd } -\cs_new_protected_nopar:Npn \ctex_preto_cmd:NnTF { \ctex_parse_name:NN \pretocmd } -\cs_new_protected_nopar:Npn \ctex_appto_cmd:NnTF { \ctex_parse_name:NN \apptocmd } -\cs_new_protected:Npn \ctex_patch_cmd:Nnn - { - \group_begin: - \char_set_catcode_other:N \# - \__ctex_patch_cmd:Nnn - } -\cs_new_protected:Npn \__ctex_patch_cmd:Nnn #1#2#3 - { - \group_end: - \group_begin: - \ExplSyntaxOff - \ctex_patch_cmd:NnnTF #1 {#2} {#3} - { - \cs_gset_eq:NN \__ctex_tmp:w #1 - \group_end: - \cs_set_eq:NN #1 \__ctex_tmp:w - \cs_undefine:N \__ctex_tmp:w - } - { \group_end: \ctex_patch_failure:N #1 } - } -\cs_new_protected:Npn \ctex_patch_failure:N #1 - { \msg_warning:nnx { ctex } { patch-failure } { \token_to_str:N #1 } } -\msg_new:nnn { ctex } { patch-failure } - { - Patching~command~`#1'~failed.\\ - ctex~may~not~work~as~expected. - } \cs_new_eq:NN \g__ctex_section_depth_flag \c_two \msg_new:nnnn { ctex } { package-too-old } { Support~package~`#1'~too~old. } @@ -217,7 +110,7 @@ \cs_new_eq:NN \ctex_if_pdfmode:TF \use_ii:nn } \cs_new_eq:NN \ctex_if_preamble:TF \use_i:nn -\AfterEndPreamble { \cs_set_eq:NN \ctex_if_preamble:TF \use_ii:nn } +\ctex_after_end_preamble:n { \cs_set_eq:NN \ctex_if_preamble:TF \use_ii:nn } \cs_new:Npn \ctex_set_default_ccwd:Nn #1#2 { \dim_compare:nNnTF @@ -303,8 +196,8 @@ { \msg_warning:nnn { ctex } { deprecated-option } { - The~ functionality~ has~ been~ removed.~ - It's~ better~ to~ set~ the~ heading~ styles~ via~ beforeskip~ + The~ functionality~ has~ been~ removed.\\ + It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ options.~ } } , @@ -313,8 +206,8 @@ { \msg_warning:nnn { ctex } { deprecated-option } { - The~ functionality~ has~ been~ removed.~ - It's~ better~ to~ set~ the~ heading~ styles~ via~ beforeskip~ + The~ functionality~ has~ been~ removed.\\ + It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ options. } } , @@ -446,7 +339,7 @@ \cs_if_exist:NF \hypersetup { \cs_new_eq:NN \hypersetup \ctex_hypersetup:n } } - \AtEndPreamble { \RequirePackage { hyperref } } + \ctex_at_end_preamble:n { \RequirePackage { hyperref } } } , } \tl_clear:N \l__ctex_tmp_tl @@ -658,6 +551,14 @@ \cs_new_eq:NN \chinese \zhnum \cs_new_eq:NN \Chinese \chinese \cs_new_eq:NN \CTEXcounter \use_none:n +\ctex_at_end_package:nn { enumitem } + { + \cs_if_free:NF \AddEnumerateCounter + { + \AddEnumerateCounter * { \zhnum } { \zhnum_int:n } { 1 } + \AddEnumerateCounter * { \chinese } { \zhnum_int:n } { 1 } + } + } \NewDocumentCommand \CTEXnumber { m m } { \protected@edef #1 { \zhnumber {#2} } } \NewDocumentCommand \CTEXdigits { m m } @@ -696,12 +597,13 @@ appendixname .tl_set:N = \appendixname , bibname .tl_set:N = \refname } + +\seq_new:N \c__ctex_section_headings_seq +\seq_gset_from_clist:Nn \c__ctex_section_headings_seq + { section , subsection , subsubsection , paragraph , subparagraph } \seq_new:N \c__ctex_headings_seq -\seq_gset_from_clist:Nn \c__ctex_headings_seq - { - part , section , subsection , subsubsection , - paragraph , subparagraph - } +\seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq +\seq_gput_left:Nn \c__ctex_headings_seq { part } \cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } @@ -734,49 +636,53 @@ { \tl_put_right:Nx \l__ctex_tmp_tl { - #1 .meta:nn = { ctex / #1 } { ####1 } , - #1 / name .code:n = + #1 .meta:nn = { ctex / #1 } { ####1 } , + #1 / name .code:n = { \ctex_assign_heading_name:nn {#1} { ####1 } } , - #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , - #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , - #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , - #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , - #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , - #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , - #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , - #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , - #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , - #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , - #1 / format+ .code:n = + #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , + #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , + #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , + #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , + #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , + #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , + #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , + #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , + #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , + #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , + #1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , + #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1@afterindent } , + #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , + #1 / format+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / format~+ .code:n = + #1 / format~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / nameformat+ .code:n = + #1 / nameformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / nameformat~+ .code:n = + #1 / nameformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / numberformat+ .code:n = + #1 / numberformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / numberformat~+ .code:n = + #1 / numberformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / aftername+ .code:n = + #1 / aftername+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / aftername~+ .code:n = + #1 / aftername~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / titleformat+ .code:n = + #1 / titleformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / titleformat~+ .code:n = + #1 / titleformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / aftertitle+ .code:n = + #1 / aftertitle+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / aftertitle~+ .code:n = + #1 / aftertitle~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / beforeskip .initial:n = \c_zero_skip , - #1 / afterskip .initial:n = \c_zero_skip , - #1 / indent .initial:n = \c_zero_dim , - #1 / beforeskip .value_required: , - #1 / afterskip .value_required: , - #1 / indent .value_required: , + #1 / numbering .initial:n = true , + #1 / beforeskip .initial:n = \c_zero_skip , + #1 / afterskip .initial:n = \c_zero_skip , + #1 / indent .initial:n = \c_zero_dim , + #1 / beforeskip .value_required: , + #1 / afterskip .value_required: , + #1 / indent .value_required: , } } \NewDocumentCommand \ctex_assign_heading_name:nn @@ -796,43 +702,68 @@ } \use:x { \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } } \tl_clear:N \l__ctex_tmp_tl +\cs_new_protected_nopar:Npn \CTEX@makeheadinganchor { } +\ctex_at_end_package:nn { hyperref } + { \cs_gset_protected_nopar:Npn \CTEX@makeheadinganchor { \phantomsection } } \renewcommand\part{% \if@noskipsec \leavevmode \fi \par - \@tempskipa \CTEX@part@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else + \addvspace{\glueexpr\CTEX@part@beforeskip\relax}% + \ifodd \CTEX@part@afterindent \@afterindenttrue + \else + \@afterindentfalse \fi - \addvspace{\@tempskipa}% \secdef\@part\@spart} \def\@part[#1]#2{% \ifnum \c@secnumdepth >\m@ne - \refstepcounter{part}% - \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \ifodd \CTEX@part@numbering + \refstepcounter{part}% + \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{part}{#1}% + \fi \else \addcontentsline{toc}{part}{#1}% \fi {\interlinepenalty \@M - \normalfont \parindent \CTEX@part@indent \CTEX@part@format - \ifnum \c@secnumdepth >\m@ne + \normalfont \parindent \dimexpr \CTEX@part@indent \relax \CTEX@part@format + \ifnum \c@secnumdepth >\m@ne \ifodd \CTEX@part@numbering \CTEX@partname - \fi + \fi \fi \CTEX@part@titleformat{#2}% \markboth{}{}% \CTEX@part@aftertitle}% \nobreak - \vskip \CTEX@part@afterskip + \vskip \glueexpr \CTEX@part@afterskip \relax \@afterheading} \def\@spart#1{% {\interlinepenalty \@M - \normalfont \parindent \CTEX@part@indent \CTEX@part@format + \normalfont \parindent \dimexpr \CTEX@part@indent \relax + \CTEX@part@format \CTEX@part@titleformat{#1}% \CTEX@part@aftertitle}% \nobreak - \vskip \CTEX@part@afterskip + \vskip \glueexpr \CTEX@part@afterskip \relax \@afterheading} +\def\@startsection#1#2#3#4#5#6{% + \if@noskipsec \leavevmode \fi + \par + \CTEX@update@sectionformat@n{#1}% + \ifodd \CTEX@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \if@nobreak + \everypar{}% + \else + \addpenalty\@secpenalty\addvspace{\glueexpr #4\relax}% + \fi + \@ifstar + {\@ssect{#3}{#4}{#5}{#6}}% + {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} \def\@seccntformat#1{% \@ifundefined{CTEX@#1name}% {\csname the#1\endcsname\quad}% @@ -841,14 +772,18 @@ \ifnum #2>\c@secnumdepth \let\@svsec\@empty \else - \refstepcounter{#1}% - \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \ifodd \csname CTEX@#1@numbering\endcsname + \refstepcounter{#1}% + \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \else + \CTEX@makeheadinganchor + \let\@svsec\@empty + \fi \fi - \@tempskipa #5\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #6{% - \@hangfrom{\hskip #3\relax\@svsec}% + \@hangfrom{\hskip\glueexpr #3\relax\@svsec}% \interlinepenalty \@M \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% @@ -856,51 +791,80 @@ \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}% \else \def\@svsechd{% - #6{\hskip #3\relax + #6{\hskip\glueexpr #3\relax \@svsec \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% - \@tempskipa #3\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #4{% - \@hangfrom{\hskip #1}% + \@hangfrom{\hskip\glueexpr #1\relax}% \interlinepenalty \@M \CTEX@titleformat@n{#5}% \CTEX@aftertitle}% \endgroup \else - \def\@svsechd{#4{\hskip #1\relax \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{\hskip\glueexpr #1\relax + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} -\cs_new_protected_nopar:Npn \CTEX@set@titleformat@n #1 +\def\@xsect#1{% + \unless \ifodd \CTEX@runin + \par \nobreak + \vskip\glueexpr #1\relax + \@afterheading + \else + \@nobreakfalse + \global\@noskipsectrue + \everypar{% + \if@noskipsec + \global\@noskipsecfalse + {\setbox\z@\lastbox}% + \clubpenalty\@M + \begingroup \@svsechd \endgroup + \unskip + \hskip\glueexpr #1\relax + \else + \clubpenalty \@clubpenalty + \everypar{}% + \fi}% + \fi + \ignorespaces} +\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } + \cs_set_eq:Nc \CTEX@afterindent { CTEX@#1@afterindent } + \cs_set_eq:Nc \CTEX@runin { CTEX@#1@runin } } \cs_new_eq:NN \CTEX@titleformat@n \use:n \cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing: +\cs_new_eq:NN \CTEX@afterindent \c_true_bool +\cs_new_eq:NN \CTEX@runin \c_false_bool \int_zero:N \l__ctex_tmp_int -\clist_map_inline:nn - { section , subsection , subsubsection , paragraph , subparagraph } +\seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int \cs_gset_protected_nopar:cpx {#1} @@ -910,18 +874,17 @@ { \exp_not:c { CTEX@#1@indent } } { \exp_not:c { CTEX@#1@beforeskip } } { \exp_not:c { CTEX@#1@afterskip } } - { - \CTEX@set@titleformat@n {#1} - \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } - } + { \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } } } } \keys_define:nn { ctex } { - appendix .meta:nn = { ctex / appendix } {#1} , - appendix / name .code:n = + appendix .meta:nn = { ctex / appendix } {#1} , + appendix / name .code:n = { \ctex_assign_heading_name:nn { appendix } {#1} } , - appendix / number .tl_set:N = \CTEX@appendixnumber + appendix / number .tl_set:N = \CTEX@appendix@number , + appendix / numbering .bool_set:N = \CTEX@appendix@numbering , + appendix / numbering .initial:n = true } \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix @@ -930,8 +893,76 @@ { \CTEX@save@appendix \gdef \CTEX@presection { \CTEX@preappendix } - \gdef \CTEX@thesection { \CTEX@appendixnumber } + \gdef \CTEX@thesection { \CTEX@appendix@number } \gdef \CTEX@postsection { \CTEX@postappendix } + \gdef \CTEX@section@numbering { \CTEX@appendix@numbering } + } +\cs_new_protected_nopar:Npn \ctex_titlesec_hook: + { + \@ifpackagewith { titlesec } { explicit } + { + \cs_set_eq:NN \__ctex_titlesec_format:Nn + \__ctex_titlesec_format_explicit:Nn + } + { } + \clist_map_inline:nn + { indentafter , noindentafter , indentfirst , nonindentfirst } + { + \@ifpackagewith { titlesec } { ##1 } + { + \clist_map_break:n + { \cs_set_eq:NN \__ctex_titlesec_hook:n \__ctex_titlesec_format:n } + } + { } + } + \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 + { + \__ctex_titlesec_format:n {#1} + \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 + { + \cs_if_free:cF { ttlf@#1 } + { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 + { + \tl_set:Nx #1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \tl_tail:N #1 + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 + { + \cs_set_nopar:Npx #1 ##1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \exp_args:No \tl_tail:n { #1 { } } + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 + { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } +\cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 + { + \exp_not:n { {#1} {#2} {#3} {#4} } + { \bool_if:cTF { CTEX@#6@afterindent } { \@ne } { \z@ } } + } +\@ifpackageloaded { titlesec } + { } + { + \ctex_at_end_package:nn { titlesec } + { + \@ifpackagewith { titlesec } { loadonly } + { } + { \ctex_titlesec_hook: } + } } \cs_new_protected:Npn \CTEX@toc@width@n #1 { @@ -947,30 +978,39 @@ \use:n { \group_end: - \ExplSyntaxOff - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline { \ExplSyntaxOff } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } \@ifpackageloaded { tocloft } { } { \ctex_at_end_package:nn { tocloft } { - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } } } - \ExplSyntaxOn } -\ctex_patch_cmd:Nnn \ps@headings { \thesection } { \CTEXthesection } +\ctex_patch_cmd:Nnn \ps@headings + { \thesection \quad } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } \if@twoside - \ctex_patch_cmd:Nnn \ps@headings { \thesubsection } { \CTEXthesubsection } + \ctex_patch_cmd:Nnn \ps@headings + { \thesubsection \quad } + { \ifodd \CTEX@subsection@numbering \CTEXthesubsection \quad \fi } \fi: \ctex_at_end_package:nn { fancyhdr } { \ctex_patch_cmd:Nnn \ps@fancy - { \thesection \hskip 1em \relax } { \CTEXthesection \quad } + { \thesection \hskip 1em \relax } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } \ctex_patch_cmd:Nnn \ps@fancy - { \thesubsection \hskip 1em \relax } { \CTEXthesubsection \quad } + { \thesubsection \hskip 1em \relax } + { \ifodd \CTEX@subsection@numbering \CTEXthesubsection \quad \fi } } \cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 { @@ -1102,7 +1142,7 @@ \fi: \fp_compare:nNnF { \l__ctex_line_spread_fp } ? { \c_zero_fp } { - \linespread { \fp_use:N \l__ctex_line_spread_fp } + \exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } \group_begin: \footnotesize \exp_args:NNNo \group_end: \dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox } } @@ -1119,26 +1159,6 @@ { You~can~load~the~package~`caption'~to~get~its~functionality. } } } -\group_begin: -\char_set_catcode_other:N \# -\use:n - { - \group_end: - \ExplSyntaxOff - \ctex_at_end_package:nn { breqn } - { - \ctex_patch_cmd:NnnTF \end { \csname end#1 \endcsname } - { - \csuse { @end@#1@hook } - \csname end#1 \endcsname - } { } - { - \ctex_preto_cmd:NnTF \end { \csuse { @end@#1@hook } } - { } { \ctex_patch_failure:N \end } - } - } - \ExplSyntaxOn - } \cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 { \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } \msg_new:nnn { ctex } { fontset-unavailable } @@ -1212,12 +1232,14 @@ %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, -%% ctexcap.sty, %% ctexsize.sty, %% ctexheading.sty, %% ctexart.cls, %% ctexbook.cls, %% ctexrep.cls, +%% ctexcap.sty, +%% ctexhook.sty, +%% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, %% ctex-article.def, diff --git a/Master/texmf-dist/tex/latex/ctex/ctexbook.cls b/Master/texmf-dist/tex/latex/ctex/ctexbook.cls index 3e6a5d76736..41e4f5b9690 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexbook.cls +++ b/Master/texmf-dist/tex/latex/ctex/ctexbook.cls @@ -28,10 +28,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter for class book (CTEX)} \ProvidesExplClass{ctexbook} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \tl_const:Nx \c__ctex_version_tl { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } } \cs_new_eq:cN { ver@ctex. \@pkgextension } \c__ctex_version_tl @@ -50,35 +50,12 @@ { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } \@ifpackagelater { l3keys2e } { 2014/05/05 } { } { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } } -\RequirePackage { etoolbox } +\RequirePackage { ctexhook , ctexpatch } \RequirePackage { fix-cm , everysel } \tl_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \dim_new:N \l__ctex_tmp_dim \box_new:N \l__ctex_tmp_box -\cs_new_protected:Npn \ctex_at_end_package:nn #1#2 - { - \@ifpackageloaded {#1} - {#2} - { \ctex_gadd_hook:cn { g__ctex_at_end_ #1 _hook_tl } {#2} } - } -\cs_new_protected:Npn \ctex_gadd_hook:Nn #1#2 - { - \tl_if_exist:NF #1 { \tl_new:N #1 } - \tl_gput_right:Nn #1 {#2} - } -\cs_generate_variant:Nn \ctex_gadd_hook:Nn { c } -\cs_new_protected_nopar:Npn \ctex_package_end_hook:n #1 - { - \cs_if_exist_use:cT { g__ctex_at_end_ #1 _hook_tl } - { \cs_undefine:c { g__ctex_at_end_ #1 _hook_tl } } - } -\cs_generate_variant:Nn \ctex_package_end_hook:n { o } -\tl_put_left:Nn \@popfilename - { - \cs_if_eq:NNT \@currext \@pkgextension - { \ctex_package_end_hook:o { \@currname } } - } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -111,90 +88,6 @@ { } } \cs_generate_variant:Nn \ctex_scheme_input:n { o } -\cs_new_protected:Npn \ctex_parse_name:NN #1#2 - { \ctex_parse_name:NNx #1#2 { \cs_to_str:N #2 } } -\group_begin: -\char_set_lccode:nn { `\< } { `\{ } -\char_set_lccode:nn { `\/ } { `\\ } -\char_set_lccode:nn { `\A } { `\t } -\tl_map_function:nN { \A \E \S \O \P } \char_set_catcode_other:N -\tex_lowercase:D - { - \group_end: - \cs_new_protected:Npn \ctex_parse_name:NNn #1#2#3 - { - \bool_if:nTF { \cs_if_exist_p:c { #3 ~ } || \cs_if_exist_p:c { /#3 } } - { - \group_begin: - \use:x - { - \group_end: - \__ctex_parse_name:nNNNnN { \token_get_replacement_spec:N #2 } - \exp_not:N #2 \exp_not:c { #3 ~ } \exp_not:c { /#3 } - } {#3} #1 - } - { #1#2 } - } - \cs_new_protected:Npn \__ctex_parse_name:nNNNnN #1#2#3#4#5#6 - { - \exp_args:Nc #6 - { - \str_case:nnTF {#1} - { - { \protect #3 } { } - { \x@protect #2 \protect #3 } { } - } - { - \str_if_eq_x:nnTF { \exp_not:n { /@protected@ #3 /#3 } } - { - \exp_last_unbraced:Nf \__ctex_parse_name:w - \token_get_replacement_spec:N #3 AESAOPA ~ < \q_stop - } - { /#5 ~ } { #5 ~ } - } - { - \str_case:onTF { \__ctex_parse_name:w #1 AESAOPA ~ < \q_stop } - { - { /@protected@ #2 #4 } { } - { /@ #4 } { } - } - { /#5 } {#5} - } - } - } - \cs_new:Npn \__ctex_parse_name:w #1 AESAOPA ~ #2 < #3 \q_stop { #1#2 } - } -\cs_generate_variant:Nn \ctex_parse_name:NNn { NNx } -\cs_new_protected_nopar:Npn \ctex_patch_cmd:NnnTF { \ctex_parse_name:NN \patchcmd } -\cs_new_protected_nopar:Npn \ctex_preto_cmd:NnTF { \ctex_parse_name:NN \pretocmd } -\cs_new_protected_nopar:Npn \ctex_appto_cmd:NnTF { \ctex_parse_name:NN \apptocmd } -\cs_new_protected:Npn \ctex_patch_cmd:Nnn - { - \group_begin: - \char_set_catcode_other:N \# - \__ctex_patch_cmd:Nnn - } -\cs_new_protected:Npn \__ctex_patch_cmd:Nnn #1#2#3 - { - \group_end: - \group_begin: - \ExplSyntaxOff - \ctex_patch_cmd:NnnTF #1 {#2} {#3} - { - \cs_gset_eq:NN \__ctex_tmp:w #1 - \group_end: - \cs_set_eq:NN #1 \__ctex_tmp:w - \cs_undefine:N \__ctex_tmp:w - } - { \group_end: \ctex_patch_failure:N #1 } - } -\cs_new_protected:Npn \ctex_patch_failure:N #1 - { \msg_warning:nnx { ctex } { patch-failure } { \token_to_str:N #1 } } -\msg_new:nnn { ctex } { patch-failure } - { - Patching~command~`#1'~failed.\\ - ctex~may~not~work~as~expected. - } \cs_new_eq:NN \g__ctex_section_depth_flag \c_two \msg_new:nnnn { ctex } { package-too-old } { Support~package~`#1'~too~old. } @@ -217,7 +110,7 @@ \cs_new_eq:NN \ctex_if_pdfmode:TF \use_ii:nn } \cs_new_eq:NN \ctex_if_preamble:TF \use_i:nn -\AfterEndPreamble { \cs_set_eq:NN \ctex_if_preamble:TF \use_ii:nn } +\ctex_after_end_preamble:n { \cs_set_eq:NN \ctex_if_preamble:TF \use_ii:nn } \cs_new:Npn \ctex_set_default_ccwd:Nn #1#2 { \dim_compare:nNnTF @@ -303,8 +196,8 @@ { \msg_warning:nnn { ctex } { deprecated-option } { - The~ functionality~ has~ been~ removed.~ - It's~ better~ to~ set~ the~ heading~ styles~ via~ beforeskip~ + The~ functionality~ has~ been~ removed.\\ + It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ options.~ } } , @@ -313,8 +206,8 @@ { \msg_warning:nnn { ctex } { deprecated-option } { - The~ functionality~ has~ been~ removed.~ - It's~ better~ to~ set~ the~ heading~ styles~ via~ beforeskip~ + The~ functionality~ has~ been~ removed.\\ + It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ options. } } , @@ -446,7 +339,7 @@ \cs_if_exist:NF \hypersetup { \cs_new_eq:NN \hypersetup \ctex_hypersetup:n } } - \AtEndPreamble { \RequirePackage { hyperref } } + \ctex_at_end_preamble:n { \RequirePackage { hyperref } } } , } \tl_clear:N \l__ctex_tmp_tl @@ -658,6 +551,14 @@ \cs_new_eq:NN \chinese \zhnum \cs_new_eq:NN \Chinese \chinese \cs_new_eq:NN \CTEXcounter \use_none:n +\ctex_at_end_package:nn { enumitem } + { + \cs_if_free:NF \AddEnumerateCounter + { + \AddEnumerateCounter * { \zhnum } { \zhnum_int:n } { 1 } + \AddEnumerateCounter * { \chinese } { \zhnum_int:n } { 1 } + } + } \NewDocumentCommand \CTEXnumber { m m } { \protected@edef #1 { \zhnumber {#2} } } \NewDocumentCommand \CTEXdigits { m m } @@ -696,12 +597,14 @@ appendixname .tl_set:N = \appendixname , bibname .tl_set:N = \bibname } + +\seq_new:N \c__ctex_section_headings_seq +\seq_gset_from_clist:Nn \c__ctex_section_headings_seq + { section , subsection , subsubsection , paragraph , subparagraph } \seq_new:N \c__ctex_headings_seq -\seq_gset_from_clist:Nn \c__ctex_headings_seq - { - part , chapter , section , subsection , subsubsection , - paragraph , subparagraph - } +\seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq +\seq_gput_left:Nn \c__ctex_headings_seq { chapter } +\seq_gput_left:Nn \c__ctex_headings_seq { part } \cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } @@ -734,49 +637,53 @@ { \tl_put_right:Nx \l__ctex_tmp_tl { - #1 .meta:nn = { ctex / #1 } { ####1 } , - #1 / name .code:n = + #1 .meta:nn = { ctex / #1 } { ####1 } , + #1 / name .code:n = { \ctex_assign_heading_name:nn {#1} { ####1 } } , - #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , - #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , - #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , - #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , - #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , - #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , - #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , - #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , - #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , - #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , - #1 / format+ .code:n = + #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , + #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , + #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , + #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , + #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , + #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , + #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , + #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , + #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , + #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , + #1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , + #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1@afterindent } , + #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , + #1 / format+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / format~+ .code:n = + #1 / format~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / nameformat+ .code:n = + #1 / nameformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / nameformat~+ .code:n = + #1 / nameformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / numberformat+ .code:n = + #1 / numberformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / numberformat~+ .code:n = + #1 / numberformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / aftername+ .code:n = + #1 / aftername+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / aftername~+ .code:n = + #1 / aftername~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / titleformat+ .code:n = + #1 / titleformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / titleformat~+ .code:n = + #1 / titleformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / aftertitle+ .code:n = + #1 / aftertitle+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / aftertitle~+ .code:n = + #1 / aftertitle~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / beforeskip .initial:n = \c_zero_skip , - #1 / afterskip .initial:n = \c_zero_skip , - #1 / indent .initial:n = \c_zero_dim , - #1 / beforeskip .value_required: , - #1 / afterskip .value_required: , - #1 / indent .value_required: , + #1 / numbering .initial:n = true , + #1 / beforeskip .initial:n = \c_zero_skip , + #1 / afterskip .initial:n = \c_zero_skip , + #1 / indent .initial:n = \c_zero_dim , + #1 / beforeskip .value_required: , + #1 / afterskip .value_required: , + #1 / indent .value_required: , } } \NewDocumentCommand \ctex_assign_heading_name:nn @@ -801,20 +708,42 @@ } \use:x { \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } } \tl_clear:N \l__ctex_tmp_tl -\def\@part[#1]#2{% +\cs_new_protected_nopar:Npn \CTEX@makeheadinganchor { } +\ctex_at_end_package:nn { hyperref } + { \cs_gset_protected_nopar:Npn \CTEX@makeheadinganchor { \phantomsection } } +\renewcommand\part{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi \thispagestyle{\CTEX@part@pagestyle}% + \if@twocolumn + \onecolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \null\vskip \glueexpr \CTEX@part@beforeskip \relax + \secdef\@part\@spart} +\def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax - \refstepcounter{part}% - \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \ifodd \CTEX@part@numbering + \refstepcounter{part}% + \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{part}{#1}% + \fi \else \addcontentsline{toc}{part}{#1}% \fi \markboth{}{}% {\interlinepenalty \@M \normalfont \CTEX@part@format - \ifnum \c@secnumdepth >-2\relax + \ifnum \c@secnumdepth >-2\relax \ifodd \CTEX@part@numbering \CTEX@partname - \fi + \fi \fi \CTEX@part@titleformat{#2}% \CTEX@part@aftertitle}% \@endpart} @@ -824,13 +753,40 @@ \CTEX@part@titleformat{#1}% \CTEX@part@aftertitle}% \@endpart} +\def\@endpart{% + \vskip \glueexpr \CTEX@part@afterskip \relax + \newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi} +\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi + \thispagestyle{\CTEX@chapter@pagestyle}% + \global\@topnum\z@ + \ifodd \CTEX@chapter@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter - \refstepcounter{chapter}% - \typeout{\CTEXthechapter}% - \addcontentsline{toc}{chapter} - {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}% + \ifodd \CTEX@chapter@numbering + \refstepcounter{chapter}% + \typeout{\CTEXthechapter}% + \addcontentsline{toc}{chapter} + {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{chapter}{#1}% + \fi \else \addcontentsline{toc}{chapter}{#1}% \fi @@ -847,42 +803,49 @@ \@afterheading \fi} \def\@makechapterhead#1{% - \thispagestyle{\CTEX@chapter@pagestyle}% - \@tempskipa \CTEX@chapter@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else - \@afterindenttrue - \fi - \vspace*{\@tempskipa}% - {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format + \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax + \CTEX@chapter@format \ifnum \c@secnumdepth >\m@ne \if@mainmatter - \CTEX@chaptername + \ifodd \CTEX@chapter@numbering + \CTEX@chaptername + \fi \fi \fi \interlinepenalty\@M \CTEX@chapter@titleformat{#1}% \CTEX@chapter@aftertitle \nobreak - \vskip \CTEX@chapter@afterskip + \vskip \glueexpr \CTEX@chapter@afterskip \relax }} \def\@makeschapterhead#1{% - \thispagestyle{\CTEX@chapter@pagestyle}% - \@tempskipa \CTEX@chapter@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else - \@afterindenttrue - \fi - \vspace*{\@tempskipa}% - {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format + \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax + \CTEX@chapter@format \interlinepenalty\@M \CTEX@chapter@titleformat{#1} \CTEX@chapter@aftertitle \nobreak - \vskip \CTEX@chapter@afterskip + \vskip \glueexpr \CTEX@chapter@afterskip \relax }} +\def\@startsection#1#2#3#4#5#6{% + \if@noskipsec \leavevmode \fi + \par + \CTEX@update@sectionformat@n{#1}% + \ifodd \CTEX@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \if@nobreak + \everypar{}% + \else + \addpenalty\@secpenalty\addvspace{\glueexpr #4\relax}% + \fi + \@ifstar + {\@ssect{#3}{#4}{#5}{#6}}% + {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} \def\@seccntformat#1{% \@ifundefined{CTEX@#1name}% {\csname the#1\endcsname\quad}% @@ -891,14 +854,18 @@ \ifnum #2>\c@secnumdepth \let\@svsec\@empty \else - \refstepcounter{#1}% - \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \ifodd \csname CTEX@#1@numbering\endcsname + \refstepcounter{#1}% + \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \else + \CTEX@makeheadinganchor + \let\@svsec\@empty + \fi \fi - \@tempskipa #5\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #6{% - \@hangfrom{\hskip #3\relax\@svsec}% + \@hangfrom{\hskip\glueexpr #3\relax\@svsec}% \interlinepenalty \@M \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% @@ -906,51 +873,80 @@ \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}% \else \def\@svsechd{% - #6{\hskip #3\relax + #6{\hskip\glueexpr #3\relax \@svsec \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% - \@tempskipa #3\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #4{% - \@hangfrom{\hskip #1}% + \@hangfrom{\hskip\glueexpr #1\relax}% \interlinepenalty \@M \CTEX@titleformat@n{#5}% \CTEX@aftertitle}% \endgroup \else - \def\@svsechd{#4{\hskip #1\relax \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{\hskip\glueexpr #1\relax + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} -\cs_new_protected_nopar:Npn \CTEX@set@titleformat@n #1 +\def\@xsect#1{% + \unless \ifodd \CTEX@runin + \par \nobreak + \vskip\glueexpr #1\relax + \@afterheading + \else + \@nobreakfalse + \global\@noskipsectrue + \everypar{% + \if@noskipsec + \global\@noskipsecfalse + {\setbox\z@\lastbox}% + \clubpenalty\@M + \begingroup \@svsechd \endgroup + \unskip + \hskip\glueexpr #1\relax + \else + \clubpenalty \@clubpenalty + \everypar{}% + \fi}% + \fi + \ignorespaces} +\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } + \cs_set_eq:Nc \CTEX@afterindent { CTEX@#1@afterindent } + \cs_set_eq:Nc \CTEX@runin { CTEX@#1@runin } } \cs_new_eq:NN \CTEX@titleformat@n \use:n \cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing: +\cs_new_eq:NN \CTEX@afterindent \c_true_bool +\cs_new_eq:NN \CTEX@runin \c_false_bool \int_zero:N \l__ctex_tmp_int -\clist_map_inline:nn - { section , subsection , subsubsection , paragraph , subparagraph } +\seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int \cs_gset_protected_nopar:cpx {#1} @@ -960,18 +956,17 @@ { \exp_not:c { CTEX@#1@indent } } { \exp_not:c { CTEX@#1@beforeskip } } { \exp_not:c { CTEX@#1@afterskip } } - { - \CTEX@set@titleformat@n {#1} - \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } - } + { \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } } } } \keys_define:nn { ctex } { - appendix .meta:nn = { ctex / appendix } {#1} , - appendix / name .code:n = + appendix .meta:nn = { ctex / appendix } {#1} , + appendix / name .code:n = { \ctex_assign_heading_name:nn { appendix } {#1} } , - appendix / number .tl_set:N = \CTEX@appendixnumber + appendix / number .tl_set:N = \CTEX@appendix@number , + appendix / numbering .bool_set:N = \CTEX@appendix@numbering , + appendix / numbering .initial:n = true } \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix @@ -980,8 +975,76 @@ { \CTEX@save@appendix \gdef \CTEX@prechapter { \CTEX@preappendix } - \gdef \CTEX@thechapter { \CTEX@appendixnumber } + \gdef \CTEX@thechapter { \CTEX@appendix@number } \gdef \CTEX@postchapter { \CTEX@postappendix } + \gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering } + } +\cs_new_protected_nopar:Npn \ctex_titlesec_hook: + { + \@ifpackagewith { titlesec } { explicit } + { + \cs_set_eq:NN \__ctex_titlesec_format:Nn + \__ctex_titlesec_format_explicit:Nn + } + { } + \clist_map_inline:nn + { indentafter , noindentafter , indentfirst , nonindentfirst } + { + \@ifpackagewith { titlesec } { ##1 } + { + \clist_map_break:n + { \cs_set_eq:NN \__ctex_titlesec_hook:n \__ctex_titlesec_format:n } + } + { } + } + \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 + { + \__ctex_titlesec_format:n {#1} + \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 + { + \cs_if_free:cF { ttlf@#1 } + { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 + { + \tl_set:Nx #1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \tl_tail:N #1 + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 + { + \cs_set_nopar:Npx #1 ##1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \exp_args:No \tl_tail:n { #1 { } } + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 + { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } +\cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 + { + \exp_not:n { {#1} {#2} {#3} {#4} } + { \bool_if:cTF { CTEX@#6@afterindent } { \@ne } { \z@ } } + } +\@ifpackageloaded { titlesec } + { } + { + \ctex_at_end_package:nn { titlesec } + { + \@ifpackagewith { titlesec } { loadonly } + { } + { \ctex_titlesec_hook: } + } } \cs_new_protected:Npn \CTEX@toc@width@n #1 { @@ -997,31 +1060,39 @@ \use:n { \group_end: - \ExplSyntaxOff - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline { \ExplSyntaxOff } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } \@ifpackageloaded { tocloft } { } { \ctex_at_end_package:nn { tocloft } { - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } } } - \ExplSyntaxOn } \ctex_patch_cmd:Nnn \ps@headings - { \@chapapp\ \thechapter.~\ } { \CTEXthechapter \quad } + { \@chapapp\ \thechapter.~\ } + { \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi } \if@twoside - \ctex_patch_cmd:Nnn \ps@headings { \thesection.~\ } { \CTEXthesection \quad } + \ctex_patch_cmd:Nnn \ps@headings + { \thesection.~\ } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } \fi: \ctex_at_end_package:nn { fancyhdr } { \ctex_patch_cmd:Nnn \ps@fancy - { \@chapapp\ \thechapter.~\ } { \if@mainmatter \CTEXthechapter \quad \fi } + { \@chapapp\ \thechapter.~\ } + { \if@mainmatter \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi \fi } \ctex_patch_cmd:Nnn \ps@fancy - { \thesection.~\ } { \CTEXthesection \quad } + { \thesection.~\ } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } } \cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 { @@ -1153,7 +1224,7 @@ \fi: \fp_compare:nNnF { \l__ctex_line_spread_fp } ? { \c_zero_fp } { - \linespread { \fp_use:N \l__ctex_line_spread_fp } + \exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } \group_begin: \footnotesize \exp_args:NNNo \group_end: \dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox } } @@ -1170,26 +1241,6 @@ { You~can~load~the~package~`caption'~to~get~its~functionality. } } } -\group_begin: -\char_set_catcode_other:N \# -\use:n - { - \group_end: - \ExplSyntaxOff - \ctex_at_end_package:nn { breqn } - { - \ctex_patch_cmd:NnnTF \end { \csname end#1 \endcsname } - { - \csuse { @end@#1@hook } - \csname end#1 \endcsname - } { } - { - \ctex_preto_cmd:NnTF \end { \csuse { @end@#1@hook } } - { } { \ctex_patch_failure:N \end } - } - } - \ExplSyntaxOn - } \cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 { \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } \msg_new:nnn { ctex } { fontset-unavailable } @@ -1263,12 +1314,14 @@ %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, -%% ctexcap.sty, %% ctexsize.sty, %% ctexheading.sty, %% ctexart.cls, %% ctexbook.cls, %% ctexrep.cls, +%% ctexcap.sty, +%% ctexhook.sty, +%% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, %% ctex-article.def, diff --git a/Master/texmf-dist/tex/latex/ctex/ctexcap.sty b/Master/texmf-dist/tex/latex/ctex/ctexcap.sty index f899abbf14f..e537e094f39 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexcap.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctexcap.sty @@ -28,66 +28,23 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter in LaTeX (CTEX)} \ProvidesExplPackage{ctexcap} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} +\clist_new:N \l__ctex_ctexcap_options_clist +\clist_set:Nx \l__ctex_ctexcap_options_clist + { \exp_not:v { opt@ \@currname . \@currext } , heading } +\msg_new:nnn { ctexcap } { deprecated } + { + Package~`ctexcap'~is~deprecated.\\ + Please~use~package~`ctex'~with~option~`#1'~instead: \\\\ + \iow_indent:n { \token_to_str:N \usepackage [#1] \{ ctex \} } \\ + } +\msg_warning:nnx { ctexcap } { deprecated } + { \clist_use:Nn \l__ctex_ctexcap_options_clist { , ~ } } \PassOptionsToPackage { heading = true } { ctexcap } \RequirePackageWithOptions { ctex } %% -%% This package consists of the file ctex.dtx, -%% and the derived files ctex.pdf, -%% ctex.ins, -%% ctex.sty, -%% ctexcap.sty, -%% ctexsize.sty, -%% ctexheading.sty, -%% ctexart.cls, -%% ctexbook.cls, -%% ctexrep.cls, -%% ctex-c5size.clo, -%% ctex-cs4size.clo, -%% ctex-article.def, -%% ctex-book.def, -%% ctex-report.def, -%% ctex-scheme-plain.def, -%% ctex-scheme-plain-article.def, -%% ctex-scheme-plain-book.def, -%% ctex-scheme-plain-report.def, -%% ctex-scheme-chinese.def, -%% ctex-scheme-chinese-article.def, -%% ctex-scheme-chinese-book.def, -%% ctex-scheme-chinese-report.def, -%% ctex-name-gbk.cfg, -%% ctex-name-utf8.cfg, -%% ctex.cfg, -%% ctexopts.cfg, -%% ctex-engine-pdftex.def, -%% ctex-engine-xetex.def, -%% ctex-engine-luatex.def, -%% c19rm.fd, -%% c19sf.fd, -%% c19tt.fd, -%% c70rm.fd, -%% c70sf.fd, -%% c70tt.fd, -%% ctex-fontset-windows.def, -%% ctex-fontset-windowsnew.def, -%% ctex-fontset-windowsold.def, -%% ctex-fontset-adobe.def, -%% ctex-fontset-fandol.def, -%% ctex-fontset-mac.def, -%% ctex-fontset-founder.def, -%% ctex-fontset-ubuntu.def, -%% ctexspa.def, -%% ctexpunct.spa, -%% ctexmakespa.tex, -%% ctexspamacro.tex, -%% zhadobefonts.tex, -%% zhfandolfonts.tex, -%% zhfounderfonts.tex, -%% zhubuntufonts.tex, -%% zhwindowsfonts.tex, and -%% README. %% %% End of file `ctexcap.sty'. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexheading.sty b/Master/texmf-dist/tex/latex/ctex/ctexheading.sty index efff90fbbdd..92d61d817d6 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexheading.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctexheading.sty @@ -28,38 +28,15 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Heading style modification (CTEX)} \ProvidesExplPackage{ctexheading} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \RequirePackage { xparse , l3keys2e } -\RequirePackage { etoolbox } +\RequirePackage { ctexhook , ctexpatch } \tl_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \box_new:N \l__ctex_tmp_box -\cs_new_protected:Npn \ctex_at_end_package:nn #1#2 - { - \@ifpackageloaded {#1} - {#2} - { \ctex_gadd_hook:cn { g__ctex_at_end_ #1 _hook_tl } {#2} } - } -\cs_new_protected:Npn \ctex_gadd_hook:Nn #1#2 - { - \tl_if_exist:NF #1 { \tl_new:N #1 } - \tl_gput_right:Nn #1 {#2} - } -\cs_generate_variant:Nn \ctex_gadd_hook:Nn { c } -\cs_new_protected_nopar:Npn \ctex_package_end_hook:n #1 - { - \cs_if_exist_use:cT { g__ctex_at_end_ #1 _hook_tl } - { \cs_undefine:c { g__ctex_at_end_ #1 _hook_tl } } - } -\cs_generate_variant:Nn \ctex_package_end_hook:n { o } -\tl_put_left:Nn \@popfilename - { - \cs_if_eq:NNT \@currext \@pkgextension - { \ctex_package_end_hook:o { \@currname } } - } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -92,90 +69,6 @@ { } } \cs_generate_variant:Nn \ctex_scheme_input:n { o } -\cs_new_protected:Npn \ctex_parse_name:NN #1#2 - { \ctex_parse_name:NNx #1#2 { \cs_to_str:N #2 } } -\group_begin: -\char_set_lccode:nn { `\< } { `\{ } -\char_set_lccode:nn { `\/ } { `\\ } -\char_set_lccode:nn { `\A } { `\t } -\tl_map_function:nN { \A \E \S \O \P } \char_set_catcode_other:N -\tex_lowercase:D - { - \group_end: - \cs_new_protected:Npn \ctex_parse_name:NNn #1#2#3 - { - \bool_if:nTF { \cs_if_exist_p:c { #3 ~ } || \cs_if_exist_p:c { /#3 } } - { - \group_begin: - \use:x - { - \group_end: - \__ctex_parse_name:nNNNnN { \token_get_replacement_spec:N #2 } - \exp_not:N #2 \exp_not:c { #3 ~ } \exp_not:c { /#3 } - } {#3} #1 - } - { #1#2 } - } - \cs_new_protected:Npn \__ctex_parse_name:nNNNnN #1#2#3#4#5#6 - { - \exp_args:Nc #6 - { - \str_case:nnTF {#1} - { - { \protect #3 } { } - { \x@protect #2 \protect #3 } { } - } - { - \str_if_eq_x:nnTF { \exp_not:n { /@protected@ #3 /#3 } } - { - \exp_last_unbraced:Nf \__ctex_parse_name:w - \token_get_replacement_spec:N #3 AESAOPA ~ < \q_stop - } - { /#5 ~ } { #5 ~ } - } - { - \str_case:onTF { \__ctex_parse_name:w #1 AESAOPA ~ < \q_stop } - { - { /@protected@ #2 #4 } { } - { /@ #4 } { } - } - { /#5 } {#5} - } - } - } - \cs_new:Npn \__ctex_parse_name:w #1 AESAOPA ~ #2 < #3 \q_stop { #1#2 } - } -\cs_generate_variant:Nn \ctex_parse_name:NNn { NNx } -\cs_new_protected_nopar:Npn \ctex_patch_cmd:NnnTF { \ctex_parse_name:NN \patchcmd } -\cs_new_protected_nopar:Npn \ctex_preto_cmd:NnTF { \ctex_parse_name:NN \pretocmd } -\cs_new_protected_nopar:Npn \ctex_appto_cmd:NnTF { \ctex_parse_name:NN \apptocmd } -\cs_new_protected:Npn \ctex_patch_cmd:Nnn - { - \group_begin: - \char_set_catcode_other:N \# - \__ctex_patch_cmd:Nnn - } -\cs_new_protected:Npn \__ctex_patch_cmd:Nnn #1#2#3 - { - \group_end: - \group_begin: - \ExplSyntaxOff - \ctex_patch_cmd:NnnTF #1 {#2} {#3} - { - \cs_gset_eq:NN \__ctex_tmp:w #1 - \group_end: - \cs_set_eq:NN #1 \__ctex_tmp:w - \cs_undefine:N \__ctex_tmp:w - } - { \group_end: \ctex_patch_failure:N #1 } - } -\cs_new_protected:Npn \ctex_patch_failure:N #1 - { \msg_warning:nnx { ctex } { patch-failure } { \token_to_str:N #1 } } -\msg_new:nnn { ctex } { patch-failure } - { - Patching~command~`#1'~failed.\\ - ctex~may~not~work~as~expected. - } \cs_new_eq:NN \g__ctex_section_depth_flag \c_two \keys_define:nn { ctex / option } { @@ -224,12 +117,14 @@ %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, -%% ctexcap.sty, %% ctexsize.sty, %% ctexheading.sty, %% ctexart.cls, %% ctexbook.cls, %% ctexrep.cls, +%% ctexcap.sty, +%% ctexhook.sty, +%% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, %% ctex-article.def, diff --git a/Master/texmf-dist/tex/latex/ctex/ctexhook.sty b/Master/texmf-dist/tex/latex/ctex/ctexhook.sty new file mode 100644 index 00000000000..f492b7444dd --- /dev/null +++ b/Master/texmf-dist/tex/latex/ctex/ctexhook.sty @@ -0,0 +1,76 @@ +%% +%% This is file `ctexhook.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ctex.dtx (with options: `ctexhook') +%% +%% Copyright (C) 2003--2015 +%% CTEX.ORG and any individual authors listed in the documentation. +%% ------------------------------------------------------------------------------ +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and 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 Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% +%% ------------------------------------------------------------------------------ +%% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ + {Document and package hooks (CTEX)} +\ProvidesExplPackage{ctexhook} + {\ExplFileDate}{2.2}{\ExplFileDescription} +\cs_new_protected:Npn \ctex_at_end_preamble:n #1 + { \tl_gput_right:Nn \g__ctex_end_preamble_hook_tl {#1} } +\cs_new_protected:Npn \ctex_after_end_preamble:n #1 + { \tl_gput_right:Nn \g__ctex_after_end_preamble_hook_tl {#1} } +\cs_new_protected_nopar:Npn \CTEX@document@left@hook + { \group_end: \g__ctex_end_preamble_hook_tl \group_begin: } +\cs_new_protected_nopar:Npn \CTEX@document@right@hook + { \scan_stop: \g__ctex_after_end_preamble_hook_tl \tex_ignorespaces:D } +\cs_set_nopar:Npx \document + { + \CTEX@document@left@hook + \exp_not:o { \document } + \CTEX@document@right@hook + } +\tl_new:N \g__ctex_end_preamble_hook_tl +\tl_new:N \g__ctex_after_end_preamble_hook_tl +\cs_new_protected:Npn \ctex_at_end_package:nn #1#2 + { + \@ifpackageloaded {#1} + {#2} + { \ctex_gadd_hook:cn { g__ctex_at_end_ #1 _hook_tl } {#2} } + } +\cs_new_protected:Npn \ctex_gadd_hook:Nn #1#2 + { + \tl_if_exist:NF #1 { \tl_new:N #1 } + \tl_gput_right:Nn #1 {#2} + } +\cs_generate_variant:Nn \ctex_gadd_hook:Nn { c } +\cs_new_protected_nopar:Npn \ctex_package_end_hook:n #1 + { + \cs_if_exist_use:cT { g__ctex_at_end_ #1 _hook_tl } + { \cs_undefine:c { g__ctex_at_end_ #1 _hook_tl } } + } +\cs_generate_variant:Nn \ctex_package_end_hook:n { o } +\tl_put_left:Nn \@popfilename + { + \cs_if_eq:NNT \@currext \@pkgextension + { \ctex_package_end_hook:o { \@currname } } + } +%% +%% +%% End of file `ctexhook.sty'. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty b/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty new file mode 100644 index 00000000000..c0e571bfd26 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty @@ -0,0 +1,252 @@ +%% +%% This is file `ctexpatch.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ctex.dtx (with options: `ctexpatch') +%% +%% Copyright (C) 2003--2015 +%% CTEX.ORG and any individual authors listed in the documentation. +%% ------------------------------------------------------------------------------ +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and 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 Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% +%% ------------------------------------------------------------------------------ +%% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ + {Patching commands (CTEX)} +\ProvidesExplPackage{ctexpatch} + {\ExplFileDate}{2.2}{\ExplFileDescription} +\cs_new_protected:Npn \ctex_patch_cmd_once:NnnnTF #1#2 + { + \ctex_patch_boot:NNnnTF \__ctex_patch_cmd:Nnnnnw #1 + { once } {#2} { \use_i:nn } { \use_ii:nn } + } +\cs_new_protected:Npn \ctex_patch_cmd_all:NnnnTF #1#2 + { + \ctex_patch_boot:NNnnTF \__ctex_patch_cmd:Nnnnnw #1 + { all } {#2} { \use_i:nn } { \use_ii:nn } + } +\cs_new_protected:Npn \ctex_patch_cmd:Nnn #1 + { + \ctex_patch_boot:NNnnTF \__ctex_patch_cmd:Nnnnnw #1 + { once } + { + \ExplSyntaxOff + \char_set_catcode_letter:n { 64 } + } + { } + { \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \ctex_patch_failure:N #1 + { \msg_warning:nnx { ctex } { patch-failure } { \token_to_str:N #1 } } +\msg_new:nnn { ctex } { patch-failure } + { Oops!~Command~`#1'~is~NOT~patchable.\\ } +\cs_new_protected:Npn \ctex_preto_cmd:NnnTF #1#2 + { + \ctex_patch_boot:NNnnTF \__ctex_hookto_cmd:Nnnnw #1 + { left } {#2} { \use_i:nn } { \use_ii:nn } + } +\cs_new_protected:Npn \ctex_appto_cmd:NnnTF #1#2 + { + \ctex_patch_boot:NNnnTF \__ctex_hookto_cmd:Nnnnw #1 + { right } {#2} { \use_i:nn } { \use_ii:nn } + } +\cs_new_protected:Npn \ctex_patch_boot:NNnnTF #1#2#3#4#5#6 + { + \tl_set:Nn \__ctex_patch_true:w {#5} + \tl_set:Nn \__ctex_patch_false:w {#6} + \group_begin: + \char_set_catcode_other:n { 35 } + \ctex_parse_name:NN #1 #2 {#3} {#4} + } +\tl_new:N \__ctex_patch_true:w +\tl_new:N \__ctex_patch_false:w +\cs_new_protected:Npn \ctex_parse_name:NN #1#2 + { \ctex_parse_name:NNx #1#2 { \cs_to_str:N #2 } } +\group_begin: +\char_set_lccode:nn { `\< } { `\{ } +\char_set_lccode:nn { `\/ } { `\\ } +\char_set_lccode:nn { `\A } { `\t } +\tl_map_function:nN { \A \E \S \O \P } \char_set_catcode_other:N +\tex_lowercase:D + { + \group_end: + \cs_new_protected:Npn \ctex_parse_name:NNn #1#2#3 + { + \bool_if:nTF { \cs_if_exist_p:c { #3 ~ } || \cs_if_exist_p:c { /#3 } } + { + \group_begin: + \use:x + { + \group_end: + \__ctex_parse_name:nNNNnN { \token_get_replacement_spec:N #2 } + \exp_not:N #2 \exp_not:c { #3 ~ } \exp_not:c { /#3 } + } {#3} #1 + } + { #1#2 } + } + \cs_new_protected:Npn \__ctex_parse_name:nNNNnN #1#2#3#4#5#6 + { + \exp_args:Nc #6 + { + \str_case:nnTF {#1} + { + { \protect #3 } { } + { \x@protect #2 \protect #3 } { } + } + { + \str_if_eq_x:nnTF { \exp_not:n { /@protected@ #3 /#3 } } + { + \exp_last_unbraced:Nf \__ctex_parse_name:w + \token_get_replacement_spec:N #3 AESAOPA ~ < \q_stop + } + { /#5 ~ } { #5 ~ } + } + { + \str_case:onTF { \__ctex_parse_name:w #1 AESAOPA ~ < \q_stop } + { + { /@protected@ #2 #4 } { } + { /@ #4 } { } + } + { /#5 } {#5} + } + } + } + \cs_new:Npn \__ctex_parse_name:w #1 AESAOPA ~ #2 < #3 \q_stop { #1#2 } + } +\cs_generate_variant:Nn \ctex_parse_name:NNn { NNx } +\tl_new:N \l__ctex_prefix_tl +\tl_new:N \l__ctex_parameter_tl +\tl_new:N \l__ctex_replacement_tl +\group_begin: + \char_set_lccode:nn { `\; } { `\: } + \tl_map_function:nN { \M \A \C \R \O \; } \char_set_catcode_other:N +\tex_lowercase:D + { + \group_end: + \cs_new_protected:Npn \ctex_get_macro_meaning:NTF #1 + { + \exp_after:wN \__ctex_get_macro_meaning:w + \token_to_meaning:N #1 \q_stop MACRO ; -> \q_no_value \q_stop + } + \cs_new_protected:Npn \__ctex_get_macro_meaning:w #1 MACRO ; #2 -> #3 \q_stop + { + \tl_set:Nn \l__ctex_replacement_tl {#3} + \quark_if_no_value:NTF \l__ctex_replacement_tl + { \use_ii:nn } + { + \tl_set:Nn \l__ctex_prefix_tl {#1} + \tl_set:Nn \l__ctex_parameter_tl {#2} + \use_i_delimit_by_q_stop:nw { \use_i:nn } + } + } + } +\cs_new_protected:Npn \ctex_if_rescanable:NnTF #1#2#3#4 + { + \ctex_get_macro_meaning:NTF #1 + { + \__ctex_patch_rebuild:Nn \CTEXPATCHRESCANCMD {#2} + \cs_if_eq:NNTF #1 \CTEXPATCHRESCANCMD {#3} {#4} + } + {#4} + } +\cs_new_eq:NN \CTEXPATCHRESCANCMD \prg_do_nothing: +\cs_new_protected:Npn \__ctex_patch_rebuild:Nn #1#2 + { + \tl_if_empty:nTF {#2} + { \tl_rescan:nx {#2} } + { + \tl_rescan:nx + { + #2 \scan_stop: + \int_set_eq:NN \tex_endlinechar:D \c_minus_one + \int_set_eq:NN \tex_newlinechar:D \c_minus_one + } + } + { + \l__ctex_prefix_tl \exp_not:N \def \exp_not:N #1 \l__ctex_parameter_tl + { \l__ctex_replacement_tl } + } + } +\cs_generate_variant:Nn \tl_rescan:nn { nx } +\cs_new_protected:Npn \__ctex_patch_cmd:Nnnnnw #1#2#3#4#5 + { + \group_end: + \ctex_if_rescanable:NnTF #1 {#3} + { + \use:x + { + \__ctex_patch_replace:nnnTF {#2} + { \tl_to_str:n {#4} } + { \tl_to_str:n {#5} } + } + { + \__ctex_patch_rebuild:Nn \CTEXPATCHRESCANCMD {#3} + \cs_set_eq:NN #1 \CTEXPATCHRESCANCMD + \__ctex_patch_true:w + } + { \__ctex_patch_false:w } + } + { \__ctex_patch_false:w } + } +\cs_new_protected:Npn \__ctex_patch_replace:nnnTF #1#2#3#4 + { + \tl_if_in:NnTF \l__ctex_replacement_tl {#2} + { \use:c { tl_replace_ #1 :Nnn } \l__ctex_replacement_tl {#2} {#3} #4 } + } +\cs_new_protected:Npn \__ctex_hookto_cmd:Nnnnw #1#2#3#4 + { + \group_end: + \ctex_get_macro_meaning:NTF #1 + { + \tl_if_empty:NTF \l__ctex_parameter_tl + { \__ctex_hookto_cmd_parameterless:Nnnw #1 {#2} {#4} } + { \__ctex_hookto_cmd_parameter:Nnnnw #1 {#2} {#3} {#4} } + } + { \__ctex_patch_false:w } + } +\cs_new_protected:Npn \__ctex_hookto_cmd_parameterless:Nnnw #1#2#3 + { + \tl_if_empty:NF \l__ctex_prefix_tl + { \tl_rescan:nx { } { \l__ctex_prefix_tl } } + \edef #1 + { + \use:c { __ctex_ #2 _hook_aux:nn } + { \exp_not:o {#1} } + { \exp_not:n {#3} } + } + \__ctex_patch_true:w + } +\cs_new:Npn \__ctex_left_hook_aux:nn #1#2 { #2#1 } +\cs_new_eq:NN \__ctex_right_hook_aux:nn \use:nn +\cs_new_protected:Npn \__ctex_hookto_cmd_parameter:Nnnnw #1#2#3#4 + { + \__ctex_patch_rebuild:Nn \CTEXPATCHRESCANCMD {#3} + \cs_if_eq:NNTF #1 \CTEXPATCHRESCANCMD + { + \use:c { tl_put_ #2 :Nx } \l__ctex_replacement_tl { \tl_to_str:n {#4} } + \__ctex_patch_rebuild:Nn \CTEXPATCHRESCANCMD {#3} + \cs_set_eq:NN #1 \CTEXPATCHRESCANCMD + \__ctex_patch_true:w + } + { \__ctex_patch_false:w } + } +%% +%% +%% End of file `ctexpatch.sty'. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexrep.cls b/Master/texmf-dist/tex/latex/ctex/ctexrep.cls index 0f7dfdeff5a..c9f8798891e 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexrep.cls +++ b/Master/texmf-dist/tex/latex/ctex/ctexrep.cls @@ -28,10 +28,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter for class report (CTEX)} \ProvidesExplClass{ctexrep} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \tl_const:Nx \c__ctex_version_tl { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } } \cs_new_eq:cN { ver@ctex. \@pkgextension } \c__ctex_version_tl @@ -50,35 +50,12 @@ { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } \@ifpackagelater { l3keys2e } { 2014/05/05 } { } { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } } -\RequirePackage { etoolbox } +\RequirePackage { ctexhook , ctexpatch } \RequirePackage { fix-cm , everysel } \tl_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \dim_new:N \l__ctex_tmp_dim \box_new:N \l__ctex_tmp_box -\cs_new_protected:Npn \ctex_at_end_package:nn #1#2 - { - \@ifpackageloaded {#1} - {#2} - { \ctex_gadd_hook:cn { g__ctex_at_end_ #1 _hook_tl } {#2} } - } -\cs_new_protected:Npn \ctex_gadd_hook:Nn #1#2 - { - \tl_if_exist:NF #1 { \tl_new:N #1 } - \tl_gput_right:Nn #1 {#2} - } -\cs_generate_variant:Nn \ctex_gadd_hook:Nn { c } -\cs_new_protected_nopar:Npn \ctex_package_end_hook:n #1 - { - \cs_if_exist_use:cT { g__ctex_at_end_ #1 _hook_tl } - { \cs_undefine:c { g__ctex_at_end_ #1 _hook_tl } } - } -\cs_generate_variant:Nn \ctex_package_end_hook:n { o } -\tl_put_left:Nn \@popfilename - { - \cs_if_eq:NNT \@currext \@pkgextension - { \ctex_package_end_hook:o { \@currname } } - } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -111,90 +88,6 @@ { } } \cs_generate_variant:Nn \ctex_scheme_input:n { o } -\cs_new_protected:Npn \ctex_parse_name:NN #1#2 - { \ctex_parse_name:NNx #1#2 { \cs_to_str:N #2 } } -\group_begin: -\char_set_lccode:nn { `\< } { `\{ } -\char_set_lccode:nn { `\/ } { `\\ } -\char_set_lccode:nn { `\A } { `\t } -\tl_map_function:nN { \A \E \S \O \P } \char_set_catcode_other:N -\tex_lowercase:D - { - \group_end: - \cs_new_protected:Npn \ctex_parse_name:NNn #1#2#3 - { - \bool_if:nTF { \cs_if_exist_p:c { #3 ~ } || \cs_if_exist_p:c { /#3 } } - { - \group_begin: - \use:x - { - \group_end: - \__ctex_parse_name:nNNNnN { \token_get_replacement_spec:N #2 } - \exp_not:N #2 \exp_not:c { #3 ~ } \exp_not:c { /#3 } - } {#3} #1 - } - { #1#2 } - } - \cs_new_protected:Npn \__ctex_parse_name:nNNNnN #1#2#3#4#5#6 - { - \exp_args:Nc #6 - { - \str_case:nnTF {#1} - { - { \protect #3 } { } - { \x@protect #2 \protect #3 } { } - } - { - \str_if_eq_x:nnTF { \exp_not:n { /@protected@ #3 /#3 } } - { - \exp_last_unbraced:Nf \__ctex_parse_name:w - \token_get_replacement_spec:N #3 AESAOPA ~ < \q_stop - } - { /#5 ~ } { #5 ~ } - } - { - \str_case:onTF { \__ctex_parse_name:w #1 AESAOPA ~ < \q_stop } - { - { /@protected@ #2 #4 } { } - { /@ #4 } { } - } - { /#5 } {#5} - } - } - } - \cs_new:Npn \__ctex_parse_name:w #1 AESAOPA ~ #2 < #3 \q_stop { #1#2 } - } -\cs_generate_variant:Nn \ctex_parse_name:NNn { NNx } -\cs_new_protected_nopar:Npn \ctex_patch_cmd:NnnTF { \ctex_parse_name:NN \patchcmd } -\cs_new_protected_nopar:Npn \ctex_preto_cmd:NnTF { \ctex_parse_name:NN \pretocmd } -\cs_new_protected_nopar:Npn \ctex_appto_cmd:NnTF { \ctex_parse_name:NN \apptocmd } -\cs_new_protected:Npn \ctex_patch_cmd:Nnn - { - \group_begin: - \char_set_catcode_other:N \# - \__ctex_patch_cmd:Nnn - } -\cs_new_protected:Npn \__ctex_patch_cmd:Nnn #1#2#3 - { - \group_end: - \group_begin: - \ExplSyntaxOff - \ctex_patch_cmd:NnnTF #1 {#2} {#3} - { - \cs_gset_eq:NN \__ctex_tmp:w #1 - \group_end: - \cs_set_eq:NN #1 \__ctex_tmp:w - \cs_undefine:N \__ctex_tmp:w - } - { \group_end: \ctex_patch_failure:N #1 } - } -\cs_new_protected:Npn \ctex_patch_failure:N #1 - { \msg_warning:nnx { ctex } { patch-failure } { \token_to_str:N #1 } } -\msg_new:nnn { ctex } { patch-failure } - { - Patching~command~`#1'~failed.\\ - ctex~may~not~work~as~expected. - } \cs_new_eq:NN \g__ctex_section_depth_flag \c_two \msg_new:nnnn { ctex } { package-too-old } { Support~package~`#1'~too~old. } @@ -217,7 +110,7 @@ \cs_new_eq:NN \ctex_if_pdfmode:TF \use_ii:nn } \cs_new_eq:NN \ctex_if_preamble:TF \use_i:nn -\AfterEndPreamble { \cs_set_eq:NN \ctex_if_preamble:TF \use_ii:nn } +\ctex_after_end_preamble:n { \cs_set_eq:NN \ctex_if_preamble:TF \use_ii:nn } \cs_new:Npn \ctex_set_default_ccwd:Nn #1#2 { \dim_compare:nNnTF @@ -303,8 +196,8 @@ { \msg_warning:nnn { ctex } { deprecated-option } { - The~ functionality~ has~ been~ removed.~ - It's~ better~ to~ set~ the~ heading~ styles~ via~ beforeskip~ + The~ functionality~ has~ been~ removed.\\ + It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ options.~ } } , @@ -313,8 +206,8 @@ { \msg_warning:nnn { ctex } { deprecated-option } { - The~ functionality~ has~ been~ removed.~ - It's~ better~ to~ set~ the~ heading~ styles~ via~ beforeskip~ + The~ functionality~ has~ been~ removed.\\ + It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ options. } } , @@ -446,7 +339,7 @@ \cs_if_exist:NF \hypersetup { \cs_new_eq:NN \hypersetup \ctex_hypersetup:n } } - \AtEndPreamble { \RequirePackage { hyperref } } + \ctex_at_end_preamble:n { \RequirePackage { hyperref } } } , } \tl_clear:N \l__ctex_tmp_tl @@ -658,6 +551,14 @@ \cs_new_eq:NN \chinese \zhnum \cs_new_eq:NN \Chinese \chinese \cs_new_eq:NN \CTEXcounter \use_none:n +\ctex_at_end_package:nn { enumitem } + { + \cs_if_free:NF \AddEnumerateCounter + { + \AddEnumerateCounter * { \zhnum } { \zhnum_int:n } { 1 } + \AddEnumerateCounter * { \chinese } { \zhnum_int:n } { 1 } + } + } \NewDocumentCommand \CTEXnumber { m m } { \protected@edef #1 { \zhnumber {#2} } } \NewDocumentCommand \CTEXdigits { m m } @@ -696,12 +597,14 @@ appendixname .tl_set:N = \appendixname , bibname .tl_set:N = \bibname } + +\seq_new:N \c__ctex_section_headings_seq +\seq_gset_from_clist:Nn \c__ctex_section_headings_seq + { section , subsection , subsubsection , paragraph , subparagraph } \seq_new:N \c__ctex_headings_seq -\seq_gset_from_clist:Nn \c__ctex_headings_seq - { - part , chapter , section , subsection , subsubsection , - paragraph , subparagraph - } +\seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq +\seq_gput_left:Nn \c__ctex_headings_seq { chapter } +\seq_gput_left:Nn \c__ctex_headings_seq { part } \cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } @@ -734,49 +637,53 @@ { \tl_put_right:Nx \l__ctex_tmp_tl { - #1 .meta:nn = { ctex / #1 } { ####1 } , - #1 / name .code:n = + #1 .meta:nn = { ctex / #1 } { ####1 } , + #1 / name .code:n = { \ctex_assign_heading_name:nn {#1} { ####1 } } , - #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , - #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , - #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , - #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , - #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , - #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , - #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , - #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , - #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , - #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , - #1 / format+ .code:n = + #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , + #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } , + #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } , + #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } , + #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } , + #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } , + #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } , + #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , + #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , + #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , + #1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , + #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1@afterindent } , + #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , + #1 / format+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / format~+ .code:n = + #1 / format~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , - #1 / nameformat+ .code:n = + #1 / nameformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / nameformat~+ .code:n = + #1 / nameformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / numberformat+ .code:n = + #1 / numberformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / numberformat~+ .code:n = + #1 / numberformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / aftername+ .code:n = + #1 / aftername+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / aftername~+ .code:n = + #1 / aftername~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / titleformat+ .code:n = + #1 / titleformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / titleformat~+ .code:n = + #1 / titleformat~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / aftertitle+ .code:n = + #1 / aftertitle+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / aftertitle~+ .code:n = + #1 / aftertitle~+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / beforeskip .initial:n = \c_zero_skip , - #1 / afterskip .initial:n = \c_zero_skip , - #1 / indent .initial:n = \c_zero_dim , - #1 / beforeskip .value_required: , - #1 / afterskip .value_required: , - #1 / indent .value_required: , + #1 / numbering .initial:n = true , + #1 / beforeskip .initial:n = \c_zero_skip , + #1 / afterskip .initial:n = \c_zero_skip , + #1 / indent .initial:n = \c_zero_dim , + #1 / beforeskip .value_required: , + #1 / afterskip .value_required: , + #1 / indent .value_required: , } } \NewDocumentCommand \ctex_assign_heading_name:nn @@ -801,20 +708,42 @@ } \use:x { \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } } \tl_clear:N \l__ctex_tmp_tl -\def\@part[#1]#2{% +\cs_new_protected_nopar:Npn \CTEX@makeheadinganchor { } +\ctex_at_end_package:nn { hyperref } + { \cs_gset_protected_nopar:Npn \CTEX@makeheadinganchor { \phantomsection } } +\renewcommand\part{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi \thispagestyle{\CTEX@part@pagestyle}% + \if@twocolumn + \onecolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \null\vskip \glueexpr \CTEX@part@beforeskip \relax + \secdef\@part\@spart} +\def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax - \refstepcounter{part}% - \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \ifodd \CTEX@part@numbering + \refstepcounter{part}% + \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{part}{#1}% + \fi \else \addcontentsline{toc}{part}{#1}% \fi \markboth{}{}% {\interlinepenalty \@M \normalfont \CTEX@part@format - \ifnum \c@secnumdepth >-2\relax + \ifnum \c@secnumdepth >-2\relax \ifodd \CTEX@part@numbering \CTEX@partname - \fi + \fi \fi \CTEX@part@titleformat{#2}% \CTEX@part@aftertitle}% \@endpart} @@ -824,12 +753,39 @@ \CTEX@part@titleformat{#1}% \CTEX@part@aftertitle}% \@endpart} +\def\@endpart{% + \vskip \glueexpr \CTEX@part@afterskip \relax + \newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi} +\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi + \thispagestyle{\CTEX@chapter@pagestyle}% + \global\@topnum\z@ + \ifodd \CTEX@chapter@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne - \refstepcounter{chapter}% - \typeout{\CTEXthechapter}% - \addcontentsline{toc}{chapter} - {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}% + \ifodd \CTEX@chapter@numbering + \refstepcounter{chapter}% + \typeout{\CTEXthechapter}% + \addcontentsline{toc}{chapter} + {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}% + \else + \CTEX@makeheadinganchor + \addcontentsline{toc}{chapter}{#1}% + \fi \else \addcontentsline{toc}{chapter}{#1}% \fi @@ -843,40 +799,47 @@ \@afterheading \fi} \def\@makechapterhead#1{% - \thispagestyle{\CTEX@chapter@pagestyle}% - \@tempskipa \CTEX@chapter@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else - \@afterindenttrue - \fi - \vspace*{\@tempskipa}% - {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format + \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax + \CTEX@chapter@format \ifnum \c@secnumdepth >\m@ne - \CTEX@chaptername + \ifodd \CTEX@chapter@numbering + \CTEX@chaptername + \fi \fi \interlinepenalty\@M \CTEX@chapter@titleformat{#1}% \CTEX@chapter@aftertitle \nobreak - \vskip \CTEX@chapter@afterskip + \vskip \glueexpr \CTEX@chapter@afterskip \relax }} \def\@makeschapterhead#1{% - \thispagestyle{\CTEX@chapter@pagestyle}% - \@tempskipa \CTEX@chapter@beforeskip \relax - \ifdim \@tempskipa <\z@ - \@tempskipa -\@tempskipa \@afterindentfalse - \else - \@afterindenttrue - \fi - \vspace*{\@tempskipa}% - {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format + \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax + \CTEX@chapter@format \interlinepenalty\@M \CTEX@chapter@titleformat{#1} \CTEX@chapter@aftertitle \nobreak - \vskip \CTEX@chapter@afterskip + \vskip \glueexpr \CTEX@chapter@afterskip \relax }} +\def\@startsection#1#2#3#4#5#6{% + \if@noskipsec \leavevmode \fi + \par + \CTEX@update@sectionformat@n{#1}% + \ifodd \CTEX@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \if@nobreak + \everypar{}% + \else + \addpenalty\@secpenalty\addvspace{\glueexpr #4\relax}% + \fi + \@ifstar + {\@ssect{#3}{#4}{#5}{#6}}% + {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} \def\@seccntformat#1{% \@ifundefined{CTEX@#1name}% {\csname the#1\endcsname\quad}% @@ -885,14 +848,18 @@ \ifnum #2>\c@secnumdepth \let\@svsec\@empty \else - \refstepcounter{#1}% - \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \ifodd \csname CTEX@#1@numbering\endcsname + \refstepcounter{#1}% + \protected@edef\@svsec{\@seccntformat{#1}\relax}% + \else + \CTEX@makeheadinganchor + \let\@svsec\@empty + \fi \fi - \@tempskipa #5\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #6{% - \@hangfrom{\hskip #3\relax\@svsec}% + \@hangfrom{\hskip\glueexpr #3\relax\@svsec}% \interlinepenalty \@M \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% @@ -900,51 +867,80 @@ \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}% \else \def\@svsechd{% - #6{\hskip #3\relax + #6{\hskip\glueexpr #3\relax \@svsec \csname CTEX@#1@titleformat\endcsname{#8}% \csname CTEX@#1@aftertitle\endcsname}% \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else - \protect\numberline{\@ifundefined{CTEXthe#1}% + \ifodd \csname CTEX@#1@numbering\endcsname + \protect\numberline{\@ifundefined{CTEXthe#1}% {\csname the#1\endcsname}% {\csname CTEXthe#1\endcsname}}% + \fi \fi #7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% - \@tempskipa #3\relax - \ifdim \@tempskipa>\z@ + \unless \ifodd \CTEX@runin \begingroup #4{% - \@hangfrom{\hskip #1}% + \@hangfrom{\hskip\glueexpr #1\relax}% \interlinepenalty \@M \CTEX@titleformat@n{#5}% \CTEX@aftertitle}% \endgroup \else - \def\@svsechd{#4{\hskip #1\relax \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{\hskip\glueexpr #1\relax + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} -\cs_new_protected_nopar:Npn \CTEX@set@titleformat@n #1 +\def\@xsect#1{% + \unless \ifodd \CTEX@runin + \par \nobreak + \vskip\glueexpr #1\relax + \@afterheading + \else + \@nobreakfalse + \global\@noskipsectrue + \everypar{% + \if@noskipsec + \global\@noskipsecfalse + {\setbox\z@\lastbox}% + \clubpenalty\@M + \begingroup \@svsechd \endgroup + \unskip + \hskip\glueexpr #1\relax + \else + \clubpenalty \@clubpenalty + \everypar{}% + \fi}% + \fi + \ignorespaces} +\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } + \cs_set_eq:Nc \CTEX@afterindent { CTEX@#1@afterindent } + \cs_set_eq:Nc \CTEX@runin { CTEX@#1@runin } } \cs_new_eq:NN \CTEX@titleformat@n \use:n \cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing: +\cs_new_eq:NN \CTEX@afterindent \c_true_bool +\cs_new_eq:NN \CTEX@runin \c_false_bool \int_zero:N \l__ctex_tmp_int -\clist_map_inline:nn - { section , subsection , subsubsection , paragraph , subparagraph } +\seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int \cs_gset_protected_nopar:cpx {#1} @@ -954,18 +950,17 @@ { \exp_not:c { CTEX@#1@indent } } { \exp_not:c { CTEX@#1@beforeskip } } { \exp_not:c { CTEX@#1@afterskip } } - { - \CTEX@set@titleformat@n {#1} - \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } - } + { \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } } } } \keys_define:nn { ctex } { - appendix .meta:nn = { ctex / appendix } {#1} , - appendix / name .code:n = + appendix .meta:nn = { ctex / appendix } {#1} , + appendix / name .code:n = { \ctex_assign_heading_name:nn { appendix } {#1} } , - appendix / number .tl_set:N = \CTEX@appendixnumber + appendix / number .tl_set:N = \CTEX@appendix@number , + appendix / numbering .bool_set:N = \CTEX@appendix@numbering , + appendix / numbering .initial:n = true } \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix @@ -974,8 +969,76 @@ { \CTEX@save@appendix \gdef \CTEX@prechapter { \CTEX@preappendix } - \gdef \CTEX@thechapter { \CTEX@appendixnumber } + \gdef \CTEX@thechapter { \CTEX@appendix@number } \gdef \CTEX@postchapter { \CTEX@postappendix } + \gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering } + } +\cs_new_protected_nopar:Npn \ctex_titlesec_hook: + { + \@ifpackagewith { titlesec } { explicit } + { + \cs_set_eq:NN \__ctex_titlesec_format:Nn + \__ctex_titlesec_format_explicit:Nn + } + { } + \clist_map_inline:nn + { indentafter , noindentafter , indentfirst , nonindentfirst } + { + \@ifpackagewith { titlesec } { ##1 } + { + \clist_map_break:n + { \cs_set_eq:NN \__ctex_titlesec_hook:n \__ctex_titlesec_format:n } + } + { } + } + \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 + { + \__ctex_titlesec_format:n {#1} + \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 + { + \cs_if_free:cF { ttlf@#1 } + { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 + { + \tl_set:Nx #1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \tl_tail:N #1 + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 + { + \cs_set_nopar:Npx #1 ##1 + { + \bool_if:cTF { CTEX@#2@runin } + { \exp_not:N \ttlh@runin } + { \exp_not:N \ttlh@hang } + \exp_args:No \tl_tail:n { #1 { } } + } + } +\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 + { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } +\cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 + { + \exp_not:n { {#1} {#2} {#3} {#4} } + { \bool_if:cTF { CTEX@#6@afterindent } { \@ne } { \z@ } } + } +\@ifpackageloaded { titlesec } + { } + { + \ctex_at_end_package:nn { titlesec } + { + \@ifpackagewith { titlesec } { loadonly } + { } + { \ctex_titlesec_hook: } + } } \cs_new_protected:Npn \CTEX@toc@width@n #1 { @@ -991,31 +1054,39 @@ \use:n { \group_end: - \ExplSyntaxOff - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline { \ExplSyntaxOff } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } \@ifpackageloaded { tocloft } { } { \ctex_at_end_package:nn { tocloft } { - \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { } + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } { \ctex_patch_failure:N \numberline } } } - \ExplSyntaxOn } \ctex_patch_cmd:Nnn \ps@headings - { \@chapapp\ \thechapter.~\ } { \CTEXthechapter \quad } + { \@chapapp\ \thechapter.~\ } + { \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi } \if@twoside - \ctex_patch_cmd:Nnn \ps@headings { \thesection.~\ } { \CTEXthesection \quad } + \ctex_patch_cmd:Nnn \ps@headings + { \thesection.~\ } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } \fi: \ctex_at_end_package:nn { fancyhdr } { \ctex_patch_cmd:Nnn \ps@fancy - { \@chapapp\ \thechapter.~\ } { \CTEXthechapter \quad } + { \@chapapp\ \thechapter.~\ } + { \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi } \ctex_patch_cmd:Nnn \ps@fancy - { \thesection.~\ } { \CTEXthesection \quad } + { \thesection.~\ } + { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } } \cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 { @@ -1147,7 +1218,7 @@ \fi: \fp_compare:nNnF { \l__ctex_line_spread_fp } ? { \c_zero_fp } { - \linespread { \fp_use:N \l__ctex_line_spread_fp } + \exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } \group_begin: \footnotesize \exp_args:NNNo \group_end: \dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox } } @@ -1164,26 +1235,6 @@ { You~can~load~the~package~`caption'~to~get~its~functionality. } } } -\group_begin: -\char_set_catcode_other:N \# -\use:n - { - \group_end: - \ExplSyntaxOff - \ctex_at_end_package:nn { breqn } - { - \ctex_patch_cmd:NnnTF \end { \csname end#1 \endcsname } - { - \csuse { @end@#1@hook } - \csname end#1 \endcsname - } { } - { - \ctex_preto_cmd:NnTF \end { \csuse { @end@#1@hook } } - { } { \ctex_patch_failure:N \end } - } - } - \ExplSyntaxOn - } \cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 { \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } \msg_new:nnn { ctex } { fontset-unavailable } @@ -1257,12 +1308,14 @@ %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, -%% ctexcap.sty, %% ctexsize.sty, %% ctexheading.sty, %% ctexart.cls, %% ctexbook.cls, %% ctexrep.cls, +%% ctexcap.sty, +%% ctexhook.sty, +%% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, %% ctex-article.def, diff --git a/Master/texmf-dist/tex/latex/ctex/ctexsize.sty b/Master/texmf-dist/tex/latex/ctex/ctexsize.sty index 59d56038732..9dcee563f86 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexsize.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctexsize.sty @@ -28,10 +28,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese font size definition (CTEX)} \ProvidesExplPackage{ctexsize} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \RequirePackage { xparse , l3keys2e } \cs_new_eq:NN \g__ctex_font_size_flag \c_minus_one \keys_define:nn { ctex / option } @@ -162,12 +162,14 @@ %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, -%% ctexcap.sty, %% ctexsize.sty, %% ctexheading.sty, %% ctexart.cls, %% ctexbook.cls, %% ctexrep.cls, +%% ctexcap.sty, +%% ctexhook.sty, +%% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, %% ctex-article.def, diff --git a/Master/texmf-dist/tex/latex/ctex/ctexspa.def b/Master/texmf-dist/tex/latex/ctex/ctexspa.def index 91048dd0a27..9e61e7c8870 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexspa.def +++ b/Master/texmf-dist/tex/latex/ctex/ctexspa.def @@ -28,7 +28,7 @@ %% ------------------------------------------------------------------------------ %% \ProvidesFile{ctexspa.def}% - [2015/05/15 v2.1 Space info for CJKpunct (CTEX)] + [2015/07/01 v2.2 Space info for CJKpunct (CTEX)] \ctexspadef{adobezhsong}{70,15,61,8,63,14,58,7,64,13,62,12,60,11,61,15,62,14,51,6,58,5,58,8,7,5,12,12,10,68,13,63,17,63,20,69,19,69,17,63,19,70,17,55,10,10,14,63,10,65,10,61,13,62,15,61,7,49,7,56,8,58,15,69,8,61,14,63,8,57,,,} \ctexspadef{adobezhhei}{78,3,64,3,64,2,61,3,72,3,70,3,72,3,70,3,60,3,51,3,62,3,66,3,0,0,10,10,3,70,5,70,6,75,6,78,17,67,13,67,17,67,4,50,8,8,3,72,3,70,3,72,3,70,3,60,3,51,3,62,3,66,3,78,7,62,3,63,3,61,,,} \ctexspadef{adobezhkai}{76,10,55,8,63,4,62,4,71,4,65,4,71,4,74,4,54,4,54,4,62,4,62,4,0,0,11,11,5,72,6,71,7,78,7,79,18,68,18,68,18,68,2,46,14,12,4,71,4,65,4,71,4,74,4,54,4,54,4,62,4,62,10,76,8,55,4,63,4,62,,,} diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def index b8c8b3e325b..902e0e3e832 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {LuaLaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-luatex.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \msg_new:nnn { ctex } { luatexja-loaded } { Package~`luatexja'~can~not~be~loaded~before~`ctex'.\\ @@ -565,13 +565,20 @@ \tl_if_exist:NF \CJKrmdefault { \tl_const:Nn \CJKrmdefault { rm } } \tl_if_exist:NF \CJKsfdefault { \tl_const:Nn \CJKsfdefault { sf } } \tl_if_exist:NF \CJKttdefault { \tl_const:Nn \CJKttdefault { tt } } -\ctex_preto_cmd:NnTF \rmfamily { \CJKfamily { \CJKrmdefault } } { } +\ctex_preto_cmd:NnnTF \rmfamily { \ExplSyntaxOff } + { \CJKfamily { \CJKrmdefault } } + { } { \ctex_patch_failure:N \rmfamily } -\ctex_preto_cmd:NnTF \sffamily { \CJKfamily { \CJKsfdefault } } { } +\ctex_preto_cmd:NnnTF \sffamily { \ExplSyntaxOff } + { \CJKfamily { \CJKsfdefault } } + { } { \ctex_patch_failure:N \sffamily } -\ctex_preto_cmd:NnTF \ttfamily { \CJKfamily { \CJKttdefault } } { } +\ctex_preto_cmd:NnnTF \ttfamily { \ExplSyntaxOff } + { \CJKfamily { \CJKttdefault } } + { } { \ctex_patch_failure:N \ttfamily } -\ctex_preto_cmd:NnTF \normalfont { \CJKfamily { \CJKfamilydefault } } +\ctex_preto_cmd:NnnTF \normalfont { \ExplSyntaxOff } + { \CJKfamily { \CJKfamilydefault } } { \cs_set_eq:NN \reset@font \normalfont } { \ctex_patch_failure:N \normalfont } \cs_new_protected_nopar:Npn \ctex_ltj_ensure_default_family: @@ -929,8 +936,11 @@ \skip_set:Nn \l__ctex_ltj_xkanjiskip_skip { .25 \zw plus 1pt minus 1pt } \AtBeginDocument { - \ctex_appto_cmd:NnTF \verbatim@font { \CTEX@verbatim@font@hook } - { } { \ctex_patch_failure:N \verbatim@font } + \ctex_appto_cmd:NnnTF \verbatim@font + { \char_set_catcode_letter:n { 64 } } + { \CTEX@verbatim@font@hook } + { } + { \ctex_patch_failure:N \verbatim@font } } \cs_new_protected_nopar:Npn \CTEX@verbatim@font@hook { \ltjsetparameter { autospacing = false , autoxspacing = false } } @@ -954,7 +964,7 @@ } \ctex_ltj_ensure_default_family: } -\AtEndPreamble { \ctex_update_default_family: } +\ctex_at_end_preamble:n { \ctex_update_default_family: } \tl_new:N \l__ctex_family_default_init_tl \cs_new_eq:NN \__ctex_family_default_wrap:n \use:n \tl_set:Nx \l__ctex_family_default_init_tl @@ -1008,17 +1018,13 @@ } \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: \cs_new_eq:Nc \__ctex_save_selectfont: { selectfont ~ } -\use:n +\ctex_preto_cmd:NnnTF \selectfont { \ExplSyntaxOff } + { \CTEX@selectfont@hook } { - \ExplSyntaxOff - \ctex_preto_cmd:NnTF \selectfont { \CTEX@selectfont@hook } - { - \tl_put_left:Nn \@EverySelectfont@Init - { \cs_set_eq:cN { selectfont ~ } \__ctex_save_selectfont: } - } - { \ctex_patch_failure:N \selectfont } + \tl_put_left:Nn \@EverySelectfont@Init + { \cs_set_eq:cN { selectfont ~ } \__ctex_save_selectfont: } } -\ExplSyntaxOn + { \ctex_patch_failure:N \selectfont } \EverySelectfont { \CTEX@selectfont@hook } \ctex_add_to_selectfont:n { diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def index 8b8d9f876cb..49dc80aca67 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {(pdf)LaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-pdftex.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \seq_new:N \c__ctex_cmap_encoding_seq \seq_set_from_clist:Nn \c__ctex_cmap_encoding_seq { C19 , C10 , C00 , C09 , C40 , C60 } @@ -69,14 +69,13 @@ \ctex_if_pdfmode:TF { \group_end: - \ExplSyntaxOff - \ctex_appto_cmd:NnTF \DeclareFontFamily { \CTEX@Family@CMap {#1} {#2} } + \ctex_appto_cmd:NnnTF \DeclareFontFamily { \ExplSyntaxOff } + { \CTEX@Family@CMap {#1} {#2} } { \ctex_at_end_package:nn { cmap } { \cs_gset_eq:NN \CTEX@Family@CMap \use_none:nn } } { \ctex_patch_failure:N \DeclareFontFamily } - \ExplSyntaxOn } { \group_end: } \if_bool:N \g__ctex_zhmCJK_bool @@ -102,13 +101,20 @@ \tl_if_exist:NF \CJKrmdefault { \tl_new:N \CJKrmdefault } \tl_if_exist:NF \CJKsfdefault { \tl_new:N \CJKsfdefault } \tl_if_exist:NF \CJKttdefault { \tl_new:N \CJKttdefault } - \ctex_preto_cmd:NnTF \rmfamily { \CJKfamily { \CJKrmdefault } } { } + \ctex_preto_cmd:NnnTF \rmfamily { \ExplSyntaxOff } + { \CJKfamily { \CJKrmdefault } } + { } { \ctex_patch_failure:N \rmfamily } - \ctex_preto_cmd:NnTF \sffamily { \CJKfamily { \CJKsfdefault } } { } + \ctex_preto_cmd:NnnTF \sffamily { \ExplSyntaxOff } + { \CJKfamily { \CJKsfdefault } } + { } { \ctex_patch_failure:N \sffamily } - \ctex_preto_cmd:NnTF \ttfamily { \CJKfamily { \CJKttdefault } } { } + \ctex_preto_cmd:NnnTF \ttfamily { \ExplSyntaxOff } + { \CJKfamily { \CJKttdefault } } + { } { \ctex_patch_failure:N \ttfamily } - \ctex_preto_cmd:NnTF \normalfont { \CJKfamily { \CJKfamilydefault } } + \ctex_preto_cmd:NnnTF \normalfont { \ExplSyntaxOff } + { \CJKfamily { \CJKfamilydefault } } { \cs_set_eq:NN \reset@font \normalfont } { \ctex_patch_failure:N \normalfont } \fi: @@ -160,7 +166,7 @@ \CJK@makeActive \CJK@loadBinding { standard } } - \exp_args:Nx \AtEndPreamble + \exp_args:Nx \ctex_at_end_preamble:n { \exp_not:N \CJK@envStart { } { \l__ctex_encoding_tl } { \exp_not:N \CJKfamilydefault } @@ -248,7 +254,7 @@ \group_end: } } -\AtEndPreamble { \ctex_update_default_family: } +\ctex_at_end_preamble:n { \ctex_update_default_family: } \tl_new:N \l__ctex_family_default_init_tl \cs_new_eq:NN \__ctex_family_default_wrap:n \use:n \tl_set:Nx \l__ctex_family_default_init_tl @@ -363,17 +369,13 @@ } \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: \cs_new_eq:Nc \__ctex_save_selectfont: { selectfont ~ } -\use:n +\ctex_preto_cmd:NnnTF \selectfont { \ExplSyntaxOff } + { \CTEX@selectfont@hook } { - \ExplSyntaxOff - \ctex_preto_cmd:NnTF \selectfont { \CTEX@selectfont@hook } - { - \tl_put_left:Nn \@EverySelectfont@Init - { \cs_set_eq:cN { selectfont ~ } \__ctex_save_selectfont: } - } - { \ctex_patch_failure:N \selectfont } + \tl_put_left:Nn \@EverySelectfont@Init + { \cs_set_eq:cN { selectfont ~ } \__ctex_save_selectfont: } } -\ExplSyntaxOn + { \ctex_patch_failure:N \selectfont } \EverySelectfont { \cs_if_exist:NF \CJK@plane { \CTEX@selectfont@hook } } \keys_define:nn { ctex } { diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def index 11f036799e0..6a6e2a0cbf4 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {XeLaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-xetex.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \RequirePackage { xeCJK } \exp_args:Nx \xeCJKsetup { @@ -119,17 +119,13 @@ } \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: \cs_new_eq:Nc \__ctex_save_selectfont: { selectfont ~ } -\use:n +\ctex_preto_cmd:NnnTF \selectfont { \ExplSyntaxOff } + { \CTEX@selectfont@hook } { - \ExplSyntaxOff - \ctex_preto_cmd:NnTF \selectfont { \CTEX@selectfont@hook } - { - \tl_put_left:Nn \@EverySelectfont@Init - { \cs_set_eq:cN { selectfont ~ } \__ctex_save_selectfont: } - } - { \ctex_patch_failure:N \selectfont } + \tl_put_left:Nn \@EverySelectfont@Init + { \cs_set_eq:cN { selectfont ~ } \__ctex_save_selectfont: } } -\ExplSyntaxOn + { \ctex_patch_failure:N \selectfont } \EverySelectfont { \CTEX@selectfont@hook } \keys_define:nn { ctex } { diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd b/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd index 30d2f7fce75..b748cdf5f57 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd @@ -27,7 +27,7 @@ %% ------------------------------------------------------------------------------ %% \ProvidesFile{c19rm.fd}% - [2015/05/15 v2.1 Chinese font definition (CTEX)] + [2015/07/01 v2.2 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd b/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd index 704ad030883..f473966f375 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd @@ -27,7 +27,7 @@ %% ------------------------------------------------------------------------------ %% \ProvidesFile{c19sf.fd}% - [2015/05/15 v2.1 Chinese font definition (CTEX)] + [2015/07/01 v2.2 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd b/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd index 0986f6b8be2..443363529e0 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd @@ -27,7 +27,7 @@ %% ------------------------------------------------------------------------------ %% \ProvidesFile{c19tt.fd}% - [2015/05/15 v2.1 Chinese font definition (CTEX)] + [2015/07/01 v2.2 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd b/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd index 914baac86f3..99eb8e23466 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd @@ -27,7 +27,7 @@ %% ------------------------------------------------------------------------------ %% \ProvidesFile{c70rm.fd}% - [2015/05/15 v2.1 Chinese font definition (CTEX)] + [2015/07/01 v2.2 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd b/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd index 492cf166309..aaca4cec351 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd @@ -27,7 +27,7 @@ %% ------------------------------------------------------------------------------ %% \ProvidesFile{c70sf.fd}% - [2015/05/15 v2.1 Chinese font definition (CTEX)] + [2015/07/01 v2.2 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd b/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd index 305df75675f..115bb4df8fb 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd @@ -27,7 +27,7 @@ %% ------------------------------------------------------------------------------ %% \ProvidesFile{c70tt.fd}% - [2015/05/15 v2.1 Chinese font definition (CTEX)] + [2015/07/01 v2.2 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def index 5fd609c3abf..24e30e0f28d 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Adobe fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-adobe.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \pdftex_if_engine:TF { \ctex_if_pdfmode:TF diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def index bcdabfb49ff..8d29591debf 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Fandol fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-fandol.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \pdftex_if_engine:TF { \ctex_if_pdfmode:TF diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def index 715bd19771b..8a8cd79d2dc 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Founder fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-founder.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \pdftex_if_engine:TF { \ctex_zhmap_case:nnn diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def index 041926b2c35..74fd11e0a80 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Mac OS X fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-mac.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \pdftex_if_engine:TF { \ctex_fontset_error:n { mac } } { diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def index b24ab4be269..6b4c840a77d 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Ubuntu fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-ubuntu.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \pdftex_if_engine:TF { \ctex_zhmap_case:nnn diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def index 296514caca3..46d2f765513 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Windows fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-windows.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \file_if_exist:nTF { C:/boot.ini } { \ctex_file_input:n { ctex-fontset-windowsold.def } } { \ctex_file_input:n { ctex-fontset-windowsnew.def } } diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def index bd52407f505..19c4b348e7a 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Windows fonts definition for Vista or later version (CTEX)} \ProvidesExplFile{ctex-fontset-windowsnew.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \pdftex_if_engine:TF { \ctex_zhmap_case:nnn diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def index 6156c9e30e8..8bb2f56860e 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Windows fonts definition for XP or earlier version (CTEX)} \ProvidesExplFile{ctex-fontset-windowsold.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \pdftex_if_engine:TF { \ctex_zhmap_case:nnn diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def index b21208988d8..744ddadda77 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def @@ -26,29 +26,30 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese scheme for article (CTEX)} \ProvidesExplFile{ctex-scheme-chinese-article.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \keys_set:nn { ctex / part } { aftertitle = \par , number = \chinese { part } , - nameformat = \Large \bfseries , + beforeskip = 4ex , afterskip = 3ex , - format = \centering , + format = \Large \bfseries \centering , aftername = \quad , - titleformat = \Large \bfseries , - beforeskip = 4ex + afterindent = true } \keys_set:nn { ctex / section } { number = \thesection , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.5ex \@plus 1ex \@minus .2ex , afterskip = 2.3ex \@plus .2ex , + runin = false , format = \Large \bfseries \centering , - beforeskip = 3.5ex \@plus 1ex \@minus .2ex + afterindent = true } \keys_set:nn { ctex / subsection } { @@ -56,8 +57,10 @@ format = \large \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex + runin = false , + afterindent = true } \keys_set:nn { ctex / subsubsection } { @@ -65,35 +68,41 @@ format = \normalsize \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex + runin = false , + afterindent = true } \keys_set:nn { ctex / paragraph } { number = \theparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = true } \keys_set:nn { ctex / subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = true } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two { \keys_set:nn { ctex / paragraph } { aftertitle = \@@par , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / paragraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_three @@ -101,15 +110,15 @@ \keys_set:nn { ctex / subparagraph } { aftertitle = \@@par , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / subparagraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def index 2d83f7e708f..055ca1c859d 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def @@ -26,40 +26,41 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese scheme for book (CTEX)} \ProvidesExplFile{ctex-scheme-chinese-book.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \keys_set:nn { ctex / part } { aftertitle = \par , number = \chinese { part } , - format = \centering , - nameformat = \huge \bfseries , aftername = \par \vskip 20 \p@ , + beforeskip = 0pt \@plus 1fil , + afterskip = 0pt \@plus 1fil , pagestyle = plain , - titleformat = \huge \bfseries + format = \huge \bfseries \centering } \keys_set:nn { ctex / chapter } { pagestyle = plain , - nameformat = \huge \bfseries , aftertitle = \par , + beforeskip = 50 \p@ , afterskip = 40 \p@ , number = \chinese { chapter } , - format = \centering , + format = \huge \bfseries \centering , aftername = \quad , - titleformat = \huge \bfseries , - beforeskip = 50 \p@ + afterindent = true } \keys_set:nn { ctex / section } { number = \thesection , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.5ex \@plus 1ex \@minus .2ex , afterskip = 2.3ex \@plus .2ex , + runin = false , format = \Large \bfseries \centering , - beforeskip = 3.5ex \@plus 1ex \@minus .2ex + afterindent = true } \keys_set:nn { ctex / subsection } { @@ -67,8 +68,10 @@ format = \large \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex + runin = false , + afterindent = true } \keys_set:nn { ctex / subsubsection } { @@ -76,35 +79,41 @@ format = \normalsize \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex + runin = false , + afterindent = true } \keys_set:nn { ctex / paragraph } { number = \theparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = true } \keys_set:nn { ctex / subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = true } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two { \keys_set:nn { ctex / paragraph } { aftertitle = \@@par , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / paragraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_three @@ -112,15 +121,15 @@ \keys_set:nn { ctex / subparagraph } { aftertitle = \@@par , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / subparagraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def index 0bf4aa05931..017ee477859 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def @@ -26,40 +26,41 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese scheme for report (CTEX)} \ProvidesExplFile{ctex-scheme-chinese-report.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \keys_set:nn { ctex / part } { aftertitle = \par , number = \chinese { part } , - format = \centering , - nameformat = \huge \bfseries , aftername = \par \vskip 20 \p@ , + beforeskip = 0pt \@plus 1fil , + afterskip = 0pt \@plus 1fil , pagestyle = plain , - titleformat = \huge \bfseries + format = \huge \bfseries \centering } \keys_set:nn { ctex / chapter } { pagestyle = plain , - nameformat = \huge \bfseries , aftertitle = \par , + beforeskip = 50 \p@ , afterskip = 40 \p@ , number = \chinese { chapter } , - format = \centering , + format = \huge \bfseries \centering , aftername = \quad , - titleformat = \huge \bfseries , - beforeskip = 50 \p@ + afterindent = true } \keys_set:nn { ctex / section } { number = \thesection , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.5ex \@plus 1ex \@minus .2ex , afterskip = 2.3ex \@plus .2ex , + runin = false , format = \Large \bfseries \centering , - beforeskip = 3.5ex \@plus 1ex \@minus .2ex + afterindent = true } \keys_set:nn { ctex / subsection } { @@ -67,8 +68,10 @@ format = \large \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex + runin = false , + afterindent = true } \keys_set:nn { ctex / subsubsection } { @@ -76,35 +79,41 @@ format = \normalsize \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex + runin = false , + afterindent = true } \keys_set:nn { ctex / paragraph } { number = \theparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = true } \keys_set:nn { ctex / subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = true } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two { \keys_set:nn { ctex / paragraph } { aftertitle = \@@par , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / paragraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_three @@ -112,15 +121,15 @@ \keys_set:nn { ctex / subparagraph } { aftertitle = \@@par , - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / subparagraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def index b3be5572070..e5b315b71c9 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese scheme for generic (CTEX)} \ProvidesExplFile{ctex-scheme-chinese.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } { \ctex_file_input:n { ctex-name-gbk.cfg } } { \ctex_file_input:n { ctex-name-utf8.cfg } } @@ -41,7 +41,7 @@ \ctex_if_autoindent_touched:F { \keys_set:nn { ctex } { autoindent = true } } \tl_if_exist:NT \c__ctex_std_class_tl - { \RequirePackage{ indentfirst } } + { \RequirePackage { indentfirst } } %% %% %% End of file `ctex-scheme-chinese.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def index 752fefd584d..771341156b2 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def @@ -26,30 +26,33 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Plain scheme for article (CTEX)} \ProvidesExplFile{ctex-scheme-plain-article.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \keys_set:nn { ctex / part } { aftertitle = \par , name = \partname \space , number = \thepart , - nameformat = \Large \bfseries , + beforeskip = 4ex , afterskip = 3ex , format = \raggedright , + nameformat = \Large \bfseries , aftername = \par \nobreak , titleformat = \huge \bfseries , - beforeskip = -4ex + afterindent = false } \keys_set:nn { ctex / section } { number = \thesection , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.5ex \@plus 1ex \@minus .2ex , afterskip = 2.3ex \@plus .2ex , + runin = false , format = \Large \bfseries , - beforeskip = -3.5ex \@plus -1ex \@minus -.2ex + afterindent = false } \keys_set:nn { ctex / subsection } { @@ -57,8 +60,10 @@ format = \large \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex + runin = false , + afterindent = false } \keys_set:nn { ctex / subsubsection } { @@ -66,35 +71,41 @@ format = \normalsize \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex + runin = false , + afterindent = false } \keys_set:nn { ctex / paragraph } { number = \theparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = false } \keys_set:nn { ctex / subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = false } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two { \keys_set:nn { ctex / paragraph } { aftertitle = \@@par , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / paragraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_three @@ -102,15 +113,15 @@ \keys_set:nn { ctex / subparagraph } { aftertitle = \@@par , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / subparagraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def index 202db21f8c7..e3ab04495eb 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def @@ -26,42 +26,47 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Plain scheme for book (CTEX)} \ProvidesExplFile{ctex-scheme-plain-book.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \keys_set:nn { ctex / part } { aftertitle = \par , name = \partname \space , number = \thepart , - format = \centering , - nameformat = \huge \bfseries , aftername = \par \vskip 20 \p@ , + beforeskip = 0pt \@plus 1fil , + afterskip = 0pt \@plus 1fil , pagestyle = plain , + format = \centering , + nameformat = \huge \bfseries , titleformat = \Huge \bfseries } \keys_set:nn { ctex / chapter } { pagestyle = plain , - nameformat = \huge \bfseries , aftertitle = \par , + beforeskip = 50 \p@ , afterskip = 40 \p@ , name = \chaptername \space , number = \thechapter , format = \raggedright , + nameformat = \huge \bfseries , aftername = \par \nobreak \vskip 20 \p@ , titleformat = \Huge \bfseries , - beforeskip = -50 \p@ + afterindent = false } \keys_set:nn { ctex / section } { number = \thesection , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.5ex \@plus 1ex \@minus .2ex , afterskip = 2.3ex \@plus .2ex , + runin = false , format = \Large \bfseries , - beforeskip = -3.5ex \@plus -1ex \@minus -.2ex + afterindent = false } \keys_set:nn { ctex / subsection } { @@ -69,8 +74,10 @@ format = \large \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex + runin = false , + afterindent = false } \keys_set:nn { ctex / subsubsection } { @@ -78,35 +85,41 @@ format = \normalsize \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex + runin = false , + afterindent = false } \keys_set:nn { ctex / paragraph } { number = \theparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = false } \keys_set:nn { ctex / subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = false } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two { \keys_set:nn { ctex / paragraph } { aftertitle = \@@par , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / paragraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_three @@ -114,15 +127,15 @@ \keys_set:nn { ctex / subparagraph } { aftertitle = \@@par , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / subparagraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def index fac90d7aea7..61d509648d8 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def @@ -26,42 +26,47 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Plain scheme for report (CTEX)} \ProvidesExplFile{ctex-scheme-plain-report.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} \keys_set:nn { ctex / part } { aftertitle = \par , name = \partname \space , number = \thepart , - format = \centering , - nameformat = \huge \bfseries , aftername = \par \vskip 20 \p@ , + beforeskip = 0pt \@plus 1fil , + afterskip = 0pt \@plus 1fil , pagestyle = plain , + format = \centering , + nameformat = \huge \bfseries , titleformat = \Huge \bfseries } \keys_set:nn { ctex / chapter } { pagestyle = plain , - nameformat = \huge \bfseries , aftertitle = \par , + beforeskip = 50 \p@ , afterskip = 40 \p@ , name = \chaptername \space , number = \thechapter , format = \raggedright , + nameformat = \huge \bfseries , aftername = \par \nobreak \vskip 20 \p@ , titleformat = \Huge \bfseries , - beforeskip = -50 \p@ + afterindent = false } \keys_set:nn { ctex / section } { number = \thesection , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.5ex \@plus 1ex \@minus .2ex , afterskip = 2.3ex \@plus .2ex , + runin = false , format = \Large \bfseries , - beforeskip = -3.5ex \@plus -1ex \@minus -.2ex + afterindent = false } \keys_set:nn { ctex / subsection } { @@ -69,8 +74,10 @@ format = \large \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex + runin = false , + afterindent = false } \keys_set:nn { ctex / subsubsection } { @@ -78,35 +85,41 @@ format = \normalsize \bfseries , aftername = \quad , aftertitle = \@@par , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex + runin = false , + afterindent = false } \keys_set:nn { ctex / paragraph } { number = \theparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = false } \keys_set:nn { ctex / subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , - aftername = \quad + aftername = \quad , + beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + afterindent = false } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two { \keys_set:nn { ctex / paragraph } { aftertitle = \@@par , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / paragraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_three @@ -114,15 +127,15 @@ \keys_set:nn { ctex / subparagraph } { aftertitle = \@@par , - beforeskip = -3.25ex \@plus -1ex \@minus -.2ex , - afterskip = 1ex \@plus .2ex + afterskip = 1ex \@plus .2ex , + runin = false } } { \keys_set:nn { ctex / subparagraph } { - beforeskip = 3.25ex \@plus 1ex \@minus .2ex , - afterskip = -1em + afterskip = 1em , + runin = true } } \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def index 7823ef28251..c3cee4ceabb 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ {Plain scheme for generic (CTEX)} \ProvidesExplFile{ctex-scheme-plain.def} - {\ExplFileDate}{2.1}{\ExplFileDescription} + {\ExplFileDate}{2.2}{\ExplFileDescription} %% %% %% End of file `ctex-scheme-plain.def'. |