diff options
author | Karl Berry <karl@freefriends.org> | 2016-10-25 20:39:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-10-25 20:39:25 +0000 |
commit | ebb5a88807ee66de22c4803faa1a8e9ad8ffa5bf (patch) | |
tree | 63748ec3e9ff6f0b11306a01d7a8db7f3c991211 /Master/texmf-dist/tex/latex/ctex/ctex-book.def | |
parent | 9d7bc14f69e65d3edee3b625e7798a15d4e05194 (diff) |
ctex (25oct16)
git-svn-id: svn://tug.org/texlive/trunk@42351 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctex-book.def')
-rw-r--r-- | Master/texmf-dist/tex/latex/ctex/ctex-book.def | 91 |
1 files changed, 70 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-book.def b/Master/texmf-dist/tex/latex/ctex/ctex-book.def index 86392ce643d..eb9c50e0184 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-book.def +++ b/Master/texmf-dist/tex/latex/ctex/ctex-book.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\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> $ {Heading modification for book (CTEX)} \ProvidesExplFile{ctex-book.def} - {\ExplFileDate}{2.4.4}{\ExplFileDescription} + {\ExplFileDate}{2.4.5}{\ExplFileDescription} \seq_new:N \c__ctex_section_headings_seq \seq_gset_from_clist:Nn \c__ctex_section_headings_seq { section , subsection , subsubsection , paragraph , subparagraph } @@ -87,10 +87,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 = @@ -127,6 +134,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 { @@ -161,6 +174,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}% @@ -179,17 +209,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 @@ -239,26 +267,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 @@ -345,15 +368,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 @@ -361,9 +382,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{% @@ -371,7 +390,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}% @@ -405,19 +424,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 { @@ -431,6 +478,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 } { |