summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ctex/ctexart.cls
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-10-25 20:39:25 +0000
committerKarl Berry <karl@freefriends.org>2016-10-25 20:39:25 +0000
commitebb5a88807ee66de22c4803faa1a8e9ad8ffa5bf (patch)
tree63748ec3e9ff6f0b11306a01d7a8db7f3c991211 /Master/texmf-dist/tex/latex/ctex/ctexart.cls
parent9d7bc14f69e65d3edee3b625e7798a15d4e05194 (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/ctexart.cls')
-rw-r--r--Master/texmf-dist/tex/latex/ctex/ctexart.cls71
1 files changed, 54 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctexart.cls b/Master/texmf-dist/tex/latex/ctex/ctexart.cls
index 3612b6c88c7..e6d741c764a 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 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 article (CTEX)}
\ProvidesExplClass{ctexart}
- {\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
@@ -649,10 +649,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 =
@@ -713,6 +720,8 @@
{ \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:Npn \CTEX@addtocline #1#2
+ { \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } }
\renewcommand\part{%
\if@noskipsec \leavevmode \fi
\par
@@ -731,17 +740,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}%
{\interlinepenalty \@M
\normalfont \parindent \dimexpr \CTEX@part@indent \relax \CTEX@part@format
\ifnum \c@secnumdepth >\m@ne \ifodd \CTEX@part@numbering
@@ -810,15 +817,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
@@ -826,9 +831,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{%
@@ -836,7 +839,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}%
@@ -870,19 +873,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
{
@@ -896,6 +927,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 }
{
@@ -1128,13 +1161,17 @@
}
}
}
-\ctex_patch_cmd:Nnn \ps@headings
- { \ifnum \c@secnumdepth > \z@ \thesection \quad \fi }
- { \CTEXifname { \CTEXthesection \quad } { } }
\if@twoside
\ctex_patch_cmd:Nnn \ps@headings
+ { \ifnum \c@secnumdepth > \z@ \thesection \quad \fi }
+ { \CTEXifname { \CTEXthesection \quad } { } }
+ \ctex_patch_cmd:Nnn \ps@headings
{ \ifnum \c@secnumdepth > \@ne \thesubsection \quad \fi }
{ \CTEXifname { \CTEXthesubsection \quad } { } }
+\else:
+ \ctex_patch_cmd:Nnn \ps@headings
+ { \ifnum \c@secnumdepth > \m@ne \thesection \quad \fi }
+ { \CTEXifname { \CTEXthesection \quad } { } }
\fi:
\ctex_at_end_package:nn { fancyhdr }
{