| 1 |
\NeedsTeXFormat{LaTeX2e} |
| 2 |
\ProvidesClass{zharticle}[2008/11/28 0.2 The LaTeX template for general chinese articles] |
| 3 |
\typeout{Document Class `zharticle' v0.2 by Nobel Huang (2008/11/28)} |
| 4 |
|
| 5 |
% 定义选项 |
| 6 |
\newif\ifwithdate\withdatefalse |
| 7 |
|
| 8 |
\DeclareOption{withdate}{\withdatetrue \typeout{[zharticle]: With date.}}% 显示日期 |
| 9 |
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}} |
| 10 |
\ProcessOptions |
| 11 |
|
| 12 |
% 加载依赖包 |
| 13 |
\LoadClass[a4paper, DIV=16, fontsize=9pt, twocolumn]{scrartcl}% 双列排版 |
| 14 |
\let\todayeng\today |
| 15 |
|
| 16 |
\RequirePackage{doc} |
| 17 |
\RequirePackage{ifpdf} |
| 18 |
\RequirePackage{CJKutf8} |
| 19 |
\RequirePackage{CJKnumb} |
| 20 |
\ifpdf |
| 21 |
\RequirePackage{hyperref} |
| 22 |
\else |
| 23 |
\RequirePackage[dvipdfmx]{hyperref} |
| 24 |
\fi |
| 25 |
\hypersetup{% |
| 26 |
unicode=true,% |
| 27 |
colorlinks=true,% |
| 28 |
linkcolor=blue,% |
| 29 |
urlcolor=black,% |
| 30 |
citecolor=black,% |
| 31 |
bookmarksopen=true,% |
| 32 |
bookmarksnumbered,% |
| 33 |
pdfpagemode=UseOutlines,% |
| 34 |
pdfstartview=Fit,% |
| 35 |
pdfpagelayout=OneColumn} |
| 36 |
\RequirePackage{caption} % 定义图的标题格式:居中. 使用caption3.0 |
| 37 |
\captionsetup{% |
| 38 |
format=plain,% |
| 39 |
labelformat=simple,% |
| 40 |
justification=centering,% |
| 41 |
singlelinecheck=off} |
| 42 |
\RequirePackage[stable, flushmargin, perpage]{footmisc} |
| 43 |
\RequirePackage{indentfirst} |
| 44 |
\RequirePackage[numbers,sort&compress]{natbib} % 修改引用参考文献格式 |
| 45 |
\RequirePackage[rm, bf]{titlesec} |
| 46 |
\RequirePackage{paralist} |
| 47 |
\RequirePackage{balance} |
| 48 |
|
| 49 |
% 正文预处理 |
| 50 |
\linespread{1.36}% 行距15pt |
| 51 |
\setlength{\parskip}{0pt}% 段落间距 Important |
| 52 |
\renewcommand{\rmdefault}{ptm}% 英文为time new roman |
| 53 |
\setlength{\bibsep}{0ex}% 参考文献间距 |
| 54 |
\setlength{\textfloatsep}{1ex}% 浮动体间距 |
| 55 |
\setlength{\intextsep}{1ex} |
| 56 |
\setlength{\floatsep}{1ex} |
| 57 |
\titlespacing*{\section}{0pt}{0pt}{0pt}% 节标题间距 |
| 58 |
\titlespacing*{\subsection}{0pt}{0pt}{0pt} |
| 59 |
\titlespacing*{\subsubsection}{0pt}{0pt}{0pt} |
| 60 |
\setdefaultenum{1)}{a)}{i.}{A.}% 设置列表模式 |
| 61 |
\setdefaultleftmargin{4ex}{}{}{}{}{} |
| 62 |
\setlength{\textheight}{244mm} |
| 63 |
\setlength{\textwidth}{170mm} |
| 64 |
\setlength{\columnsep}{7mm} |
| 65 |
|
| 66 |
\AtBeginDocument{% |
| 67 |
\InputIfFileExists{zharticle.cfg}% 加载配置文件 |
| 68 |
{\typeout{[zharticle]: Load zharticle.cfg successfully!}}% |
| 69 |
{\typeout{[zharticle]: Load zharticle.cfg failed!}}% |
| 70 |
\begin{CJK*}{UTF8}{song}\CJKtilde\CJKindent\CJKcaption{zh-Hans}% |
| 71 |
\balance% |
| 72 |
} |
| 73 |
\AtEndDocument{% |
| 74 |
\end{CJK*} |
| 75 |
} |
| 76 |
|
| 77 |
% 命令 |
| 78 |
\newcommand{\@authoreng}{} |
| 79 |
\renewcommand{\author}[2]{ |
| 80 |
\def\@author{#1} |
| 81 |
\renewcommand{\@authoreng}{#2} |
| 82 |
} |
| 83 |
|
| 84 |
\newcommand{\@address}{} |
| 85 |
\newcommand{\@addresseng}{} |
| 86 |
\newcommand{\address}[2]{ |
| 87 |
\renewcommand{\@address}{#1} |
| 88 |
\renewcommand{\@addresseng}{#2} |
| 89 |
} |
| 90 |
|
| 91 |
\newcommand{\@titleeng}{} |
| 92 |
\renewcommand{\title}[2]{ |
| 93 |
\def\@title{#1} |
| 94 |
\renewcommand{\@titleeng}{#2} |
| 95 |
} |
| 96 |
|
| 97 |
\newcommand{\@categorynumber}{}% 中图分类号 |
| 98 |
\newcommand{\categorynumber}[1]{\renewcommand{\@categorynumber}{#1}} |
| 99 |
|
| 100 |
\newcommand{\@refmark}{}% 文献标识码 |
| 101 |
\newcommand{\refmark}[1]{\renewcommand{\@refmark}{#1}} |
| 102 |
|
| 103 |
\newcommand{\@articleid}{}% 文章编号 |
| 104 |
\newcommand{\articleid}[1]{\renewcommand{\@articleid}{#1}} |
| 105 |
|
| 106 |
\newcommand{\@abstract}{} |
| 107 |
\newcommand{\@abstracteng}{} |
| 108 |
\newcommand{\@keywords}{} |
| 109 |
\newcommand{\@keywordseng}{} |
| 110 |
\newcommand{\abstractkeyword}[4]{ |
| 111 |
\renewcommand{\@abstract}{#1} |
| 112 |
\renewcommand{\@abstracteng}{#2} |
| 113 |
\renewcommand{\@keywords}{#3} |
| 114 |
\renewcommand{\@keywordseng}{#4} |
| 115 |
} |
| 116 |
|
| 117 |
\renewcommand{\@maketitle}{% |
| 118 |
\clearpage |
| 119 |
\let\footnote\thanks |
| 120 |
\ifx\@extratitle\@empty \else |
| 121 |
\noindent\@extratitle \next@tpage \if@twoside \null\next@tpage \fi |
| 122 |
\fi |
| 123 |
\setparsizes{\z@}{\z@}{\z@\@plus 1fil}\par@updaterelative |
| 124 |
\ifx\@titlehead\@empty \else |
| 125 |
\begin{minipage}[t]{\textwidth} |
| 126 |
\@titlehead |
| 127 |
\end{minipage}\par |
| 128 |
\fi |
| 129 |
\null |
| 130 |
\vskip 28pt% |
| 131 |
\begin{center}% |
| 132 |
\ifx\@subject\@empty \else |
| 133 |
{\subject@font \@subject \par} |
| 134 |
\vskip 1em |
| 135 |
\fi |
| 136 |
{\song\xiaoerhao \textbf{\@title} \par}% |
| 137 |
\vskip 2pt |
| 138 |
{\ifx\@subtitle\@empty\else\usekomafont{subtitle}\@subtitle\par\fi}% |
| 139 |
\vskip 6pt |
| 140 |
{\kai\wuhao \@author \par} |
| 141 |
\vspace{0mm} |
| 142 |
{\song\liuhao (\@address) \par} |
| 143 |
\ifwithdate |
| 144 |
\vspace{0mm} |
| 145 |
{\song\liuhao \@date \par}% % Set date in \large size. |
| 146 |
\else |
| 147 |
\fi |
| 148 |
\end{center}% |
| 149 |
\par |
| 150 |
\vspace{-1mm} |
| 151 |
|
| 152 |
\begin{abstract}{\@keywords} |
| 153 |
\@abstrac |
| 154 |
\end{abstract} |
| 155 |
|
| 156 |
\maketitleeng |
| 157 |
\begin{engabstract}{\@keywordseng} |
| 158 |
\@abstracten |
| 159 |
\end{engabstract} |
| 160 |
|
| 161 |
\vspace{1em} |
| 162 |
|
| 163 |
%设置文件属性 |
| 164 |
\GetFileInfo{zharticle.cls} |
| 165 |
\hypersetup{ |
| 166 |
pdfauthor={\@author}, |
| 167 |
pdftitle={\@title}, %文件标题 |
| 168 |
pdfsubject={\@title}, %文件主题 |
| 169 |
pdfcreator={The zharticle class (v \fileversion)} % 应用程序 |
| 170 |
} |
| 171 |
} |
| 172 |
|
| 173 |
\newcommand{\maketitleeng}{% 请在\maketitle后调用 |
| 174 |
\begin{center}% |
| 175 |
\ifx\@subject\@empty \else |
| 176 |
{\subject@font \@subject \par} |
| 177 |
\vskip 1em |
| 178 |
\fi |
| 179 |
{\sihao \textbf{\@titleeng} \par}% |
| 180 |
\vskip 2pt |
| 181 |
{\ifx\@subtitle\@empty\else\usekomafont{subtitle}\@subtitle\par\fi}% |
| 182 |
\vskip 6pt |
| 183 |
\vspace{0mm} |
| 184 |
{\wuhao \textit{\@authoreng} \par} |
| 185 |
\vspace{0mm} |
| 186 |
{\liuhao (\@addresseng)\par} |
| 187 |
\end{center}% |
| 188 |
\vspace{-1mm}% |
| 189 |
} |
| 190 |
|
| 191 |
\renewenvironment{abstract}[1]{% 中文摘要, 关键字作为参数 |
| 192 |
\kai\xiaowuhao\noindent |
| 193 |
\textbf{\song 摘要:~}\noindent |
| 194 |
}{% |
| 195 |
\par\noindent |
| 196 |
\textbf{\song 关键词:} \@keywords |
| 197 |
\par\noindent |
| 198 |
\textbf{\song 中图分类号:} \makebox[3cm][l]{\@categorynumber}% |
| 199 |
\textbf{\song 文献标识码:} \makebox[1.5cm][l]{\@refmark}% |
| 200 |
\textbf{\song 文章编号:} \makebox[5cm][l]{\@articleid} |
| 201 |
\par |
| 202 |
\hypersetup{pdfkeywords={\@keywords}} |
| 203 |
} |
| 204 |
|
| 205 |
\newenvironment{engabstract}[1]{% 英文摘要 |
| 206 |
\xiaowuhao\noindent |
| 207 |
\textbf{Abstract:}\noindent |
| 208 |
}{% |
| 209 |
\par\noindent |
| 210 |
\textbf{Key words:} \@keywordseng |
| 211 |
\par |
| 212 |
} |
| 213 |
|
| 214 |
% 其他 |
| 215 |
\let\orig@emph=\emph% 中文强调 |
| 216 |
\renewcommand{\emph}[1]{{\orig@emph{\kai#1}}} |
| 217 |
|
| 218 |
% 参考文献 |
| 219 |
\let\originalcite=\cite |
| 220 |
\renewcommand{\cite}[1]{\textsuperscript{\originalcite{#1}}} |
| 221 |
\renewcommand{\citet}[1]{\originalcite{#1}} |
| 222 |
|
| 223 |
\bibliographystyle{zharticle} |