summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-05-15 22:08:12 +0000
committerKarl Berry <karl@freefriends.org>2016-05-15 22:08:12 +0000
commita7d586c95a2abcb15eac95c2a2531b158fe19a1b (patch)
tree4f717671246a1eff3c111c43171d6b4fac5c305c /Master/texmf-dist/tex/latex/ctex/ctxdoc.cls
parentf36e4b262397fbc107ecd9c73f0366fb286c4857 (diff)
ctex (15may16)
git-svn-id: svn://tug.org/texlive/trunk@41156 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctxdoc.cls')
-rw-r--r--Master/texmf-dist/tex/latex/ctex/ctxdoc.cls61
1 files changed, 38 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls b/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls
index 5f7839a3a36..f5e29ca94ab 100644
--- a/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls
+++ b/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls
@@ -28,10 +28,10 @@
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx f745b21 2016-05-14 12:17:18 +0800 Qing Lee <sobenlee@gmail.com> $
+\GetIdInfo$Id: ctex.dtx f12457f 2016-05-16 00:55:34 +0800 Qing Lee <sobenlee@gmail.com> $
{ctex documentation (CTEX)}
\ProvidesExplClass{ctxdoc}
- {\ExplFileDate}{2.4.1}{\ExplFileDescription}
+ {\ExplFileDate}{2.4.2}{\ExplFileDescription}
\ExplSyntaxOff
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{l3doc}}
\PassOptionsToClass{a4paper,full}{l3doc}
@@ -166,15 +166,7 @@
\newcounter{ctexexam}
\BeforeBeginEnvironment{function}{\par\nointerlineskip}
\AtEndEnvironment{function}{%
- \par\xdef\ctexfixprevdepth{\prevdepth=\the\prevdepth\space}%
- \ctexfixdescrcoffinyoffset}
-%% l3doc 会在 function 环境的 syntax 和 descr 盒子中间加上 \medskipamount 的距离。
-%% 但是若 syntax 盒子为空(未使用 syntax 环境),就会显得不好看。
-%% 此时我们通过将 \medskipamount 设置为零来修正。
-\def\ctexfixdescrcoffinyoffset{%
- \aftergroup\aftergroup\aftergroup\ctexzeromedskipamount}
-\def\ctexzeromedskipamount{\setlength\medskipamount{\z@skip}}
-\AfterEndEnvironment{syntax}{\let\ctexfixdescrcoffinyoffset\relax}
+ \par\xdef\ctexfixprevdepth{\prevdepth=\the\prevdepth\space}}
\AfterEndEnvironment{function}{\ctexfixprevdepth}
\AtBeginEnvironment{syntax}{\linespread{1}\ctexplainps\ctexdisableecglue}
\BeforeBeginEnvironment{SideBySideExample}{\par\addvspace{\medskipamount}}
@@ -196,19 +188,42 @@
\exp_last_unbraced:Nf \tl_head:w
{ \prop_item:Nn \c__ctex_font_size_prop {#1} } { } \q_stop
}
+%% 抑制首段的 \parskip
+\ctex_patch_cmd_once:NnnnTF \__codedoc_function_descr_start:w
+ { }
+ { \noindent }
+ { \skip_vertical:n { -\parskip } \noindent }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+%% l3doc 会在 function 环境的 syntax 和 descr 盒子中间加上 \medskipamount 的距离。
+%% 但是若 syntax 盒子为空(未使用 syntax 环境),就会显得不好看。
+%% 此时我们通过将 \medskipamount 设置为零来修正。若盒子非空,则将 \parskip 还回去。
+\ctex_preto_cmd:NnnTF \__codedoc_function_assemble:
+ { }
+ { \ctex_doc_fix_yoffset: }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+\cs_new_protected_nopar:Npn \ctex_doc_fix_yoffset:
+ {
+ \box_if_empty:NTF \g__codedoc_syntax_box
+ { \skip_zero:N \medskipamount }
+ { \skip_add:Nn \medskipamount { \parskip } }
+ }
%% 用 \vtop 让函数名字和语法盒子首行对齐
-\patchcmd \__codedoc_syntax:w
+\ctex_patch_cmd_once:NnnnTF \__codedoc_syntax:w
+ { }
{ { minipage } { \l__codedoc_syntax_dim } }
{ { minipage } [t] { \l__codedoc_syntax_dim } }
{ \iow_term:n { *** ~ SUCCESS ~ *** } }
{ \iow_term:n { *** ~ FAIL ~ *** } }
%% 左侧边注的函数列表采用单倍行距
-\cs_set_protected_nopar:Npx \__codedoc_typeset_names:
- {
- \exp_not:N \linespread { 1 }
- \exp_not:o { \__codedoc_typeset_names: }
- }
-\patchcmd \__codedoc_macro_typeset_one:n
+\ctex_preto_cmd:NnnTF \__codedoc_typeset_names:
+ { }
+ { \linespread { 1 } }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_typeset_one:n
+ { }
{ \vbox_unpack_clear:N }
{ \linespread { 1 } \selectfont \vbox_unpack_clear:N }
{ \iow_term:n { *** ~ SUCCESS ~ *** } }
@@ -274,16 +289,16 @@
\DeclareDocumentCommand \GetFileId { m }
{
\GetFileInfo {#1}
- \ior_open:NnTF \g_ctxdoc_ior { \c_sys_jobname_str .id }
+ \ior_open:NnTF \g__ctex_doc_ior { \c_sys_jobname_str .id }
{
- \ior_get:NN \g_ctxdoc_ior \l_tmpa_tl
- \ior_close:N \g_ctxdoc_ior
- \exp_after:wN \GetIdInfo \l_tmpa_tl
+ \ior_get:NN \g__ctex_doc_ior \l__ctex_tmp_tl
+ \ior_close:N \g__ctex_doc_ior
+ \exp_after:wN \GetIdInfo \l__ctex_tmp_tl
}
{ \GetIdInfo $Id$ }
{ \fileinfo }
}
-\iow_new:N \g_ctxdoc_ior
+\ior_new:N \g__ctex_doc_ior
\ExplSyntaxOff
\AtBeginDocument{\addtocontents{toc}{\StopSpecialIndexModule}}
\pdfstringdefDisableCommands{%