summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ctex/ctexbook.cls
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-05-29 20:52:28 +0000
committerKarl Berry <karl@freefriends.org>2019-05-29 20:52:28 +0000
commit06ba56c2710363cd4256b875eb274d3c5e650438 (patch)
tree38f79a926574a27de0c2b5c0e9494f1d813510ff /Master/texmf-dist/tex/latex/ctex/ctexbook.cls
parentca76545abb30790ed39022f0f4a26ea2109c0128 (diff)
ctex (29may19)
git-svn-id: svn://tug.org/texlive/trunk@51262 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctexbook.cls')
-rw-r--r--Master/texmf-dist/tex/latex/ctex/ctexbook.cls69
1 files changed, 41 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctexbook.cls b/Master/texmf-dist/tex/latex/ctex/ctexbook.cls
index 56e9fe9dadf..bc6fab18252 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 cb8bf3c 2019-04-07 23:32:09 +0800 Qing Lee <sobenlee@gmail.com> $
+\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $
{Chinese adapter for class book (CTEX)}
\ProvidesExplClass{ctexbook}
- {\ExplFileDate}{2.4.15}{\ExplFileDescription}
+ {\ExplFileDate}{2.4.16}{\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
@@ -112,24 +112,17 @@
{ \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
+\cs_new_protected:Npn \ctex_set_default_ccwd:Nn #1#2
+ { \tl_set:Nx #1 { \__ctex_default_ccwd_aux:n {#2} } }
+\cs_new:Npn \__ctex_default_ccwd_aux:n #1
{
- \dim_compare:nNnTF
- { \ctex_default_pt:n {#2} } = { \ctex_default_pt:n { #2 ~ mm } }
- { \tl_set:Nn #1 {#2} }
- { \tl_set:Nn #1 { #2 \ccwd } }
- }
-\cs_new:Npn \ctex_default_pt:n #1
- {
- \exp_after:wN \__ctex_default_pt:w
+ \exp_not:n {#1}
+ \exp_after:wN \__ctex_default_ccwd_aux:w
\dim_use:N \tex_dimexpr:D #1 pt \scan_stop: \q_stop
}
-\use:x
- {
- \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 } }
- }
+\exp_last_unbraced:NNNNo
+ \cs_new:Npn \__ctex_default_ccwd_aux:w #1 { \tl_to_str:n { pt } } #2 \q_stop
+ { \tl_if_empty:nT {#2} { \ccwd } }
\tl_new:N \l__ctex_encoding_tl
\tl_set:Nx \l__ctex_encoding_tl
{ \sys_if_engine_pdftex:TF { GBK } { UTF8 } }
@@ -749,6 +742,8 @@
}
\cs_new_protected:Npn \CTEX@addtocline #1#2
{ \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } }
+\cs_new_protected_nopar:Npn \CTEX@disableautoindent
+ { \tl_clear:N \l__ctex_autoindent_tl }
\renewcommand\part{%
\CTEX@part@break
\thispagestyle{\CTEX@part@pagestyle}%
@@ -775,9 +770,11 @@
\CTEX@ifnamefalse
\CTEX@makeanchor{part*}%
\fi
+ \CTEX@gettitle{#1}%
\CTEX@addtocline{part}{#1}%
\partmark{#1}%
{\interlinepenalty \@M
+ \CTEX@disableautoindent
\normalfont \CTEX@part@format
\CTEX@hangindent{part}%
{\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}%
@@ -787,7 +784,9 @@
\def\@spart#1{%
\CTEX@ifnamefalse
\CTEX@makeanchor@spart{part*}%
+ \CTEX@gettitle{#1}%
{\interlinepenalty \@M
+ \CTEX@disableautoindent
\normalfont \CTEX@part@format
\CTEX@hangindent{part}{}%
\CTEX@part@titleformat{#1}%
@@ -837,6 +836,7 @@
\CTEX@ifnamefalse
\CTEX@makeanchor@chapter{\Hy@chapapp*}%
\fi
+ \CTEX@gettitle{#1}%
\CTEX@addtocline{chapter}{#1}%
\chaptermark{#1}%
\CTEX@addloflotskip{chapter}%
@@ -849,6 +849,7 @@
\def\@schapter#1{%
\CTEX@ifnamefalse
\CTEX@makeanchor@schapter{\Hy@chapapp*}%
+ \CTEX@gettitle{#1}%
\if@twocolumn
\@topnewpage[\@makeschapterhead{#1}]%
\else
@@ -859,7 +860,8 @@
\CTEX@setheadingskip \CTEX@chapter@beforeskip
\ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi
\vspace*{\CTEX@headingskip}%
- {\normalfont \CTEX@chapter@format
+ {\CTEX@disableautoindent
+ \normalfont \CTEX@chapter@format
\interlinepenalty\@M
\CTEX@hangindent{chapter}%
{\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}%
@@ -874,7 +876,8 @@
\CTEX@setheadingskip \CTEX@chapter@beforeskip
\ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi
\vspace*{\CTEX@headingskip}%
- {\normalfont \CTEX@chapter@format
+ {\CTEX@disableautoindent
+ \normalfont \CTEX@chapter@format
\interlinepenalty\@M
\CTEX@hangindent{chapter}{}%
\CTEX@chapter@titleformat{#1}%
@@ -923,6 +926,7 @@
\let\@svsec\@empty
\fi
\fi
+ \CTEX@gettitle{#7}%
\unless \ifodd \CTEX@runin
\begingroup
#6{%
@@ -945,6 +949,7 @@
\@xsect{#5}}
\def\@ssect#1#2#3#4#5{%
\CTEX@ifnamefalse
+ \CTEX@gettitle{#5}%
\unless \ifodd \CTEX@runin
\begingroup
#4{%
@@ -984,18 +989,15 @@
\ignorespaces}
\cs_new_protected:Npn \CTEX@hangindent #1#2
{
+ \dim_set:Nn \parindent { \use:c { CTEX@#1@indent } }
\bool_if:cTF { CTEX@#1@hang }
- { \@hangfrom }
- { \noindent \use:n }
- { \__ctex_indent_aux:n {#1} #2 }
+ { \@hangfrom { \__ctex_indent_aux: #2 } }
+ {#2}
}
-\cs_new_protected:Npn \__ctex_indent_aux:n #1
+\cs_new_protected_nopar:Npn \__ctex_indent_aux:
{
- \group_begin:
- \skip_set:Nn \l__ctex_heading_skip { \use:c { CTEX@#1@indent } }
- \dim_compare:nNnF \l__ctex_heading_skip = \c_zero_dim
- { \skip_horizontal:N \l__ctex_heading_skip }
- \group_end:
+ \dim_compare:nNnF \parindent = \c_zero_dim
+ { \skip_horizontal:n { \parindent } }
}
\cs_new_protected_nopar:Npn \CTEX@hangfrom
{
@@ -1115,6 +1117,17 @@
}
\CTEX@hyperheadinghook
}
+\cs_new_protected:Npn \CTEX@gettitle #1
+ { }
+\ctex_at_end_package:nn { nameref }
+ {
+ \cs_gset_protected_nopar:Npn \CTEX@gettitle { \NR@gettitle }
+ \seq_map_inline:Nn \c__ctex_headings_cs_seq
+ {
+ \cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 }
+ { \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } }
+ }
+ }
\cs_new_protected_nopar:Npn \ctex_titlesec_hook:
{
\@ifpackagewith { titlesec } { explicit }