Skip to content

Commit

Permalink
move thm to sty
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Mar 10, 2016
1 parent 897c8da commit 188bac7
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 111 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ clean :
# for developers only:
release : cls doc
mkdir ustcthesis
cp -r bib chapters figures .latexmkrc main.tex Makefile README.md \
ustcextra.sty ustcthesis.cls ustcthesis.dtx ustcthesis.pdf ustcthesis/
cp -r ustcthesis.dtx ustcthesis.cls ustcthesis.bst ustcthesis.pdf figures \
main.tex ustcextra.sty chapters bib Makefile .latexmkrc README.md ustcthesis/
zip -r ../ustcthesis.zip ustcthesis
-rm -rf ustcthesis
cleanall :
Expand Down
44 changes: 43 additions & 1 deletion ustcextra.sty
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,54 @@
%% extra packages and configuration.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{ustcextra}[2016/02/21 v2.0 USTC thesis template]
\ProvidesPackage{ustcextra}

% 数学定理:
% 以下定义数学定理环境默认风格为 ustcplain。
\RequirePackage{amsmath,amsthm,amssymb}
\newtheoremstyle{ustcplain}%
{}{}%
{}{2\ccwd}%
{\bfseries}{}%
{\ccwd}{}
\theoremstyle{ustcplain}
% 定义新的定理
\newtheorem{theorem} {\ustc@theoremname} [chapter]
\newtheorem{assertion} [theorem] {\ustc@assertionname}
\newtheorem{axiom} [theorem] {\ustc@axiomname}
\newtheorem{corollary} [theorem] {\ustc@corollaryname}
\newtheorem{lemma} [theorem] {\ustc@lemmaname}
\newtheorem{proposition}[theorem] {\ustc@propositionname}
\newtheorem{definition} {\ustc@definitionname} [chapter]
\newtheorem{example} {\ustc@examplename} [chapter]
\newtheorem*{remark} {\ustc@remarkname}
% \pkg{amsthm} 单独定义了 proof 环境,这里重新定义以满足格式要求。
% 原本模仿 \pkg{amsthm} 写成 |\item[\hskip\labelsep\hskip2\ccwd #1\hskip\ccwd]|,
% 但是却会多出一些间隙。
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item\relax\hskip2\ccwd
\textbf{#1}
\hskip\ccwd\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
\renewcommand\proofname\ustc@proofname

% 表格:
% 三线表
\RequirePackage{booktabs}
% 跨页表格
\RequirePackage{longtable}

% 算法和代码:
% 算法环境
\RequirePackage[boxed, algochapter, lined, linesnumbered]{algorithm2e}
\renewcommand{\listalgorithmcfname}{算法索引}
\renewcommand{\algorithmcfname}{算法}
% 代码环境
\RequirePackage{listings}
\lstset{
basicstyle=\small\ttfamily,
Expand Down
53 changes: 11 additions & 42 deletions ustcthesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesClass{ustcthesis}
[2016/02/21 v2.0 USTC thesis template]
[2016/03/10 v2.0.1 USTC thesis template]
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=ustc@opt, prefix=ustc@opt@, setkeys=\kvsetkeys}
\DeclareBoolOption[false]{doctor}
Expand Down Expand Up @@ -116,6 +116,16 @@
\renewcommand\listfigurename{图目录}
\renewcommand\listtablename{表目录}
\newcommand\ustc@pdf@contentsname{目录}
\newcommand\ustc@assertionname{断言}
\newcommand\ustc@axiomname{公理}
\newcommand\ustc@corollaryname{推论}
\newcommand\ustc@definitionname{定义}
\newcommand\ustc@examplename{例}
\newcommand\ustc@lemmaname{引理}
\newcommand\ustc@proofname{证明}
\newcommand\ustc@propositionname{命题}
\newcommand\ustc@remarkname{注}
\newcommand\ustc@theoremname{定理}
\RequirePackage{geometry}
\geometry{
paper=a4paper,
Expand Down Expand Up @@ -393,47 +403,6 @@
\captionsetup{position = bottom}
\caption*{\hangindent=2\ccwd\relax\textbf{}:#1}}
\DeclareMathSizes{10.5bp}{10.5bp}{7.35bp}{5.25bp}
\RequirePackage{amsmath,amsthm,amssymb}


\newcommand\ustc@assertionname{断言}
\newcommand\ustc@axiomname{公理}
\newcommand\ustc@corollaryname{推论}
\newcommand\ustc@definitionname{定义}
\newcommand\ustc@examplename{例}
\newcommand\ustc@lemmaname{引理}
\newcommand\ustc@proofname{证明}
\newcommand\ustc@propositionname{命题}
\newcommand\ustc@remarkname{注}
\newcommand\ustc@theoremname{定理}

\newtheoremstyle{ustcplain}%
{}{}%
{}{2\ccwd}%
{\bfseries}{}%
{\ccwd}{}
\theoremstyle{ustcplain}

\newtheorem{theorem} {\ustc@theoremname} [chapter]
\newtheorem{assertion} [theorem] {\ustc@assertionname}
\newtheorem{axiom} [theorem] {\ustc@axiomname}
\newtheorem{corollary} [theorem] {\ustc@corollaryname}
\newtheorem{lemma} [theorem] {\ustc@lemmaname}
\newtheorem{proposition}[theorem] {\ustc@propositionname}
\newtheorem{definition} {\ustc@definitionname} [chapter]
\newtheorem{example} {\ustc@examplename} [chapter]
\newtheorem*{remark} {\ustc@remarkname}
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item\relax\hskip2\ccwd
\textbf{#1}
\hskip\ccwd\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
\renewcommand\proofname\ustc@proofname
\newenvironment{notation}{%
\ctexset{chapter/format += \rmfamily\setfontsize{12bp}}
\chapter{符号说明}
Expand Down
89 changes: 23 additions & 66 deletions ustcthesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ LaTeX version 1999/12/01 or later.
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{ustcthesis}
%<*class>
[2016/02/21 v2.0 USTC thesis template]
[2016/03/10 v2.0.1 USTC thesis template]
%</class>
%
%<*driver>
Expand Down Expand Up @@ -745,6 +745,26 @@ LaTeX version 1999/12/01 or later.
\renewcommand\listfigurename{图目录}
\renewcommand\listtablename{表目录}
\newcommand\ustc@pdf@contentsname{目录}
% \newcommand\ustc@assertionname{Assertion}
% \newcommand\ustc@axiomname{Axiom}
% \newcommand\ustc@corollaryname{Corollary}
% \newcommand\ustc@definitionname{Definition}
% \newcommand\ustc@examplename{Example}
% \newcommand\ustc@lemmaname{Lemma}
% \newcommand\ustc@proofname{Proof}
% \newcommand\ustc@propositionname{Proposition}
% \newcommand\ustc@remarkname{Remark}
% \newcommand\ustc@theoremname{Theorem}
\newcommand\ustc@assertionname{断言}
\newcommand\ustc@axiomname{公理}
\newcommand\ustc@corollaryname{推论}
\newcommand\ustc@definitionname{定义}
\newcommand\ustc@examplename{例}
\newcommand\ustc@lemmaname{引理}
\newcommand\ustc@proofname{证明}
\newcommand\ustc@propositionname{命题}
\newcommand\ustc@remarkname{注}
\newcommand\ustc@theoremname{定理}
% \end{macrocode}
%
% \subsection{页面设置}
Expand Down Expand Up @@ -1122,75 +1142,12 @@ LaTeX version 1999/12/01 or later.
% \end{macro}
%
% \subsection{数学}
% \LaTeX{} 在使用 |10pt| 选项时有 \cs{DeclareMathSizes{\@xpt}{\@xpt}{7}{5}},
% \LaTeX{} 在使用 |10pt| 选项时有 |DeclareMathSizes}{\@xpt}{\@xpt}{7}{5}}|
% 这里按照相同的比例设置 10.5 bp。
% \begin{macrocode}
\DeclareMathSizes{10.5bp}{10.5bp}{7.35bp}{5.25bp}
% \end{macrocode}
%
% 以下定义数学定理环境默认风格为 ustcplain。
% \begin{macrocode}
\RequirePackage{amsmath,amsthm,amssymb}

% \newcommand\ustc@assertionname{Assertion}
% \newcommand\ustc@axiomname{Axiom}
% \newcommand\ustc@corollaryname{Corollary}
% \newcommand\ustc@definitionname{Definition}
% \newcommand\ustc@examplename{Example}
% \newcommand\ustc@lemmaname{Lemma}
% \newcommand\ustc@proofname{Proof}
% \newcommand\ustc@propositionname{Proposition}
% \newcommand\ustc@remarkname{Remark}
% \newcommand\ustc@theoremname{Theorem}

\newcommand\ustc@assertionname{断言}
\newcommand\ustc@axiomname{公理}
\newcommand\ustc@corollaryname{推论}
\newcommand\ustc@definitionname{定义}
\newcommand\ustc@examplename{例}
\newcommand\ustc@lemmaname{引理}
\newcommand\ustc@proofname{证明}
\newcommand\ustc@propositionname{命题}
\newcommand\ustc@remarkname{注}
\newcommand\ustc@theoremname{定理}

\newtheoremstyle{ustcplain}%
{}{}%
{}{2\ccwd}%
{\bfseries}{}%
{\ccwd}{}
\theoremstyle{ustcplain}

\newtheorem{theorem} {\ustc@theoremname} [chapter]
\newtheorem{assertion} [theorem] {\ustc@assertionname}
\newtheorem{axiom} [theorem] {\ustc@axiomname}
\newtheorem{corollary} [theorem] {\ustc@corollaryname}
\newtheorem{lemma} [theorem] {\ustc@lemmaname}
\newtheorem{proposition}[theorem] {\ustc@propositionname}
\newtheorem{definition} {\ustc@definitionname} [chapter]
\newtheorem{example} {\ustc@examplename} [chapter]
\newtheorem*{remark} {\ustc@remarkname}
% \end{macrocode}
%
% \pkg{amsthm} 单独定义了 proof 环境,这里重新定义以满足格式要求。
% \begin{macrocode}
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
% \end{macrocode}
% 原本模仿 \pkg{amsthm} 写成 |\item[\hskip\labelsep\hskip2\ccwd #1\hskip\ccwd]|,
% 但是却会多出一些间隙。
% \begin{macrocode}
\item\relax\hskip2\ccwd
\textbf{#1}
\hskip\ccwd\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
\renewcommand\proofname\ustc@proofname
% \end{macrocode}
%
% \subsection{符号说明}
% \begin{environment}{notation}
% 这里只定义了一个满足要求的环境,具体内容由用户自定义
Expand Down Expand Up @@ -1270,8 +1227,8 @@ LaTeX version 1999/12/01 or later.
\newenvironment{publications}{\chapter{在读期间发表的学术论文与取得的研究成果}}{}
% \end{macrocode}
% \end{environment}
% 书脊部分代码无效
% \begin{macrocode}
% 书脊
% 书脊的论文题目、系别、作者姓名默认为\ustc@title, \ustc@depart, \ustc@author,
% 竖排的内部实现是,先用 \addCJKfontfeatures{Vertical=RotatedGlyphs} 旋转每个字,
% 再用 \rotatebox{-90}{} 旋转整个盒子,
Expand Down

0 comments on commit 188bac7

Please sign in to comment.