Skip to content

Commit

Permalink
ctex: 更好地兼容 nameref 宏包。
Browse files Browse the repository at this point in the history
  • Loading branch information
qinglee committed May 29, 2019
1 parent ee88dc4 commit 616e7b5
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion ctex/ctex.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ Copyright and Licence
% \changes{v2.4.15}{2019/03/23}{同步 \LaTeXiii{} 2019/03/05。}
%
%
% \CheckSum{5916}
% \CheckSum{5934}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
Expand Down Expand Up @@ -7375,6 +7375,7 @@ Copyright and Licence
\CTEX@makeanchor{part*}%
% \addcontentsline{toc}{part}{#1}%
\fi
\CTEX@gettitle{#1}%
\CTEX@addtocline{part}{#1}%
{\interlinepenalty \@M
% \normalfont \parindent \z@ \raggedright
Expand Down Expand Up @@ -7414,6 +7415,7 @@ Copyright and Licence
\CTEX@makeanchor{part*}%
% \addcontentsline{toc}{part}{#1}%
\fi
\CTEX@gettitle{#1}%
\CTEX@addtocline{part}{#1}%
% \markboth{}{}%
\partmark{#1}%
Expand All @@ -7440,6 +7442,7 @@ Copyright and Licence
\def\@spart#1{%
\CTEX@ifnamefalse
\CTEX@makeanchor@spart{part*}%
\CTEX@gettitle{#1}%
{\interlinepenalty \@M
% \normalfont \parindent \z@ \raggedright
\CTEX@disableautoindent
Expand All @@ -7459,6 +7462,7 @@ Copyright and Licence
\def\@spart#1{%
\CTEX@ifnamefalse
\CTEX@makeanchor@spart{part*}%
\CTEX@gettitle{#1}%
{\interlinepenalty \@M
% \normalfont \centering
\CTEX@disableautoindent
Expand Down Expand Up @@ -7550,6 +7554,7 @@ Copyright and Licence
\CTEX@makeanchor@chapter{\Hy@chapapp*}%
% \addcontentsline{toc}{chapter}{#1}%
\fi
\CTEX@gettitle{#1}%
\CTEX@addtocline{chapter}{#1}%
\chaptermark{#1}%
% \addtocontents{lof}{\protect\addvspace{10\p@}}%
Expand All @@ -7569,6 +7574,7 @@ Copyright and Licence
\def\@schapter#1{%
\CTEX@ifnamefalse
\CTEX@makeanchor@schapter{\Hy@chapapp*}%
\CTEX@gettitle{#1}%
\if@twocolumn
\@topnewpage[\@makeschapterhead{#1}]%
\else
Expand Down Expand Up @@ -7696,6 +7702,7 @@ Copyright and Licence
\let\@svsec\@empty
\fi
\fi
\CTEX@gettitle{#7}%
% \@tempskipa #5\relax
% \ifdim \@tempskipa>\z@
\unless \ifodd \CTEX@runin
Expand Down Expand Up @@ -7737,6 +7744,7 @@ Copyright and Licence
% \begin{macrocode}
\def\@ssect#1#2#3#4#5{%
\CTEX@ifnamefalse
\CTEX@gettitle{#5}%
% \@tempskipa #3\relax
% \ifdim \@tempskipa>\z@
\unless \ifodd \CTEX@runin
Expand Down Expand Up @@ -8006,6 +8014,27 @@ Copyright and Licence
}
% \end{macrocode}
%
% \paragraph{兼容 \pkg{nameref} 宏包}
%
% \changes{v2.4.16}{2019/05/29}{更好地兼容 \pkg{nameref} 宏包。}
%
% \begin{macro}[int]{\CTEX@gettitle}
% 在 \pkg{nameref} 载入后才有意义,与上述 \pkg{hyperref} 的处理类似。
% \begin{macrocode}
\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_@@_headings_cs_seq
{
\cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 }
{ \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } }
}
}
% \end{macrocode}
% \end{macro}
%
% \paragraph{兼容 \pkg{titlesec} 宏包}
%
% 我们修改了 \tn{@startsection} 的定义,它的第四个(\meta{beforeskip})和
Expand Down

0 comments on commit 616e7b5

Please sign in to comment.