\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!} 
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ctextemp_ustcbook}[2008/01/26 v0.1 ustcbook document class]
\LoadClass[10.5pt,fancyhdr,fntef,twoside,sub3section,openany,CCT]{ctexbook}


\usepackage{amsmath,amsthm,amsfonts,mathrsfs,amssymb,amsbsy,bm,multido,ifthen,xcolor}
\usepackage{mathrsfs}
\usepackage{pst-poly}
\usepackage{latexsym}
\usepackage{graphicx} %We can use any other package if necessary
\usepackage{makeidx}
\usepackage{headrule}
\usepackage{arydshln}
\usepackage{kuvio}
\usepackage{multicol}%
\usepackage{picinpar}%此指令用于{figwindow}(两图并列)
\usepackage{times}
\usepackage{mathptmx}
\DeclareSymbolFont{letters}{OML}{cmm}{m}{it}
\DeclareSymbolFont{operators}{OT1}{cmr}{m}{n}
\DeclareSymbolFont{largesymbols}{OMX}{cmex}{m}{n}
\DeclareSymbolFont{symbols}{OMS}{cmsy}{m}{n}
\DeclareSymbolFont{symbols}{OMS}{cmsy}{m}{n}

%\usepackage{CJK}
\usepackage{eqnarray,wrapfig,Picins,afterpage,bbm}
\usepackage{epsf}
\usepackage{floatflt}
\usepackage{wrapfig}
\usepackage{courier}
\usepackage{color}
\usepackage{listings}


%%%%%%Fonts
\setCJKmainfont[BoldFont={"方正黑体简体"}]{"方正书宋简体"}
\setCJKsansfont{"方正黑体简体"}
%\setCJKmonofont{Adobe Fangsong Std}
\setCJKfamilyfont{"方正书宋简体"}{"方正书宋简体"}
\setCJKfamilyfont{"方正黑体简体"}{"方正黑体简体"}
%\setCJKfamilyfont{Adobe Kaiti Std}{Adobe Kaiti Std}
%\setCJKfamilyfont{Adobe Fangsong Std}{Adobe Fangsong Std}
\setCJKfamilyfont{"方正中等线简体"}{"方正中等线简体"}
\setCJKfamilyfont{"方正小标宋简体"}{"方正小标宋简体"}
\setCJKfamilyfont{"方正大标宋简体"}{"方正大标宋简体"}
\font\euftwo="[EU-F2.TTF]" at 17.2pt
\font\eufone="[EU-F1.TTF]" at 17.2pt
\font\euhfour="[EU-H4.TTF]" at 14pt
\font\eufz="[EU-FZ.TTF]" at 12pt
\font\eufznine="[EU-FZ.TTF]" at 9pt
\font\eufzeleven="[EU-FZ.TTF]" at 11pt
\font\eufzeight="[EU-FZ.TTF]" at 8pt
\font\euhzeleven="[EU-HZ.TTF]" at 11pt
\renewcommand*{\songti}{\CJKfamily{"方正书宋简体"}}
\newcommand*{\zhongdengxian}{\CJKfamily{"方正中等线简体"}}
\renewcommand*{\heiti}{\CJKfamily{"方正黑体简体"}}
\newcommand*{\xbsong}{\CJKfamily{"方正小标宋简体"}}
\newcommand*{\dbsong}{\CJKfamily{"方正小标宋简体"}}
%Chinese font size
\newcommand{\chuhao}{\fontsize{42pt}{\baselineskip}\selectfont}
\newcommand{\xiaochuhao}{\fontsize{36pt}{\baselineskip}\selectfont}
\newcommand{\yihao}{\fontsize{28pt}{\baselineskip}\selectfont}
\newcommand{\erhao}{\fontsize{21pt}{\baselineskip}\selectfont}
\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}
\newcommand{\sanhao}{\fontsize{15.75pt}{\baselineskip}\selectfont}
\newcommand{\xiaosanhao}{\fontsize{15pt}{\baselineskip}\selectfont}
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}
\newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont}
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}
\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}
\newcommand{\liuhao}{\fontsize{7.875pt}{\baselineskip}\selectfont}
\newcommand{\qihao}{\fontsize{5.25pt}{\baselineskip}\selectfont}


\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
  \thispagestyle{empty}%
  \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
  
\setcounter{secnumdepth}{4}
\renewcommand\theparagraph{paragraph} 

