Skip to content

Commit

Permalink
Major version update
Browse files Browse the repository at this point in the history
- Use official character LOGO `zjuchar.pdf`
- Fix heading numbering and format problems
- Use .cls file as original `config.tex` + `info.tex`
  • Loading branch information
TheNetAdmin committed Jul 19, 2018
1 parent a013397 commit 23a4df5
Show file tree
Hide file tree
Showing 22 changed files with 206 additions and 101 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,33 @@

1. [下载模板代码](https://github.com/TheNetAdmin/zjuthesis/releases)
2. 安装TexLive工具包,编译需要XeTeX引擎
3.`config/info.tex`中填写个人信息,注意其中部分信息用于控制文档的生成
3.`zjuthesis.tex``\documentclass[]{zjuthesis}`部分填写个人信息,注意以下信息用于控制文档的生成

|Type|Period|BlindReview|
|:---|:-----|:----------|
|thesis: 论文类|proposal: 开题报告|true: 生成盲审用pdf(隐藏个人信息)|
|design: 设计类|final: 最终论文/设计|false: 生成提交用pdf|
|Type|Period|BlindReview|MajorFormat|
|:---|:-----|:----------|:----------|
|thesis: 论文类|proposal: 开题报告|true: 生成盲审用pdf(隐藏个人信息)|默认: cs|
|design: 设计类|final: 最终论文/设计|false: 生成提交用pdf|`config/format/major/`下目录名相同|

4.`content`目录下编写内容
5.`pages`目录下填写必要的内容,如审核评语等
6.`figure`目录下保存图片,在`reference/ref.bib`内插入文献条目
7. 在根目录下运行命令`latexmk -xelatex -outdir=out zjutheis`即可编译LaTex到`out`目录(该目录不会被记录版本)

>注意:本模板默认情况下使用计算机科学与技术专用格式,如需使用其他专业格式,请修改文件`config/format/format.tex`的引入规则
>注意:本模板默认情况下使用计算机科学与技术专用格式,如需使用其他专业格式,请修改`zjuthesis.tex``\documentclass`部分的`\MajorFormat`
## 扩展

1. 针对每个专业的扩展格式编写请新建目录`config/format/major/专业简称`,在该目录下固定新建文件`format.tex`,引入该目录下所有格式设置文件
2. 扩展格式的`\usepackage{packagename}`尽量放在其所在子目录下的`packages.tex`内,不要放在`config/packages.tex`内,避免其他专业同学使用时产生package冲突或额外引入
3. 最后更改`config/format/format.tex`中的引入规则,引入新扩展的格式目录下的`format.tex`即可
3. 最后修改`zjuthesis.tex``\documentclass`部分的`\MajorFormat`,使用新格式的目录名即可

## Q&A

1. 为何不使用`.cls`:我个人认为将所有格式写入同一文件会造成扩展与修改的困难,面对一个.cls中几百行上千行的代码,即使有注释也很难进行正确的修改和扩展。所以我将所有格式以及命令定义都放入`config`文件夹内,并以文件名区分其负责的格式内容。虽然这样带来了大量的文件引入,但相对来讲更易于定位代码和进行扩展
2. 没有我所在专业的格式:由于个人精力有限,难以查阅并编写各系具体要求的格式,如果同学们有相关需求,可以:
1. 没有我所在专业的格式:由于个人精力有限,难以查阅并编写各系具体要求的格式,如果同学们有相关需求,可以:
- 在Github上提出issue,附上模板格式要求
- 发送邮件到我邮箱(zxwang42 [at] gmail.com),附上模板格式要求与样例文件
- **在Github上提出Pull Request,贡献你编写的代码**
3. 其他问题请在Github issue提出或使用邮件与我联系
2. 其他问题请在Github issue提出或使用邮件与我联系

## 开源许可

Expand Down
126 changes: 89 additions & 37 deletions config/commands.tex
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,63 @@
\end{flushright}
}

