diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctexbook.cls')
-rw-r--r-- | Master/texmf-dist/tex/latex/ctex/ctexbook.cls | 70 |
1 files changed, 52 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctexbook.cls b/Master/texmf-dist/tex/latex/ctex/ctexbook.cls index 19394a51ba8..0944499835d 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 1fcc459 2016-04-25 13:35:13 +0800 Liu Haiyang <leoliu.pku@gmail.com> $ +\GetIdInfo$Id: ctex.dtx f745b21 2016-05-14 12:17:18 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter for class book (CTEX)} \ProvidesExplClass{ctexbook} - {\ExplFileDate}{2.4}{\ExplFileDescription} + {\ExplFileDate}{2.4.1}{\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,15 +50,17 @@ { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } \@ifpackagelater { l3keys2e } { 2015/12/20 } { } { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } } +\str_const:Nx \c__ctex_engine_str + { \cs_if_exist:NTF \ngostype { aptex } { \c_sys_engine_str } } \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 } + { You~can~switch~to~xelatex,~lualatex,~pdflatex,~uplatex,~or~aplatex. } +\file_if_exist:nTF { ctex-engine- \c__ctex_engine_str .def } { \str_const:Nx \c__ctex_engine_file_str - { ctex-engine- \c_sys_engine_str .def } + { ctex-engine- \c__ctex_engine_str .def } } - { \msg_critical:nnx { ctex } { engine-not-supported } { \c_sys_engine_str } } + { \msg_critical:nnx { ctex } { engine-not-supported } { \c__ctex_engine_str } } \RequirePackage { ctexhook , ctexpatch } \RequirePackage { fix-cm , everysel } \tl_new:N \l__ctex_tmp_tl @@ -150,7 +152,7 @@ \keys_define:nn { ctex / option } { zihao .choice: , - zihao .default:n = { 5 } , + zihao .value_required:n = true , zihao / 5 .code:n = { \cs_gset_eq:NN \g__ctex_font_size_flag \c_zero } , zihao / -4 .code:n = { \cs_gset_eq:NN \g__ctex_font_size_flag \c_one } , zihao / false .code:n = { \cs_gset_eq:NN \g__ctex_font_size_flag \c_two } , @@ -534,15 +536,17 @@ } \PassOptionsToPackage { encoding = \l__ctex_encoding_tl } { zhnumber } \RequirePackage { zhnumber } -\cs_new_eq:NN \chinese \zhnum +\cs_new_nopar:Npn \chinese { \zhnum_counter:n } +\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 } + \AddEnumerateCounter * { \zhnum } { \@zhnum } { 1 } + \AddEnumerateCounter * { \zhdig } { \@zhdig } { 1 } + \AddEnumerateCounter * { \chinese } { \@chinese } { 1 } } } \NewDocumentCommand \CTEXnumber { m m } @@ -672,21 +676,36 @@ { \tl_clear:c { CTEX@post#1 } } { \tl_set:cn { CTEX@post#1 } {#3} } } +\group_begin: \tl_set:Nn \l__ctex_tmp_tl { - part / pagestyle .tl_set:N = \CTEX@part@pagestyle , - chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle , + part / pagestyle .tl_set:N = \CTEX@part@pagestyle , + chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle , + part / fixbeforeskip .bool_set:N = \CTEX@part@fixbeforeskip , + chapter / fixbeforeskip .bool_set:N = \CTEX@chapter@fixbeforeskip , } \seq_map_inline:Nn \c__ctex_headings_seq { \__ctex_initial_heading:n {#1} \__ctex_def_heading_keys:n {#1} } -\use:x { \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } } -\tl_clear:N \l__ctex_tmp_tl +\use:x + { + \group_end: + \keys_define:nn { ctex } { \exp_not:o { \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 } } +\cs_new_protected_nopar:Npn \CTEX@fixbeforeskip + { + \par + \ifdim \pagegoal = \maxdimen + \advance \@tempskipa -\topskip + \advance \@tempskipa -\parskip + \nointerlineskip + \fi + } \renewcommand\part{% \if@openright \cleardoublepage @@ -700,7 +719,11 @@ \else \@tempswafalse \fi - \null\vskip \glueexpr \CTEX@part@beforeskip \relax + \@tempskipa = \glueexpr \CTEX@part@beforeskip \relax + \ifodd \CTEX@part@fixbeforeskip + \CTEX@fixbeforeskip + \fi + \vspace*{\@tempskipa}% \secdef\@part\@spart} \def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax @@ -779,7 +802,11 @@ \@afterheading \fi} \def\@makechapterhead#1{% - \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + \@tempskipa = \glueexpr \CTEX@chapter@beforeskip \relax + \ifodd \CTEX@chapter@fixbeforeskip + \CTEX@fixbeforeskip + \fi + \vspace*{\@tempskipa}% {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax \CTEX@chapter@format \ifnum \c@secnumdepth >\m@ne @@ -796,7 +823,11 @@ \vskip \glueexpr \CTEX@chapter@afterskip \relax }} \def\@makeschapterhead#1{% - \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}% + \@tempskipa = \glueexpr \CTEX@chapter@beforeskip \relax + \ifodd \CTEX@chapter@fixbeforeskip + \CTEX@fixbeforeskip + \fi + \vspace*{\@tempskipa}% {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax \CTEX@chapter@format \interlinepenalty\@M @@ -1327,6 +1358,7 @@ %% ctexbook.cls, %% ctexrep.cls, %% ctexbeamer.cls, +%% ctxdoc.cls, %% ctexcap.sty, %% ctexhook.sty, %% ctexpatch.sty, @@ -1353,6 +1385,7 @@ %% ctex-engine-pdftex.def, %% ctex-engine-xetex.def, %% ctex-engine-luatex.def, +%% ctex-engine-aptex.def, %% ctex-engine-uptex.def, %% c19rm.fd, %% c19sf.fd, @@ -1372,6 +1405,7 @@ %% ctexpunct.spa, %% ctexmakespa.tex, %% ctexspamacro.tex, +%% ctxdocstrip.tex, %% zhadobefonts.tex, %% zhfandolfonts.tex, %% zhfounderfonts.tex, @@ -1379,6 +1413,6 @@ %% zhwindowsfonts.tex, %% translator-theorem-dictionary-ChineseGBK.dict, %% translator-theorem-dictionary-ChineseUTF8.dict, and -%% README. +%% README.md. %% %% End of file `ctexbook.cls'. |