Skip to content

Commit

Permalink
update: doc
Browse files Browse the repository at this point in the history
  • Loading branch information
stone-zeng committed Apr 8, 2017
1 parent c5d421f commit b7312af
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 128 deletions.
52 changes: 41 additions & 11 deletions source/ctxdoc-m.cls
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%%
%% This is the modified version of `ctxdoc.cls'.
%% Modified by Zeng Xiangdong, last update 2017-04-08.
%% Modified by Xiangdong Zeng, last update 2017-04-08.
%%
%% Copyright (C) 2003--2017
%% CTEX.ORG and any individual authors listed in the documentation.
Expand All @@ -26,7 +26,8 @@
\RequirePackage{expl3}
\GetIdInfo$Id: ctex.dtx d459e18 2017-02-23 02:07:49 +0800 Qing Lee <[email protected]> $
{ctex documentation (CTEX)}
\ProvidesExplClass{ctxdoc}
% Modified by Xiangdong Zeng, 2017-04-08.
\ProvidesExplClass{ctxdoc-m}
{\ExplFileDate}{2.4.8}{\ExplFileDescription}
\ExplSyntaxOff
\let\pdfmdfivesum\mdfivesum
Expand All @@ -35,14 +36,14 @@
\ProcessOptions
\@namedef{[email protected]}{9999/99/99}
\LoadClass{l3doc}
% Modified by Zeng Xiangdong, 2017-04-08.
% Modified by Xiangdong Zeng, 2017-04-08.
%\RequirePackage[UTF8, punct = kaiming, heading, fontset = none,
% linespread = 1.2, sub3section]{ctex}
\RequirePackage[UTF8, heading = true]{ctex}
\ifxetex
\xeCJKsetup{AutoFakeBold=false}
\fi
% Modified by Zeng Xiangdong, 2017-04-08.
% Modified by Xiangdong Zeng, 2017-04-08.
%\ctexset{
% fontset,
% abstractname = 简介,
Expand All @@ -63,13 +64,13 @@
\RequirePackage{caption}
\RequirePackage{fvrb-ex}
\RequirePackage{zref-base}
% Modified by Zeng Xiangdong, 2017-04-08.
% Modified by Xiangdong Zeng, 2017-04-08.
%\geometry{includemp,hmargin={0mm,15mm},vmargin={25mm,15mm},footskip=7mm}
%\hypersetup{pdfstartview=FitH,bookmarksdepth=subparagraph}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{2}
\newcommand*\email{\nolinkurl}
% Modified by Zeng Xiangdong, 2017-04-08.
% Modified by Xiangdong Zeng, 2017-04-08.
%\setmainfont{TeX Gyre Pagella}
%\setsansfont{TeX Gyre Heros}
%\setmonofont[
Expand Down Expand Up @@ -172,7 +173,7 @@
\AtEndEnvironment{function}{%
\par\xdef\ctexfixprevdepth{\prevdepth=\the\prevdepth\space}}
\AfterEndEnvironment{function}{\ctexfixprevdepth}
% Modified by Zeng Xiangdong, 2017-04-08.
% Modified by Xiangdong Zeng, 2017-04-08.
% linespread: 1 -> 1.2.
\AtBeginEnvironment{syntax}{\linespread{1.2}\ctexplainps\ctexdisableecglue}
\BeforeBeginEnvironment{SideBySideExample}{\par\addvspace{\medskipamount}}
Expand Down Expand Up @@ -228,7 +229,7 @@
{ \iow_term:n { *** ~ SUCCESS ~ *** } }
{ \iow_term:n { *** ~ FAIL ~ *** } }
\cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n
% Modified by Zeng Xiangdong, 2017-04-08.
% Modified by Xiangdong Zeng, 2017-04-08.
%\cs_set_protected:Npn \__codedoc_macro_typeset_one:nN #1#2
% {
% \vbox_set:Nn \l__codedoc_macro_box
Expand Down Expand Up @@ -273,6 +274,35 @@
% \__codedoc_macroname_suffix:N #2
% }
% }
\cs_gset_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_last_unbraced:NNo \hyperref
[ \l__codedoc_tmpa_tl ]
}
{ \use:n }
{
\int_compare:nTF
% 修改不使用紧缩字体的最大命令长度为 99
{ \str_count:n {#1} <= 99 }
{ \MacroFont }
{ \MacroLongFont }
\tl_set:Nn \l__codedoc_tmpa_tl {#1}
\tl_replace_all:Nno \l__codedoc_tmpa_tl
{ ~ } { \c_catcode_other_space_tl }
\__codedoc_macroname_prefix:o \l__codedoc_tmpa_tl
\__codedoc_macroname_suffix:N #2
}
}
% Modified by Xiangdong Zeng, 2017-04-08.
%\AtBeginEnvironment { syntax }
% {
% \char_set_catcode_active:N \|
Expand Down Expand Up @@ -694,7 +724,7 @@
\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 }
% Modified by Zeng Xiangdong, 2017-04-08.
% Modified by Xiangdong Zeng, 2017-04-08.
% linespread: 1 -> 1.2.
\cs_set_protected:Npn \MacroFont
{
Expand Down Expand Up @@ -833,7 +863,7 @@
\input{ctex-name-utf8.cfg}%
\ExplSyntaxOff
\MakePercentIgnore}{}
% Modified by Zeng Xiangdong, 2017-04-08.
% Modified by Xiangdong Zeng, 2017-04-08.
%\def\ctexkit{\href{https://github.com/CTeX-org/ctex-kit/}{\texttt{ctex-kit}}}
%\def\ctexkitrev#1{%
% \href{https://github.com/CTeX-org/ctex-kit/commit/#1}{\texttt{ctex-kit} rev. #1}}
Expand All @@ -850,7 +880,7 @@
\textit{意大利体的数字表示描述对应索引项的页码;
带下划线的数字表示定义对应索引项的代码行号;
罗马字体的数字表示使用对应索引项的代码行号。}}
% Modified by Zeng Xiangdong, 2017-04-08.
% Modified by Xiangdong Zeng, 2017-04-08.
\def\IndexLayout{%
%\newgeometry{hmargin=15mm,vmargin={25mm,15mm},footskip=7mm}%
\setlength\IndexMin{.5\textheight}%
Expand Down
152 changes: 45 additions & 107 deletions source/zhlipsum.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -25,100 +25,27 @@
%
% \iffalse
%

%
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\RequirePackage{expl3,xparse}
%<package|zh-cn>\GetIdInfo $Id: zhlipsum.dtx 0.1 2017-04-08 12:00:00Z Xiangdong Zeng $
%<driver|package> {Chinese `Lorem Ipsum' text}
%<zh-cn> {Simplified Chinese `Lorem Ipsum' text (for zhlipsum)}
%
%<*driver>

%%%%%%%%%% 版本历史 %%%%%%%%%%
% v0.1 2017/04/07
% 开始

% 禁止调用 `thumbpdf' 宏包
% 见 http://tex.stackexchange.com/q/39415
% 又见 `ctxdoc.sty'
\makeatletter
\@namedef{[email protected]}{9999/99/99}
\makeatother

\documentclass{ctxdoc-m}

\ExplSyntaxOn
% 重定义 `\__codedoc_print_macroname:nN`
% 修改不使用紧缩字体的最大命令长度为 99
\int_const:Nn \l__mydoc_max_name_length_int { 99 }
\cs_gset_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_last_unbraced:NNo \hyperref
[ \l__codedoc_tmpa_tl ]
}
{ \use:n }
{
\int_compare:nTF
{ \str_count:n {#1} <= \l__mydoc_max_name_length_int }
{ \MacroFont }
{ \MacroLongFont }
\tl_set:Nn \l__codedoc_tmpa_tl {#1}
\tl_replace_all:Nno \l__codedoc_tmpa_tl
{ ~ } { \c_catcode_other_space_tl }
\__codedoc_macroname_prefix:o \l__codedoc_tmpa_tl
\__codedoc_macroname_suffix:N #2
}
}
\ExplSyntaxOff

\usepackage[UTF8, heading = true]{ctex}
%\usepackage{geometry}
%\usepackage{xcolor}
%\usepackage{unicode-math}
%\usepackage{pifont}
%\usepackage{siunitx}
\sisetup{
number-math-rm = \ensuremath,
inter-unit-product = \ensuremath{{}\cdot{}},
group-digits = true,
group-minimum-digits = 4,
group-separator = \text{~},
range-phrase = \symbol{65374},
separate-uncertainty = true
}

%% 代码部分页边距。
\geometry{
paper = a4paper,
left = 6.35 cm,
right = 2.54 cm,
top = 3.18 cm,
bottom = 2.54 cm
% showframe
}

%% 字体设置。
\setmainfont{TeX Gyre Pagella}
\setsansfont{TeX Gyre Heros}
\setmonofont{Latin Modern Mono Light}[HyphenChar = None]
\setmathfont{TeX Gyre Pagella Math}

\setCJKmainfont{FZShuSong-Z01}%
[BoldFont = FZHei-B01, ItalicFont = FZKai-Z03]
\setCJKmonofont{FZFangSong-Z02}%
[BoldFont = FZHei-B01, ItalicFont = FZKai-Z03]

%\setCJKfamilyfont{宋}{FZShuSong-Z01}
%\setCJKfamilyfont{黑}{FZHei-B01}
%\setCJKfamilyfont{仿}{FZFangSong-Z02}
%\setCJKfamilyfont{楷}{FZKai-Z03}

%% 句号处理
%\catcode`\。 = \active
%\newcommand{。}{.}

%% 中文排版格式。
\ctexset
{
section = {
Expand All @@ -128,28 +55,41 @@
indexname = {代码索引}
}

\renewcommand{\pkg}[1]{\textsf{#1}}
\renewcommand{\cls}[1]{\textsf{\textit{#1}}}
%% 代码部分页边距。
\geometry{
paper = a4paper,
left = 6.35 cm,
right = 2.54 cm,
top = 3.18 cm,
bottom = 2.54 cm
}

%\newcommand{\XeLaTeX}{\hologo{XeLaTeX}}
%\newcommand{\LuaLaTeX}{\hologo{LuaLaTeX}}
\sisetup{
number-math-rm = \ensuremath,
inter-unit-product = \ensuremath{{}\cdot{}},
group-digits = true,
group-minimum-digits = 4,
group-separator = \text{~},
range-phrase = \symbol{65374},
separate-uncertainty = true
}

\hypersetup{
% PDF 标题作者
pdftitle = {zhlipsum:中文版乱数假文(Lorem ipsum)},
pdfauthor = {曾祥东},
bookmarksopen = true,
% bookmarksopenlevel = 1,
pdftitle = {zhlipsum:中文版乱数假文(Lorem ipsum)},
pdfauthor = {曾祥东},
bookmarksopen = true,
bookmarksnumbered = true,
% hyperfootnotes = false,
% linktoc = page,
pdfborder = 0 0 0,
pdfborder = 0 0 0,
colorlinks,
linkcolor = {red!60!black},
citecolor = {green!50!black},
urlcolor = {blue!63!green}
linkcolor = {red!60!black},
citecolor = {green!50!black},
urlcolor = {blue!63!green}
}

\renewcommand{\pkg}[1]{\textsf{#1}}
\renewcommand{\cls}[1]{\textsf{\textit{#1}}}


\EnableCrossrefs
\CodelineIndex
\RecordChanges
Expand Down Expand Up @@ -188,10 +128,12 @@
%
% \title{\textbf{zhlipsum:中文版乱数假文(Lorem ipsum)}}
% \author{曾祥东}
% \date{2017/04/08 \quad v0.1\thanks{\url{https://github.com/Stone-Zeng/zhlipsum}.}}
% \maketitle
%
% \begin{minipage}{0.9\textwidth}
% \small \itshape
% \mbox{} \par \mbox{} \par
% \qquad 如彭奇和瓦特曼的公共事业所证实的那样有一个胡子雪雪白
% 的上帝超越时间超越空间确确实实存在他在神圣的冷漠神圣的疯狂神
% 圣的喑哑的高处深深地爱着我们除了少数的例外不知什么原因但时间
Expand Down Expand Up @@ -270,17 +212,15 @@
%
% 本宏包使用 \LaTeX3 语法编写,依赖于 \pkg{expl3} 环境。
% \begin{macrocode}
%<*sty|zh-cn>
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3,xparse}
%</sty|zh-cn>
%<package>\ProvidesExplPackage{\ExplFileName}
%<zh-cn>\ProvidesExplFile{\ExplFileName}
%<package|zh-cn> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
% \end{macrocode}
%
% \subsection{宏包主体}
%
% \begin{macrocode}
%<*sty>
\ProvidesExplPackage {zhlipsum} {2017/04/07} {0.1}
{Chinese `Lorem Ipsum' text}
%<*package>
% \end{macrocode}
%
% \begin{macro}{\l__zhlipsum_tmpa_int,\l__zhlipsum_tmpa_str}
Expand Down Expand Up @@ -363,14 +303,12 @@
% 读入假文文本定义文件。
% \begin{macrocode}
\file_input:n { zhlipsum-zh-cn.def }
%</sty>
%</package>
% \end{macrocode}
%
% \subsection{假文文本——简体中文}
% \begin{macrocode}
%<*zh-cn>
\ProvidesExplFile {zhlipsum-zh-cn.def} {2017/04/07} {0.1}
{Simplified~ Chinese~ `Lorem~ Ipsum'~ text~ (zhlipsum)}
% \end{macrocode}
%
% 由 \url{http://www.cancms.com/content/dummytext} 网站生成。
Expand Down
4 changes: 2 additions & 2 deletions source/zhlipsum.ins
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
%% zhlipsum-zh-cn.def
%%

\input l3docstrip.tex
\input ctxdocstrip.tex

\keepsilent

Expand Down Expand Up @@ -54,7 +54,7 @@

\generate
{
\file{zhlipsum.sty} {\from{\jobname.dtx}{sty}}
\file{zhlipsum.sty} {\from{\jobname.dtx}{package}}
\file{zhlipsum-zh-cn.def} {\from{\jobname.dtx}{zh-cn}}
}

Expand Down
9 changes: 4 additions & 5 deletions zhlipsum-zh-cn.def
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
%% and the derived files zhlipsum.sty
%% zhlipsum-zh-cn.def
%%

\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3,xparse}
\ProvidesExplFile {zhlipsum-zh-cn.def} {2017/04/07} {0.1}
{Simplified~ Chinese~ `Lorem~ Ipsum'~ text~ (zhlipsum)}
\GetIdInfo $Id: zhlipsum.dtx 0.1 2017-04-08 12:00:00Z Xiangdong Zeng $
{Simplified Chinese `Lorem Ipsum' text (for zhlipsum)}
\ProvidesExplFile{\ExplFileName}
{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\tl_const:Nn \c__zhlipsum_text_zh_cn_i_tl
{
劳仑衣普桑,认至将指点效则机,最你更枝。想极整月正进好志次回
Expand Down
Loading

0 comments on commit b7312af

Please sign in to comment.