summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ctex/ctexbook.cls
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctexbook.cls')
-rw-r--r--Master/texmf-dist/tex/latex/ctex/ctexbook.cls91
1 files changed, 70 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctexbook.cls b/Master/texmf-dist/tex/latex/ctex/ctexbook.cls
index fe02ff541c7..8c723dfe13b 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 b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee@gmail.com> $
+\GetIdInfo$Id: ctex.dtx 575f038 2016-10-25 17:56:58 +0800 Qing Lee <sobenlee@gmail.com> $
{Chinese adapter for class book (CTEX)}
\ProvidesExplClass{ctexbook}
- {\ExplFileDate}{2.4.4}{\ExplFileDescription}
+ {\ExplFileDate}{2.4.5}{\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
@@ -650,10 +650,17 @@
#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 / hang .bool_set:N = \exp_not:c { CTEX@#1@hang } ,
+ #1 / hang .initial:n = true ,
#1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } ,
#1 / break .tl_set:N = \exp_not:c { CTEX@#1@break } ,
#1 / break+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@break } { ####1 } } ,
+ #1 / tocline .code:n =
+ {
+ \cs_set:Npn \exp_not:c { CTEX@#1@tocline}
+ \exp_not:n { ####1####2 } { ####1 }
+ } ,
#1 / format+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } ,
#1 / nameformat+ .code:n =
@@ -690,6 +697,12 @@
{
part / pagestyle .tl_set:N = \CTEX@part@pagestyle ,
chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle ,
+ chapter / lofskip .tl_set:N = \CTEX@chapter@lofskip ,
+ chapter / lotskip .tl_set:N = \CTEX@chapter@lotskip ,
+ chapter / lofskip .initial:n = \c_zero_skip ,
+ chapter / lotskip .initial:n = \c_zero_skip ,
+ chapter / lofskip .value_required:n = true ,
+ chapter / lotskip .value_required:n = true ,
}
\seq_map_inline:Nn \c__ctex_headings_seq
{
@@ -724,6 +737,23 @@
{ \cs_set_eq:NN \CTEXifname \use_i:nn }
\cs_new_protected_nopar:Npn \CTEX@ifnamefalse
{ \cs_set_eq:NN \CTEXifname \use_ii:nn }
+\cs_new_protected_nopar:Npn \CTEX@addloflotskip #1
+ {
+ \skip_set:Nn \l__ctex_heading_skip { \use:c { CTEX@#1@lofskip } }
+ \skip_if_eq:nnF { \l__ctex_heading_skip } { \c_zero_skip }
+ {
+ \addtocontents { lof }
+ { \protect \addvspace { \skip_use:N \l__ctex_heading_skip } }
+ }
+ \skip_set:Nn \l__ctex_heading_skip { \use:c { CTEX@#1@lotskip } }
+ \skip_if_eq:nnF { \l__ctex_heading_skip } { \c_zero_skip }
+ {
+ \addtocontents { lot }
+ { \protect \addvspace { \skip_use:N \l__ctex_heading_skip } }
+ }
+ }
+\cs_new_protected:Npn \CTEX@addtocline #1#2
+ { \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } }
\renewcommand\part{%
\CTEX@part@break
\thispagestyle{\CTEX@part@pagestyle}%
@@ -742,17 +772,15 @@
\ifodd \CTEX@part@numbering
\CTEX@ifnametrue
\refstepcounter{part}%
- \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
\else
\CTEX@ifnamefalse
\CTEX@makeanchor{part*}%
- \addcontentsline{toc}{part}{#1}%
\fi
\else
\CTEX@ifnamefalse
- \CTEX@makeanchor@part{part*}%
- \addcontentsline{toc}{part}{#1}%
+ \CTEX@makeanchor{part*}%
\fi
+ \CTEX@addtocline{part}{#1}%
\partmark{#1}%
{\interlinepenalty \@M
\normalfont \CTEX@part@format
@@ -802,26 +830,21 @@
\CTEX@ifnametrue
\refstepcounter{chapter}%
\typeout{\CTEXthechapter}%
- \addcontentsline{toc}{chapter}
- {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}%
\else
\CTEX@ifnamefalse
\CTEX@makeanchor{\Hy@chapapp*}%
- \addcontentsline{toc}{chapter}{#1}%
\fi
\else
\CTEX@ifnamefalse
\CTEX@makeanchor@chapter{\Hy@chapapp*}%
- \addcontentsline{toc}{chapter}{#1}%
\fi
\else
\CTEX@ifnamefalse
\CTEX@makeanchor@chapter{\Hy@chapapp*}%
- \addcontentsline{toc}{chapter}{#1}%
\fi
+ \CTEX@addtocline{chapter}{#1}%
\chaptermark{#1}%
- \addtocontents{lof}{\protect\addvspace{10\p@}}%
- \addtocontents{lot}{\protect\addvspace{10\p@}}%
+ \CTEX@addloflotskip{chapter}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
@@ -908,15 +931,13 @@
\unless \ifodd \CTEX@runin
\begingroup
#6{%
- \@hangfrom{\hskip\glueexpr #3\relax\@svsec}%
+ \CTEX@hangfrom{\hskip\glueexpr #3\relax\@svsec}%
\interlinepenalty \@M
\csname CTEX@#1@titleformat\endcsname{#8}%
\csname CTEX@#1@aftertitle\endcsname}%
\endgroup
\csname #1mark\endcsname{#7}%
- \addcontentsline{toc}{#1}{%
- \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
- #7}%
+ \CTEX@addtocline{#1}{#7}%
\else
\def\@svsechd{%
#6{\hskip\glueexpr #3\relax
@@ -924,9 +945,7 @@
\csname CTEX@#1@titleformat\endcsname{#8}%
\csname CTEX@#1@aftertitle\endcsname}%
\csname #1mark\endcsname{#7}%
- \addcontentsline{toc}{#1}{%
- \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
- #7}}%
+ \CTEX@addtocline{#1}{#7}}%
\fi
\@xsect{#5}}
\def\@ssect#1#2#3#4#5{%
@@ -934,7 +953,7 @@
\unless \ifodd \CTEX@runin
\begingroup
#4{%
- \@hangfrom{\hskip\glueexpr #1\relax}%
+ \CTEX@hangfrom{\hskip\glueexpr #1\relax}%
\interlinepenalty \@M
\CTEX@titleformat@n{#5}%
\CTEX@aftertitle}%
@@ -968,19 +987,47 @@
\fi}%
\fi
\ignorespaces}
+\cs_new_protected_nopar:Npn \CTEX@hangfrom
+ {
+ \bool_if:NTF \CTEX@hang
+ { \@hangfrom }
+ { \noindent \use:n }
+ }
\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1
{
\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@hang { CTEX@#1@hang }
\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@hang \c_true_bool
\cs_new_eq:NN \CTEX@runin \c_false_bool
+\cs_new:Npn \CTEX@part@tocline #1#2
+ {
+ \CTEXifname
+ { \CTEXthepart \hspace { 1em } }
+ { }
+ #2
+ }
+\cs_new:Npn \CTEX@chapter@tocline #1#2
+ {
+ \CTEXifname
+ { \protect \numberline { \CTEXthechapter \hspace { .3em } } }
+ { }
+ #2
+ }
+\cs_new_nopar:Npn \CTEXnumberline #1
+ {
+ \CTEXifname
+ { \protect \numberline { \use:c { CTEXthe #1 } } }
+ { }
+ }
\int_zero:N \l__ctex_tmp_int
\seq_map_inline:Nn \c__ctex_section_headings_seq
{
@@ -994,6 +1041,8 @@
{ \exp_not:c { CTEX@#1@afterskip } }
{ \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } }
}
+ \cs_new:cpn { CTEX@#1@tocline } ##1##2
+ { \CTEXnumberline { ##1 } ##2 }
}
\keys_define:nn { ctex }
{