diff options
author | Karl Berry <karl@freefriends.org> | 2016-02-03 22:59:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-02-03 22:59:51 +0000 |
commit | 1290d7454b9754f3c7a7e4a229981e18f58ea6f6 (patch) | |
tree | aa01beb72d34acd81690358b54be7493a5244544 /Master/texmf-dist/tex/latex/ctex/ctexrep.cls | |
parent | e5ef88072190f4f0e310c900fd626db1dd7dc096 (diff) |
ctex (3feb16)
git-svn-id: svn://tug.org/texlive/trunk@39559 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctexrep.cls')
-rw-r--r-- | Master/texmf-dist/tex/latex/ctex/ctexrep.cls | 198 |
1 files changed, 102 insertions, 96 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctexrep.cls b/Master/texmf-dist/tex/latex/ctex/ctexrep.cls index c9f8798891e..a8d1d0d5155 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 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 4e02493 2016-02-02 17:10:17 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter for class report (CTEX)} \ProvidesExplClass{ctexrep} - {\ExplFileDate}{2.2}{\ExplFileDescription} + {\ExplFileDate}{2.3}{\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 @@ -46,10 +46,19 @@ `l3kernel'~and~`l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2014/07/20 } { } +\@ifpackagelater { expl3 } { 2015/12/20 } { } { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } -\@ifpackagelater { l3keys2e } { 2014/05/05 } { } +\@ifpackagelater { l3keys2e } { 2015/12/20 } { } { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } } +\msg_new:nnnn { ctex } { engine-not-supported } + { Engine~`#1'~is~not~yet~supported,~ctex~will~abort! } + { You~can~switch~to~xelatex,~lualatex~or~pdflatex.} +\file_if_exist:nTF { ctex-engine- \c_sys_engine_str .def } + { + \str_const:Nx \c__ctex_engine_file_str + { ctex-engine- \c_sys_engine_str .def } + } + { \msg_critical:nnx { ctex } { engine-not-supported } { \c_sys_engine_str } } \RequirePackage { ctexhook , ctexpatch } \RequirePackage { fix-cm , everysel } \tl_new:N \l__ctex_tmp_tl @@ -95,20 +104,9 @@ Please~update~an~up~to~date~version~of~the~package~`#1'\\ using~your~TeX~package~manager~or~from~CTAN. } -\cs_new_eq:NN \ctex_lua_now_x:n \luatex_directlua:D -\cs_if_exist:NTF \pdftex_pdfoutput:D - { - \int_compare:nNnTF \pdftex_pdfoutput:D > \c_zero - { - \cs_new_eq:NN \ifctexpdf \tex_iftrue:D - \cs_new_eq:NN \ctex_if_pdfmode:TF \use_i:nn - } - } - { \use:n } - { - \cs_new_eq:NN \ifctexpdf \tex_iffalse:D - \cs_new_eq:NN \ctex_if_pdfmode:TF \use_ii:nn - } +\sys_if_output_pdf:TF + { \cs_new_eq:NN \ifctexpdf \if_true: } + { \cs_new_eq:NN \ifctexpdf \if_false: } \cs_new_eq:NN \ctex_if_preamble:TF \use_i: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 @@ -123,17 +121,15 @@ \exp_after:wN \__ctex_default_pt:w \dim_use:N \etex_dimexpr:D #1 pt \scan_stop: \q_stop } -\group_begin: - \char_set_catcode_other:N \P - \char_set_catcode_other:N \T -\tex_lowercase:D +\use:x { - \group_end: - \cs_new:Npn \__ctex_default_pt:w #1 PT #2 \q_stop { #1 PT } + \cs_new:Npn \exp_not:N \__ctex_default_pt:w + ##1 \tl_to_str:n { pt } ##2 \exp_not:N \q_stop + { ##1 \tl_to_str:n { pt } } } \tl_new:N \l__ctex_encoding_tl \tl_set:Nx \l__ctex_encoding_tl - { \pdftex_if_engine:TF { GBK } { UTF8 } } + { \sys_if_engine_pdftex:TF { GBK } { UTF8 } } \bool_new:N \g__ctex_zhmCJK_bool \tl_new:N \l__ctex_autoindent_tl \cs_new_eq:NN \ctex_if_autoindent_touched:F \use:n @@ -170,11 +166,11 @@ { Option~ `zihao=-4'~ is~ set. } \keys_set:nn { ctex / option } { zihao = -4 } } , - c5size .value_forbidden: , - cs4size .value_forbidden: , + c5size .value_forbidden:n = true , + cs4size .value_forbidden:n = true , linespread .fp_set:N = \l__ctex_line_spread_fp , linespread .initial:n = { \c_nan_fp } , - linespread .value_required: , + linespread .value_required:n = true , autoindent .choice: , autoindent .default:n = { true } , autoindent / true .code:n = @@ -201,7 +197,7 @@ options.~ } } , - indent .value_forbidden: , + indent .value_forbidden:n = true , noindent .code:n = { \msg_warning:nnn { ctex } { deprecated-option } @@ -211,11 +207,11 @@ options. } } , - noindent .value_forbidden: , + noindent .value_forbidden:n = true , GBK .code:n = { \tl_set:Nn \l__ctex_encoding_tl { GBK } } , UTF8 .code:n = { \tl_set:Nn \l__ctex_encoding_tl { UTF8 } } , - GBK .value_forbidden: , - UTF8 .value_forbidden: , + GBK .value_forbidden:n = true , + UTF8 .value_forbidden:n = true , fontset .tl_gset:N = \g__ctex_fontset_tl , nofonts .code:n = { @@ -244,9 +240,9 @@ } \keys_set:nn { ctex / option } { fontset = windows } } , - nofonts .value_forbidden: , - winfonts .value_forbidden: , - adobefonts .value_forbidden: , + nofonts .value_forbidden:n = true , + winfonts .value_forbidden:n = true , + adobefonts .value_forbidden:n = true , zhmap .choice: , zhmap .default:n = { true } , zhmap / zhmCJK .code:n = @@ -270,7 +266,7 @@ { Option~ `zhmap=false'~ is~ set. } \keys_set:nn { ctex / option } { zhmap = false } } , - nozhmap .value_forbidden: , + nozhmap .value_forbidden:n = true , punct .tl_set:N = \l__ctex_punct_tl , punct .default:n = { quanjiao } , punct .initial:n = { quanjiao } , @@ -280,7 +276,7 @@ { Option~ `punct=plain'~ is~ set. } \keys_set:nn { ctex / option } { punct = plain } } , - nopunct .value_forbidden: , + nopunct .value_forbidden:n = true , space .choices:nn = { true , auto , false } { @@ -294,14 +290,14 @@ { Option~ `space=false'~ is~ set. } \keys_set:nn { ctex / option } { space = false } } , - nospace .value_forbidden: , + nospace .value_forbidden:n = true , heading .bool_set:N = \l__ctex_heading_bool , sub3section .code:n = { \cs_gset_eq:NN \g__ctex_section_depth_flag \c_three } , sub4section .code:n = { \cs_gset_eq:NN \g__ctex_section_depth_flag \c_four } , - sub3section .value_forbidden: , - sub4section .value_forbidden: , + sub3section .value_forbidden:n = true , + sub4section .value_forbidden:n = true , scheme .tl_set:N = \l__ctex_scheme_tl , scheme .default:n = { chinese } , scheme .initial:n = { chinese } , @@ -317,8 +313,8 @@ { Option~ `scheme = plain' ~ is~ set. } \keys_set:nn { ctex / option } { scheme = plain } } , - cap .value_forbidden: , - nocap .value_forbidden: , + cap .value_forbidden:n = true , + nocap .value_forbidden:n = true , fntef .code:n = { \msg_warning:nnn { ctex } { deprecated-option } @@ -356,7 +352,7 @@ \cs_gset_eq:NN \g__ctex_font_size_flag \c_two \clist_gput_right:Nn \g__ctex_std_options_clist {#1} } , - #1 .value_forbidden: , + #1 .value_forbidden:n = true , } } \use:x { \keys_define:nn { ctex / option } { \exp_not:o { \l__ctex_tmp_tl } } } @@ -398,17 +394,7 @@ \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 { \PassOptionsToPackage {#1} { hyperref } } } -\pdftex_if_engine:TF - { - \tl_set:Nx \l__ctex_encoding_tl { \l__ctex_encoding_tl } - \ctex_file_input:n { ctex-engine-pdftex.def } - } - { - \tl_set:Nn \l__ctex_encoding_tl { UTF8 } - \xetex_if_engine:TF - { \ctex_file_input:n { ctex-engine-xetex.def } } - { \ctex_file_input:n { ctex-engine-luatex.def } } - } +\ctex_file_input:n { \c__ctex_engine_file_str } \keys_define:nn { ctex } { autoindent .choice: , @@ -450,7 +436,7 @@ \ctex_set_default_ccwd:Nn \l__ctex_line_stretch_tl {#1} \ctex_select_size: } , - linestretch .value_required: + linestretch .value_required:n = true } \tl_new:N \l__ctex_line_stretch_tl \tl_set:Nn \l__ctex_line_stretch_tl { \ccwd } @@ -597,7 +583,6 @@ 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 } @@ -617,20 +602,22 @@ } \tl_const:cx { CTEX@#1name } { - \exp_not:c { CTEX@#1@nameformat } - { - \exp_not:c { CTEX@pre#1 } - \exp_not:N \tl_if_empty:NTF \exp_not:c { CTEX@#1@numberformat } - { \exp_not:c { CTEX@the#1 } } - { - \group_begin: - \exp_not:c { CTEX@#1@numberformat } - \exp_not:c { CTEX@the#1 } - \group_end: - } - \exp_not:c { CTEX@post#1 } - } - \exp_not:c { CTEX@#1@aftername } + \group_begin: + \exp_not:c { CTEX@#1@nameformat } + { + \exp_not:c { CTEX@pre#1 } + \exp_not:N \tl_if_empty:NTF + \exp_not:c { CTEX@#1@numberformat } + { \exp_not:c { CTEX@the#1 } } + { + \group_begin: + \exp_not:c { CTEX@#1@numberformat } + \exp_not:c { CTEX@the#1 } + \group_end: + } + \exp_not:c { CTEX@post#1 } + } + \group_end: } } \cs_new_protected_nopar:Npn \__ctex_def_heading_keys:n #1 @@ -655,35 +642,23 @@ #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 = - { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , #1 / nameformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , - #1 / nameformat~+ .code:n = - { \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } , #1 / numberformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , - #1 / numberformat~+ .code:n = - { \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } , #1 / aftername+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , - #1 / aftername~+ .code:n = - { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } , #1 / titleformat+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , - #1 / titleformat~+ .code:n = - { \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } , #1 / aftertitle+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , - #1 / aftertitle~+ .code:n = - { \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } , #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: , + #1 / beforeskip .value_required:n = true , + #1 / afterskip .value_required:n = true , + #1 / indent .value_required:n = true , } } \NewDocumentCommand \ctex_assign_heading_name:nn @@ -742,7 +717,7 @@ {\interlinepenalty \@M \normalfont \CTEX@part@format \ifnum \c@secnumdepth >-2\relax \ifodd \CTEX@part@numbering - \CTEX@partname + \CTEX@partname \CTEX@part@aftername \fi \fi \CTEX@part@titleformat{#2}% \CTEX@part@aftertitle}% @@ -804,7 +779,7 @@ \CTEX@chapter@format \ifnum \c@secnumdepth >\m@ne \ifodd \CTEX@chapter@numbering - \CTEX@chaptername + \CTEX@chaptername \CTEX@chapter@aftername \fi \fi \interlinepenalty\@M @@ -841,9 +816,7 @@ {\@ssect{#3}{#4}{#5}{#6}}% {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} \def\@seccntformat#1{% - \@ifundefined{CTEX@#1name}% - {\csname the#1\endcsname\quad}% - {\csname CTEX@#1name\endcsname}} + \csname CTEX@#1name\endcsname \csname CTEX@#1@aftername\endcsname} \def\@sect#1#2#3#4#5#6[#7]#8{% \ifnum #2>\c@secnumdepth \let\@svsec\@empty @@ -868,9 +841,7 @@ \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \ifodd \csname CTEX@#1@numbering\endcsname - \protect\numberline{\@ifundefined{CTEXthe#1}% - {\csname the#1\endcsname}% - {\csname CTEXthe#1\endcsname}}% + \protect\numberline{\csname CTEXthe#1\endcsname}% \fi \fi #7}% @@ -884,9 +855,7 @@ \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \ifodd \csname CTEX@#1@numbering\endcsname - \protect\numberline{\@ifundefined{CTEXthe#1}% - {\csname the#1\endcsname}% - {\csname CTEXthe#1\endcsname}}% + \protect\numberline{\csname CTEXthe#1\endcsname}% \fi \fi #7}}% @@ -1040,6 +1009,43 @@ { \ctex_titlesec_hook: } } } +\group_begin: +\char_set_catcode_other:N \# +\cs_new_protected_nopar:Npn \ctex_titleps_hook: + { + \ctex_patch_cmd:Nnn \ttl@settopmark + { \protect \@namedef { the#1 } { \@nameuse { the#1 } } } + { + \protect \@namedef { the#1 } { \@nameuse { the#1 } } + \CTEX@titlepslabel@set {#1} + } + \ctex_patch_cmd:Nnn \ttl@setsubmark + { \protect \@namedef { the#1 } { } } + { + \protect \@namedef { the#1 } { } + \CTEX@titlepslabel@clear {#1} + } + \ctex_patch_cmd:Nnn \ttl@setsubmark + { \protect \@namedef { the#2 } { \@nameuse { the#2 } } } + { + \protect \@namedef { the#2 } { \@nameuse { the#2 } } + \CTEX@titlepslabel@set {#2} + } + } +\group_end: +\cs_new_nopar:Npn \CTEX@titlepslabel@set #1 + { + \cs_if_free:cF { CTEXthe#1 } + { \protect \@namedef { CTEXthe#1 } { \@nameuse { CTEXthe#1 } } } + } +\cs_new_nopar:Npn \CTEX@titlepslabel@clear #1 + { + \cs_if_free:cF { CTEXthe#1 } + { \protect \@namedef { CTEXthe#1 } { } } + } +\ctex_at_end_package:nn { titlesec } + { \cs_if_free:NF \ttl@settopmark { \ctex_titleps_hook: } } +\ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: } \cs_new_protected:Npn \CTEX@toc@width@n #1 { \hbox_set:Nn \l__ctex_tmp_box {#1} |