From 5fd39aa8867152c78c0dd8676a185880b9a797b6 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 27 Aug 2016 22:15:39 +0000
Subject: ctex (27aug16)

git-svn-id: svn://tug.org/texlive/trunk@41937 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/ctex/ctexart.cls | 43 +++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 7 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/ctex/ctexart.cls')

diff --git a/Master/texmf-dist/tex/latex/ctex/ctexart.cls b/Master/texmf-dist/tex/latex/ctex/ctexart.cls
index 853d0e50cdb..3daee3bd597 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 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 article (CTEX)}
 \ProvidesExplClass{ctexart}
-  {\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 ,
@@ -643,6 +648,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 } } ,
@@ -690,10 +696,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@fixheadingskip
+  {
+    \par
+    \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@noskipsec \leavevmode \fi
    \par
-   \addvspace{\glueexpr\CTEX@part@beforeskip\relax}%
+   \CTEX@setheadingskip \CTEX@part@beforeskip
+   \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi
+   \addvspace \CTEX@headingskip
    \ifodd \CTEX@part@afterindent
      \@afterindenttrue
    \else
@@ -721,7 +739,9 @@
    \markboth{}{}%
    \CTEX@part@aftertitle}%
   \nobreak
-  \vskip \glueexpr \CTEX@part@afterskip \relax
+  \CTEX@setheadingskip \CTEX@part@afterskip
+  \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi
+  \vskip \CTEX@headingskip
   \@afterheading}
 \def\@spart#1{%
     {\interlinepenalty \@M
@@ -730,7 +750,9 @@
      \CTEX@part@titleformat{#1}%
      \CTEX@part@aftertitle}%
      \nobreak
-     \vskip \glueexpr \CTEX@part@afterskip \relax
+     \CTEX@setheadingskip \CTEX@part@afterskip
+     \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi
+     \vskip \CTEX@headingskip
      \@afterheading}
 \def\@startsection#1#2#3#4#5#6{%
   \if@noskipsec \leavevmode \fi
@@ -744,7 +766,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}}%
@@ -812,7 +837,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
@@ -836,11 +863,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
-- 
cgit v1.2.3

