summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ctex/ctexrep.cls
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctexrep.cls')
-rw-r--r--Master/texmf-dist/tex/latex/ctex/ctexrep.cls82
1 files changed, 50 insertions, 32 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctexrep.cls b/Master/texmf-dist/tex/latex/ctex/ctexrep.cls
index 8d63adcb8df..7434d7e5ac2 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 f12457f 2016-05-16 00:55:34 +0800 Qing Lee <sobenlee@gmail.com> $
+\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee@gmail.com> $
{Chinese adapter for class report (CTEX)}
\ProvidesExplClass{ctexrep}
- {\ExplFileDate}{2.4.2}{\ExplFileDescription}
+ {\ExplFileDate}{2.4.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
@@ -575,6 +575,11 @@
\msg_new:nnnn { ctex } { today-undef }
{ Today~format~`#1'~is~undefined. }
{ Available~today~formats~are~`old',~`small',~and~`big'. }
+\tl_if_exist:NF \proofname
+ {
+ \tl_new:N \proofname
+ \tl_set:Nn \proofname { Proof }
+ }
\keys_define:nn { ctex }
{
contentsname .tl_set:N = \contentsname ,
@@ -644,6 +649,7 @@
#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 / fixskip .bool_set:N = \exp_not:c { CTEX@#1@fixskip } ,
#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 } } ,
@@ -679,10 +685,8 @@
\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 / fixbeforeskip .bool_set:N = \CTEX@part@fixbeforeskip ,
- chapter / fixbeforeskip .bool_set:N = \CTEX@chapter@fixbeforeskip ,
+ part / pagestyle .tl_set:N = \CTEX@part@pagestyle ,
+ chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle ,
}
\seq_map_inline:Nn \c__ctex_headings_seq
{
@@ -697,15 +701,22 @@
\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
+\cs_new_protected_nopar:Npn \CTEX@fixtopskip
+ {
+ \CTEX@fixheadingskip
+ \dim_compare:nNnF \tex_pagegoal:D < \c_max_dim
+ { \skip_sub:Nn \l__ctex_heading_skip { \tex_topskip:D } }
+ }
+\cs_new_protected_nopar:Npn \CTEX@fixheadingskip
{
\par
- \ifdim \pagegoal = \maxdimen
- \advance \@tempskipa -\topskip
- \advance \@tempskipa -\parskip
- \nointerlineskip
- \fi
+ \dim_set:Nn \tex_prevdepth:D { -1000pt }
+ \skip_sub:Nn \l__ctex_heading_skip { \tex_parskip:D }
}
+\skip_new:N \l__ctex_heading_skip
+\cs_new_protected_nopar:Npn \CTEX@setheadingskip
+ { \skip_set:Nn \l__ctex_heading_skip }
+\cs_new_eq:NN \CTEX@headingskip \l__ctex_heading_skip
\renewcommand\part{%
\if@openright
\cleardoublepage
@@ -719,11 +730,9 @@
\else
\@tempswafalse
\fi
- \@tempskipa = \glueexpr \CTEX@part@beforeskip \relax
- \ifodd \CTEX@part@fixbeforeskip
- \CTEX@fixbeforeskip
- \fi
- \vspace*{\@tempskipa}%
+ \CTEX@setheadingskip \CTEX@part@beforeskip
+ \ifodd \CTEX@part@fixskip \CTEX@fixtopskip \fi
+ \vspace*{\CTEX@headingskip}%
\secdef\@part\@spart}
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax
@@ -753,7 +762,9 @@
\CTEX@part@aftertitle}%
\@endpart}
\def\@endpart{%
- \vskip \glueexpr \CTEX@part@afterskip \relax
+ \CTEX@setheadingskip \CTEX@part@afterskip
+ \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi
+ \vskip \CTEX@headingskip
\newpage
\if@twoside
\if@openright
@@ -798,11 +809,9 @@
\@afterheading
\fi}
\def\@makechapterhead#1{%
- \@tempskipa = \glueexpr \CTEX@chapter@beforeskip \relax
- \ifodd \CTEX@chapter@fixbeforeskip
- \CTEX@fixbeforeskip
- \fi
- \vspace*{\@tempskipa}%
+ \CTEX@setheadingskip \CTEX@chapter@beforeskip
+ \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi
+ \vspace*{\CTEX@headingskip}%
{\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax
\CTEX@chapter@format
\ifnum \c@secnumdepth >\m@ne
@@ -814,21 +823,23 @@
\CTEX@chapter@titleformat{#1}%
\CTEX@chapter@aftertitle
\nobreak
- \vskip \glueexpr \CTEX@chapter@afterskip \relax
+ \CTEX@setheadingskip \CTEX@chapter@afterskip
+ \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi
+ \vskip \CTEX@headingskip
}}
\def\@makeschapterhead#1{%
- \@tempskipa = \glueexpr \CTEX@chapter@beforeskip \relax
- \ifodd \CTEX@chapter@fixbeforeskip
- \CTEX@fixbeforeskip
- \fi
- \vspace*{\@tempskipa}%
+ \CTEX@setheadingskip \CTEX@chapter@beforeskip
+ \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi
+ \vspace*{\CTEX@headingskip}%
{\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax
\CTEX@chapter@format
\interlinepenalty\@M
\CTEX@chapter@titleformat{#1}
\CTEX@chapter@aftertitle
\nobreak
- \vskip \glueexpr \CTEX@chapter@afterskip \relax
+ \CTEX@setheadingskip \CTEX@chapter@afterskip
+ \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi
+ \vskip \CTEX@headingskip
}}
\def\@startsection#1#2#3#4#5#6{%
\if@noskipsec \leavevmode \fi
@@ -842,7 +853,10 @@
\if@nobreak
\everypar{}%
\else
- \addpenalty\@secpenalty\addvspace{\glueexpr #4\relax}%
+ \addpenalty\@secpenalty
+ \CTEX@setheadingskip{#4}%
+ \ifodd \CTEX@fixskip \CTEX@fixheadingskip \fi
+ \addvspace \CTEX@headingskip
\fi
\@ifstar
{\@ssect{#3}{#4}{#5}{#6}}%
@@ -910,7 +924,9 @@
\def\@xsect#1{%
\unless \ifodd \CTEX@runin
\par \nobreak
- \vskip\glueexpr #1\relax
+ \CTEX@setheadingskip{#1}%
+ \ifodd \CTEX@fixskip \CTEX@fixheadingskip \fi
+ \vskip \CTEX@headingskip
\@afterheading
\else
\@nobreakfalse
@@ -934,11 +950,13 @@
\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@fixskip { CTEX@#1@fixskip }
\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@fixskip \c_false_bool
\cs_new_eq:NN \CTEX@runin \c_false_bool
\int_zero:N \l__ctex_tmp_int
\seq_map_inline:Nn \c__ctex_section_headings_seq