texlive[42148] Master/texmf-dist: ctex

commits+karl at tug.org commits+karl at tug.org
Sun Sep 25 23:05:03 CEST 2016


Revision: 42148
          http://tug.org/svn/texlive?view=revision&revision=42148
Author:   karl
Date:     2016-09-25 23:05:03 +0200 (Sun, 25 Sep 2016)
Log Message:
-----------
ctex

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/ctex/ctex.pdf
    trunk/Master/texmf-dist/source/latex/ctex/ctex.dtx
    trunk/Master/texmf-dist/tex/generic/ctex/zhadobefonts.tex
    trunk/Master/texmf-dist/tex/generic/ctex/zhfandolfonts.tex
    trunk/Master/texmf-dist/tex/generic/ctex/zhfounderfonts.tex
    trunk/Master/texmf-dist/tex/generic/ctex/zhubuntufonts.tex
    trunk/Master/texmf-dist/tex/generic/ctex/zhwindowsfonts.tex
    trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg
    trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg
    trunk/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg
    trunk/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg
    trunk/Master/texmf-dist/tex/latex/ctex/ctex-article.def
    trunk/Master/texmf-dist/tex/latex/ctex/ctex-beamer.def
    trunk/Master/texmf-dist/tex/latex/ctex/ctex-book.def
    trunk/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo
    trunk/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo
    trunk/Master/texmf-dist/tex/latex/ctex/ctex-report.def
    trunk/Master/texmf-dist/tex/latex/ctex/ctex.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexart.cls
    trunk/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls
    trunk/Master/texmf-dist/tex/latex/ctex/ctexbook.cls
    trunk/Master/texmf-dist/tex/latex/ctex/ctexcap.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexheading.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexhook.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexrep.cls
    trunk/Master/texmf-dist/tex/latex/ctex/ctexsize.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexspa.def
    trunk/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls
    trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict
    trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def

Modified: trunk/Master/texmf-dist/doc/latex/ctex/ctex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/ctex/ctex.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/ctex/ctex.dtx	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/source/latex/ctex/ctex.dtx	2016-09-25 21:05:03 UTC (rev 42148)
@@ -413,7 +413,7 @@
 %<*!(c19|c70|ctexspa|dict)>
 %<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\NeedsTeXFormat{LaTeX2e}
 %<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\RequirePackage{expl3}
-%<+!driver>\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+%<+!driver>\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
 %<ctxdoc>  {ctex documentation (CTEX)}
 %<ctxdoc>\ProvidesExplClass{ctxdoc}
 %<ctex>  {Chinese adapter in LaTeX (CTEX)}
@@ -502,7 +502,7 @@
 %<founder>\ProvidesExplFile{ctex-fontset-founder.def}
 %<ubuntu>  {Ubuntu fonts definition (CTEX)}
 %<ubuntu>\ProvidesExplFile{ctex-fontset-ubuntu.def}
-%<!driver>  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+%<!driver>  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 %</!(c19|c70|ctexspa|dict)>
 %<c19&rm>\ProvidesFile{c19rm.fd}%
 %<c19&sf>\ProvidesFile{c19sf.fd}%
@@ -513,9 +513,9 @@
 %<ctexspa>\ProvidesFile{ctexspa.def}%
 %<dict&theorem&GBK>\ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}%
 %<dict&theorem&UTF8>\ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}%
-%<c19|c70>  [2016/08/27 v2.4.3 Chinese font definition (CTEX)]
-%<ctexspa>  [2016/08/27 v2.4.3 Space info for CJKpunct (CTEX)]
-%<dict&theorem>  [2016/08/27 v2.4.3 Chinese translation for theorem name (CTEX)]
+%<c19|c70>  [2016/09/21 v2.4.4 Chinese font definition (CTEX)]
+%<ctexspa>  [2016/09/21 v2.4.4 Space info for CJKpunct (CTEX)]
+%<dict&theorem>  [2016/09/21 v2.4.4 Chinese translation for theorem name (CTEX)]
 %</!(driver|readme|install|zhmap|spa|docstrip)>
 %<*driver>
 \documentclass{ctxdoc}
@@ -537,7 +537,7 @@
 % \changes{v2.4}{2015/02/19}{加强 \pkg{beamer} 宏包支持。}
 %
 %
-% \CheckSum{5629}
+% \CheckSum{5793}
 %
 % \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