\DeclareDocumentCommand{\finaleval}{O{~} O{~} O{~} O{~} O{~}}
{
\begin{table}[H]
\centering \bfseries
\begin{tabularx}{\textwidth}{|>{\fangsong}c
|>{\fangsong}X<{\centering}
|>{\fangsong}X<{\centering}
|>{\fangsong}X<{\centering}
|>{\fangsong}X<{\centering}
|>{\fangsong}c|}
\hline
\makecell{成绩\\比例}
& \makecell{\ifthenelse{\equal{\Type}{thesis}}{文献综述}{中期报告} \\(10\%)}
& \makecell{开题报告\\(15\%)}
& \makecell{外文翻译\\(5\%)}
& \ifthenelse{\equal{\Type}{thesis}}{毕业论文质量及答辩(70\%)}{毕业设计质量及答辩(70\%)}
& \makecell{总评\\成绩} \\

\hline
\multirow{2}*{分值}
& \multirow{2}*{\zihao{4}#1}
& \multirow{2}*{\zihao{4}#2}
& \multirow{2}*{\zihao{4}#3}
& \multirow{2}*{\zihao{4}#4}
& \multirow{2}*{\zihao{4}#5} \\

~ & ~ & ~ & ~ & ~ & ~ \\
\hline
\end{tabularx}
\end{table}
}

% `design` commands
\DeclareDocumentCommand{\designproposaleval}{O{~} O{~}}
{
\begin{flushright}
\begin{tabular}{| >{\zihao{4}}c | >{\zihao{5}}c | >{\zihao{5}}c |}
\begin{tabular}{| >{\fangsong \zihao{4}}c
| >{\fangsong \zihao{5}}c
| >{\fangsong \zihao{5}}c |}
\hline
\multirow{2}*{成绩比例} & 开题报告 & 外文翻译 \\
~ & (15\%) & (5\%) \\
\multirow{2}*{成绩比例}
& 开题报告
& 外文翻译 \\

~
& (15\%
& (5\%) \\

\hline
\multirow{2}*{分值} & \multirow{2}*{\zihao{4}#1} & \multirow{2}*{\zihao{4}#2} \\
~ & ~ & ~ \\

\multirow{2}*{分值}
& \multirow{2}*{\zihao{4}#1}
& \multirow{2}*{\zihao{4}#2} \\

~
& ~
& ~ \\
\hline
\end{tabular}
\end{flushright}
Expand All @@ -65,13 +111,22 @@
\DeclareDocumentCommand{\designmidcheckeval}{O{~}}
{
\begin{flushright}
\begin{tabular}{| >{\zihao{4}}c | >{\zihao{5}}c |}
\begin{tabular}{| >{\fangsong \zihao{4}}c
| >{\fangsong \zihao{5}}c |}
\hline
\multirow{2}*{成绩比例} & 中期报告 \\
~ & (10\%) \\
\multirow{2}*{成绩比例}
& 中期报告 \\

~
& (10\%) \\

\hline
\multirow{2}*{分值} & \multirow{2}*{\zihao{4}#1} \\
~ & ~ \\

\multirow{2}*{分值}
& \multirow{2}*{\zihao{4}#1} \\

~
& ~ \\
\hline
\end{tabular}
\end{flushright}
Expand All @@ -81,36 +136,33 @@
\DeclareDocumentCommand{\thesisproposaleval}{O{~} O{~} O{~}}
{
\begin{flushright}
\begin{tabular}{| >{\zihao{4}}c | >{\zihao{5}}c | >{\zihao{5}}c | >{\zihao{5}}c |}
\hline
\multirow{2}*{成绩比例} & 文献综述 & 开题报告 & 外文翻译 \\
~ & (10\%) & (15\%) & (5\%) \\
\hline
\multirow{2}*{分值} & \multirow{2}*{\zihao{4}#1} & \multirow{2}*{\zihao{4}#2} & \multirow{2}*{\zihao{4}#3} \\
~ & ~ & ~ & ~ \\
\begin{tabular}{| >{\fangsong \zihao{4}}c
| >{\fangsong \zihao{5}}c
| >{\fangsong \zihao{5}}c
| >{\fangsong \zihao{5}}c |}
\hline
\end{tabular}
\end{flushright}
}
\multirow{2}*{成绩比例}
& 文献综述
& 开题报告
& 外文翻译 \\

% final report commands
~
& (10\%
& (15\%
& (5\%) \\

\DeclareDocumentCommand{\finaleval}{O{~} O{~} O{~} O{~} O{~}}
{
\begin{table}[H]
\centering \bfseries
\begin{tabularx}{\textwidth}{|>{\fangsong}c
|>{\fangsong}X<{\centering}
|>{\fangsong}X<{\centering}
|>{\fangsong}X<{\centering}
|>{\fangsong}X<{\centering}
|>{\fangsong}c|}
\hline
\makecell{成绩\\比例} & \makecell{ \ifthenelse{\equal{\Type}{thesis}}{文献综述}{中期报告} \\(10\%)}& \makecell{开题报告\\(15\%)} & \makecell{外文翻译\\(5\%)} & 毕业论文(设计)质量及答辩(70\%) & \makecell{总评\\成绩} \\
\hline
\multirow{2}*{分值} & \multirow{2}*{\zihao{4}#1} & \multirow{2}*{\zihao{4}#2} & \multirow{2}*{\zihao{4}#3} & \multirow{2}*{\zihao{4}#4} & \multirow{2}*{\zihao{4}#5} \\
~ & ~ & ~ & ~ & ~ & ~ \\

\multirow{2}*{分值}
& \multirow{2}*{\zihao{4}#1}
& \multirow{2}*{\zihao{4}#2}
& \multirow{2}*{\zihao{4}#3} \\

~
& ~
& ~
& ~ \\
\hline
\end{tabularx}
\end{table}
\end{tabular}
\end{flushright}
}
6 changes: 0 additions & 6 deletions config/config.tex

This file was deleted.

2 changes: 1 addition & 1 deletion config/format/format.tex
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
\input{config/format/general/format}
\input{config/format/major/cs/format}
\input{config/format/major/\MajorFormat/format}
6 changes: 5 additions & 1 deletion config/format/general/heading.tex
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
% ctex style settings
\ctexset
{
part =
{
format=\centering\zihao{-0}\bfseries,
nameformat=\centering\heiti\fontsize{48}{48}\bfseries,
},
chapter =
{
format=\centering\zihao{3}\bfseries,
pagestyle=empty,
name={,、},
aftername=,
number=\chinese{chapter},
Expand Down
3 changes: 3 additions & 0 deletions config/format/general/numbering.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

\counterwithin*{figure}{section}
\renewcommand{\thefigure}{\thesection.\arabic{figure}}

\counterwithin*{table}{section}
\renewcommand{\thetable}{\thesection.\arabic{table}}

\AtBeginDocument{\counterwithin*{lstlisting}{section}}
\AtBeginDocument{\renewcommand{\thelstlisting}{\thesection.\arabic{lstlisting}}}

\counterwithin*{equation}{section}
\renewcommand{\theequation}{\thesection-\arabic{equation}}
17 changes: 0 additions & 17 deletions config/info.tex

This file was deleted.

2 changes: 1 addition & 1 deletion config/version.tex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
\newcommand{\zjuthesisversion}{1.2.6}
\newcommand{\zjuthesisversion}{2.0.0}
38 changes: 38 additions & 0 deletions config/zjuthesis.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{zjuthesis}
[Zhejiang University Thesis and Design Template, Zixuan Wang [email protected]]

\RequirePackage{kvoptions}

\SetupKeyvalOptions{
family=zjuthesis,
prefix=
}
\DeclareStringOption{StudentName}
\DeclareStringOption{StudentID}
\DeclareStringOption{AdvisorName}
\DeclareStringOption{Grade}
\DeclareStringOption{Major}
\DeclareStringOption{Department}
\DeclareStringOption{Title}
\DeclareStringOption{SubmitDate}
\DeclareStringOption[cs]{MajorFormat}
\DeclareStringOption[thesis]{Type}
\DeclareStringOption[proposal]{Period}
\DeclareStringOption[false]{BlindReview}

\ProcessKeyvalOptions*

\PassOptionsToPackage{AutoFakeBold}{xeCJK}
\LoadClass[
zihao=-4,
heading=true,
UTF8,
twoside
]{ctexrep}

\input{config/packages}
\input{config/path}
\input{config/format/format}
\input{config/commands}
\input{config/version}
6 changes: 3 additions & 3 deletions content/final/body/body.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ \subsubsection{小节标题}

\par\autoref{fig:a-figure}所示,这是一张由TIKZ\autocite{tikz}包画出的图片,我们也可以用includegraphics来插入现有的jpg等格式的图片,如\autoref{fig:zju-logo}。

\begin{figure}[!h]
\begin{figure}[ht]
\centering
\begin{tikzpicture}[thick,help lines/.style={thin,draw=black!50}]
\def\A{\textcolor{input}{$A$}} \def\B{\textcolor{input}{$B$}}
Expand Down Expand Up @@ -41,15 +41,15 @@ \subsubsection{小节标题}
\caption{\label{fig:a-figure}这是一张图片}
\end{figure}

\begin{figure}[!h]
\begin{figure}[ht]
\centering
\includegraphics[width=.4\linewidth]{logo/zju}
\caption{\label{fig:zju-logo}浙江大学LOGO}
\end{figure}

\par\autoref{tab:sample}所示,这是一张自动调节列宽的表格。

\begin{table}[!h]
\begin{table}[ht]
\caption{\label{tab:sample}自动调节列宽的表格}
\begin{tabularx}{\linewidth}{c|X<{\centering}}
\hline
Expand Down
1 change: 1 addition & 0 deletions content/final/content.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
\cleardoublestylepage{empty}
\thispagestyle{common}
\pagestyle{common}
\setcounter{page}{1}

\input{content/final/introduction/introduction}
Expand Down
3 changes: 2 additions & 1 deletion content/proposal/content.tex
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
% Contents
\cleardoublestylepage{empty}
\thispagestyle{common}
\pagestyle{common}
\setcounter{page}{1}

% set as first page if inside `proposal`
% FIXME: set as first page if inside `proposal`
\ifthenelse{\equal{\Period}{proposal}}
{
\setcounter{page}{1}
Expand Down
Binary file modified figure/logo/zjuchar.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions pages/final/post.tex
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
\pagestyle{empty}

\inputpage{final/job}
\inputpage{final/eval}
3 changes: 3 additions & 0 deletions pages/final/previous.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
\cleardoublestylepage{empty}
\pagestyle{previous}

\inputpage{final/promise}
\input{content/final/thanksto}
\input{content/final/abstract}
3 changes: 3 additions & 0 deletions pages/proposal/design/post.tex
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
\cleardoublestylepage{empty}
\pagestyle{empty}

\input{pages/proposal/design/proposaleval}
\input{pages/proposal/design/midcheckeval}
3 changes: 0 additions & 3 deletions pages/proposal/design/previous.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
\cleardoublestylepage{empty}
\thispagestyle{empty}

{
\setlength{\parindent}{0em}
\par {\zihao{4}\bfseries 一、题目:\uline{\hfill \Title \hfill}}
Expand Down
10 changes: 10 additions & 0 deletions pages/proposal/post.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
\cleardoublestylepage{empty}
\thispagestyle{empty}

\ifthenelse{\equal{\Type}{design}}
{
\inputpage{proposal/design/post}
}
{
\inputpage{proposal/thesis/post}
}
10 changes: 10 additions & 0 deletions pages/proposal/previous.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
\cleardoublestylepage{empty}
\thispagestyle{empty}

\ifthenelse{\equal{\Type}{design}}
{
\inputpage{proposal/design/previous}
}
{
\inputpage{proposal/thesis/previous}
}
3 changes: 3 additions & 0 deletions pages/proposal/thesis/post.tex
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
\cleardoublestylepage{empty}
\pagestyle{empty}

\input{pages/proposal/thesis/proposaleval}
Loading

0 comments on commit 23a4df5

Please sign in to comment.