% doublespacing
\def\baselinestretch{1.3}

\newcommand{\idx}[1]{#1\index{#1}}

\newcommand\NrCol{2}
\renewenvironment{theindex}{%
\xiaowuhao
\columnseprule \z@
\columnsep 35\p@
\chapter*{\indexname}%
\addcontentsline{toc}{chapter}{索\qquad引\dotfill}
\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}%
\begin{multicols}{\NrCol}%
 \thispagestyle{empty}
 \parindent\z@
 \parskip\z@ \@plus .3\p@\relax
 \let\item\@idxitem%
}{\clearpage\end{multicols}}
\renewcommand{\indexname}{索\qquad引}

\renewenvironment{thebibliography}[1]
     {\def\baselinestretch{1.25}\xiaowuhao\songti\chapter*{\bibname}%
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
       {\settowidth\labelwidth{\@biblabel{#1}}%
        \leftmargin\labelwidth
        \advance\leftmargin\labelsep
        \@openbib@code
        \usecounter{enumiv}%
        \let\p@enumiv\@empty}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\renewcommand{\bibname}{参~考~文~献}
\def\@bibitem#1{\item\if@filesw \immediate\write\@auxout
       {\string\bibcite{#1}{\the\value{\@listctr}}}\fi\ignorespaces\songti\xiaowuhao}
       
%\usepackage[T1]{fontenc}
\usepackage{type1cm}
\usepackage[dvipdfm,paperwidth=14cm,paperheight=21cm,textwidth=13cm,textheight=18cm,centering]{geometry}
\AtBeginDvi{\special{pdf:tounicode GBK-EUC-UCS2}}




\def\CTEX@thechapter{~\arabic{chapter}~}
\def\CTEX@thesection{\arabic{chapter}.\arabic{section}\centering}
\def\CTEX@thesubsection{\arabic{chapter}.\arabic{section}.\arabic{subsection}}
\def\CTEX@thesubsubsection{\thesubsubsection}
\def\CTEX@theparagraph{~(\chinese{\theparagraph})}
\def\CTEX@chapter@nameformat{\fontsize{20.pt}{\baselineskip}\selectfont\euftwo\heiti}
\def\CTEX@chapter@titleformat{\fontsize{20.pt}{\baselineskip}\selectfont\euftwo\heiti\centering}
\def\CTEX@section@format{\fontsize{15pt}{\baselineskip}\selectfont\euhfour\xbsong}
\def\CTEX@section@titleformat{\fontsize{15pt}{\baselineskip}\selectfont\euhfour\xbsong\centering}%H4
\def\CTEX@chapter@beforeskip{45\p@}
\def\CTEX@chapter@afterskip{45\p@}
\def\CTEX@section@aftername{\quad}
\def\CTEX@section@beforeskip{45\p@}
\def\CTEX@section@afterskip{30\p@}
\def\CTEX@section@indent{\z@}
\def\CTEX@subsection@format{\usefont{T1}{eu-fz}{m}{n}\zhongdengxian\fontsize{12pt}\flushleft\selectfont}
\def\CTEX@subsection@aftername{\quad}
\def\CTEX@subsection@beforeskip{15\p@}
\def\CTEX@subsection@afterskip{15\p@}
\def\CTEX@subsection@indent{\z@}
\def\CTEX@subsubsection@format{\normalsize\bfseries\flushleft}
\def\CTEX@subsubsection@aftername{\quad}
\def\CTEX@subsubsection@beforeskip{11pt}
\def\CTEX@subsubsection@afterskip{11pt}
\def\CTEX@subsubsection@indent{\z@}
\def\CTEX@paragraph@format{\normalsize\bfseries\flushleft}
\def\CTEX@paragraph@aftername{\quad}
\def\CTEX@paragraph@beforeskip{2\p@}
\def\CTEX@paragraph@afterskip{1\p@}
\def\CTEX@paragraph@indent{\z@}

\newlength\middlecaptionskip
\setlength\middlecaptionskip{5\p@}
\def\captypefigure{figure}
\def\captypetable{table}
\long\def\@makecaption#1#2{%
  \ifx \@captype \captypefigure 
      \vskip\middlecaptionskip 
  \fi
  \sbox\@tempboxa{\usefont{T1}{eu-fz}{m}{n}\selectfont\heiti\zihao{-5}{\bf#1}\quad#2}%
  \ifdim \wd\@tempboxa >\hsize
    {\usefont{T1}{eu-fz}{m}{n}\selectfont\heiti\zihao{-5}{\bf#1}~~#2}\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi%
  \ifx \@captype \captypetable 
      \vskip\middlecaptionskip 
  \fi
}

\long\def\@makewincaption#1#2{%
   \setbox\@tempboxa\hbox{\usefont{T1}{eu-fz}{m}{n}\zihao{-5}{\bf #1\quad}{\bf #2}}%
   \ifdim\wd\@tempboxa>\picwd
      {\usefont{T1}{eu-fz}{m}{n}\zihao{-5}{\bf #1\quad}{\bf #2\par}}
   \else
      \hbox to\picwd{\hfil\box\@tempboxa\hfil}
   \fi
       }
   
\renewenvironment{table}
           {\@float{table}\songti\zihao{-5}}
           {\end@float}
\renewenvironment{table*}
           {\@dblfloat{table}\songti\zihao{-5}}
           {\end@dblfloat}
\def\fps@figure{hbtp}
\def\fps@table{htbp}

\usepackage {cite}

% 其他
\ifx\CS\undefined
  \ifx\CJKglue\undefined
    \def\CS{{\CC\ }}
  \else
    \def\CS{\CJKglue}
  \fi
\fi


\DeclareMathOperator*{\slim}{ {l \mathbf{\cdot} i \mathbf{\cdot} m} }
\DeclareMathOperator*{\dd}{\,d\!}
\DeclareMathOperator*{\ddn}{\,d}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\tg}{tg}
\DeclareMathOperator*{\arctg}{arc\,tg}

\newtheoremstyle{ustcbookthm}% name
{1pt}      % Space above, empty = `usual value'
{1pt}      % Space below
{}      % Body font
{}      % Indent amount (empty = no indent, \parindent = para indent)
{\bfseries} % Thm head font
{ }     % Punctuation after thm head
{0.8em}     % Space after thm head: \newline = linebreak
{\thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}\thmnote{ {\the\thm@headfont(#3)}}}        % Thm head spec
\theoremstyle{ustcbookthm}

\newtheorem{theorem}{\qquad 定理\,}[chapter]
\newtheorem{lemma}{\qquad 引理\,}[chapter]
\newtheorem{corollary}{\qquad 推论\,}[chapter]
\newtheorem{property}{\qquad 性质\,}[chapter]
\newtheorem{proposition}{\qquad 命题\,}[chapter]
\newtheorem{definition}{\qquad 定义\,}[chapter]
\newtheorem{remark}{\qquad 注记\,}[chapter]
\newtheorem{algorithm}{\qquad 算法\,}[chapter]


\newtheoremstyle{ustcbookalg}% name
{}      % Space above, empty = `usual value'
{}      % Space below
{\itshape}%\sffamily}       % Body font
{}      % Indent amount (empty = no indent, \parindent = para indent)
{\bfseries} % Thm head font
{}      % Punctuation after thm head
{0pt}       % Space after thm head: \newline = linebreak
{\thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}\thmnote{ {\the\thm@headfont{#3}}}}        % Thm head spec
\theoremstyle{ustcbookalg}
\newtheorem{ustc@alg}{算法~}[chapter]
% \@definecounter{algcounter}%
\newenvironment{alg}[1][]{\begin{ustc@alg}[#1]\ 
      % \list{\@arabic\c@algcounter.}%
      \list{\@arabic\c@enumiv.}%
       {\settowidth\labelwidth{88.}%
        \leftmargin\labelwidth
        \advance\leftmargin\labelsep
        \usecounter{enumiv}\let\p@enumiv\@empty%
         \renewcommand\theenumiv{\@arabic\c@enumiv}}%
\def\step{\@inmatherr\item \@ifnextchar [\@item{\@noitemargtrue \@item[\@itemlabel]}}
}{\endlist\end{ustc@alg}}

\renewcommand{\labelenumi}{{(\arabic{enumi})}}
\renewcommand{\labelenumii}{{(\roman{enumii})}}
\renewcommand{\labelenumiii}{{(\alph{enumiii})}}


\def\dengdotfill{%
  \leavevmode
  \cleaders \hb@xt@ .63em{\hss.\hss}\hfill
  \kern\z@}
\def\@chapter[#1]#2{%
  \ifnum \c@secnumdepth >\m@ne
    \if@mainmatter
      \refstepcounter{chapter}% 
      \protected@xdef\@currentlabel{\hspace{-1pt}第~\arabic{chapter}~章\hspace{-1pt}}
      \typeout{\CTEXthechapter}%
      \addcontentsline{toc}{chapter}
        {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1\dengdotfill}%
    \else
      \addcontentsline{toc}{chapter}
       {\protect#1\dengdotfill}%
    \fi
  \else
    \addcontentsline{toc}{chapter}
       {\protect#1\dengdotfill}%
  \fi
  \chaptermark{#1}%
  \addtocontents{lof}{\protect\addvspace{10\p@}}%
  \addtocontents{lot}{\protect\addvspace{10\p@}}%
  \if@twocolumn
    \@topnewpage[\@makechapterhead{#2}]%
  \else
    \@makechapterhead{#2}%
  \@afterheading
  \fi}

\newlength{\@@textleng}
\newlength{\@@cirspace}
\newlength{\@@cirleng}
\newcounter{@@cirnum}
\newsavebox{\mybox}
\CTEXdigits{\mybox}{0}

\pagestyle{fancy}
\fancyhf{}
%  \fancyhead[CO]{\fangsong\fontsize{8pt}{\baselineskip}\selectfont \leftmark}
\fancyhead[CO]{\fangsong\fontsize{8pt}{\baselineskip}\selectfont 
\settowidth{\@@textleng}{\leftmark}
\setlength{\@@cirspace}{\textwidth}
\addtolength{\@@cirspace}{-\@@textleng}
\setlength{\@@cirleng}{0pt} \setcounter{@@cirnum}{0}
\multido{\i=0+1}{50}{\addtolength{\@@cirleng}{\ccwd}
\ifthenelse{\lengthtest{\@@cirleng >
\@@cirspace}}{\multidostop}{\stepcounter{@@cirnum}}}
\multido{\i=0+1,\n=1+-.02174}{\value{@@cirnum}}{%
\definecolor{mycolor}{gray}{\n}\color{mycolor}\heiti\bf\hspace{\hfill\hspace{-1mm}}{\zihao{3}{\circ}}% 
% \newgray{@@mygray}{\n}%
% \psset{unit=\ccwd}%
% \rput(\i,0){\pscircle[linecolor=@@mygray](0.02,0.02){0.1}}%
}%
\hfill\raisebox{0.3mm}\leftmark}


\fancyhead[CE]{\fangsong\fontsize{8pt}{\baselineskip}\selectfont 
\settowidth{\@@textleng}{\@title}%
\setlength{\@@cirspace}{\textwidth}%
\addtolength{\@@cirspace}{-\@@textleng}%
\setlength{\@@cirleng}{0pt}\setcounter{@@cirnum}{0}%
\multido{\ii=0+1,\nn=1+-.02174}{50}{\addtolength{\@@cirleng}{ \ccwd}%
\ifthenelse{\lengthtest{\@@cirleng > \@@cirspace}}{%
\@title \hfill \multido{\i=0+-1,\n=\nn+.02174}{\value{@@cirnum}}{%
\definecolor{mycolor}{gray}{\n}\color{mycolor}\heiti\bf\hspace{\hfill}{\zihao{3}{\circ}}}%
\multidostop}{\stepcounter{@@cirnum}}}%
}
\renewcommand{\headrulewidth}{0pt}

\newcommand{\helv}{%
\fontfamily{phv}\fontseries{m}\fontsize{9}{11}\selectfont}

%\DeclareFixedFont{\myb}{T1}{eu-b4}{m}{n}{10.5pt}

\fancyfoot[RO]{\helv\wuhao\eufzeleven\heiti\thepage}
\fancyfoot[LE]{\helv\wuhao\eufzeleven\heiti\thepage}

 \DeclareMathSymbol{\Gamma}{\mathalpha}{letters}{0}
 \DeclareMathSymbol{\Delta}{\mathalpha}{letters}{1}

\renewcommand\chapter{%\if@openright\cleardoublepage\else\clearpage\fi
                   % \thispagestyle{fancy}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}


\allowdisplaybreaks

\DeclareMathSymbol{\Phi}{\mathalpha}{letters}{8}

\def\CTEX@contentsname{目\hspace{2\ccwd}次}
\message{end of ustcbook.^^J}
\endinput