@@ -1478,7 +1478,7 @@
 %   \pagestyle{fancy}
 %   % \sectionmark 的重定义需要在 \pagestyle 之后生效
 %   \renewcommand\sectionmark[1]{%
-%     \markright{\CTEXthesection——#1}}
+%     \markright{\CTEXifname{\CTEXthesection——}{}#1}}
 %
 %   \begin{document}
 %
@@ -1515,13 +1515,13 @@
 % \opt{name}, \opt{number}, \opt{format}, \opt{nameformat}, \opt{numberformat},
 % \opt{aftername}, \opt{titleformat}, \opt{aftertitle}, \opt{runin},
 % \opt{afterindent}, \opt{beforeskip}, \opt{afterskip}, \opt{fixskip},
-% \opt{indent}, \opt{pagestyle} 等。
+% \opt{indent}, \opt{pagestyle}, \opt{break} 等。
 %
 % 注意,对 \cls{article} 及其衍生的 \cls{ctexart} 等文档类,没有 |chapter|
 % 级别的标题。而对于 \cls{beamer} 文档类,这些选项控制的是由 \tn{partpage},
 % \tn{sectionpage} 和 \tn{subsectionpage} 产生的标题格式,此时只有 |part|,
-% |section| 和 |subsection| 这三层级别,并且 \opt{runin}, \opt{afterindent}
-% 和 \opt{fixskip} 这三个格式无效。
+% |section| 和 |subsection| 这三层级别,并且 \opt{runin}, \opt{afterindent},
+% \opt{fixskip} 和 \opt{break} 这四个格式无效。
 %
 % 多级选项之间用斜线分开,例如,\opt{part/name} 选项设置 \tn{part} 标题的在数
 % 字前后的名称,而 \opt{section/number} 选项设置 \tn{section} 标题的数字类型。
@@ -1663,6 +1663,25 @@
 %   节的完整编号。例如用于帮助定义自定义的目录格式、页眉格式等。
 % \end{function}
 %
+% \begin{function}[added=2016-09-18]{\CTEXifname}
+%   \begin{syntax}
+%     \tn{CTEXifname} \Arg{有名字时的格式命令} \Arg{无名字时的格式命令}
+%   \end{syntax}
+%   \tn{CTEXifname} 用于根据当前章节的名字的有无设置不同的格式。
+%
+%   它可用于 \opt{format}, \opt{titleformat}, \opt{aftertitle}, \opt{afterskip},
+%   \opt{indent} 这五个选项和 \tn{chapter} 标题 \opt{beforeskip} 选项的格式设置之中。
+%   也可用于帮助定义自定义的目录格式、页眉格式等。
+%
+%   例如,设置章的标题有名字时左对齐,无名字时居中对齐,并且在标题后画一条横线。
+%   \begin{ctexexam}
+%   \ctexset{
+%     chapter/format = \CTEXifname{\raggedright}{\centering},
+%     chapter/aftertitle = \par\CTEXifname{}{\hrule},
+%   }
+%   \end{ctexexam}
+% \end{function}
+%
 % \begin{function}[EXP,updated=2015-06-30]{.../format, .../format+}
 %   \begin{syntax}
 %     format = \Arg{格式命令}
@@ -1674,7 +1693,6 @@
 %   带加号的 \opt{format+} 选项则用于在已有格式之后追加新的格式命令。
 %
 %   例如,设置章格式为无衬线字体左对齐,为节格式增加无衬线字体设置:
-% \end{function}
 %   \begin{ctexexam}
 %   \ctexset{
 %     chapter/format  = \sffamily\raggedright,
@@ -1681,6 +1699,7 @@
 %     section/format += \sffamily
 %   }
 %   \end{ctexexam}
+% \end{function}
 %
 % \begin{table}[htbp]
 % \small\centering
@@ -2116,6 +2135,43 @@
 % \end{tabular}
 % \end{table}
 %
+% \begin{function}[EXP,added=2016-09-19]{.../break, .../break+}
+%   \begin{syntax}
+%     break = \Arg{格式命令}
+%     break+= \Arg{格式命令}
+%   \end{syntax}
+%   \opt{break} 选项用于控制章节标题与之前正文的分隔关系。一般用于设置是否在标题之前分页或者设置行间罚点。
+%
+%   带加号的 \opt{break+} 选项则用于在已有格式之后追加新的格式命令。
+%
+%   \opt{break} 选项的默认值,在 \opt{scheme} 选项的不同取值下相同。
+%
+%   例如,若当前页剩余高度小于正文高度的一半时,则另起一页输出 \tn{section} 标题:
+%   \begin{ctexexam}
+%   \usepackage{needspace}
+%   \ctexset{section/break = \Needspace{.5\textheight}}
+%   \end{ctexexam}
+% \end{function}
+%
+% \begin{table}[htbp]
+% \small\centering
+% \caption{\opt{break} 选项的默认设置}
+% \begin{tabular}{ll}
+% \toprule
+% 标题名 & 默认值 \\
+% \midrule
+% part (article) & |{}| \\
+% part & |\if at openright\cleardoublepage\else\clearpage\fi| \\
+% chapter & 同上 \\
+% section & |\addpenalty{\@secpenalty}| \\
+% subsection & 同上 \\
+% subsubsection & 同上 \\
+% paragraph & 同上 \\
+% subparagraph & 同上 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%
 % \begin{function}[EXP,added=2015-06-21]{appendix/numbering}
 %   \begin{syntax}
 %     numbering = \TTF
@@ -2939,12 +2995,13 @@
 %
 % \subsection{内部函数与变量}
 %
-% \begin{variable}[int]{\l_@@_tmp_tl,\l_@@_tmp_int,\l_@@_tmp_dim,\l_@@_tmp_box}
+% \begin{variable}[int]{\l_@@_tmp_tl,\l_@@_tmp_int,\l_@@_tmp_box,\l_@@_tmp_dim}
+% 临时变量。
 %    \begin{macrocode}
 \tl_new:N \l_@@_tmp_tl
 \int_new:N \l_@@_tmp_int
+\box_new:N \l_@@_tmp_box
 %<!ctexheading>\dim_new:N \l_@@_tmp_dim
-\box_new:N \l_@@_tmp_box
 %    \end{macrocode}
 % \end{variable}
 %
@@ -3637,9 +3694,9 @@
 %<*pdftex|uptex|aptex>
 \cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1
   {
-    \AtBeginDvi { #1 }
+    \AtBeginDvi {#1}
     \ctex_at_end_package:nn { atbegshi }
-      { \AtBeginShipoutFirst { #1 } }
+      { \AtBeginShipoutFirst {#1} }
   }
 \@onlypreamble \ctex_set_zhmap:n
 %</pdftex|uptex|aptex>
@@ -3747,13 +3804,33 @@
       \tl_set:Nn \CJKrmdefault {#1}
       \tl_set:Nn \CJKsfdefault {#2}
       \tl_set:Nn \CJKttdefault {#3}
-      \ctex_set_zhmap:n { \file_input:n {#4} }
+      \ctex_set_zhmap:n { \ctex_zhmap_input:n {#4} }
     }
   \@onlypreamble \ctex_load_zhmap:nnnn
 %    \end{macrocode}
 % \end{macro}
 %
+% \changes{v2.4.4}{2016/09/09}{解决 \opt{zhmap} 文件的 \tn{catcode} 问题。}
+% \begin{macro}[int]{\ctex_zhmap_input:n}
+% 载入字体映射文件时,确认 |%| 和 |\| 的 \tn{catcode}。
 %    \begin{macrocode}
+  \cs_new_protected_nopar:Npn \ctex_zhmap_input:n #1
+    {
+      \ctex_file_wrapper:nnn
+        {
+          \char_set_catcode_comment:n { 37 } % %
+          \char_set_catcode_escape:n  { 92 } % \
+        }
+        { \file_input:n {#1} }
+        {
+          \char_set_catcode:nn { 37 } { \char_value_catcode:n { 37 } }
+          \char_set_catcode:nn { 92 } { \char_value_catcode:n { 92 } }
+        }
+    }
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
   \tl_if_exist:NF \CJKfamilydefault
     { \tl_const:Nn \CJKfamilydefault { \CJKrmdefault } }
   \tl_if_exist:NF \CJKrmdefault { \tl_new:N \CJKrmdefault }
@@ -4042,12 +4119,12 @@
 %<*xetex>
 %    \end{macrocode}
 %
+% \changes{v2.4.4}{2016/09/12}{不再默认设置 \pkg{xeCJK} 的伪粗体。}
 %    \begin{macrocode}
 \RequirePackage { xeCJK }
 \exp_args:Nx \xeCJKsetup
   {
     LoadFandol   = false ,
-    AutoFakeBold = true ,
     PunctStyle   = \l_@@_punct_tl
   }
 %    \end{macrocode}
@@ -4132,7 +4209,7 @@
   local s = kpse.find_file('ltj-kinsoku.lua', 'tex')
   luatexja.stack.charprop_stack_table[0] = s and dofile(s) or {}
 }
-\ltjsetparameter{kanjiskip=\z@ plus .4pt minus .4pt,
+\ltjsetparameter{kanjiskip=\z@ plus .4pt minus .5pt,
   xkanjiskip=.25\zw plus 1pt minus 1pt,
   autospacing, autoxspacing, jacharrange={-1},
   yalbaselineshift=\z@, yjabaselineshift=\z@,
@@ -5920,9 +5997,7 @@
 %<*uptex|aptex>
 \ctex_hypersetup:n { driverfallback = dvipdfmx }
 \ctex_at_end_package:nn { hyperref }
-  {
-    \AtBeginShipoutFirst{ \special{ pdf:tounicode~ UTF8-UTF16 } }
-  }
+  { \AtBeginShipoutFirst { \special { pdf:tounicode~ UTF8-UTF16 } } }
 %</uptex|aptex>
 %    \end{macrocode}
 %
@@ -6704,6 +6779,7 @@
 % \changes{v2.2}{2015/06/27}{新的标题格式选项 \opt{afterindent}。}
 % \changes{v2.2}{2015/06/27}{新的标题格式选项 \opt{runin}。}
 % \changes{v2.4.3}{2016/06/03}{新的标题格式选项 \opt{fixskip}。}
+% \changes{v2.4.4}{2016/09/19}{新的标题格式选项 \opt{break}。}
 %
 % \begin{macro}[int]{\@@_def_heading_keys:n}
 %    \begin{macrocode}
@@ -6729,6 +6805,9 @@
         #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1 at afterindent } ,
         #1 / fixskip     .bool_set:N = \exp_not:c { CTEX@#1 at fixskip } ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
+        #1 / break         .tl_set:N = \exp_not:c { CTEX@#1 at break } ,
+        #1 / break+          .code:n =
+          { \tl_put_right:Nn \exp_not:c { CTEX@#1 at break } { ####1 } } ,
 %</article|book|report>
         #1 / format+         .code:n =
           { \tl_put_right:Nn \exp_not:c { CTEX@#1 at format } { ####1 } } ,
@@ -6817,15 +6896,6 @@
 %
 % \subsubsection{标准标题命令的修改}
 %
-% \begin{macro}[int]{\CTEX at makeheadinganchor}
-% 用于 |numbering=false| 时,设置超链接跳转描点。
-%    \begin{macrocode}
-\cs_new_protected_nopar:Npn \CTEX at makeheadinganchor { }
-\ctex_at_end_package:nn { hyperref }
-  { \cs_gset_protected_nopar:Npn \CTEX at makeheadinganchor { \phantomsection } }
-%    \end{macrocode}
-% \end{macro}
-%
 % \begin{macro}[int]{\CTEX at fixtopskip}
 % 修正 \cls{book} 和 \cls{report} 类的 \tn{part} 和 \tn{chapter} 标题之前的多余空行。
 %    \begin{macrocode}
@@ -6859,6 +6929,29 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \changes{v2.4.4}{2016/09/18}{提供 \tn{partmark}。}
+% \begin{macro}[int]{\partmark}
+% 提供 \tn{partmark}。
+%    \begin{macrocode}
+\ProvideDocumentCommand \partmark { m }
+  { \markboth { } { } }
+%    \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.4.4}{2016/09/19}{提供 \tn{CTEXifname}。}
+% \begin{macro}{\CTEXifname}
+% \begin{macro}[int]{\CTEX at ifnametrue,\CTEX at ifnamefalse}
+% 用于判断当前标题是否有编号。
+%    \begin{macrocode}
+\cs_new_eq:NN \CTEXifname \use_i:nn
+\cs_new_protected_nopar:Npn \CTEX at ifnametrue
+  { \cs_set_eq:NN \CTEXifname \use_i:nn }
+\cs_new_protected_nopar:Npn \CTEX at ifnamefalse
+  { \cs_set_eq:NN \CTEXifname \use_ii:nn }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 % \changes{v2.2}{2015/06/27}{\opt{beforeskip}、\opt{afterskip} 和 \opt{indent}
 %   选项支持表达式。}
 %
@@ -6877,6 +6970,7 @@
 \renewcommand\part{%
    \if at noskipsec \leavevmode \fi
    \par
+   \CTEX at part@break
 %  \addvspace{4ex}%
    \CTEX at setheadingskip \CTEX at part@beforeskip
    \ifodd \CTEX at part@fixskip \CTEX at fixheadingskip \fi
@@ -6890,11 +6984,12 @@
 %</article>
 %<*book|report>
 \renewcommand\part{%
-  \if at openright
-    \cleardoublepage
-  \else
-    \clearpage
-  \fi
+% \if at openright
+%   \cleardoublepage
+% \else
+%   \clearpage
+% \fi
+  \CTEX at part@break
 % \thispagestyle{plain}%
   \thispagestyle{\CTEX at part@pagestyle}%
   \if at twocolumn
@@ -6918,14 +7013,18 @@
 \def\@part[#1]#2{%
   \ifnum \c at secnumdepth >\m at ne
     \ifodd \CTEX at part@numbering
+      \CTEX at ifnametrue
       \refstepcounter{part}%
 %     \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
       \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{part*}%
       \addcontentsline{toc}{part}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@part{part*}%
     \addcontentsline{toc}{part}{#1}%
   \fi
   {\interlinepenalty \@M
@@ -6937,7 +7036,8 @@
    \fi \fi
 %  \huge\bfseries #2%
    \CTEX at part@titleformat{#2}%
-   \markboth{}{}%
+%  \markboth{}{}%
+   \partmark{#1}%
    \CTEX at part@aftertitle}%
   \nobreak
 % \vskip 3ex
@@ -6950,17 +7050,22 @@
 \def\@part[#1]#2{%
   \ifnum \c at secnumdepth >-2\relax
     \ifodd \CTEX at part@numbering
+      \CTEX at ifnametrue
       \refstepcounter{part}%
 %     \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
       \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{part*}%
       \addcontentsline{toc}{part}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@part{part*}%
     \addcontentsline{toc}{part}{#1}%
   \fi
-  \markboth{}{}%
+%  \markboth{}{}%
+   \partmark{#1}%
   {\interlinepenalty \@M
 %  \normalfont \centering
    \normalfont \CTEX at part@format
@@ -6980,6 +7085,8 @@
 %    \begin{macrocode}
 %<*article>
 \def\@spart#1{%
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@spart{part*}%
     {\interlinepenalty \@M
 %    \normalfont \parindent \z@ \raggedright
      \normalfont \parindent \dimexpr \CTEX at part@indent \relax
@@ -6996,6 +7103,8 @@
 %</article>
 %<*book|report>
 \def\@spart#1{%
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@spart{part*}%
     {\interlinepenalty \@M
 %    \normalfont \centering
      \normalfont \CTEX at part@format
@@ -7038,8 +7147,10 @@
 %
 % \begin{macro}[int]{\chapter}
 %    \begin{macrocode}
-\renewcommand\chapter{\if at openright\cleardoublepage\else\clearpage\fi
+\renewcommand\chapter{%
+%                   \if at openright\cleardoublepage\else\clearpage\fi
 %                   \thispagestyle{plain}%
+                    \CTEX at chapter@break
                     \thispagestyle{\CTEX at chapter@pagestyle}%
                     \global\@topnum\z@
 %                   \@afterindentfalse
@@ -7058,6 +7169,7 @@
   \ifnum \c at secnumdepth >\m at ne
 %<book>    \if at mainmatter
       \ifodd \CTEX at chapter@numbering
+        \CTEX at ifnametrue
         \refstepcounter{chapter}%
 %       \typeout{\@chapapp\space\thechapter.}%
         \typeout{\CTEXthechapter}%
@@ -7065,13 +7177,18 @@
 %         {\protect\numberline{\thechapter}#1}%
           {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}%
       \else
-        \CTEX at makeheadinganchor
+        \CTEX at ifnamefalse
+        \CTEX at makeanchor{\Hy at chapapp*}%
         \addcontentsline{toc}{chapter}{#1}%
       \fi
 %<book>    \else
+%<book>      \CTEX at ifnamefalse
+%<book>      \CTEX at makeanchor@chapter{\Hy at chapapp*}%
 %<book>      \addcontentsline{toc}{chapter}{#1}%
 %<book>    \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@chapter{\Hy at chapapp*}%
     \addcontentsline{toc}{chapter}{#1}%
   \fi
   \chaptermark{#1}%
@@ -7086,6 +7203,20 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}[int]{\@schapter}
+%    \begin{macrocode}
+\def\@schapter#1{%
+  \CTEX at ifnamefalse
+  \CTEX at makeanchor@schapter{\Hy at chapapp*}%
+  \if at twocolumn
+    \@topnewpage[\@makeschapterhead{#1}]%
+  \else
+    \@makeschapterhead{#1}%
+    \@afterheading
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}[int]{\@makechapterhead}
 %    \begin{macrocode}
 \def\@makechapterhead#1{%
@@ -7096,14 +7227,12 @@
 % {\normalfont \parindent \z@ \raggedright
   {\normalfont \parindent \dimexpr \CTEX at chapter@indent \relax
    \CTEX at chapter@format
-   \ifnum \c at secnumdepth >\m at ne
-%<book>     \if at mainmatter
-       \ifodd \CTEX at chapter@numbering
-%        \huge\bfseries\@chapapp\space\thechapter\par\nobreak\vskip 20\p@
-         \CTEX at chaptername \CTEX at chapter@aftername
-       \fi
-%<book>     \fi
-   \fi
+%  \ifnum \c at secnumdepth >\m at ne
+%    \if at mainmatter
+%      \huge\bfseries\@chapapp\space\thechapter\par\nobreak\vskip 20\p@
+%    \fi
+%  \fi
+   \CTEXifname{\CTEX at chaptername\CTEX at chapter@aftername}{}%
    \interlinepenalty\@M
 %  \Huge \bfseries #1\par\nobreak
    \CTEX at chapter@titleformat{#1}%
@@ -7166,13 +7295,13 @@
     \everypar{}%
   \else
 %   \addpenalty\@secpenalty\addvspace\@tempskipa
-    \addpenalty\@secpenalty
+    \csname CTEX@#1 at break\endcsname
     \CTEX at setheadingskip{#4}%
     \ifodd \CTEX at fixskip \CTEX at fixheadingskip \fi
     \addvspace \CTEX at headingskip
   \fi
   \@ifstar
-    {\@ssect{#3}{#4}{#5}{#6}}%
+    {\CTEX at makeanchor@ssect{#1*}\@ssect{#3}{#4}{#5}{#6}}%
     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
 %    \end{macrocode}
 % \end{macro}
@@ -7181,7 +7310,8 @@
 %    \begin{macrocode}
 \def\@seccntformat#1{%
 % \csname the#1\endcsname\quad}%
-  \csname CTEX@#1name\endcsname \csname CTEX@#1 at aftername\endcsname}
+  \csname CTEX@#1name\endcsname
+  \csname CTEX@#1 at aftername\endcsname}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -7189,13 +7319,17 @@
 %    \begin{macrocode}
 \def\@sect#1#2#3#4#5#6[#7]#8{%
   \ifnum #2>\c at secnumdepth
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@sect{#1*}%
     \let\@svsec\@empty
   \else
     \ifodd \csname CTEX@#1 at numbering\endcsname
+      \CTEX at ifnametrue
       \refstepcounter{#1}%
       \protected at edef\@svsec{\@seccntformat{#1}\relax}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{#1*}%
       \let\@svsec\@empty
     \fi
   \fi
@@ -7212,12 +7346,10 @@
     \endgroup
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-%         \protect\numberline{\csname the#1\endcsname}%
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+%     \ifnum #2>\c at secnumdepth \else
+%       \protect\numberline{\csname the#1\endcsname}%
+%     \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}%
   \else
     \def\@svsechd{%
@@ -7228,12 +7360,10 @@
       \csname CTEX@#1 at aftertitle\endcsname}%
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-%         \protect\numberline{\csname the#1\endcsname}%
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+%     \ifnum #2>\c at secnumdepth \else
+%       \protect\numberline{\csname the#1\endcsname}%
+%     \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}}%
   \fi
   \@xsect{#5}}
@@ -7243,6 +7373,7 @@
 % \begin{macro}[int]{\@ssect}
 %    \begin{macrocode}
 \def\@ssect#1#2#3#4#5{%
+  \CTEX at ifnamefalse
 % \@tempskipa #3\relax
 % \ifdim \@tempskipa>\z@
   \unless \ifodd \CTEX at runin
@@ -7377,6 +7508,76 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \paragraph{设置 \pkg{hyperref} 宏包的标题锚点}
+%
+% \changes{v2.4.4}{2016/09/12}{改进 \pkg{hyperref} 宏包的标题锚点设置。}
+%
+% \begin{macro}[int]{\CTEX at makeanchor}
+% 设置超链接跳转锚点,在 \pkg{hyperref} 载入后才有意义。
+%    \begin{macrocode}
+\cs_new_protected_nopar:Npn \CTEX at makeanchor #1
+  { }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}[int]{\c_@@_headings_cs_seq}
+% 保存内部标题命令的 \CTeX{} 定义,用于随后比较。
+%    \begin{macrocode}
+\seq_new:N \c_@@_headings_cs_seq
+\seq_gset_from_clist:Nn \c_@@_headings_cs_seq
+%<article>  { part , spart , sect , ssect }
+%<book|report>  { part , spart , chapter , schapter , sect , ssect }
+\seq_map_inline:Nn \c_@@_headings_cs_seq
+  {
+    \cs_new_eq:cc { CTEX@ #1 } { @ #1 }
+    \cs_new_eq:cN { CTEX at makeanchor@ #1 } \CTEX at makeanchor
+  }
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[int]{\CTEX at hyperheadinghook}
+% \pkg{hyperref} 会重定义内部标题命令,目的在于为没有编号的标题设置锚点(这一功能受他的
+% \opt{implicit} 选项的控制)。我们在上面对标题命令的修改已经包含这一功能,如果这些标题命令在
+% \pkg{hyperref} 载入之前没有被修改过,则恢复 \CTeX{} 的定义。
+%    \begin{macrocode}
+\cs_new_protected_nopar:Npn \CTEX at hyperheadinghook
+  {
+    \group_begin:
+      \ifHy at implicit
+        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+        \seq_map_inline:Nn \c_@@_headings_cs_seq
+          {
+            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+              {
+                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+              }
+          }
+      \else:
+        \seq_map_inline:Nn \c_@@_headings_cs_seq
+          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+      \fi:
+    \group_end:
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+\ctex_at_end_package:nn { hyperref }
+  {
+    \cs_gset_protected_nopar:Npn \CTEX at makeanchor #1
+      {
+        \Hy at MakeCurrentHrefAuto {#1}
+        \Hy at raisedlink
+          {
+            \hyper at anchorstart { \@currentHref }
+            \hyper at anchorend
+          }
+      }
+    \CTEX at hyperheadinghook
+  }
+%    \end{macrocode}
+%
 % \paragraph{兼容 \pkg{titlesec} 宏包}
 %
 % 我们修改了 \tn{@startsection} 的定义,它的第四个(\meta{beforeskip})和
@@ -7477,6 +7678,36 @@
   }
 %    \end{macrocode}
 %
+% \changes{v2.4.4}{2016/09/13}{使用 \pkg{titlesec} 时,章节目录也使用 \CTeX{} 的编号。}
+% 让编译时终端显示  \tn{CTEXthechapter},目录使用 |\CTEXtheXXX| 编号。
+%    \begin{macrocode}
+\ctex_at_end_package:nn { titlesec }
+  {
+%<*book|report>
+    \tl_set:Nn \ttl at chapterout { \typeout { \CTEXthechapter } }
+%</book|report>
+    \cs_if_free:NF \ttl at tocpart
+      {
+        \cs_set_protected_nopar:Npn \ttl at tocpart
+          { \tl_set:Nn \ttl at a { \CTEXthepart \hspace { 1em } } }
+      }
+    \seq_map_inline:Nn \c_@@_headings_seq
+      {
+        \cs_if_exist:cF { ttl at toc #1 }
+          {
+            \cs_new_protected_nopar:cpx { ttl at toc #1 }
+              {
+                \tl_set:Nn \exp_not:N \ttl at a
+                  {
+                    \exp_not:N \protect
+                    \exp_not:N \numberline { \exp_not:c { CTEXthe #1 } }
+                  }
+              }
+          }
+      }
+  }
+%    \end{macrocode}
+%
 % \paragraph{兼容 \pkg{titleps} 宏包}
 %
 % \changes{v2.3}{2015/12/25}{兼容 \pkg{titleps} 宏包。}
@@ -7546,7 +7777,25 @@
 % \end{verbatim}
 % 但 \tn{newtitlemark} 不包含章节间的层次信息,功能上不及修改内部命令完整。
 %
+% \begin{macro}[int]{\ttl at setifthe}
+% 使 |\iftheXXX| 等命令在页眉设置中可用。
+%    \begin{macrocode}
+\ctex_at_end_package:nn { titleps }
+  {
+    \cs_set_protected_nopar:Npn \ttl at setifthe #1
+      {
+        \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 }
+          {
+            \CTEXifname
+              { \protect \@firstoftwo }
+              { \protect \@secondoftwo }
+          }
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
 %
+%
 % \subsubsection{目录标签的宽度}
 %
 % \begin{macro}[int]{\numberline}
@@ -7591,22 +7840,26 @@
 %    \begin{macrocode}
 %<*article>
 \ctex_patch_cmd:Nnn \ps at headings
-  { \thesection \quad }
-  { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+  { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+  { \CTEXifname { \CTEXthesection \quad } { } }
 \if at twoside
   \ctex_patch_cmd:Nnn \ps at headings
-    { \thesubsection \quad }
-    { \ifodd \CTEX at subsection@numbering \CTEXthesubsection \quad \fi }
+    { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
+    { \CTEXifname { \CTEXthesubsection \quad } { } }
 \fi:
 %</article>
 %<*book|report>
 \ctex_patch_cmd:Nnn \ps at headings
-  { \@chapapp\ \thechapter.~\ }
-  { \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi }
+  {
+    \ifnum \c at secnumdepth > \m at ne \if at mainmatter
+      \@chapapp \ \thechapter . ~ \
+    \fi \fi
+  }
+  { \CTEXifname { \CTEXthechapter \quad } { } }
 \if at twoside
   \ctex_patch_cmd:Nnn \ps at headings
-    { \thesection.~\ }
-    { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+    { \CTEXifname { \CTEXthesection } { } }
 \fi:
 %</book|report>
 %    \end{macrocode}
@@ -7622,20 +7875,19 @@
   {
 %<*article>
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesection \hskip 1em \relax }
-      { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+      { \ifnum \c at secnumdepth > \z@ \thesection \hskip 1em \relax \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesubsection \hskip 1em \relax }
-      { \ifodd \CTEX at subsection@numbering \CTEXthesubsection \quad \fi }
+      { \ifnum \c at secnumdepth > \@ne \thesubsection \hskip 1em \relax \fi }
+      { \CTEXifname { \CTEXthesubsection \quad } { } }
 %</article>
 %<*book|report>
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \@chapapp\ \thechapter.~\ }
-%<book>      { \if at mainmatter \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi \fi }
-%<report>      { \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi }
+      { \ifnum \c at secnumdepth > \m at ne \@chapapp \ \thechapter . ~ \ \fi }
+      { \CTEXifname { \CTEXthechapter \quad } { } }
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesection.~\ }
-      { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection } { } }
 %</book|report>
   }
 %    \end{macrocode}
@@ -7862,6 +8114,7 @@
     beforeskip  = 0pt \@plus 1fil ,
     afterskip   = 0pt \@plus 1fil ,
     pagestyle   = plain ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
 %<*plain>
     format      = \centering ,
     nameformat  = \huge \bfseries ,
@@ -7889,6 +8142,7 @@
     aftertitle  = \par ,
     beforeskip  = 50 \p@ ,
     afterskip   = 40 \p@ ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
 %<*plain>
     name        = \chaptername \space ,
     number      = \thechapter ,
@@ -7922,6 +8176,7 @@
     beforeskip  = 3.5ex \@plus 1ex \@minus .2ex ,
     afterskip   = 2.3ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
 %<*plain>
     format      = \Large \bfseries ,
     afterindent = false
@@ -7957,6 +8212,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex  \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
 %<*plain>
     afterindent = false
 %</plain>
@@ -7996,6 +8252,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
 %<*plain>
     afterindent = false
 %</plain>
@@ -8012,6 +8269,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
 %<*plain>
     afterindent = false
 %</plain>
@@ -8028,6 +8286,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
 %<*plain>
     afterindent = false
 %</plain>
@@ -9506,7 +9765,7 @@
 %    \begin{macrocode}
 %<*windows>
 \ProvidesFile{zhwindowsfonts.tex}%
-  [2016/08/27 v2.4.3 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
 
 \ifzhmappdf
   \pdfmapline{=gbk at UGBK@     <simsun.ttc}
@@ -9578,7 +9837,7 @@
 %    \begin{macrocode}
 %<*adobe>
 \ProvidesFile{zhadobefonts.tex}%
-  [2016/08/27 v2.4.3 Adobe font map loader for DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Adobe font map loader for DVIPDFMx (CTEX)]
 
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts
@@ -9614,7 +9873,7 @@
 %    \begin{macrocode}
 %<*fandol>
 \ProvidesFile{zhfandolfonts.tex}%
-  [2016/08/27 v2.4.3 Fandol font map loader for DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Fandol font map loader for DVIPDFMx (CTEX)]
 
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts
@@ -9650,7 +9909,7 @@
 %    \begin{macrocode}
 %<*founder>
 \ProvidesFile{zhfounderfonts.tex}%
-  [2016/08/27 v2.4.3 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
 
 \ifzhmappdf
   \pdfmapline{=gbk at UGBK@     <FZSSK.TTF}
@@ -9722,7 +9981,7 @@
 %    \begin{macrocode}
 %<*ubuntu>
 \ProvidesFile{zhubuntufonts.tex}%
-  [2016/08/27 v2.4.3 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)]
 
 \ifzhmappdf
   \pdfmapline{=gbk at UGBK@     <uming.ttc}
@@ -10555,6 +10814,7 @@
 \RequirePackage{xcolor}
 \RequirePackage{caption}
 \RequirePackage{fvrb-ex}
+\RequirePackage{zref-base}
 \geometry{includemp,hmargin={0mm,15mm},vmargin={25mm,15mm},footskip=7mm}
 \hypersetup{pdfstartview=FitH,bookmarksdepth=subparagraph}
 \setcounter{secnumdepth}{4}
@@ -10563,6 +10823,7 @@
 \setmainfont{TeX Gyre Pagella}
 \setsansfont{TeX Gyre Heros}
 \setmonofont[
+  HyphenChar = None ,
   UprightFont=* Light, BoldFont=* Bold,
   SlantedFont=* Light Oblique]{CMU Typewriter Text}
 \setmathfont{texgyrepagella-math.otf}
@@ -10663,10 +10924,6 @@
 \AfterEndEnvironment{function}{\ctexfixprevdepth}
 \AtBeginEnvironment{syntax}{\linespread{1}\ctexplainps\ctexdisableecglue}
 \BeforeBeginEnvironment{SideBySideExample}{\par\addvspace{\medskipamount}}
-\preto\MacroFont{\linespread{1}}
-\appto\MacroFont{\hyphenchar\font\m at ne\ctexdocverbaddon}
-\preto\AltMacroFont{\linespread{1}}
-\appto\AltMacroFont{\hyphenchar\font\m at ne\ctexdocverbaddon}
 \newcommand*\exptarget{\Hy at raisedlink{\hypertarget{expstar}{}}}
 \newcommand*\rexptarget{\Hy at raisedlink{\hypertarget{rexpstar}{}}}
 \newcommand*\expstar{\hyperlink{expstar}{$\star$}}
@@ -10712,12 +10969,6 @@
   { \MacroFont \hbox:n }
   { \iow_term:n { *** ~ SUCCESS ~ *** } }
   { \iow_term:n { *** ~ FAIL ~ *** } }
-\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_typeset_one:nN
-  { }
-  { \vbox_unpack_clear:N }
-  { \MacroFont \vbox_unpack_clear:N }
-  { \iow_term:n { *** ~ SUCCESS ~ *** } }
-  { \iow_term:n { *** ~ FAIL ~ *** } }
 \ctex_patch_cmd_once:NnnnTF \__codedoc_macro_dump:
   { }
   { \hbox_unpack_clear:N }
@@ -10724,17 +10975,51 @@
   { \MacroFont \hbox_unpack_clear:N }
   { \iow_term:n { *** ~ SUCCESS ~ *** } }
   { \iow_term:n { *** ~ FAIL ~ *** } }
-\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_end:
-  { }
-  { \endtrivlist }
-  { \@noparlisttrue \endtrivlist }
-  { \iow_term:n { *** ~ SUCCESS ~ *** } }
-  { \iow_term:n { *** ~ FAIL ~ *** } }
-\ctex_appto_cmd:NnnTF \__codedoc_macro_end_style:n
-  { }
-  { \@endparenv }
-  { \iow_term:n { *** ~ SUCCESS ~ *** } }
-  { \iow_term:n { *** ~ FAIL ~ *** } }
+\cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n
+\cs_set_protected:Npn \__codedoc_macro_typeset_one:nN #1#2
+  {
+    \vbox_set:Nn \l__codedoc_macro_box
+      {
+        \MacroFont
+        \vbox_unpack_clear:N \l__codedoc_macro_box
+        \hbox_set:Nn \l_tmpa_box
+          { \__codedoc_print_macroname:nN {#1} #2 }
+        \dim_set:Nn \l_tmpa_dim { \marginparwidth - \labelsep }
+        \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > \l_tmpa_dim
+          {
+            \box_resize_to_wd_and_ht:Nnn \l_tmpa_box
+              { \l_tmpa_dim }
+              { \box_ht:N \l_tmpa_box }
+          }
+        \hbox_overlap_left:n
+          {
+            \box_use:N \l_tmpa_box
+            \skip_horizontal:n { \marginparsep - \labelsep }
+          }
+      }
+    \int_incr:N \l__codedoc_macro_int
+  }
+\cs_set_protected:Npn \__codedoc_print_macroname:nN #1#2
+  {
+    \strut
+    \__codedoc_get_hyper_target:xN
+      {
+        \exp_not:n {#1}
+        \bool_if:NT #2 { \tl_to_str:n {TF} }
+      }
+      \l__codedoc_tmpa_tl
+    \cs_if_exist:cTF { r@ \l__codedoc_tmpa_tl }
+      { \exp_args:NNo \label at hyperref [ \l__codedoc_tmpa_tl ] }
+      { \use:n }
+      {
+        \tl_set:Nn \l__codedoc_tmpa_tl {#1}
+        \tl_replace_all:Non \l__codedoc_tmpa_tl
+          { \c_catcode_other_space_tl }
+          { \fontspec_visible_space: }
+        \__codedoc_macroname_prefix:o \l__codedoc_tmpa_tl
+        \__codedoc_macroname_suffix:N #2
+      }
+  }
 \AtBeginEnvironment { syntax }
   {
     \char_set_catcode_active:N \|
@@ -10769,9 +11054,6 @@
       { \fileinfo }
   }
 \ior_new:N \g_@@_id_ior
-\ctex_patch_cmd:Nnn \changes@
-  { \space \actualchar }
-  { \actualchar }
 \cs_new_eq:NN \@@_ltx_changes:nnn \changes@
 \cs_set_protected:Npn \changes@ #1#2
   {
@@ -10790,18 +11072,24 @@
 \cs_new_protected:Npn \@@_version_zfill:nnnn #1#2
   {
     \tl_clear:N \l_@@_tmp_tl
-    \seq_set_split:Nnn \l_@@_tmp_seq { . } {#1}
-    \seq_map_function:NN \l_@@_tmp_seq \@@_version_zfill:n
+    \int_zero:N \l_tmpa_int
+    \seq_set_split:Nnn \l_tmpa_seq { . } {#1}
+    \seq_map_function:NN \l_tmpa_seq \@@_version_zfill:n
+    \int_compare:nNnF \l_tmpa_int > \c_two
+      {
+        \tl_put_right:Nx \l_@@_tmp_tl
+          { \prg_replicate:nn { \c_three - \l_tmpa_int } { 00000 } }
+      }
     \@@_ltx_changes:nnn { \l_@@_tmp_tl \actualchar #2 }
   }
 \tl_new:N \l_@@_tmp_tl
-\seq_new:N \l_@@_tmp_seq
 \cs_new_protected:Npn \@@_version_zfill:n #1
   {
+    \int_incr:N \l_tmpa_int
     \tl_put_right:Nx \l_@@_tmp_tl
       {
         \prg_replicate:nn
-          { \int_max:nn { 0 } { 10 - \tl_count:n {#1} } } { 0 }
+          { \int_max:nn { 0 } { 5 - \tl_count:n {#1} } } { 0 }
         \exp_not:n {#1}
       }
   }
@@ -10957,7 +11245,7 @@
         \tl_gclear:N \g_@@_verbatim_verb_stop_tl
         \cs_gset_eq:NN \@@_verbatim_process_line: \@@_process_normal_line:
         \@@_output_module:nn
-          { slash at guard }
+          { \color { verb at guard } }
           { \@@_module_pop:n { \l_@@_verbatim_line_tl } }
       }
       { \tl_use:N \l_@@_verbatim_line_tl }
@@ -10992,33 +11280,23 @@
   \cs_new_protected:Npn \@@_module_star:w #1 > #2 \q_stop
     {
       \@@_output_module:nn
-        { star at guard }
+        { \@@_star_color: }
         { \@@_module_push:n { \@@_module_angle:n {#1} } }
-      \int_compare:nNnF \guard at level < \c at StandardModuleDepth
-        {
-          \cs_gset_eq:NN \macro at font \AltMacroFont
-          \macro at font
-        }
-      \int_gincr:N \guard at level
       \@@_output_line:n {#2}
+      \@@_star_format:
     }
   \cs_new_protected:Npn \@@_module_slash:w #1 > #2 \q_stop
     {
       \@@_output_module:nn
-        { slash at guard }
+        { \@@_slash_color: }
         { \@@_module_pop:n { \@@_module_angle:n {#1} } }
-      \int_gdecr:N \guard at level
-      \int_compare:nNnF \guard at level < \c at StandardModuleDepth
-        {
-          \cs_gset_eq:NN \macro at font \MacroFont
-          \macro at font
-        }
       \@@_output_line:n {#2}
+      \@@_slash_format:
     }
   \cs_new_protected:Npn \@@_module_at:w @ @ = #1 > #2 \q_stop
     {
       \@@_output_module:nn
-        { at at guard }
+        { \color { at at guard } }
         { \@@_module_angle:n { @ @ = #1 } }
       \tl_gset:Nn \g__codedoc_module_name_tl {#1}
       \@@_output_line:n {#2}
@@ -11025,12 +11303,16 @@
     }
   \cs_new_protected:Npn \@@_module_pm:w #1 > #2 \q_stop
     {
-      \@@_output_module:nn
-        { pm at guard }
-        { \@@_module_angle:n {#1} }
+      \tex_noindent:D
+      \hbox_overlap_left:n
+        {
+          \@@_output_module:nn
+            { \@@_pm_color: }
+            { \@@_module_angle:n {#1} }
+          \skip_horizontal:n { \leftskip + \smallskipamount }
+        }
       \group_begin:
-        \int_compare:nNnF \guard at level < \c at StandardModuleDepth
-          { \AltMacroFont }
+        \@@_pm_format:
         \@@_output_line:n {#2}
       \group_end:
     }
@@ -11040,7 +11322,7 @@
       \tl_gset:Nx \g_@@_verbatim_verb_stop_tl
         { \c_percent_str \tl_tail:n {#1} }
       \@@_output_module:nn
-        { star at guard }
+        { \color { verb at guard } }
         { \@@_module_push:n { \l_@@_verbatim_line_tl } }
     }
 \group_end:
@@ -11088,43 +11370,141 @@
     \group_end:
   }
 \cs_new_protected_nopar:Npn \@@_module_push:n
-  { \exp_args:Nx \@@_module_push_aux:nn { \int_use:N \c at HD@hypercount } }
+  { \exp_args:No \@@_module_push_aux:nn { \int_use:N \c at HD@hypercount } }
 \cs_new_protected:Npn \@@_module_push_aux:nn #1
   {
     \seq_gpush:Nn \g_@@_module_dest_seq {#1}
-    \HD at savedest@add {#1}
-    \cs_if_exist:cTF { r at HD. #1 }
-      {
-        \hypersetup { hidelinks }
-        \hyperref [ HD. #1 ]
-      }
-      { \use:n }
+    \hypersetup { hidelinks }
+    \exp_args:Nx \hdclindex
+      { \zref at extractdefault { HD.#1 } { guard at end } { 1 } } { }
   }
 \cs_new_protected_nopar:Npn \@@_module_pop:n
   {
     \seq_gpop:NNTF \g_@@_module_dest_seq \l_@@_tmp_tl
+      { \exp_args:No \@@_module_pop_aux:nn { \l_@@_tmp_tl } }
+      { \BOOM \use:n }
+  }
+\cs_new_protected:Npn \@@_module_pop_aux:nn #1
+  {
+    \zref at labelbylist { HD.#1 } { ctxdoc }
+    \hypersetup { hidelinks }
+    \hdclindex {#1} { }
+  }
+\seq_new:N \g_@@_module_dest_seq
+\zref at newlist { ctxdoc }
+\zref at newprop { guard at end } [ 1 ]
+  { \int_eval:n { \c at HD@hypercount - 1 } }
+\zref at addprop { ctxdoc } { guard at end }
+\cs_new_protected_nopar:Npn \@@_star_format:
+  {
+    \seq_gpush:No \g_@@_slash_format_seq { \macro at font }
+    \seq_gpop:NNF \g_@@_star_format_seq \l_@@_format_tl
+      { \@@_pop_format: }
+    \@@_select_format:
+  }
+\cs_new_protected_nopar:Npn \@@_slash_format:
+  {
+    \seq_gpop:NNTF \g_@@_slash_format_seq \l_@@_format_tl
       {
-        \tl_set:Nx \@currentlabel { \int_use:N \c at HD@hypercount }
-        \HD at savedest@add { \@currentlabel }
-        \Hy at MakeCurrentHref { HD. \@currentlabel }
-        \label { HD. \l_@@_tmp_tl }
-        \hypersetup { hidelinks }
-        \hdclindex { \l_@@_tmp_tl } { }
+        \seq_gpush:No \g_@@_star_format_seq { \macro at font }
+        \@@_select_format:
       }
-      { \BOOM \use:n }
+      { \BOOM }
   }
-\seq_new:N \g_@@_module_dest_seq
+\cs_new_protected_nopar:Npn \@@_pm_format:
+  {
+    \seq_get:NNF \g_@@_star_format_seq \l_@@_format_tl
+      {
+        \@@_pop_format:
+        \seq_gpush:No \g_@@_star_format_seq { \l_@@_format_tl }
+      }
+    \cs_if_eq:NNF \macro at font \l_@@_format_tl
+      { \l_@@_format_tl }
+  }
+\cs_new_protected_nopar:Npn \@@_pop_format:
+  {
+    \seq_gpop_left:NN \g_@@_format_seq \l_@@_format_tl
+    \seq_gput_right:No \g_@@_format_seq { \l_@@_format_tl }
+  }
+\cs_new_protected_nopar:Npn \@@_select_format:
+  {
+    \cs_if_eq:NNF \macro at font \l_@@_format_tl
+      {
+        \cs_gset_eq:NN \macro at font \l_@@_format_tl
+        \macro at font
+      }
+  }
+\tl_new:N \l_@@_format_tl
+\seq_new:N \g_@@_format_seq
+\seq_new:N \g_@@_star_format_seq
+\seq_new:N \g_@@_slash_format_seq
+\seq_gput_right:Nn \g_@@_format_seq { \MacroFont }
+\seq_gput_right:Nn \g_@@_format_seq { \AltMacroFont }
+\cs_set_protected:Npn \MacroFont
+  {
+    \linespread { 1 }
+    \small
+    \fontseries { \mddefault }
+    \fontshape  { \updefault }
+    \ttfamily
+    \ctexdocverbaddon
+  }
+\cs_set_protected:Npn \AltMacroFont
+  {
+    \linespread { 1 }
+    \small
+    \fontseries { \mddefault }
+    \fontshape  { \sldefault }
+    \ttfamily
+    \ctexdocverbaddon
+  }
+\AtBeginDocument
+  {
+    \tl_gset:Nx \macro at font
+      { \seq_item:Nn \g_@@_format_seq { 1 } }
+  }
 \cs_new_protected:Npn \@@_output_module:nn #1#2
   {
     \tex_noindent:D
     \group_begin:
-      \color {#1} \footnotesize \normalfont \sffamily #2
+      #1
+      \footnotesize \normalfont \sffamily #2
     \group_end:
   }
-\definecolor { star at guard }  { rgb } { 0    , 0   , 0.55 }
-\definecolor { slash at guard } { rgb } { 0.75 , 0   , 0.25 }
-\definecolor { pm at guard }    { rgb } { 0.5  , 0.5 , 0 }
-\definecolor { at at guard }    { rgb } { 0.5  , 0   , 0.5 }
+\cs_new_protected_nopar:Npn \@@_star_color:
+  {
+    \seq_gpop:NNTF \g_@@_star_color_seq \current at color
+      { \set at color }
+      { \@@_select_color: }
+    \seq_gpush:No \g_@@_slash_color_seq { \current at color }
+  }
+\cs_new_protected_nopar:Npn \@@_slash_color:
+  {
+    \seq_gpop:NNTF \g_@@_slash_color_seq \current at color
+      {
+        \set at color
+        \seq_gpush:No \g_@@_star_color_seq { \current at color }
+      }
+      { \BOOM }
+  }
+\cs_new_protected_nopar:Npn \@@_pm_color:
+  {
+    \seq_get:NNTF \g_@@_star_color_seq \current at color
+      { \set at color }
+      {
+        \@@_select_color:
+        \seq_gpush:No \g_@@_star_color_seq { \current at color }
+      }
+  }
+\seq_new:N \g_@@_star_color_seq
+\seq_new:N \g_@@_slash_color_seq
+\cs_new_protected_nopar:Npn \@@_select_color:
+  { \color { guard at series!!+ } }
+\definecolorseries { guard at series }
+  { cmyk } { last } { blue } { purple }
+\resetcolorseries [ 3 ] { guard at series }
+\definecolor { verb at guard } { rgb }  { 0.5  , 0.5 , 0 }
+\definecolor { at at guard }   { rgb }  { 0.5  , 0   , 0.5 }
 \definecolor { code at gray }  { gray } { 0.5 }
 \cs_new_protected:Npn \@@_module_angle:n #1
   { \textlangle #1 \textrangle }

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhadobefonts.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhadobefonts.tex	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhadobefonts.tex	2016-09-25 21:05:03 UTC (rev 42148)
@@ -76,7 +76,7 @@
 \fi
 \endgroup
 \ProvidesFile{zhadobefonts.tex}%
-  [2016/08/27 v2.4.3 Adobe font map loader for DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Adobe font map loader for DVIPDFMx (CTEX)]
 
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhfandolfonts.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhfandolfonts.tex	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhfandolfonts.tex	2016-09-25 21:05:03 UTC (rev 42148)
@@ -76,7 +76,7 @@
 \fi
 \endgroup
 \ProvidesFile{zhfandolfonts.tex}%
-  [2016/08/27 v2.4.3 Fandol font map loader for DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Fandol font map loader for DVIPDFMx (CTEX)]
 
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhfounderfonts.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhfounderfonts.tex	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhfounderfonts.tex	2016-09-25 21:05:03 UTC (rev 42148)
@@ -76,7 +76,7 @@
 \fi
 \endgroup
 \ProvidesFile{zhfounderfonts.tex}%
-  [2016/08/27 v2.4.3 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
 
 \ifzhmappdf
   \pdfmapline{=gbk at UGBK@     <FZSSK.TTF}

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhubuntufonts.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhubuntufonts.tex	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhubuntufonts.tex	2016-09-25 21:05:03 UTC (rev 42148)
@@ -76,7 +76,7 @@
 \fi
 \endgroup
 \ProvidesFile{zhubuntufonts.tex}%
-  [2016/08/27 v2.4.3 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)]
 
 \ifzhmappdf
   \pdfmapline{=gbk at UGBK@     <uming.ttc}

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhwindowsfonts.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhwindowsfonts.tex	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhwindowsfonts.tex	2016-09-25 21:05:03 UTC (rev 42148)
@@ -76,7 +76,7 @@
 \fi
 \endgroup
 \ProvidesFile{zhwindowsfonts.tex}%
-  [2016/08/27 v2.4.3 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2016/09/21 v2.4.4 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
 
 \ifzhmappdf
   \pdfmapline{=gbk at UGBK@     <simsun.ttc}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Caption with encoding GBK (CTEX)}
 \ProvidesExplFile{ctex-name-gbk.cfg}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set_known:nn { ctex }
   {
     contentsname   = Ŀ¼ ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Caption with encoding UTF8 (CTEX)}
 \ProvidesExplFile{ctex-name-utf8.cfg}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set_known:nn { ctex }
   {
     contentsname   = 目录 ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Configuration file (CTEX)}
 \ProvidesExplFile{\ExplFileName.cfg}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 %%
 %% 
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Option configuration file (CTEX)}
 \ProvidesExplFile{ctexopts.cfg}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 %%
 %% \keys_set:nn { ctex / option } { fontset = windowsnew }
 %% 

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex-article.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex-article.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex-article.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading modification for article (CTEX)}
 \ProvidesExplFile{ctex-article.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\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,6 +87,9 @@
         #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1 at afterindent } ,
         #1 / fixskip     .bool_set:N = \exp_not:c { CTEX@#1 at fixskip } ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
+        #1 / break         .tl_set:N = \exp_not:c { CTEX@#1 at break } ,
+        #1 / break+          .code:n =
+          { \tl_put_right:Nn \exp_not:c { CTEX@#1 at break } { ####1 } } ,
         #1 / format+         .code:n =
           { \tl_put_right:Nn \exp_not:c { CTEX@#1 at format } { ####1 } } ,
         #1 / nameformat+     .code:n =
@@ -130,9 +133,6 @@
     \group_end:
     \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } }
   }
-\cs_new_protected_nopar:Npn \CTEX at makeheadinganchor { }
-\ctex_at_end_package:nn { hyperref }
-  { \cs_gset_protected_nopar:Npn \CTEX at makeheadinganchor { \phantomsection } }
 \cs_new_protected_nopar:Npn \CTEX at fixheadingskip
   {
     \par
@@ -143,9 +143,17 @@
 \cs_new_protected_nopar:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\ProvideDocumentCommand \partmark { m }
+  { \markboth { } { } }
+\cs_new_eq:NN \CTEXifname \use_i:nn
+\cs_new_protected_nopar:Npn \CTEX at ifnametrue
+  { \cs_set_eq:NN \CTEXifname \use_i:nn }
+\cs_new_protected_nopar:Npn \CTEX at ifnamefalse
+  { \cs_set_eq:NN \CTEXifname \use_ii:nn }
 \renewcommand\part{%
    \if at noskipsec \leavevmode \fi
    \par
+   \CTEX at part@break
    \CTEX at setheadingskip \CTEX at part@beforeskip
    \ifodd \CTEX at part@fixskip \CTEX at fixheadingskip \fi
    \addvspace \CTEX at headingskip
@@ -158,13 +166,17 @@
 \def\@part[#1]#2{%
   \ifnum \c at secnumdepth >\m at ne
     \ifodd \CTEX at part@numbering
+      \CTEX at ifnametrue
       \refstepcounter{part}%
       \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{part*}%
       \addcontentsline{toc}{part}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@part{part*}%
     \addcontentsline{toc}{part}{#1}%
   \fi
   {\interlinepenalty \@M
@@ -173,7 +185,7 @@
      \CTEX at partname \CTEX at part@aftername
    \fi \fi
    \CTEX at part@titleformat{#2}%
-   \markboth{}{}%
+   \partmark{#1}%
    \CTEX at part@aftertitle}%
   \nobreak
   \CTEX at setheadingskip \CTEX at part@afterskip
@@ -181,6 +193,8 @@
   \vskip \CTEX at headingskip
   \@afterheading}
 \def\@spart#1{%
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@spart{part*}%
     {\interlinepenalty \@M
      \normalfont \parindent \dimexpr \CTEX at part@indent \relax
      \CTEX at part@format
@@ -203,25 +217,30 @@
   \if at nobreak
     \everypar{}%
   \else
-    \addpenalty\@secpenalty
+    \csname CTEX@#1 at break\endcsname
     \CTEX at setheadingskip{#4}%
     \ifodd \CTEX at fixskip \CTEX at fixheadingskip \fi
     \addvspace \CTEX at headingskip
   \fi
   \@ifstar
-    {\@ssect{#3}{#4}{#5}{#6}}%
+    {\CTEX at makeanchor@ssect{#1*}\@ssect{#3}{#4}{#5}{#6}}%
     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
 \def\@seccntformat#1{%
-  \csname CTEX@#1name\endcsname \csname CTEX@#1 at aftername\endcsname}
+  \csname CTEX@#1name\endcsname
+  \csname CTEX@#1 at aftername\endcsname}
 \def\@sect#1#2#3#4#5#6[#7]#8{%
   \ifnum #2>\c at secnumdepth
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@sect{#1*}%
     \let\@svsec\@empty
   \else
     \ifodd \csname CTEX@#1 at numbering\endcsname
+      \CTEX at ifnametrue
       \refstepcounter{#1}%
       \protected at edef\@svsec{\@seccntformat{#1}\relax}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{#1*}%
       \let\@svsec\@empty
     \fi
   \fi
@@ -235,11 +254,7 @@
     \endgroup
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}%
   \else
     \def\@svsechd{%
@@ -249,15 +264,12 @@
       \csname CTEX@#1 at aftertitle\endcsname}%
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}}%
   \fi
   \@xsect{#5}}
 \def\@ssect#1#2#3#4#5{%
+  \CTEX at ifnamefalse
   \unless \ifodd \CTEX at runin
     \begingroup
       #4{%
@@ -342,6 +354,48 @@
     \gdef \CTEX at postsection { \CTEX at postappendix }
     \gdef \CTEX at section@numbering { \CTEX at appendix@numbering }
   }
+\cs_new_protected_nopar:Npn \CTEX at makeanchor #1
+  { }
+\seq_new:N \c__ctex_headings_cs_seq
+\seq_gset_from_clist:Nn \c__ctex_headings_cs_seq
+  { part , spart , sect , ssect }
+\seq_map_inline:Nn \c__ctex_headings_cs_seq
+  {
+    \cs_new_eq:cc { CTEX@ #1 } { @ #1 }
+    \cs_new_eq:cN { CTEX at makeanchor@ #1 } \CTEX at makeanchor
+  }
+\cs_new_protected_nopar:Npn \CTEX at hyperheadinghook
+  {
+    \group_begin:
+      \ifHy at implicit
+        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          {
+            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+              {
+                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+              }
+          }
+      \else:
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+      \fi:
+    \group_end:
+  }
+\ctex_at_end_package:nn { hyperref }
+  {
+    \cs_gset_protected_nopar:Npn \CTEX at makeanchor #1
+      {
+        \Hy at MakeCurrentHrefAuto {#1}
+        \Hy at raisedlink
+          {
+            \hyper at anchorstart { \@currentHref }
+            \hyper at anchorend
+          }
+      }
+    \CTEX at hyperheadinghook
+  }
 \cs_new_protected_nopar:Npn \ctex_titlesec_hook:
   {
     \@ifpackagewith { titlesec } { explicit }
@@ -409,6 +463,28 @@
           { \ctex_titlesec_hook: }
       }
   }
+\ctex_at_end_package:nn { titlesec }
+  {
+    \cs_if_free:NF \ttl at tocpart
+      {
+        \cs_set_protected_nopar:Npn \ttl at tocpart
+          { \tl_set:Nn \ttl at a { \CTEXthepart \hspace { 1em } } }
+      }
+    \seq_map_inline:Nn \c__ctex_headings_seq
+      {
+        \cs_if_exist:cF { ttl at toc #1 }
+          {
+            \cs_new_protected_nopar:cpx { ttl at toc #1 }
+              {
+                \tl_set:Nn \exp_not:N \ttl at a
+                  {
+                    \exp_not:N \protect
+                    \exp_not:N \numberline { \exp_not:c { CTEXthe #1 } }
+                  }
+              }
+          }
+      }
+  }
 \group_begin:
 \char_set_catcode_other:N \#
 \cs_new_protected_nopar:Npn \ctex_titleps_hook:
@@ -446,6 +522,18 @@
 \ctex_at_end_package:nn { titlesec }
   { \cs_if_free:NF \ttl at settopmark { \ctex_titleps_hook: } }
 \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: }
+\ctex_at_end_package:nn { titleps }
+  {
+    \cs_set_protected_nopar:Npn \ttl at setifthe #1
+      {
+        \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 }
+          {
+            \CTEXifname
+              { \protect \@firstoftwo }
+              { \protect \@secondoftwo }
+          }
+      }
+  }
 \cs_new_protected:Npn \CTEX at toc@width at n #1
   {
     \hbox_set:Nn \l__ctex_tmp_box {#1}
@@ -478,21 +566,21 @@
       }
   }
 \ctex_patch_cmd:Nnn \ps at headings
-  { \thesection \quad }
-  { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+  { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+  { \CTEXifname { \CTEXthesection \quad } { } }
 \if at twoside
   \ctex_patch_cmd:Nnn \ps at headings
-    { \thesubsection \quad }
-    { \ifodd \CTEX at subsection@numbering \CTEXthesubsection \quad \fi }
+    { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
+    { \CTEXifname { \CTEXthesubsection \quad } { } }
 \fi:
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesection \hskip 1em \relax }
-      { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+      { \ifnum \c at secnumdepth > \z@ \thesection \hskip 1em \relax \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesubsection \hskip 1em \relax }
-      { \ifodd \CTEX at subsection@numbering \CTEXthesubsection \quad \fi }
+      { \ifnum \c at secnumdepth > \@ne \thesubsection \hskip 1em \relax \fi }
+      { \CTEXifname { \CTEXthesubsection \quad } { } }
   }
 \cs_new_protected_nopar:Npn \CTEX at setcurrentlabel@n #1
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex-beamer.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex-beamer.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex-beamer.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading modification for beamer (CTEX)}
 \ProvidesExplFile{ctex-beamer.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \seq_new:N \c__ctex_headings_seq
 \seq_gset_from_clist:Nn \c__ctex_headings_seq
   { part , section , subsection }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex-book.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex-book.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex-book.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading modification for book (CTEX)}
 \ProvidesExplFile{ctex-book.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \seq_new:N \c__ctex_section_headings_seq
 \seq_gset_from_clist:Nn \c__ctex_section_headings_seq
   { section , subsection , subsubsection , paragraph , subparagraph }
@@ -88,6 +88,9 @@
         #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1 at afterindent } ,
         #1 / fixskip     .bool_set:N = \exp_not:c { CTEX@#1 at fixskip } ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
+        #1 / break         .tl_set:N = \exp_not:c { CTEX@#1 at break } ,
+        #1 / break+          .code:n =
+          { \tl_put_right:Nn \exp_not:c { CTEX@#1 at break } { ####1 } } ,
         #1 / format+         .code:n =
           { \tl_put_right:Nn \exp_not:c { CTEX@#1 at format } { ####1 } } ,
         #1 / nameformat+     .code:n =
@@ -135,9 +138,6 @@
     \group_end:
     \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } }
   }
-\cs_new_protected_nopar:Npn \CTEX at makeheadinganchor { }
-\ctex_at_end_package:nn { hyperref }
-  { \cs_gset_protected_nopar:Npn \CTEX at makeheadinganchor { \phantomsection } }
 \cs_new_protected_nopar:Npn \CTEX at fixtopskip
   {
     \CTEX at fixheadingskip
@@ -154,12 +154,15 @@
 \cs_new_protected_nopar:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\ProvideDocumentCommand \partmark { m }
+  { \markboth { } { } }
+\cs_new_eq:NN \CTEXifname \use_i:nn
+\cs_new_protected_nopar:Npn \CTEX at ifnametrue
+  { \cs_set_eq:NN \CTEXifname \use_i:nn }
+\cs_new_protected_nopar:Npn \CTEX at ifnamefalse
+  { \cs_set_eq:NN \CTEXifname \use_ii:nn }
 \renewcommand\part{%
-  \if at openright
-    \cleardoublepage
-  \else
-    \clearpage
-  \fi
+  \CTEX at part@break
   \thispagestyle{\CTEX at part@pagestyle}%
   \if at twocolumn
     \onecolumn
@@ -174,16 +177,20 @@
 \def\@part[#1]#2{%
   \ifnum \c at secnumdepth >-2\relax
     \ifodd \CTEX at part@numbering
+      \CTEX at ifnametrue
       \refstepcounter{part}%
       \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{part*}%
       \addcontentsline{toc}{part}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@part{part*}%
     \addcontentsline{toc}{part}{#1}%
   \fi
-  \markboth{}{}%
+   \partmark{#1}%
   {\interlinepenalty \@M
    \normalfont \CTEX at part@format
    \ifnum \c at secnumdepth >-2\relax \ifodd \CTEX at part@numbering
@@ -193,6 +200,8 @@
    \CTEX at part@aftertitle}%
   \@endpart}
 \def\@spart#1{%
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@spart{part*}%
     {\interlinepenalty \@M
      \normalfont \CTEX at part@format
      \CTEX at part@titleformat{#1}%
@@ -213,7 +222,8 @@
               \if at tempswa
                 \twocolumn
               \fi}
-\renewcommand\chapter{\if at openright\cleardoublepage\else\clearpage\fi
+\renewcommand\chapter{%
+                    \CTEX at chapter@break
                     \thispagestyle{\CTEX at chapter@pagestyle}%
                     \global\@topnum\z@
                     \ifodd \CTEX at chapter@afterindent
@@ -226,18 +236,24 @@
   \ifnum \c at secnumdepth >\m at ne
     \if at mainmatter
       \ifodd \CTEX at chapter@numbering
+        \CTEX at ifnametrue
         \refstepcounter{chapter}%
         \typeout{\CTEXthechapter}%
         \addcontentsline{toc}{chapter}
           {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}%
       \else
-        \CTEX at makeheadinganchor
+        \CTEX at ifnamefalse
+        \CTEX at makeanchor{\Hy at chapapp*}%
         \addcontentsline{toc}{chapter}{#1}%
       \fi
     \else
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor@chapter{\Hy at chapapp*}%
       \addcontentsline{toc}{chapter}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@chapter{\Hy at chapapp*}%
     \addcontentsline{toc}{chapter}{#1}%
   \fi
   \chaptermark{#1}%
@@ -249,6 +265,15 @@
     \@makechapterhead{#2}%
   \@afterheading
   \fi}
+\def\@schapter#1{%
+  \CTEX at ifnamefalse
+  \CTEX at makeanchor@schapter{\Hy at chapapp*}%
+  \if at twocolumn
+    \@topnewpage[\@makeschapterhead{#1}]%
+  \else
+    \@makeschapterhead{#1}%
+    \@afterheading
+  \fi}
 \def\@makechapterhead#1{%
   \CTEX at setheadingskip \CTEX at chapter@beforeskip
   \ifodd \CTEX at chapter@fixskip \CTEX at fixtopskip \fi
@@ -255,13 +280,7 @@
   \vspace*{\CTEX at headingskip}%
   {\normalfont \parindent \dimexpr \CTEX at chapter@indent \relax
    \CTEX at chapter@format
-   \ifnum \c at secnumdepth >\m at ne
-     \if at mainmatter
-       \ifodd \CTEX at chapter@numbering
-         \CTEX at chaptername \CTEX at chapter@aftername
-       \fi
-     \fi
-   \fi
+   \CTEXifname{\CTEX at chaptername\CTEX at chapter@aftername}{}%
    \interlinepenalty\@M
    \CTEX at chapter@titleformat{#1}%
    \CTEX at chapter@aftertitle
@@ -296,25 +315,30 @@
   \if at nobreak
     \everypar{}%
   \else
-    \addpenalty\@secpenalty
+    \csname CTEX@#1 at break\endcsname
     \CTEX at setheadingskip{#4}%
     \ifodd \CTEX at fixskip \CTEX at fixheadingskip \fi
     \addvspace \CTEX at headingskip
   \fi
   \@ifstar
-    {\@ssect{#3}{#4}{#5}{#6}}%
+    {\CTEX at makeanchor@ssect{#1*}\@ssect{#3}{#4}{#5}{#6}}%
     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
 \def\@seccntformat#1{%
-  \csname CTEX@#1name\endcsname \csname CTEX@#1 at aftername\endcsname}
+  \csname CTEX@#1name\endcsname
+  \csname CTEX@#1 at aftername\endcsname}
 \def\@sect#1#2#3#4#5#6[#7]#8{%
   \ifnum #2>\c at secnumdepth
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@sect{#1*}%
     \let\@svsec\@empty
   \else
     \ifodd \csname CTEX@#1 at numbering\endcsname
+      \CTEX at ifnametrue
       \refstepcounter{#1}%
       \protected at edef\@svsec{\@seccntformat{#1}\relax}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{#1*}%
       \let\@svsec\@empty
     \fi
   \fi
@@ -328,11 +352,7 @@
     \endgroup
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}%
   \else
     \def\@svsechd{%
@@ -342,15 +362,12 @@
       \csname CTEX@#1 at aftertitle\endcsname}%
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}}%
   \fi
   \@xsect{#5}}
 \def\@ssect#1#2#3#4#5{%
+  \CTEX at ifnamefalse
   \unless \ifodd \CTEX at runin
     \begingroup
       #4{%
@@ -435,6 +452,48 @@
     \gdef \CTEX at postchapter { \CTEX at postappendix }
     \gdef \CTEX at chapter@numbering { \CTEX at appendix@numbering }
   }
+\cs_new_protected_nopar:Npn \CTEX at makeanchor #1
+  { }
+\seq_new:N \c__ctex_headings_cs_seq
+\seq_gset_from_clist:Nn \c__ctex_headings_cs_seq
+  { part , spart , chapter , schapter , sect , ssect }
+\seq_map_inline:Nn \c__ctex_headings_cs_seq
+  {
+    \cs_new_eq:cc { CTEX@ #1 } { @ #1 }
+    \cs_new_eq:cN { CTEX at makeanchor@ #1 } \CTEX at makeanchor
+  }
+\cs_new_protected_nopar:Npn \CTEX at hyperheadinghook
+  {
+    \group_begin:
+      \ifHy at implicit
+        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          {
+            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+              {
+                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+              }
+          }
+      \else:
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+      \fi:
+    \group_end:
+  }
+\ctex_at_end_package:nn { hyperref }
+  {
+    \cs_gset_protected_nopar:Npn \CTEX at makeanchor #1
+      {
+        \Hy at MakeCurrentHrefAuto {#1}
+        \Hy at raisedlink
+          {
+            \hyper at anchorstart { \@currentHref }
+            \hyper at anchorend
+          }
+      }
+    \CTEX at hyperheadinghook
+  }
 \cs_new_protected_nopar:Npn \ctex_titlesec_hook:
   {
     \@ifpackagewith { titlesec } { explicit }
@@ -502,6 +561,29 @@
           { \ctex_titlesec_hook: }
       }
   }
+\ctex_at_end_package:nn { titlesec }
+  {
+    \tl_set:Nn \ttl at chapterout { \typeout { \CTEXthechapter } }
+    \cs_if_free:NF \ttl at tocpart
+      {
+        \cs_set_protected_nopar:Npn \ttl at tocpart
+          { \tl_set:Nn \ttl at a { \CTEXthepart \hspace { 1em } } }
+      }
+    \seq_map_inline:Nn \c__ctex_headings_seq
+      {
+        \cs_if_exist:cF { ttl at toc #1 }
+          {
+            \cs_new_protected_nopar:cpx { ttl at toc #1 }
+              {
+                \tl_set:Nn \exp_not:N \ttl at a
+                  {
+                    \exp_not:N \protect
+                    \exp_not:N \numberline { \exp_not:c { CTEXthe #1 } }
+                  }
+              }
+          }
+      }
+  }
 \group_begin:
 \char_set_catcode_other:N \#
 \cs_new_protected_nopar:Npn \ctex_titleps_hook:
@@ -539,6 +621,18 @@
 \ctex_at_end_package:nn { titlesec }
   { \cs_if_free:NF \ttl at settopmark { \ctex_titleps_hook: } }
 \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: }
+\ctex_at_end_package:nn { titleps }
+  {
+    \cs_set_protected_nopar:Npn \ttl at setifthe #1
+      {
+        \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 }
+          {
+            \CTEXifname
+              { \protect \@firstoftwo }
+              { \protect \@secondoftwo }
+          }
+      }
+  }
 \cs_new_protected:Npn \CTEX at toc@width at n #1
   {
     \hbox_set:Nn \l__ctex_tmp_box {#1}
@@ -571,21 +665,25 @@
       }
   }
 \ctex_patch_cmd:Nnn \ps at headings
-  { \@chapapp\ \thechapter.~\ }
-  { \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi }
+  {
+    \ifnum \c at secnumdepth > \m at ne \if at mainmatter
+      \@chapapp \ \thechapter . ~ \
+    \fi \fi
+  }
+  { \CTEXifname { \CTEXthechapter \quad } { } }
 \if at twoside
   \ctex_patch_cmd:Nnn \ps at headings
-    { \thesection.~\ }
-    { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+    { \CTEXifname { \CTEXthesection } { } }
 \fi:
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \@chapapp\ \thechapter.~\ }
-      { \if at mainmatter \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi \fi }
+      { \ifnum \c at secnumdepth > \m at ne \@chapapp \ \thechapter . ~ \ \fi }
+      { \CTEXifname { \CTEXthechapter \quad } { } }
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesection.~\ }
-      { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection } { } }
   }
 \cs_new_protected_nopar:Npn \CTEX at setcurrentlabel@n #1
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {c5size option (CTEX)}
 \ProvidesExplFile{ctex-c5size.clo}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \ctex_set_font_size:Nnn \normalsize { 5 }
   {
     \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {cs4size option (CTEX)}
 \ProvidesExplFile{ctex-cs4size.clo}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \ctex_set_font_size:Nnn \normalsize { -4 }
   {
     \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex-report.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex-report.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex-report.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading modification for report (CTEX)}
 \ProvidesExplFile{ctex-report.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \seq_new:N \c__ctex_section_headings_seq
 \seq_gset_from_clist:Nn \c__ctex_section_headings_seq
   { section , subsection , subsubsection , paragraph , subparagraph }
@@ -88,6 +88,9 @@
         #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1 at afterindent } ,
         #1 / fixskip     .bool_set:N = \exp_not:c { CTEX@#1 at fixskip } ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
+        #1 / break         .tl_set:N = \exp_not:c { CTEX@#1 at break } ,
+        #1 / break+          .code:n =
+          { \tl_put_right:Nn \exp_not:c { CTEX@#1 at break } { ####1 } } ,
         #1 / format+         .code:n =
           { \tl_put_right:Nn \exp_not:c { CTEX@#1 at format } { ####1 } } ,
         #1 / nameformat+     .code:n =
@@ -135,9 +138,6 @@
     \group_end:
     \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } }
   }
-\cs_new_protected_nopar:Npn \CTEX at makeheadinganchor { }
-\ctex_at_end_package:nn { hyperref }
-  { \cs_gset_protected_nopar:Npn \CTEX at makeheadinganchor { \phantomsection } }
 \cs_new_protected_nopar:Npn \CTEX at fixtopskip
   {
     \CTEX at fixheadingskip
@@ -154,12 +154,15 @@
 \cs_new_protected_nopar:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\ProvideDocumentCommand \partmark { m }
+  { \markboth { } { } }
+\cs_new_eq:NN \CTEXifname \use_i:nn
+\cs_new_protected_nopar:Npn \CTEX at ifnametrue
+  { \cs_set_eq:NN \CTEXifname \use_i:nn }
+\cs_new_protected_nopar:Npn \CTEX at ifnamefalse
+  { \cs_set_eq:NN \CTEXifname \use_ii:nn }
 \renewcommand\part{%
-  \if at openright
-    \cleardoublepage
-  \else
-    \clearpage
-  \fi
+  \CTEX at part@break
   \thispagestyle{\CTEX at part@pagestyle}%
   \if at twocolumn
     \onecolumn
@@ -174,16 +177,20 @@
 \def\@part[#1]#2{%
   \ifnum \c at secnumdepth >-2\relax
     \ifodd \CTEX at part@numbering
+      \CTEX at ifnametrue
       \refstepcounter{part}%
       \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{part*}%
       \addcontentsline{toc}{part}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@part{part*}%
     \addcontentsline{toc}{part}{#1}%
   \fi
-  \markboth{}{}%
+   \partmark{#1}%
   {\interlinepenalty \@M
    \normalfont \CTEX at part@format
    \ifnum \c at secnumdepth >-2\relax \ifodd \CTEX at part@numbering
@@ -193,6 +200,8 @@
    \CTEX at part@aftertitle}%
   \@endpart}
 \def\@spart#1{%
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@spart{part*}%
     {\interlinepenalty \@M
      \normalfont \CTEX at part@format
      \CTEX at part@titleformat{#1}%
@@ -213,7 +222,8 @@
               \if at tempswa
                 \twocolumn
               \fi}
-\renewcommand\chapter{\if at openright\cleardoublepage\else\clearpage\fi
+\renewcommand\chapter{%
+                    \CTEX at chapter@break
                     \thispagestyle{\CTEX at chapter@pagestyle}%
                     \global\@topnum\z@
                     \ifodd \CTEX at chapter@afterindent
@@ -225,15 +235,19 @@
 \def\@chapter[#1]#2{%
   \ifnum \c at secnumdepth >\m at ne
       \ifodd \CTEX at chapter@numbering
+        \CTEX at ifnametrue
         \refstepcounter{chapter}%
         \typeout{\CTEXthechapter}%
         \addcontentsline{toc}{chapter}
           {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}%
       \else
-        \CTEX at makeheadinganchor
+        \CTEX at ifnamefalse
+        \CTEX at makeanchor{\Hy at chapapp*}%
         \addcontentsline{toc}{chapter}{#1}%
       \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@chapter{\Hy at chapapp*}%
     \addcontentsline{toc}{chapter}{#1}%
   \fi
   \chaptermark{#1}%
@@ -245,6 +259,15 @@
     \@makechapterhead{#2}%
   \@afterheading
   \fi}
+\def\@schapter#1{%
+  \CTEX at ifnamefalse
+  \CTEX at makeanchor@schapter{\Hy at chapapp*}%
+  \if at twocolumn
+    \@topnewpage[\@makeschapterhead{#1}]%
+  \else
+    \@makeschapterhead{#1}%
+    \@afterheading
+  \fi}
 \def\@makechapterhead#1{%
   \CTEX at setheadingskip \CTEX at chapter@beforeskip
   \ifodd \CTEX at chapter@fixskip \CTEX at fixtopskip \fi
@@ -251,11 +274,7 @@
   \vspace*{\CTEX at headingskip}%
   {\normalfont \parindent \dimexpr \CTEX at chapter@indent \relax
    \CTEX at chapter@format
-   \ifnum \c at secnumdepth >\m at ne
-       \ifodd \CTEX at chapter@numbering
-         \CTEX at chaptername \CTEX at chapter@aftername
-       \fi
-   \fi
+   \CTEXifname{\CTEX at chaptername\CTEX at chapter@aftername}{}%
    \interlinepenalty\@M
    \CTEX at chapter@titleformat{#1}%
    \CTEX at chapter@aftertitle
@@ -290,25 +309,30 @@
   \if at nobreak
     \everypar{}%
   \else
-    \addpenalty\@secpenalty
+    \csname CTEX@#1 at break\endcsname
     \CTEX at setheadingskip{#4}%
     \ifodd \CTEX at fixskip \CTEX at fixheadingskip \fi
     \addvspace \CTEX at headingskip
   \fi
   \@ifstar
-    {\@ssect{#3}{#4}{#5}{#6}}%
+    {\CTEX at makeanchor@ssect{#1*}\@ssect{#3}{#4}{#5}{#6}}%
     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
 \def\@seccntformat#1{%
-  \csname CTEX@#1name\endcsname \csname CTEX@#1 at aftername\endcsname}
+  \csname CTEX@#1name\endcsname
+  \csname CTEX@#1 at aftername\endcsname}
 \def\@sect#1#2#3#4#5#6[#7]#8{%
   \ifnum #2>\c at secnumdepth
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@sect{#1*}%
     \let\@svsec\@empty
   \else
     \ifodd \csname CTEX@#1 at numbering\endcsname
+      \CTEX at ifnametrue
       \refstepcounter{#1}%
       \protected at edef\@svsec{\@seccntformat{#1}\relax}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{#1*}%
       \let\@svsec\@empty
     \fi
   \fi
@@ -322,11 +346,7 @@
     \endgroup
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}%
   \else
     \def\@svsechd{%
@@ -336,15 +356,12 @@
       \csname CTEX@#1 at aftertitle\endcsname}%
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}}%
   \fi
   \@xsect{#5}}
 \def\@ssect#1#2#3#4#5{%
+  \CTEX at ifnamefalse
   \unless \ifodd \CTEX at runin
     \begingroup
       #4{%
@@ -429,6 +446,48 @@
     \gdef \CTEX at postchapter { \CTEX at postappendix }
     \gdef \CTEX at chapter@numbering { \CTEX at appendix@numbering }
   }
+\cs_new_protected_nopar:Npn \CTEX at makeanchor #1
+  { }
+\seq_new:N \c__ctex_headings_cs_seq
+\seq_gset_from_clist:Nn \c__ctex_headings_cs_seq
+  { part , spart , chapter , schapter , sect , ssect }
+\seq_map_inline:Nn \c__ctex_headings_cs_seq
+  {
+    \cs_new_eq:cc { CTEX@ #1 } { @ #1 }
+    \cs_new_eq:cN { CTEX at makeanchor@ #1 } \CTEX at makeanchor
+  }
+\cs_new_protected_nopar:Npn \CTEX at hyperheadinghook
+  {
+    \group_begin:
+      \ifHy at implicit
+        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          {
+            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+              {
+                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+              }
+          }
+      \else:
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+      \fi:
+    \group_end:
+  }
+\ctex_at_end_package:nn { hyperref }
+  {
+    \cs_gset_protected_nopar:Npn \CTEX at makeanchor #1
+      {
+        \Hy at MakeCurrentHrefAuto {#1}
+        \Hy at raisedlink
+          {
+            \hyper at anchorstart { \@currentHref }
+            \hyper at anchorend
+          }
+      }
+    \CTEX at hyperheadinghook
+  }
 \cs_new_protected_nopar:Npn \ctex_titlesec_hook:
   {
     \@ifpackagewith { titlesec } { explicit }
@@ -496,6 +555,29 @@
           { \ctex_titlesec_hook: }
       }
   }
+\ctex_at_end_package:nn { titlesec }
+  {
+    \tl_set:Nn \ttl at chapterout { \typeout { \CTEXthechapter } }
+    \cs_if_free:NF \ttl at tocpart
+      {
+        \cs_set_protected_nopar:Npn \ttl at tocpart
+          { \tl_set:Nn \ttl at a { \CTEXthepart \hspace { 1em } } }
+      }
+    \seq_map_inline:Nn \c__ctex_headings_seq
+      {
+        \cs_if_exist:cF { ttl at toc #1 }
+          {
+            \cs_new_protected_nopar:cpx { ttl at toc #1 }
+              {
+                \tl_set:Nn \exp_not:N \ttl at a
+                  {
+                    \exp_not:N \protect
+                    \exp_not:N \numberline { \exp_not:c { CTEXthe #1 } }
+                  }
+              }
+          }
+      }
+  }
 \group_begin:
 \char_set_catcode_other:N \#
 \cs_new_protected_nopar:Npn \ctex_titleps_hook:
@@ -533,6 +615,18 @@
 \ctex_at_end_package:nn { titlesec }
   { \cs_if_free:NF \ttl at settopmark { \ctex_titleps_hook: } }
 \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: }
+\ctex_at_end_package:nn { titleps }
+  {
+    \cs_set_protected_nopar:Npn \ttl at setifthe #1
+      {
+        \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 }
+          {
+            \CTEXifname
+              { \protect \@firstoftwo }
+              { \protect \@secondoftwo }
+          }
+      }
+  }
 \cs_new_protected:Npn \CTEX at toc@width at n #1
   {
     \hbox_set:Nn \l__ctex_tmp_box {#1}
@@ -565,21 +659,25 @@
       }
   }
 \ctex_patch_cmd:Nnn \ps at headings
-  { \@chapapp\ \thechapter.~\ }
-  { \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi }
+  {
+    \ifnum \c at secnumdepth > \m at ne \if at mainmatter
+      \@chapapp \ \thechapter . ~ \
+    \fi \fi
+  }
+  { \CTEXifname { \CTEXthechapter \quad } { } }
 \if at twoside
   \ctex_patch_cmd:Nnn \ps at headings
-    { \thesection.~\ }
-    { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+    { \CTEXifname { \CTEXthesection } { } }
 \fi:
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \@chapapp\ \thechapter.~\ }
-      { \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi }
+      { \ifnum \c at secnumdepth > \m at ne \@chapapp \ \thechapter . ~ \ \fi }
+      { \CTEXifname { \CTEXthechapter \quad } { } }
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesection.~\ }
-      { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection } { } }
   }
 \cs_new_protected_nopar:Npn \CTEX at setcurrentlabel@n #1
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex.sty	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex.sty	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter in LaTeX (CTEX)}
 \ProvidesExplPackage{\ExplFileName}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \tl_const:Nx \c__ctex_version_tl
   { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } }
 \msg_new:nnnn { ctex } { subpackage-loaded }
@@ -71,8 +71,8 @@
 \RequirePackage { fix-cm , everysel }
 \tl_new:N \l__ctex_tmp_tl
 \int_new:N \l__ctex_tmp_int
+\box_new:N \l__ctex_tmp_box
 \dim_new:N \l__ctex_tmp_dim
-\box_new:N \l__ctex_tmp_box
 \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3
   {
     \use:x

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexart.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexart.cls	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexart.cls	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter for class article (CTEX)}
 \ProvidesExplClass{ctexart}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \tl_const:Nx \c__ctex_version_tl
   { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } }
 \cs_new_eq:cN { ver at ctex.        \@pkgextension } \c__ctex_version_tl
@@ -65,8 +65,8 @@
 \RequirePackage { fix-cm , everysel }
 \tl_new:N \l__ctex_tmp_tl
 \int_new:N \l__ctex_tmp_int
+\box_new:N \l__ctex_tmp_box
 \dim_new:N \l__ctex_tmp_dim
-\box_new:N \l__ctex_tmp_box
 \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3
   {
     \use:x
@@ -650,6 +650,9 @@
         #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1 at afterindent } ,
         #1 / fixskip     .bool_set:N = \exp_not:c { CTEX@#1 at fixskip } ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
+        #1 / break         .tl_set:N = \exp_not:c { CTEX@#1 at break } ,
+        #1 / break+          .code:n =
+          { \tl_put_right:Nn \exp_not:c { CTEX@#1 at break } { ####1 } } ,
         #1 / format+         .code:n =
           { \tl_put_right:Nn \exp_not:c { CTEX@#1 at format } { ####1 } } ,
         #1 / nameformat+     .code:n =
@@ -693,9 +696,6 @@
     \group_end:
     \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } }
   }
-\cs_new_protected_nopar:Npn \CTEX at makeheadinganchor { }
-\ctex_at_end_package:nn { hyperref }
-  { \cs_gset_protected_nopar:Npn \CTEX at makeheadinganchor { \phantomsection } }
 \cs_new_protected_nopar:Npn \CTEX at fixheadingskip
   {
     \par
@@ -706,9 +706,17 @@
 \cs_new_protected_nopar:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\ProvideDocumentCommand \partmark { m }
+  { \markboth { } { } }
+\cs_new_eq:NN \CTEXifname \use_i:nn
+\cs_new_protected_nopar:Npn \CTEX at ifnametrue
+  { \cs_set_eq:NN \CTEXifname \use_i:nn }
+\cs_new_protected_nopar:Npn \CTEX at ifnamefalse
+  { \cs_set_eq:NN \CTEXifname \use_ii:nn }
 \renewcommand\part{%
    \if at noskipsec \leavevmode \fi
    \par
+   \CTEX at part@break
    \CTEX at setheadingskip \CTEX at part@beforeskip
    \ifodd \CTEX at part@fixskip \CTEX at fixheadingskip \fi
    \addvspace \CTEX at headingskip
@@ -721,13 +729,17 @@
 \def\@part[#1]#2{%
   \ifnum \c at secnumdepth >\m at ne
     \ifodd \CTEX at part@numbering
+      \CTEX at ifnametrue
       \refstepcounter{part}%
       \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{part*}%
       \addcontentsline{toc}{part}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@part{part*}%
     \addcontentsline{toc}{part}{#1}%
   \fi
   {\interlinepenalty \@M
@@ -736,7 +748,7 @@
      \CTEX at partname \CTEX at part@aftername
    \fi \fi
    \CTEX at part@titleformat{#2}%
-   \markboth{}{}%
+   \partmark{#1}%
    \CTEX at part@aftertitle}%
   \nobreak
   \CTEX at setheadingskip \CTEX at part@afterskip
@@ -744,6 +756,8 @@
   \vskip \CTEX at headingskip
   \@afterheading}
 \def\@spart#1{%
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@spart{part*}%
     {\interlinepenalty \@M
      \normalfont \parindent \dimexpr \CTEX at part@indent \relax
      \CTEX at part@format
@@ -766,25 +780,30 @@
   \if at nobreak
     \everypar{}%
   \else
-    \addpenalty\@secpenalty
+    \csname CTEX@#1 at break\endcsname
     \CTEX at setheadingskip{#4}%
     \ifodd \CTEX at fixskip \CTEX at fixheadingskip \fi
     \addvspace \CTEX at headingskip
   \fi
   \@ifstar
-    {\@ssect{#3}{#4}{#5}{#6}}%
+    {\CTEX at makeanchor@ssect{#1*}\@ssect{#3}{#4}{#5}{#6}}%
     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
 \def\@seccntformat#1{%
-  \csname CTEX@#1name\endcsname \csname CTEX@#1 at aftername\endcsname}
+  \csname CTEX@#1name\endcsname
+  \csname CTEX@#1 at aftername\endcsname}
 \def\@sect#1#2#3#4#5#6[#7]#8{%
   \ifnum #2>\c at secnumdepth
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@sect{#1*}%
     \let\@svsec\@empty
   \else
     \ifodd \csname CTEX@#1 at numbering\endcsname
+      \CTEX at ifnametrue
       \refstepcounter{#1}%
       \protected at edef\@svsec{\@seccntformat{#1}\relax}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{#1*}%
       \let\@svsec\@empty
     \fi
   \fi
@@ -798,11 +817,7 @@
     \endgroup
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}%
   \else
     \def\@svsechd{%
@@ -812,15 +827,12 @@
       \csname CTEX@#1 at aftertitle\endcsname}%
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}}%
   \fi
   \@xsect{#5}}
 \def\@ssect#1#2#3#4#5{%
+  \CTEX at ifnamefalse
   \unless \ifodd \CTEX at runin
     \begingroup
       #4{%
@@ -905,6 +917,48 @@
     \gdef \CTEX at postsection { \CTEX at postappendix }
     \gdef \CTEX at section@numbering { \CTEX at appendix@numbering }
   }
+\cs_new_protected_nopar:Npn \CTEX at makeanchor #1
+  { }
+\seq_new:N \c__ctex_headings_cs_seq
+\seq_gset_from_clist:Nn \c__ctex_headings_cs_seq
+  { part , spart , sect , ssect }
+\seq_map_inline:Nn \c__ctex_headings_cs_seq
+  {
+    \cs_new_eq:cc { CTEX@ #1 } { @ #1 }
+    \cs_new_eq:cN { CTEX at makeanchor@ #1 } \CTEX at makeanchor
+  }
+\cs_new_protected_nopar:Npn \CTEX at hyperheadinghook
+  {
+    \group_begin:
+      \ifHy at implicit
+        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          {
+            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+              {
+                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+              }
+          }
+      \else:
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+      \fi:
+    \group_end:
+  }
+\ctex_at_end_package:nn { hyperref }
+  {
+    \cs_gset_protected_nopar:Npn \CTEX at makeanchor #1
+      {
+        \Hy at MakeCurrentHrefAuto {#1}
+        \Hy at raisedlink
+          {
+            \hyper at anchorstart { \@currentHref }
+            \hyper at anchorend
+          }
+      }
+    \CTEX at hyperheadinghook
+  }
 \cs_new_protected_nopar:Npn \ctex_titlesec_hook:
   {
     \@ifpackagewith { titlesec } { explicit }
@@ -972,6 +1026,28 @@
           { \ctex_titlesec_hook: }
       }
   }
+\ctex_at_end_package:nn { titlesec }
+  {
+    \cs_if_free:NF \ttl at tocpart
+      {
+        \cs_set_protected_nopar:Npn \ttl at tocpart
+          { \tl_set:Nn \ttl at a { \CTEXthepart \hspace { 1em } } }
+      }
+    \seq_map_inline:Nn \c__ctex_headings_seq
+      {
+        \cs_if_exist:cF { ttl at toc #1 }
+          {
+            \cs_new_protected_nopar:cpx { ttl at toc #1 }
+              {
+                \tl_set:Nn \exp_not:N \ttl at a
+                  {
+                    \exp_not:N \protect
+                    \exp_not:N \numberline { \exp_not:c { CTEXthe #1 } }
+                  }
+              }
+          }
+      }
+  }
 \group_begin:
 \char_set_catcode_other:N \#
 \cs_new_protected_nopar:Npn \ctex_titleps_hook:
@@ -1009,6 +1085,18 @@
 \ctex_at_end_package:nn { titlesec }
   { \cs_if_free:NF \ttl at settopmark { \ctex_titleps_hook: } }
 \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: }
+\ctex_at_end_package:nn { titleps }
+  {
+    \cs_set_protected_nopar:Npn \ttl at setifthe #1
+      {
+        \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 }
+          {
+            \CTEXifname
+              { \protect \@firstoftwo }
+              { \protect \@secondoftwo }
+          }
+      }
+  }
 \cs_new_protected:Npn \CTEX at toc@width at n #1
   {
     \hbox_set:Nn \l__ctex_tmp_box {#1}
@@ -1041,21 +1129,21 @@
       }
   }
 \ctex_patch_cmd:Nnn \ps at headings
-  { \thesection \quad }
-  { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+  { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+  { \CTEXifname { \CTEXthesection \quad } { } }
 \if at twoside
   \ctex_patch_cmd:Nnn \ps at headings
-    { \thesubsection \quad }
-    { \ifodd \CTEX at subsection@numbering \CTEXthesubsection \quad \fi }
+    { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
+    { \CTEXifname { \CTEXthesubsection \quad } { } }
 \fi:
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesection \hskip 1em \relax }
-      { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+      { \ifnum \c at secnumdepth > \z@ \thesection \hskip 1em \relax \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesubsection \hskip 1em \relax }
-      { \ifodd \CTEX at subsection@numbering \CTEXthesubsection \quad \fi }
+      { \ifnum \c at secnumdepth > \@ne \thesubsection \hskip 1em \relax \fi }
+      { \CTEXifname { \CTEXthesubsection \quad } { } }
   }
 \cs_new_protected_nopar:Npn \CTEX at setcurrentlabel@n #1
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter for class beamer (CTEX)}
 \ProvidesExplClass{ctexbeamer}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \tl_const:Nx \c__ctex_version_tl
   { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } }
 \cs_new_eq:cN { ver at ctex.        \@pkgextension } \c__ctex_version_tl
@@ -65,8 +65,8 @@
 \RequirePackage { fix-cm , everysel }
 \tl_new:N \l__ctex_tmp_tl
 \int_new:N \l__ctex_tmp_int
+\box_new:N \l__ctex_tmp_box
 \dim_new:N \l__ctex_tmp_dim
-\box_new:N \l__ctex_tmp_box
 \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3
   {
     \use:x

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexbook.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexbook.cls	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexbook.cls	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter for class book (CTEX)}
 \ProvidesExplClass{ctexbook}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \tl_const:Nx \c__ctex_version_tl
   { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } }
 \cs_new_eq:cN { ver at ctex.        \@pkgextension } \c__ctex_version_tl
@@ -65,8 +65,8 @@
 \RequirePackage { fix-cm , everysel }
 \tl_new:N \l__ctex_tmp_tl
 \int_new:N \l__ctex_tmp_int
+\box_new:N \l__ctex_tmp_box
 \dim_new:N \l__ctex_tmp_dim
-\box_new:N \l__ctex_tmp_box
 \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3
   {
     \use:x
@@ -651,6 +651,9 @@
         #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1 at afterindent } ,
         #1 / fixskip     .bool_set:N = \exp_not:c { CTEX@#1 at fixskip } ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
+        #1 / break         .tl_set:N = \exp_not:c { CTEX@#1 at break } ,
+        #1 / break+          .code:n =
+          { \tl_put_right:Nn \exp_not:c { CTEX@#1 at break } { ####1 } } ,
         #1 / format+         .code:n =
           { \tl_put_right:Nn \exp_not:c { CTEX@#1 at format } { ####1 } } ,
         #1 / nameformat+     .code:n =
@@ -698,9 +701,6 @@
     \group_end:
     \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } }
   }
-\cs_new_protected_nopar:Npn \CTEX at makeheadinganchor { }
-\ctex_at_end_package:nn { hyperref }
-  { \cs_gset_protected_nopar:Npn \CTEX at makeheadinganchor { \phantomsection } }
 \cs_new_protected_nopar:Npn \CTEX at fixtopskip
   {
     \CTEX at fixheadingskip
@@ -717,12 +717,15 @@
 \cs_new_protected_nopar:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\ProvideDocumentCommand \partmark { m }
+  { \markboth { } { } }
+\cs_new_eq:NN \CTEXifname \use_i:nn
+\cs_new_protected_nopar:Npn \CTEX at ifnametrue
+  { \cs_set_eq:NN \CTEXifname \use_i:nn }
+\cs_new_protected_nopar:Npn \CTEX at ifnamefalse
+  { \cs_set_eq:NN \CTEXifname \use_ii:nn }
 \renewcommand\part{%
-  \if at openright
-    \cleardoublepage
-  \else
-    \clearpage
-  \fi
+  \CTEX at part@break
   \thispagestyle{\CTEX at part@pagestyle}%
   \if at twocolumn
     \onecolumn
@@ -737,16 +740,20 @@
 \def\@part[#1]#2{%
   \ifnum \c at secnumdepth >-2\relax
     \ifodd \CTEX at part@numbering
+      \CTEX at ifnametrue
       \refstepcounter{part}%
       \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{part*}%
       \addcontentsline{toc}{part}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@part{part*}%
     \addcontentsline{toc}{part}{#1}%
   \fi
-  \markboth{}{}%
+   \partmark{#1}%
   {\interlinepenalty \@M
    \normalfont \CTEX at part@format
    \ifnum \c at secnumdepth >-2\relax \ifodd \CTEX at part@numbering
@@ -756,6 +763,8 @@
    \CTEX at part@aftertitle}%
   \@endpart}
 \def\@spart#1{%
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@spart{part*}%
     {\interlinepenalty \@M
      \normalfont \CTEX at part@format
      \CTEX at part@titleformat{#1}%
@@ -776,7 +785,8 @@
               \if at tempswa
                 \twocolumn
               \fi}
-\renewcommand\chapter{\if at openright\cleardoublepage\else\clearpage\fi
+\renewcommand\chapter{%
+                    \CTEX at chapter@break
                     \thispagestyle{\CTEX at chapter@pagestyle}%
                     \global\@topnum\z@
                     \ifodd \CTEX at chapter@afterindent
@@ -789,18 +799,24 @@
   \ifnum \c at secnumdepth >\m at ne
     \if at mainmatter
       \ifodd \CTEX at chapter@numbering
+        \CTEX at ifnametrue
         \refstepcounter{chapter}%
         \typeout{\CTEXthechapter}%
         \addcontentsline{toc}{chapter}
           {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}%
       \else
-        \CTEX at makeheadinganchor
+        \CTEX at ifnamefalse
+        \CTEX at makeanchor{\Hy at chapapp*}%
         \addcontentsline{toc}{chapter}{#1}%
       \fi
     \else
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor@chapter{\Hy at chapapp*}%
       \addcontentsline{toc}{chapter}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@chapter{\Hy at chapapp*}%
     \addcontentsline{toc}{chapter}{#1}%
   \fi
   \chaptermark{#1}%
@@ -812,6 +828,15 @@
     \@makechapterhead{#2}%
   \@afterheading
   \fi}
+\def\@schapter#1{%
+  \CTEX at ifnamefalse
+  \CTEX at makeanchor@schapter{\Hy at chapapp*}%
+  \if at twocolumn
+    \@topnewpage[\@makeschapterhead{#1}]%
+  \else
+    \@makeschapterhead{#1}%
+    \@afterheading
+  \fi}
 \def\@makechapterhead#1{%
   \CTEX at setheadingskip \CTEX at chapter@beforeskip
   \ifodd \CTEX at chapter@fixskip \CTEX at fixtopskip \fi
@@ -818,13 +843,7 @@
   \vspace*{\CTEX at headingskip}%
   {\normalfont \parindent \dimexpr \CTEX at chapter@indent \relax
    \CTEX at chapter@format
-   \ifnum \c at secnumdepth >\m at ne
-     \if at mainmatter
-       \ifodd \CTEX at chapter@numbering
-         \CTEX at chaptername \CTEX at chapter@aftername
-       \fi
-     \fi
-   \fi
+   \CTEXifname{\CTEX at chaptername\CTEX at chapter@aftername}{}%
    \interlinepenalty\@M
    \CTEX at chapter@titleformat{#1}%
    \CTEX at chapter@aftertitle
@@ -859,25 +878,30 @@
   \if at nobreak
     \everypar{}%
   \else
-    \addpenalty\@secpenalty
+    \csname CTEX@#1 at break\endcsname
     \CTEX at setheadingskip{#4}%
     \ifodd \CTEX at fixskip \CTEX at fixheadingskip \fi
     \addvspace \CTEX at headingskip
   \fi
   \@ifstar
-    {\@ssect{#3}{#4}{#5}{#6}}%
+    {\CTEX at makeanchor@ssect{#1*}\@ssect{#3}{#4}{#5}{#6}}%
     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
 \def\@seccntformat#1{%
-  \csname CTEX@#1name\endcsname \csname CTEX@#1 at aftername\endcsname}
+  \csname CTEX@#1name\endcsname
+  \csname CTEX@#1 at aftername\endcsname}
 \def\@sect#1#2#3#4#5#6[#7]#8{%
   \ifnum #2>\c at secnumdepth
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@sect{#1*}%
     \let\@svsec\@empty
   \else
     \ifodd \csname CTEX@#1 at numbering\endcsname
+      \CTEX at ifnametrue
       \refstepcounter{#1}%
       \protected at edef\@svsec{\@seccntformat{#1}\relax}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{#1*}%
       \let\@svsec\@empty
     \fi
   \fi
@@ -891,11 +915,7 @@
     \endgroup
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}%
   \else
     \def\@svsechd{%
@@ -905,15 +925,12 @@
       \csname CTEX@#1 at aftertitle\endcsname}%
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}}%
   \fi
   \@xsect{#5}}
 \def\@ssect#1#2#3#4#5{%
+  \CTEX at ifnamefalse
   \unless \ifodd \CTEX at runin
     \begingroup
       #4{%
@@ -998,6 +1015,48 @@
     \gdef \CTEX at postchapter { \CTEX at postappendix }
     \gdef \CTEX at chapter@numbering { \CTEX at appendix@numbering }
   }
+\cs_new_protected_nopar:Npn \CTEX at makeanchor #1
+  { }
+\seq_new:N \c__ctex_headings_cs_seq
+\seq_gset_from_clist:Nn \c__ctex_headings_cs_seq
+  { part , spart , chapter , schapter , sect , ssect }
+\seq_map_inline:Nn \c__ctex_headings_cs_seq
+  {
+    \cs_new_eq:cc { CTEX@ #1 } { @ #1 }
+    \cs_new_eq:cN { CTEX at makeanchor@ #1 } \CTEX at makeanchor
+  }
+\cs_new_protected_nopar:Npn \CTEX at hyperheadinghook
+  {
+    \group_begin:
+      \ifHy at implicit
+        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          {
+            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+              {
+                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+              }
+          }
+      \else:
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+      \fi:
+    \group_end:
+  }
+\ctex_at_end_package:nn { hyperref }
+  {
+    \cs_gset_protected_nopar:Npn \CTEX at makeanchor #1
+      {
+        \Hy at MakeCurrentHrefAuto {#1}
+        \Hy at raisedlink
+          {
+            \hyper at anchorstart { \@currentHref }
+            \hyper at anchorend
+          }
+      }
+    \CTEX at hyperheadinghook
+  }
 \cs_new_protected_nopar:Npn \ctex_titlesec_hook:
   {
     \@ifpackagewith { titlesec } { explicit }
@@ -1065,6 +1124,29 @@
           { \ctex_titlesec_hook: }
       }
   }
+\ctex_at_end_package:nn { titlesec }
+  {
+    \tl_set:Nn \ttl at chapterout { \typeout { \CTEXthechapter } }
+    \cs_if_free:NF \ttl at tocpart
+      {
+        \cs_set_protected_nopar:Npn \ttl at tocpart
+          { \tl_set:Nn \ttl at a { \CTEXthepart \hspace { 1em } } }
+      }
+    \seq_map_inline:Nn \c__ctex_headings_seq
+      {
+        \cs_if_exist:cF { ttl at toc #1 }
+          {
+            \cs_new_protected_nopar:cpx { ttl at toc #1 }
+              {
+                \tl_set:Nn \exp_not:N \ttl at a
+                  {
+                    \exp_not:N \protect
+                    \exp_not:N \numberline { \exp_not:c { CTEXthe #1 } }
+                  }
+              }
+          }
+      }
+  }
 \group_begin:
 \char_set_catcode_other:N \#
 \cs_new_protected_nopar:Npn \ctex_titleps_hook:
@@ -1102,6 +1184,18 @@
 \ctex_at_end_package:nn { titlesec }
   { \cs_if_free:NF \ttl at settopmark { \ctex_titleps_hook: } }
 \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: }
+\ctex_at_end_package:nn { titleps }
+  {
+    \cs_set_protected_nopar:Npn \ttl at setifthe #1
+      {
+        \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 }
+          {
+            \CTEXifname
+              { \protect \@firstoftwo }
+              { \protect \@secondoftwo }
+          }
+      }
+  }
 \cs_new_protected:Npn \CTEX at toc@width at n #1
   {
     \hbox_set:Nn \l__ctex_tmp_box {#1}
@@ -1134,21 +1228,25 @@
       }
   }
 \ctex_patch_cmd:Nnn \ps at headings
-  { \@chapapp\ \thechapter.~\ }
-  { \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi }
+  {
+    \ifnum \c at secnumdepth > \m at ne \if at mainmatter
+      \@chapapp \ \thechapter . ~ \
+    \fi \fi
+  }
+  { \CTEXifname { \CTEXthechapter \quad } { } }
 \if at twoside
   \ctex_patch_cmd:Nnn \ps at headings
-    { \thesection.~\ }
-    { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+    { \CTEXifname { \CTEXthesection } { } }
 \fi:
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \@chapapp\ \thechapter.~\ }
-      { \if at mainmatter \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi \fi }
+      { \ifnum \c at secnumdepth > \m at ne \@chapapp \ \thechapter . ~ \ \fi }
+      { \CTEXifname { \CTEXthechapter \quad } { } }
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesection.~\ }
-      { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection } { } }
   }
 \cs_new_protected_nopar:Npn \CTEX at setcurrentlabel@n #1
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexcap.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexcap.sty	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexcap.sty	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter in LaTeX (CTEX)}
 \ProvidesExplPackage{ctexcap}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \clist_new:N \l__ctex_ctexcap_options_clist
 \clist_set:Nx \l__ctex_ctexcap_options_clist
   { \exp_not:v { opt@ \@currname . \@currext } , heading }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexheading.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexheading.sty	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexheading.sty	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading style modification (CTEX)}
 \ProvidesExplPackage{ctexheading}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \RequirePackage { xparse , l3keys2e }
 \RequirePackage { ctexhook , ctexpatch }
 \tl_new:N \l__ctex_tmp_tl

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexhook.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexhook.sty	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexhook.sty	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Document and package hooks (CTEX)}
 \ProvidesExplPackage{ctexhook}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \cs_new_protected:Npn \ctex_at_end_preamble:n #1
   { \tl_gput_right:Nn \g__ctex_end_preamble_hook_tl {#1} }
 \cs_new_protected:Npn \ctex_after_end_preamble:n #1

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Patching commands (CTEX)}
 \ProvidesExplPackage{ctexpatch}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \cs_if_exist:NF \str_new:N { \RequirePackage { l3str } }
 \cs_new_protected:Npn \ctex_patch_cmd_once:NnnnTF #1#2
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexrep.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexrep.cls	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexrep.cls	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter for class report (CTEX)}
 \ProvidesExplClass{ctexrep}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \tl_const:Nx \c__ctex_version_tl
   { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } }
 \cs_new_eq:cN { ver at ctex.        \@pkgextension } \c__ctex_version_tl
@@ -65,8 +65,8 @@
 \RequirePackage { fix-cm , everysel }
 \tl_new:N \l__ctex_tmp_tl
 \int_new:N \l__ctex_tmp_int
+\box_new:N \l__ctex_tmp_box
 \dim_new:N \l__ctex_tmp_dim
-\box_new:N \l__ctex_tmp_box
 \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3
   {
     \use:x
@@ -651,6 +651,9 @@
         #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1 at afterindent } ,
         #1 / fixskip     .bool_set:N = \exp_not:c { CTEX@#1 at fixskip } ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
+        #1 / break         .tl_set:N = \exp_not:c { CTEX@#1 at break } ,
+        #1 / break+          .code:n =
+          { \tl_put_right:Nn \exp_not:c { CTEX@#1 at break } { ####1 } } ,
         #1 / format+         .code:n =
           { \tl_put_right:Nn \exp_not:c { CTEX@#1 at format } { ####1 } } ,
         #1 / nameformat+     .code:n =
@@ -698,9 +701,6 @@
     \group_end:
     \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } }
   }
-\cs_new_protected_nopar:Npn \CTEX at makeheadinganchor { }
-\ctex_at_end_package:nn { hyperref }
-  { \cs_gset_protected_nopar:Npn \CTEX at makeheadinganchor { \phantomsection } }
 \cs_new_protected_nopar:Npn \CTEX at fixtopskip
   {
     \CTEX at fixheadingskip
@@ -717,12 +717,15 @@
 \cs_new_protected_nopar:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\ProvideDocumentCommand \partmark { m }
+  { \markboth { } { } }
+\cs_new_eq:NN \CTEXifname \use_i:nn
+\cs_new_protected_nopar:Npn \CTEX at ifnametrue
+  { \cs_set_eq:NN \CTEXifname \use_i:nn }
+\cs_new_protected_nopar:Npn \CTEX at ifnamefalse
+  { \cs_set_eq:NN \CTEXifname \use_ii:nn }
 \renewcommand\part{%
-  \if at openright
-    \cleardoublepage
-  \else
-    \clearpage
-  \fi
+  \CTEX at part@break
   \thispagestyle{\CTEX at part@pagestyle}%
   \if at twocolumn
     \onecolumn
@@ -737,16 +740,20 @@
 \def\@part[#1]#2{%
   \ifnum \c at secnumdepth >-2\relax
     \ifodd \CTEX at part@numbering
+      \CTEX at ifnametrue
       \refstepcounter{part}%
       \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{part*}%
       \addcontentsline{toc}{part}{#1}%
     \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@part{part*}%
     \addcontentsline{toc}{part}{#1}%
   \fi
-  \markboth{}{}%
+   \partmark{#1}%
   {\interlinepenalty \@M
    \normalfont \CTEX at part@format
    \ifnum \c at secnumdepth >-2\relax \ifodd \CTEX at part@numbering
@@ -756,6 +763,8 @@
    \CTEX at part@aftertitle}%
   \@endpart}
 \def\@spart#1{%
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@spart{part*}%
     {\interlinepenalty \@M
      \normalfont \CTEX at part@format
      \CTEX at part@titleformat{#1}%
@@ -776,7 +785,8 @@
               \if at tempswa
                 \twocolumn
               \fi}
-\renewcommand\chapter{\if at openright\cleardoublepage\else\clearpage\fi
+\renewcommand\chapter{%
+                    \CTEX at chapter@break
                     \thispagestyle{\CTEX at chapter@pagestyle}%
                     \global\@topnum\z@
                     \ifodd \CTEX at chapter@afterindent
@@ -788,15 +798,19 @@
 \def\@chapter[#1]#2{%
   \ifnum \c at secnumdepth >\m at ne
       \ifodd \CTEX at chapter@numbering
+        \CTEX at ifnametrue
         \refstepcounter{chapter}%
         \typeout{\CTEXthechapter}%
         \addcontentsline{toc}{chapter}
           {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}%
       \else
-        \CTEX at makeheadinganchor
+        \CTEX at ifnamefalse
+        \CTEX at makeanchor{\Hy at chapapp*}%
         \addcontentsline{toc}{chapter}{#1}%
       \fi
   \else
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@chapter{\Hy at chapapp*}%
     \addcontentsline{toc}{chapter}{#1}%
   \fi
   \chaptermark{#1}%
@@ -808,6 +822,15 @@
     \@makechapterhead{#2}%
   \@afterheading
   \fi}
+\def\@schapter#1{%
+  \CTEX at ifnamefalse
+  \CTEX at makeanchor@schapter{\Hy at chapapp*}%
+  \if at twocolumn
+    \@topnewpage[\@makeschapterhead{#1}]%
+  \else
+    \@makeschapterhead{#1}%
+    \@afterheading
+  \fi}
 \def\@makechapterhead#1{%
   \CTEX at setheadingskip \CTEX at chapter@beforeskip
   \ifodd \CTEX at chapter@fixskip \CTEX at fixtopskip \fi
@@ -814,11 +837,7 @@
   \vspace*{\CTEX at headingskip}%
   {\normalfont \parindent \dimexpr \CTEX at chapter@indent \relax
    \CTEX at chapter@format
-   \ifnum \c at secnumdepth >\m at ne
-       \ifodd \CTEX at chapter@numbering
-         \CTEX at chaptername \CTEX at chapter@aftername
-       \fi
-   \fi
+   \CTEXifname{\CTEX at chaptername\CTEX at chapter@aftername}{}%
    \interlinepenalty\@M
    \CTEX at chapter@titleformat{#1}%
    \CTEX at chapter@aftertitle
@@ -853,25 +872,30 @@
   \if at nobreak
     \everypar{}%
   \else
-    \addpenalty\@secpenalty
+    \csname CTEX@#1 at break\endcsname
     \CTEX at setheadingskip{#4}%
     \ifodd \CTEX at fixskip \CTEX at fixheadingskip \fi
     \addvspace \CTEX at headingskip
   \fi
   \@ifstar
-    {\@ssect{#3}{#4}{#5}{#6}}%
+    {\CTEX at makeanchor@ssect{#1*}\@ssect{#3}{#4}{#5}{#6}}%
     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
 \def\@seccntformat#1{%
-  \csname CTEX@#1name\endcsname \csname CTEX@#1 at aftername\endcsname}
+  \csname CTEX@#1name\endcsname
+  \csname CTEX@#1 at aftername\endcsname}
 \def\@sect#1#2#3#4#5#6[#7]#8{%
   \ifnum #2>\c at secnumdepth
+    \CTEX at ifnamefalse
+    \CTEX at makeanchor@sect{#1*}%
     \let\@svsec\@empty
   \else
     \ifodd \csname CTEX@#1 at numbering\endcsname
+      \CTEX at ifnametrue
       \refstepcounter{#1}%
       \protected at edef\@svsec{\@seccntformat{#1}\relax}%
     \else
-      \CTEX at makeheadinganchor
+      \CTEX at ifnamefalse
+      \CTEX at makeanchor{#1*}%
       \let\@svsec\@empty
     \fi
   \fi
@@ -885,11 +909,7 @@
     \endgroup
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}%
   \else
     \def\@svsechd{%
@@ -899,15 +919,12 @@
       \csname CTEX@#1 at aftertitle\endcsname}%
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
-      \ifnum #2>\c at secnumdepth \else
-        \ifodd \csname CTEX@#1 at numbering\endcsname
-          \protect\numberline{\csname CTEXthe#1\endcsname}%
-        \fi
-      \fi
+      \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}%
       #7}}%
   \fi
   \@xsect{#5}}
 \def\@ssect#1#2#3#4#5{%
+  \CTEX at ifnamefalse
   \unless \ifodd \CTEX at runin
     \begingroup
       #4{%
@@ -992,6 +1009,48 @@
     \gdef \CTEX at postchapter { \CTEX at postappendix }
     \gdef \CTEX at chapter@numbering { \CTEX at appendix@numbering }
   }
+\cs_new_protected_nopar:Npn \CTEX at makeanchor #1
+  { }
+\seq_new:N \c__ctex_headings_cs_seq
+\seq_gset_from_clist:Nn \c__ctex_headings_cs_seq
+  { part , spart , chapter , schapter , sect , ssect }
+\seq_map_inline:Nn \c__ctex_headings_cs_seq
+  {
+    \cs_new_eq:cc { CTEX@ #1 } { @ #1 }
+    \cs_new_eq:cN { CTEX at makeanchor@ #1 } \CTEX at makeanchor
+  }
+\cs_new_protected_nopar:Npn \CTEX at hyperheadinghook
+  {
+    \group_begin:
+      \ifHy at implicit
+        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          {
+            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+              {
+                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+              }
+          }
+      \else:
+        \seq_map_inline:Nn \c__ctex_headings_cs_seq
+          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+      \fi:
+    \group_end:
+  }
+\ctex_at_end_package:nn { hyperref }
+  {
+    \cs_gset_protected_nopar:Npn \CTEX at makeanchor #1
+      {
+        \Hy at MakeCurrentHrefAuto {#1}
+        \Hy at raisedlink
+          {
+            \hyper at anchorstart { \@currentHref }
+            \hyper at anchorend
+          }
+      }
+    \CTEX at hyperheadinghook
+  }
 \cs_new_protected_nopar:Npn \ctex_titlesec_hook:
   {
     \@ifpackagewith { titlesec } { explicit }
@@ -1059,6 +1118,29 @@
           { \ctex_titlesec_hook: }
       }
   }
+\ctex_at_end_package:nn { titlesec }
+  {
+    \tl_set:Nn \ttl at chapterout { \typeout { \CTEXthechapter } }
+    \cs_if_free:NF \ttl at tocpart
+      {
+        \cs_set_protected_nopar:Npn \ttl at tocpart
+          { \tl_set:Nn \ttl at a { \CTEXthepart \hspace { 1em } } }
+      }
+    \seq_map_inline:Nn \c__ctex_headings_seq
+      {
+        \cs_if_exist:cF { ttl at toc #1 }
+          {
+            \cs_new_protected_nopar:cpx { ttl at toc #1 }
+              {
+                \tl_set:Nn \exp_not:N \ttl at a
+                  {
+                    \exp_not:N \protect
+                    \exp_not:N \numberline { \exp_not:c { CTEXthe #1 } }
+                  }
+              }
+          }
+      }
+  }
 \group_begin:
 \char_set_catcode_other:N \#
 \cs_new_protected_nopar:Npn \ctex_titleps_hook:
@@ -1096,6 +1178,18 @@
 \ctex_at_end_package:nn { titlesec }
   { \cs_if_free:NF \ttl at settopmark { \ctex_titleps_hook: } }
 \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: }
+\ctex_at_end_package:nn { titleps }
+  {
+    \cs_set_protected_nopar:Npn \ttl at setifthe #1
+      {
+        \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 }
+          {
+            \CTEXifname
+              { \protect \@firstoftwo }
+              { \protect \@secondoftwo }
+          }
+      }
+  }
 \cs_new_protected:Npn \CTEX at toc@width at n #1
   {
     \hbox_set:Nn \l__ctex_tmp_box {#1}
@@ -1128,21 +1222,25 @@
       }
   }
 \ctex_patch_cmd:Nnn \ps at headings
-  { \@chapapp\ \thechapter.~\ }
-  { \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi }
+  {
+    \ifnum \c at secnumdepth > \m at ne \if at mainmatter
+      \@chapapp \ \thechapter . ~ \
+    \fi \fi
+  }
+  { \CTEXifname { \CTEXthechapter \quad } { } }
 \if at twoside
   \ctex_patch_cmd:Nnn \ps at headings
-    { \thesection.~\ }
-    { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+    { \CTEXifname { \CTEXthesection } { } }
 \fi:
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \@chapapp\ \thechapter.~\ }
-      { \ifodd \CTEX at chapter@numbering \CTEXthechapter \quad \fi }
+      { \ifnum \c at secnumdepth > \m at ne \@chapapp \ \thechapter . ~ \ \fi }
+      { \CTEXifname { \CTEXthechapter \quad } { } }
     \ctex_patch_cmd:Nnn \ps at fancy
-      { \thesection.~\ }
-      { \ifodd \CTEX at section@numbering \CTEXthesection \quad \fi }
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection } { } }
   }
 \cs_new_protected_nopar:Npn \CTEX at setcurrentlabel@n #1
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexsize.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexsize.sty	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexsize.sty	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese font size definition (CTEX)}
 \ProvidesExplPackage{ctexsize}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \RequirePackage { xparse , l3keys2e }
 \cs_new_eq:NN \g__ctex_font_size_flag \c_minus_one
 \keys_define:nn { ctex / option }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexspa.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexspa.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexspa.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,7 +28,7 @@
 %% ------------------------------------------------------------------------------
 %% 
 \ProvidesFile{ctexspa.def}%
-  [2016/08/27 v2.4.3 Space info for CJKpunct (CTEX)]
+  [2016/09/21 v2.4.4 Space info for CJKpunct (CTEX)]
 \ctexspadef{adobezhsong}{70,15,61,8,63,14,58,7,64,13,62,12,60,11,61,15,62,14,51,6,58,5,58,8,7,5,12,12,10,68,13,63,17,63,20,69,19,69,17,63,19,70,17,55,10,10,14,63,10,65,10,61,13,62,15,61,7,49,7,56,8,58,15,69,8,61,14,63,8,57,,,}
 \ctexspadef{adobezhhei}{78,3,64,3,64,2,61,3,72,3,70,3,72,3,70,3,60,3,51,3,62,3,66,3,0,0,10,10,3,70,5,70,6,75,6,78,17,67,13,67,17,67,4,50,8,8,3,72,3,70,3,72,3,70,3,60,3,51,3,62,3,66,3,78,7,62,3,63,3,61,,,}
 \ctexspadef{adobezhkai}{76,10,55,8,63,4,62,4,71,4,65,4,71,4,74,4,54,4,54,4,62,4,62,4,0,0,11,11,5,72,6,71,7,78,7,79,18,68,18,68,18,68,2,46,14,12,4,71,4,65,4,71,4,74,4,54,4,54,4,62,4,62,10,76,8,55,4,63,4,62,,,}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls	2016-09-25 21:05:03 UTC (rev 42148)
@@ -28,10 +28,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {ctex documentation (CTEX)}
 \ProvidesExplClass{ctxdoc}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \ExplSyntaxOff
 \let\pdfmdfivesum\mdfivesum
 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{l3doc}}
@@ -63,6 +63,7 @@
 \RequirePackage{xcolor}
 \RequirePackage{caption}
 \RequirePackage{fvrb-ex}
+\RequirePackage{zref-base}
 \geometry{includemp,hmargin={0mm,15mm},vmargin={25mm,15mm},footskip=7mm}
 \hypersetup{pdfstartview=FitH,bookmarksdepth=subparagraph}
 \setcounter{secnumdepth}{4}
@@ -71,6 +72,7 @@
 \setmainfont{TeX Gyre Pagella}
 \setsansfont{TeX Gyre Heros}
 \setmonofont[
+  HyphenChar = None ,
   UprightFont=* Light, BoldFont=* Bold,
   SlantedFont=* Light Oblique]{CMU Typewriter Text}
 \setmathfont{texgyrepagella-math.otf}
@@ -171,10 +173,6 @@
 \AfterEndEnvironment{function}{\ctexfixprevdepth}
 \AtBeginEnvironment{syntax}{\linespread{1}\ctexplainps\ctexdisableecglue}
 \BeforeBeginEnvironment{SideBySideExample}{\par\addvspace{\medskipamount}}
-\preto\MacroFont{\linespread{1}}
-\appto\MacroFont{\hyphenchar\font\m at ne\ctexdocverbaddon}
-\preto\AltMacroFont{\linespread{1}}
-\appto\AltMacroFont{\hyphenchar\font\m at ne\ctexdocverbaddon}
 \newcommand*\exptarget{\Hy at raisedlink{\hypertarget{expstar}{}}}
 \newcommand*\rexptarget{\Hy at raisedlink{\hypertarget{rexpstar}{}}}
 \newcommand*\expstar{\hyperlink{expstar}{$\star$}}
@@ -220,12 +218,6 @@
   { \MacroFont \hbox:n }
   { \iow_term:n { *** ~ SUCCESS ~ *** } }
   { \iow_term:n { *** ~ FAIL ~ *** } }
-\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_typeset_one:nN
-  { }
-  { \vbox_unpack_clear:N }
-  { \MacroFont \vbox_unpack_clear:N }
-  { \iow_term:n { *** ~ SUCCESS ~ *** } }
-  { \iow_term:n { *** ~ FAIL ~ *** } }
 \ctex_patch_cmd_once:NnnnTF \__codedoc_macro_dump:
   { }
   { \hbox_unpack_clear:N }
@@ -232,17 +224,51 @@
   { \MacroFont \hbox_unpack_clear:N }
   { \iow_term:n { *** ~ SUCCESS ~ *** } }
   { \iow_term:n { *** ~ FAIL ~ *** } }
-\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_end:
-  { }
-  { \endtrivlist }
-  { \@noparlisttrue \endtrivlist }
-  { \iow_term:n { *** ~ SUCCESS ~ *** } }
-  { \iow_term:n { *** ~ FAIL ~ *** } }
-\ctex_appto_cmd:NnnTF \__codedoc_macro_end_style:n
-  { }
-  { \@endparenv }
-  { \iow_term:n { *** ~ SUCCESS ~ *** } }
-  { \iow_term:n { *** ~ FAIL ~ *** } }
+\cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n
+\cs_set_protected:Npn \__codedoc_macro_typeset_one:nN #1#2
+  {
+    \vbox_set:Nn \l__codedoc_macro_box
+      {
+        \MacroFont
+        \vbox_unpack_clear:N \l__codedoc_macro_box
+        \hbox_set:Nn \l_tmpa_box
+          { \__codedoc_print_macroname:nN {#1} #2 }
+        \dim_set:Nn \l_tmpa_dim { \marginparwidth - \labelsep }
+        \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > \l_tmpa_dim
+          {
+            \box_resize_to_wd_and_ht:Nnn \l_tmpa_box
+              { \l_tmpa_dim }
+              { \box_ht:N \l_tmpa_box }
+          }
+        \hbox_overlap_left:n
+          {
+            \box_use:N \l_tmpa_box
+            \skip_horizontal:n { \marginparsep - \labelsep }
+          }
+      }
+    \int_incr:N \l__codedoc_macro_int
+  }
+\cs_set_protected:Npn \__codedoc_print_macroname:nN #1#2
+  {
+    \strut
+    \__codedoc_get_hyper_target:xN
+      {
+        \exp_not:n {#1}
+        \bool_if:NT #2 { \tl_to_str:n {TF} }
+      }
+      \l__codedoc_tmpa_tl
+    \cs_if_exist:cTF { r@ \l__codedoc_tmpa_tl }
+      { \exp_args:NNo \label at hyperref [ \l__codedoc_tmpa_tl ] }
+      { \use:n }
+      {
+        \tl_set:Nn \l__codedoc_tmpa_tl {#1}
+        \tl_replace_all:Non \l__codedoc_tmpa_tl
+          { \c_catcode_other_space_tl }
+          { \fontspec_visible_space: }
+        \__codedoc_macroname_prefix:o \l__codedoc_tmpa_tl
+        \__codedoc_macroname_suffix:N #2
+      }
+  }
 \AtBeginEnvironment { syntax }
   {
     \char_set_catcode_active:N \|
@@ -277,9 +303,6 @@
       { \fileinfo }
   }
 \ior_new:N \g__ctxdoc_id_ior
-\ctex_patch_cmd:Nnn \changes@
-  { \space \actualchar }
-  { \actualchar }
 \cs_new_eq:NN \__ctxdoc_ltx_changes:nnn \changes@
 \cs_set_protected:Npn \changes@ #1#2
   {
@@ -298,18 +321,24 @@
 \cs_new_protected:Npn \__ctxdoc_version_zfill:nnnn #1#2
   {
     \tl_clear:N \l__ctxdoc_tmp_tl
-    \seq_set_split:Nnn \l__ctxdoc_tmp_seq { . } {#1}
-    \seq_map_function:NN \l__ctxdoc_tmp_seq \__ctxdoc_version_zfill:n
+    \int_zero:N \l_tmpa_int
+    \seq_set_split:Nnn \l_tmpa_seq { . } {#1}
+    \seq_map_function:NN \l_tmpa_seq \__ctxdoc_version_zfill:n
+    \int_compare:nNnF \l_tmpa_int > \c_two
+      {
+        \tl_put_right:Nx \l__ctxdoc_tmp_tl
+          { \prg_replicate:nn { \c_three - \l_tmpa_int } { 00000 } }
+      }
     \__ctxdoc_ltx_changes:nnn { \l__ctxdoc_tmp_tl \actualchar #2 }
   }
 \tl_new:N \l__ctxdoc_tmp_tl
-\seq_new:N \l__ctxdoc_tmp_seq
 \cs_new_protected:Npn \__ctxdoc_version_zfill:n #1
   {
+    \int_incr:N \l_tmpa_int
     \tl_put_right:Nx \l__ctxdoc_tmp_tl
       {
         \prg_replicate:nn
-          { \int_max:nn { 0 } { 10 - \tl_count:n {#1} } } { 0 }
+          { \int_max:nn { 0 } { 5 - \tl_count:n {#1} } } { 0 }
         \exp_not:n {#1}
       }
   }
@@ -465,7 +494,7 @@
         \tl_gclear:N \g__ctxdoc_verbatim_verb_stop_tl
         \cs_gset_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_process_normal_line:
         \__ctxdoc_output_module:nn
-          { slash at guard }
+          { \color { verb at guard } }
           { \__ctxdoc_module_pop:n { \l__ctxdoc_verbatim_line_tl } }
       }
       { \tl_use:N \l__ctxdoc_verbatim_line_tl }
@@ -500,33 +529,23 @@
   \cs_new_protected:Npn \__ctxdoc_module_star:w #1 > #2 \q_stop
     {
       \__ctxdoc_output_module:nn
-        { star at guard }
+        { \__ctxdoc_star_color: }
         { \__ctxdoc_module_push:n { \__ctxdoc_module_angle:n {#1} } }
-      \int_compare:nNnF \guard at level < \c at StandardModuleDepth
-        {
-          \cs_gset_eq:NN \macro at font \AltMacroFont
-          \macro at font
-        }
-      \int_gincr:N \guard at level
       \__ctxdoc_output_line:n {#2}
+      \__ctxdoc_star_format:
     }
   \cs_new_protected:Npn \__ctxdoc_module_slash:w #1 > #2 \q_stop
     {
       \__ctxdoc_output_module:nn
-        { slash at guard }
+        { \__ctxdoc_slash_color: }
         { \__ctxdoc_module_pop:n { \__ctxdoc_module_angle:n {#1} } }
-      \int_gdecr:N \guard at level
-      \int_compare:nNnF \guard at level < \c at StandardModuleDepth
-        {
-          \cs_gset_eq:NN \macro at font \MacroFont
-          \macro at font
-        }
       \__ctxdoc_output_line:n {#2}
+      \__ctxdoc_slash_format:
     }
   \cs_new_protected:Npn \__ctxdoc_module_at:w @ @ = #1 > #2 \q_stop
     {
       \__ctxdoc_output_module:nn
-        { at at guard }
+        { \color { at at guard } }
         { \__ctxdoc_module_angle:n { @ @ = #1 } }
       \tl_gset:Nn \g__codedoc_module_name_tl {#1}
       \__ctxdoc_output_line:n {#2}
@@ -533,12 +552,16 @@
     }
   \cs_new_protected:Npn \__ctxdoc_module_pm:w #1 > #2 \q_stop
     {
-      \__ctxdoc_output_module:nn
-        { pm at guard }
-        { \__ctxdoc_module_angle:n {#1} }
+      \tex_noindent:D
+      \hbox_overlap_left:n
+        {
+          \__ctxdoc_output_module:nn
+            { \__ctxdoc_pm_color: }
+            { \__ctxdoc_module_angle:n {#1} }
+          \skip_horizontal:n { \leftskip + \smallskipamount }
+        }
       \group_begin:
-        \int_compare:nNnF \guard at level < \c at StandardModuleDepth
-          { \AltMacroFont }
+        \__ctxdoc_pm_format:
         \__ctxdoc_output_line:n {#2}
       \group_end:
     }
@@ -548,7 +571,7 @@
       \tl_gset:Nx \g__ctxdoc_verbatim_verb_stop_tl
         { \c_percent_str \tl_tail:n {#1} }
       \__ctxdoc_output_module:nn
-        { star at guard }
+        { \color { verb at guard } }
         { \__ctxdoc_module_push:n { \l__ctxdoc_verbatim_line_tl } }
     }
 \group_end:
@@ -596,43 +619,141 @@
     \group_end:
   }
 \cs_new_protected_nopar:Npn \__ctxdoc_module_push:n
-  { \exp_args:Nx \__ctxdoc_module_push_aux:nn { \int_use:N \c at HD@hypercount } }
+  { \exp_args:No \__ctxdoc_module_push_aux:nn { \int_use:N \c at HD@hypercount } }
 \cs_new_protected:Npn \__ctxdoc_module_push_aux:nn #1
   {
     \seq_gpush:Nn \g__ctxdoc_module_dest_seq {#1}
-    \HD at savedest@add {#1}
-    \cs_if_exist:cTF { r at HD. #1 }
-      {
-        \hypersetup { hidelinks }
-        \hyperref [ HD. #1 ]
-      }
-      { \use:n }
+    \hypersetup { hidelinks }
+    \exp_args:Nx \hdclindex
+      { \zref at extractdefault { HD.#1 } { guard at end } { 1 } } { }
   }
 \cs_new_protected_nopar:Npn \__ctxdoc_module_pop:n
   {
     \seq_gpop:NNTF \g__ctxdoc_module_dest_seq \l__ctxdoc_tmp_tl
+      { \exp_args:No \__ctxdoc_module_pop_aux:nn { \l__ctxdoc_tmp_tl } }
+      { \BOOM \use:n }
+  }
+\cs_new_protected:Npn \__ctxdoc_module_pop_aux:nn #1
+  {
+    \zref at labelbylist { HD.#1 } { ctxdoc }
+    \hypersetup { hidelinks }
+    \hdclindex {#1} { }
+  }
+\seq_new:N \g__ctxdoc_module_dest_seq
+\zref at newlist { ctxdoc }
+\zref at newprop { guard at end } [ 1 ]
+  { \int_eval:n { \c at HD@hypercount - 1 } }
+\zref at addprop { ctxdoc } { guard at end }
+\cs_new_protected_nopar:Npn \__ctxdoc_star_format:
+  {
+    \seq_gpush:No \g__ctxdoc_slash_format_seq { \macro at font }
+    \seq_gpop:NNF \g__ctxdoc_star_format_seq \l__ctxdoc_format_tl
+      { \__ctxdoc_pop_format: }
+    \__ctxdoc_select_format:
+  }
+\cs_new_protected_nopar:Npn \__ctxdoc_slash_format:
+  {
+    \seq_gpop:NNTF \g__ctxdoc_slash_format_seq \l__ctxdoc_format_tl
       {
-        \tl_set:Nx \@currentlabel { \int_use:N \c at HD@hypercount }
-        \HD at savedest@add { \@currentlabel }
-        \Hy at MakeCurrentHref { HD. \@currentlabel }
-        \label { HD. \l__ctxdoc_tmp_tl }
-        \hypersetup { hidelinks }
-        \hdclindex { \l__ctxdoc_tmp_tl } { }
+        \seq_gpush:No \g__ctxdoc_star_format_seq { \macro at font }
+        \__ctxdoc_select_format:
       }
-      { \BOOM \use:n }
+      { \BOOM }
   }
-\seq_new:N \g__ctxdoc_module_dest_seq
+\cs_new_protected_nopar:Npn \__ctxdoc_pm_format:
+  {
+    \seq_get:NNF \g__ctxdoc_star_format_seq \l__ctxdoc_format_tl
+      {
+        \__ctxdoc_pop_format:
+        \seq_gpush:No \g__ctxdoc_star_format_seq { \l__ctxdoc_format_tl }
+      }
+    \cs_if_eq:NNF \macro at font \l__ctxdoc_format_tl
+      { \l__ctxdoc_format_tl }
+  }
+\cs_new_protected_nopar:Npn \__ctxdoc_pop_format:
+  {
+    \seq_gpop_left:NN \g__ctxdoc_format_seq \l__ctxdoc_format_tl
+    \seq_gput_right:No \g__ctxdoc_format_seq { \l__ctxdoc_format_tl }
+  }
+\cs_new_protected_nopar:Npn \__ctxdoc_select_format:
+  {
+    \cs_if_eq:NNF \macro at font \l__ctxdoc_format_tl
+      {
+        \cs_gset_eq:NN \macro at font \l__ctxdoc_format_tl
+        \macro at font
+      }
+  }
+\tl_new:N \l__ctxdoc_format_tl
+\seq_new:N \g__ctxdoc_format_seq
+\seq_new:N \g__ctxdoc_star_format_seq
+\seq_new:N \g__ctxdoc_slash_format_seq
+\seq_gput_right:Nn \g__ctxdoc_format_seq { \MacroFont }
+\seq_gput_right:Nn \g__ctxdoc_format_seq { \AltMacroFont }
+\cs_set_protected:Npn \MacroFont
+  {
+    \linespread { 1 }
+    \small
+    \fontseries { \mddefault }
+    \fontshape  { \updefault }
+    \ttfamily
+    \ctexdocverbaddon
+  }
+\cs_set_protected:Npn \AltMacroFont
+  {
+    \linespread { 1 }
+    \small
+    \fontseries { \mddefault }
+    \fontshape  { \sldefault }
+    \ttfamily
+    \ctexdocverbaddon
+  }
+\AtBeginDocument
+  {
+    \tl_gset:Nx \macro at font
+      { \seq_item:Nn \g__ctxdoc_format_seq { 1 } }
+  }
 \cs_new_protected:Npn \__ctxdoc_output_module:nn #1#2
   {
     \tex_noindent:D
     \group_begin:
-      \color {#1} \footnotesize \normalfont \sffamily #2
+      #1
+      \footnotesize \normalfont \sffamily #2
     \group_end:
   }
-\definecolor { star at guard }  { rgb } { 0    , 0   , 0.55 }
-\definecolor { slash at guard } { rgb } { 0.75 , 0   , 0.25 }
-\definecolor { pm at guard }    { rgb } { 0.5  , 0.5 , 0 }
-\definecolor { at at guard }    { rgb } { 0.5  , 0   , 0.5 }
+\cs_new_protected_nopar:Npn \__ctxdoc_star_color:
+  {
+    \seq_gpop:NNTF \g__ctxdoc_star_color_seq \current at color
+      { \set at color }
+      { \__ctxdoc_select_color: }
+    \seq_gpush:No \g__ctxdoc_slash_color_seq { \current at color }
+  }
+\cs_new_protected_nopar:Npn \__ctxdoc_slash_color:
+  {
+    \seq_gpop:NNTF \g__ctxdoc_slash_color_seq \current at color
+      {
+        \set at color
+        \seq_gpush:No \g__ctxdoc_star_color_seq { \current at color }
+      }
+      { \BOOM }
+  }
+\cs_new_protected_nopar:Npn \__ctxdoc_pm_color:
+  {
+    \seq_get:NNTF \g__ctxdoc_star_color_seq \current at color
+      { \set at color }
+      {
+        \__ctxdoc_select_color:
+        \seq_gpush:No \g__ctxdoc_star_color_seq { \current at color }
+      }
+  }
+\seq_new:N \g__ctxdoc_star_color_seq
+\seq_new:N \g__ctxdoc_slash_color_seq
+\cs_new_protected_nopar:Npn \__ctxdoc_select_color:
+  { \color { guard at series!!+ } }
+\definecolorseries { guard at series }
+  { cmyk } { last } { blue } { purple }
+\resetcolorseries [ 3 ] { guard at series }
+\definecolor { verb at guard } { rgb }  { 0.5  , 0.5 , 0 }
+\definecolor { at at guard }   { rgb }  { 0.5  , 0   , 0.5 }
 \definecolor { code at gray }  { gray } { 0.5 }
 \cs_new_protected:Npn \__ctxdoc_module_angle:n #1
   { \textlangle #1 \textrangle }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict	2016-09-25 21:05:03 UTC (rev 42148)
@@ -27,7 +27,7 @@
 %% ------------------------------------------------------------------------------
 %% 
 \ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}%
-  [2016/08/27 v2.4.3 Chinese translation for theorem name (CTEX)]
+  [2016/09/21 v2.4.4 Chinese translation for theorem name (CTEX)]
 \providetranslation{Comments}{\xC6\xC0\xC2\xDB}
 \providetranslation{comments}{\xC6\xC0\xC2\xDB}
 \providetranslation{Comment}{\xC6\xC0\xC2\xDB}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict	2016-09-25 21:05:03 UTC (rev 42148)
@@ -27,7 +27,7 @@
 %% ------------------------------------------------------------------------------
 %% 
 \ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}%
-  [2016/08/27 v2.4.3 Chinese translation for theorem name (CTEX)]
+  [2016/09/21 v2.4.4 Chinese translation for theorem name (CTEX)]
 \providetranslation{Comments}{评论}
 \providetranslation{comments}{评论}
 \providetranslation{Comment}{评论}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,15 +26,15 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Asian pTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-aptex.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1
   {
-    \AtBeginDvi { #1 }
+    \AtBeginDvi {#1}
     \ctex_at_end_package:nn { atbegshi }
-      { \AtBeginShipoutFirst { #1 } }
+      { \AtBeginShipoutFirst {#1} }
   }
 \@onlypreamble \ctex_set_zhmap:n
 \tl_set:Nn \CJKrmdefault { rm }
@@ -161,9 +161,7 @@
   }
 \ctex_hypersetup:n { driverfallback = dvipdfmx }
 \ctex_at_end_package:nn { hyperref }
-  {
-    \AtBeginShipoutFirst{ \special{ pdf:tounicode~ UTF8-UTF16 } }
-  }
+  { \AtBeginShipoutFirst { \special { pdf:tounicode~ UTF8-UTF16 } } }
 \msg_new:nnn { ctex } { fntef-not-available }
   { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ ApLaTeX. }
 \msg_warning:nn { ctex } { fntef-not-available }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {LuaLaTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-luatex.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \msg_new:nnn { ctex } { luatexja-loaded }
   {
     Package~`luatexja'~can~not~be~loaded~before~`ctex'.\\
@@ -67,7 +67,7 @@
   local s = kpse.find_file('ltj-kinsoku.lua', 'tex')
   luatexja.stack.charprop_stack_table[0] = s and dofile(s) or {}
 }
-\ltjsetparameter{kanjiskip=\z@ plus .4pt minus .4pt,
+\ltjsetparameter{kanjiskip=\z@ plus .4pt minus .5pt,
   xkanjiskip=.25\zw plus 1pt minus 1pt,
   autospacing, autoxspacing, jacharrange={-1},
   yalbaselineshift=\z@, yjabaselineshift=\z@,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,15 +26,15 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {(pdf)LaTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-pdftex.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1
   {
-    \AtBeginDvi { #1 }
+    \AtBeginDvi {#1}
     \ctex_at_end_package:nn { atbegshi }
-      { \AtBeginShipoutFirst { #1 } }
+      { \AtBeginShipoutFirst {#1} }
   }
 \@onlypreamble \ctex_set_zhmap:n
 \seq_new:N \c__ctex_cmap_encoding_seq
@@ -98,9 +98,22 @@
       \tl_set:Nn \CJKrmdefault {#1}
       \tl_set:Nn \CJKsfdefault {#2}
       \tl_set:Nn \CJKttdefault {#3}
-      \ctex_set_zhmap:n { \file_input:n {#4} }
+      \ctex_set_zhmap:n { \ctex_zhmap_input:n {#4} }
     }
   \@onlypreamble \ctex_load_zhmap:nnnn
+  \cs_new_protected_nopar:Npn \ctex_zhmap_input:n #1
+    {
+      \ctex_file_wrapper:nnn
+        {
+          \char_set_catcode_comment:n { 37 } % %
+          \char_set_catcode_escape:n  { 92 } % \
+        }
+        { \file_input:n {#1} }
+        {
+          \char_set_catcode:nn { 37 } { \char_value_catcode:n { 37 } }
+          \char_set_catcode:nn { 92 } { \char_value_catcode:n { 92 } }
+        }
+    }
   \tl_if_exist:NF \CJKfamilydefault
     { \tl_const:Nn \CJKfamilydefault { \CJKrmdefault } }
   \tl_if_exist:NF \CJKrmdefault { \tl_new:N \CJKrmdefault }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,15 +26,15 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {upTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-uptex.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1
   {
-    \AtBeginDvi { #1 }
+    \AtBeginDvi {#1}
     \ctex_at_end_package:nn { atbegshi }
-      { \AtBeginShipoutFirst { #1 } }
+      { \AtBeginShipoutFirst {#1} }
   }
 \@onlypreamble \ctex_set_zhmap:n
 \tl_set:Nn \CJKrmdefault { rm }
@@ -171,9 +171,7 @@
 \str_const:Nn \c__ctex_macosx_file_str { /Library/Fonts/Songti.ttc }
 \ctex_hypersetup:n { driverfallback = dvipdfmx }
 \ctex_at_end_package:nn { hyperref }
-  {
-    \AtBeginShipoutFirst{ \special{ pdf:tounicode~ UTF8-UTF16 } }
-  }
+  { \AtBeginShipoutFirst { \special { pdf:tounicode~ UTF8-UTF16 } } }
 \msg_new:nnn { ctex } { fntef-not-available }
   { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ upLaTeX. }
 \msg_warning:nn { ctex } { fntef-not-available }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,15 +26,14 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {XeLaTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-xetex.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \RequirePackage { xeCJK }
 \exp_args:Nx \xeCJKsetup
   {
     LoadFandol   = false ,
-    AutoFakeBold = true ,
     PunctStyle   = \l__ctex_punct_tl
   }
 \@ifpackagelater { fontspec } { 2014/05/25 } { }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd	2016-09-25 21:05:03 UTC (rev 42148)
@@ -27,7 +27,7 @@
 %% ------------------------------------------------------------------------------
 %% 
 \ProvidesFile{c19rm.fd}%
-  [2016/08/27 v2.4.3 Chinese font definition (CTEX)]
+  [2016/09/21 v2.4.4 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd	2016-09-25 21:05:03 UTC (rev 42148)
@@ -27,7 +27,7 @@
 %% ------------------------------------------------------------------------------
 %% 
 \ProvidesFile{c19sf.fd}%
-  [2016/08/27 v2.4.3 Chinese font definition (CTEX)]
+  [2016/09/21 v2.4.4 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd	2016-09-25 21:05:03 UTC (rev 42148)
@@ -27,7 +27,7 @@
 %% ------------------------------------------------------------------------------
 %% 
 \ProvidesFile{c19tt.fd}%
-  [2016/08/27 v2.4.3 Chinese font definition (CTEX)]
+  [2016/09/21 v2.4.4 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd	2016-09-25 21:05:03 UTC (rev 42148)
@@ -27,7 +27,7 @@
 %% ------------------------------------------------------------------------------
 %% 
 \ProvidesFile{c70rm.fd}%
-  [2016/08/27 v2.4.3 Chinese font definition (CTEX)]
+  [2016/09/21 v2.4.4 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd	2016-09-25 21:05:03 UTC (rev 42148)
@@ -27,7 +27,7 @@
 %% ------------------------------------------------------------------------------
 %% 
 \ProvidesFile{c70sf.fd}%
-  [2016/08/27 v2.4.3 Chinese font definition (CTEX)]
+  [2016/09/21 v2.4.4 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd	2016-09-25 21:05:03 UTC (rev 42148)
@@ -27,7 +27,7 @@
 %% ------------------------------------------------------------------------------
 %% 
 \ProvidesFile{c70tt.fd}%
-  [2016/08/27 v2.4.3 Chinese font definition (CTEX)]
+  [2016/09/21 v2.4.4 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Adobe fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-adobe.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \sys_if_engine_pdftex:TF
   {
     \sys_if_output_pdf:TF

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Fandol fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-fandol.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \sys_if_engine_pdftex:TF
   {
     \sys_if_output_pdf:TF

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Founder fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-founder.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \sys_if_engine_pdftex:TF
   {
     \ctex_zhmap_case:nnn

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Mac OS X fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-mac.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \sys_if_engine_pdftex:TF
   { \ctex_fontset_error:n { mac } }
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Ubuntu fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-ubuntu.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \sys_if_engine_pdftex:TF
   {
     \ctex_zhmap_case:nnn

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Windows fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-windows.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \file_if_exist:nTF { C:/bootfont.bin }
   { \ctex_file_input:n { ctex-fontset-windowsold.def } }
   { \ctex_file_input:n { ctex-fontset-windowsnew.def } }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Windows fonts definition for Vista or later version (CTEX)}
 \ProvidesExplFile{ctex-fontset-windowsnew.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \tl_new:N \l__ctex_msyh_suffix_tl
 \tl_set:Nn \l__ctex_msyh_suffix_tl { .ttc }
 \file_if_exist:nF { C:/Windows/Fonts/msyh.ttc }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Windows fonts definition for XP or earlier version (CTEX)}
 \ProvidesExplFile{ctex-fontset-windowsold.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \sys_if_engine_pdftex:TF
   {
     \ctex_zhmap_case:nnn

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for article (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese-article.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set:nn { ctex / part }
   {
     aftertitle  = \par ,
@@ -48,6 +48,7 @@
     beforeskip  = 3.5ex \@plus 1ex \@minus .2ex ,
     afterskip   = 2.3ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     format      = \Large \bfseries \centering ,
     afterindent = true
   }
@@ -60,6 +61,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex  \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \keys_set:nn { ctex / subsubsection }
@@ -71,6 +73,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \keys_set:nn { ctex / paragraph }
@@ -79,6 +82,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \keys_set:nn { ctex / subparagraph }
@@ -87,6 +91,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for beamer (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese-beamer.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set:nn { ctex / part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for book (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese-book.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set:nn { ctex / part }
   {
     aftertitle  = \par ,
@@ -38,6 +38,7 @@
     beforeskip  = 0pt \@plus 1fil ,
     afterskip   = 0pt \@plus 1fil ,
     pagestyle   = plain ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
     format      = \huge \bfseries \centering
   }
 \keys_set:nn { ctex / chapter }
@@ -46,6 +47,7 @@
     aftertitle  = \par ,
     beforeskip  = 50 \p@ ,
     afterskip   = 40 \p@ ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
     number      = \chinese { chapter } ,
     format      = \huge \bfseries \centering ,
     aftername   = \quad ,
@@ -59,6 +61,7 @@
     beforeskip  = 3.5ex \@plus 1ex \@minus .2ex ,
     afterskip   = 2.3ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     format      = \Large \bfseries \centering ,
     afterindent = true
   }
@@ -71,6 +74,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex  \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \keys_set:nn { ctex / subsubsection }
@@ -82,6 +86,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \keys_set:nn { ctex / paragraph }
@@ -90,6 +95,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \keys_set:nn { ctex / subparagraph }
@@ -98,6 +104,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for report (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese-report.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set:nn { ctex / part }
   {
     aftertitle  = \par ,
@@ -38,6 +38,7 @@
     beforeskip  = 0pt \@plus 1fil ,
     afterskip   = 0pt \@plus 1fil ,
     pagestyle   = plain ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
     format      = \huge \bfseries \centering
   }
 \keys_set:nn { ctex / chapter }
@@ -46,6 +47,7 @@
     aftertitle  = \par ,
     beforeskip  = 50 \p@ ,
     afterskip   = 40 \p@ ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
     number      = \chinese { chapter } ,
     format      = \huge \bfseries \centering ,
     aftername   = \quad ,
@@ -59,6 +61,7 @@
     beforeskip  = 3.5ex \@plus 1ex \@minus .2ex ,
     afterskip   = 2.3ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     format      = \Large \bfseries \centering ,
     afterindent = true
   }
@@ -71,6 +74,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex  \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \keys_set:nn { ctex / subsubsection }
@@ -82,6 +86,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \keys_set:nn { ctex / paragraph }
@@ -90,6 +95,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \keys_set:nn { ctex / subparagraph }
@@ -98,6 +104,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = true
   }
 \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for generic (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set:nn { ctex } { today = small }
 \ctex_if_autoindent_touched:F
   { \keys_set:nn { ctex } { autoindent = true } }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for article (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain-article.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set:nn { ctex / part }
   {
     aftertitle  = \par ,
@@ -51,6 +51,7 @@
     beforeskip  = 3.5ex \@plus 1ex \@minus .2ex ,
     afterskip   = 2.3ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     format      = \Large \bfseries ,
     afterindent = false
   }
@@ -63,6 +64,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex  \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \keys_set:nn { ctex / subsubsection }
@@ -74,6 +76,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \keys_set:nn { ctex / paragraph }
@@ -82,6 +85,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \keys_set:nn { ctex / subparagraph }
@@ -90,6 +94,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for beamer (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain-beamer.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set:nn { ctex / part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for book (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain-book.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set:nn { ctex / part }
   {
     aftertitle  = \par ,
@@ -39,6 +39,7 @@
     beforeskip  = 0pt \@plus 1fil ,
     afterskip   = 0pt \@plus 1fil ,
     pagestyle   = plain ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
     format      = \centering ,
     nameformat  = \huge \bfseries ,
     titleformat = \Huge \bfseries
@@ -49,6 +50,7 @@
     aftertitle  = \par ,
     beforeskip  = 50 \p@ ,
     afterskip   = 40 \p@ ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
     name        = \chaptername \space ,
     number      = \thechapter ,
     format      = \raggedright ,
@@ -65,6 +67,7 @@
     beforeskip  = 3.5ex \@plus 1ex \@minus .2ex ,
     afterskip   = 2.3ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     format      = \Large \bfseries ,
     afterindent = false
   }
@@ -77,6 +80,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex  \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \keys_set:nn { ctex / subsubsection }
@@ -88,6 +92,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \keys_set:nn { ctex / paragraph }
@@ -96,6 +101,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \keys_set:nn { ctex / subparagraph }
@@ -104,6 +110,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for report (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain-report.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 \keys_set:nn { ctex / part }
   {
     aftertitle  = \par ,
@@ -39,6 +39,7 @@
     beforeskip  = 0pt \@plus 1fil ,
     afterskip   = 0pt \@plus 1fil ,
     pagestyle   = plain ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
     format      = \centering ,
     nameformat  = \huge \bfseries ,
     titleformat = \Huge \bfseries
@@ -49,6 +50,7 @@
     aftertitle  = \par ,
     beforeskip  = 50 \p@ ,
     afterskip   = 40 \p@ ,
+    break       = \if at openright \cleardoublepage \else \clearpage \fi ,
     name        = \chaptername \space ,
     number      = \thechapter ,
     format      = \raggedright ,
@@ -65,6 +67,7 @@
     beforeskip  = 3.5ex \@plus 1ex \@minus .2ex ,
     afterskip   = 2.3ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     format      = \Large \bfseries ,
     afterindent = false
   }
@@ -77,6 +80,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex  \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \keys_set:nn { ctex / subsubsection }
@@ -88,6 +92,7 @@
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
     afterskip   = 1.5ex \@plus .2ex ,
     runin       = false ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \keys_set:nn { ctex / paragraph }
@@ -96,6 +101,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \keys_set:nn { ctex / subparagraph }
@@ -104,6 +110,7 @@
     format      = \normalsize \bfseries ,
     aftername   = \quad ,
     beforeskip  = 3.25ex \@plus 1ex \@minus .2ex ,
+    break       = \addpenalty \@secpenalty ,
     afterindent = false
   }
 \int_compare:nNnTF \g__ctex_section_depth_flag > \c_two

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def	2016-09-25 21:04:43 UTC (rev 42147)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def	2016-09-25 21:05:03 UTC (rev 42148)
@@ -26,10 +26,10 @@
 %% 
 %% ------------------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for generic (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain.def}
-  {\ExplFileDate}{2.4.3}{\ExplFileDescription}
+  {\ExplFileDate}{2.4.4}{\ExplFileDescription}
 %% 
 %%
 %% End of file `ctex-scheme-plain.def'.



More information about the tex-live-commits mailing list