% % Definitions for typesetting Chinese documents with LaTeX2e % % This package should work with 'book' and 'article' classes. % % % This file contains Chinese characters and should be CCTed to generate % a file with the extension .STY for use as a LaTeX2e package: % % cct cctbase.ctx cctbase.sty % % Author: 张林波 (zlb@lsec.cc.ac.cn) % 汪道柳 (wdl@lsec.cc.ac.cn} % \NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesPackage{cctbase}[1997/12/10 Custom definitions for CCT] \RequirePackage{cchead} % % Define \chntoday, and reset default \date \newcommand\chntoday{\the\year\年\the\month\月\the\day\日} \date{\chntoday} % \CS is equal to a Chinese inter-word space \def\CS{{\CC\ }} % \ccnospace suppresses spaces before and after the argument \def\ccnospace#1{\leavevmode\unskip #1\ignorespaces} \newcommand\chnno@one[1]{% \ifcase#1 零\or 一\or 二\or 三\or 四\or 五\or 六\or 七\or 八\or 九\or 十% \else\@ctrerr\fi} \def\chnno@two#1#2{% \ifnum #1=1\else\chnno@one{#1}\unskip\CS\fi 十\unskip \ifnum #2=0\else\CS\chnno@one{#2}\fi\unskip } \newcommand\chnno[1]{% \ifnum\arabic{#1}>99\@ctrerr\else \ifnum\arabic{#1}>10 \expandafter\chnno@two\the\value{#1}\unskip \else \chnno@one{\arabic{#1}}\unskip \fi \fi} % % Change \@seccntformat to use \sectionname, \subsectionname, etc. %org \def\@seccntformat#1{\csname the#1\endcsname\quad} \def\@seccntformat#1{\csname #1name\endcsname\quad}% !!! % % Change \@sect to use \sectionname, \subsectionname, etc., in the table of % contents \def\@sect#1#2#3#4#5#6[#7]#8{% \ifnum #2>\c@secnumdepth \let\@svsec\@empty \else \refstepcounter{#1}% \protected@edef\@svsec{\@seccntformat{#1}\relax}% \fi \@tempskipa #5\relax \ifdim \@tempskipa>\z@ \begingroup #6{% \@hangfrom{\hskip #3\relax\@svsec}% \interlinepenalty \@M #8\@@par}% \endgroup \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else %org \protect\numberline{\csname the#1\endcsname}% \protect\numberline{\csname #1name\endcsname}% !!! \fi #7}% \else \def\@svsechd{% #6{\hskip #3\relax \@svsec #8}% \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else %org \protect\numberline{\csname the#1\endcsname}% \protect\numberline{\csname #1name\endcsname}% !!! \fi #7}}% \fi \@xsect{#5}} % % Change \afterheading to leave \parindent after heading \def\@afterheading{% \@nobreaktrue \everypar{% \if@nobreak \@nobreakfalse \clubpenalty \@M %org \if@afterindent \else %org {\setbox\z@\lastbox}% %org \fi \else \clubpenalty \@clubpenalty \everypar{}% \fi}} % Change default font size and style in \caption. % Insert \pushziti and \popziti to avoid changing style of Chinese chars. % (based on article/book classes). \long\def\@makecaption#1#2{% \vskip\abovecaptionskip %org \sbox\@tempboxa{#1: #2}% \sbox\@tempboxa{\pushziti\small #1: #2\popziti}% !!! \ifdim \wd\@tempboxa >\hsize %org #1: #2\par {\pushziti\small #1: #2\popziti\par}% !!! \else \global \@minipagefalse \hbox to\hsize{\hfil\box\@tempboxa\hfil}% \fi \vskip\belowcaptionskip} % % Match Chinese typefaces to LaTeX typefaces \newcommand\@matchccfont[3]{% \let#2#1\def#1{#2#3} } % Use \heiti for \bfseries \@matchccfont{\bfseries}{\obfseries}{\heiti} % Use \songti for \rmfamily, \mdseries, \upshape \@matchccfont{\rmfamily}{\ormfamily}{\songti} \@matchccfont{\mdseries}{\omdseries}{\songti} \@matchccfont{\upshape}{\oupshape}{\songti} % Use \kaishu for \itshape \@matchccfont{\itshape}{\oitshape}{\kaishu} % Use \fangsong for \slshape, \sffamily \@matchccfont{\slshape}{\oslshape}{\fangsong} \@matchccfont{\sffamily}{\osffamily}{\fangsong} % % Map Chinese and LaTeX2e font sizes by redefining % \set@fontsize{baselinestretch}{point size}{baselineskip} % % We also set \parindent=2\ccwd if current parindent is not zero. \let\oset@fontsize=\set@fontsize \def\set@fontsize#1#2#3{% \oset@fontsize{#1}{#2}{#3}% \ifdim #2pt < 6.25pt \zihao{7}\else \ifdim #2pt < 8pt \zihao{6}\else \ifdim #2pt < 9.2pt \zihao{-5}\else \ifdim #2pt < 10.61pt \zihao{5}\else \ifdim #2pt < 12.16pt \zihao{-4}\else \ifdim #2pt < 14pt \zihao{4}\else \ifdim #2pt < 17.5pt \zihao{3}\else \ifdim #2pt < 23pt \zihao{2}\else \ifdim #2pt < 30pt \zihao{1}\else \zihao{0}\relax \fi\fi\fi\fi\fi\fi\fi\fi\fi \ifdim\parindent=0pt\else\parindent 2\ccwd\fi } % Change definition of \numberline to allow wider section/chapter labels in % \tableofcontents %org \def\numberline#1{\hb@xt@\@tempdima{#1\hfil}} \def\numberline#1{\ifx\relax#1\relax\else#1\quad\fi}% !!! %=========== suppress extra inter-line spacing in \list environments \setlength\partopsep{0pt} \def\@listI{\leftmargin\leftmargini \parsep 0pt \topsep \parsep \itemsep \parsep} \@listI \def\@listii {\leftmargin\leftmarginii \labelwidth\leftmarginii \advance\labelwidth-\labelsep \parsep \z@ \@plus\z@ \@minus\z@ \topsep \parsep \itemsep \parsep} \def\@listiii{\leftmargin\leftmarginiii \labelwidth\leftmarginiii \advance\labelwidth-\labelsep \parsep \z@ \@plus\z@ \@minus\z@ \topsep \parsep \itemsep \parsep} \def\@listiv{\leftmargin\leftmarginiv \labelwidth\leftmarginiv \advance\labelwidth-\labelsep \parsep \z@ \@plus\z@ \@minus\z@ \topsep \parsep \itemsep \parsep} \def\@listv{\leftmargin\leftmarginv \labelwidth\leftmarginv \advance\labelwidth-\labelsep \parsep \z@ \@plus\z@ \@minus\z@ \topsep \parsep \itemsep \parsep} \def\@listvi{\leftmargin\leftmarginvi \labelwidth\leftmarginvi \advance\labelwidth-\labelsep \parsep \z@ \@plus\z@ \@minus\z@ \topsep \parsep \itemsep \parsep} % % Change default margins for \list environments \setlength\leftmargini {2\ccwd} \setlength\leftmarginii {\leftmargini} \setlength\leftmarginiii {\leftmargini} \setlength\leftmarginiv {\leftmargini} \setlength\leftmarginv {\ccwd} \setlength\leftmarginvi {\ccwd} \setlength\leftmargin {\leftmargini} \setlength\labelsep {.5\ccwd} \setlength\labelwidth {\leftmargini} % \setlength\listparindent{2\ccwd} % Change \listparindent to 2\ccwd in \list \def\list#1#2{\ifnum \@listdepth >5\relax \@toodeep \else \global\advance\@listdepth\@ne \fi \rightmargin \z@ \listparindent2\ccwd \itemindent \z@ \csname @list\romannumeral\the\@listdepth\endcsname \def\@itemlabel{#1}\let\makelabel\@mklab \@nmbrlistfalse #2\relax \@trivlist \parskip\parsep \parindent\listparindent \advance\linewidth -\rightmargin \advance\linewidth -\leftmargin \advance\@totalleftmargin \leftmargin \parshape \@ne \@totalleftmargin \linewidth \ignorespaces} % % Use \bfseries in the title \let\oldtitle=\title \def\title#1{\oldtitle{\bfseries\biaosong #1}} \def\baselinestretch{1.3}\normalsize \endinput