Skip to content

Commit

Permalink
0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
weijianwen committed Jan 21, 2016
2 parents 13d28ab + 16296d1 commit 8d5ce2f
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 86 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -18,3 +18,4 @@ README.pdf
*~
*.fdb_latexmk
*.zip
*.gz
5 changes: 3 additions & 2 deletions Makefile
Expand Up @@ -10,7 +10,7 @@ LATEXMK_OPT_PVC = $(LATEXMK_OPT_BASE) -pvc

all: $(THESIS).pdf

.PHONY : all clean pvc validate view wordcount git zip
.PHONY : all clean pvc view wordcount git zip

$(THESIS).pdf : $(THESIS).tex $(TEX_DIR)/*.tex $(BIB_DIR)/*.bib sjtuthesis.cls sjtuthesis.cfg Makefile
-latexmk $(LATEXMK_OPT) $(THESIS)
Expand Down Expand Up @@ -38,7 +38,8 @@ s3 : $(THESIS).pdf
s3cmd put $< s3://sjtuthesis/README.pdf

git :
for tag in "v0.7" "v0.8" "v0.9" "master"; do git co $${tag}; git push gitlab; git push github; git push gitcafe; done
for b in "0.7.x" "0.8.x" "develop" "develop-0.7" "develop-0.8"; do git co $${b}; git push --tags -f -u gitlab $${b}; git push --tags -f -u github $${b}; git push -f -u gitcafe $${b}; done
git co master; git push gitlab master; git push github master; git push gitcafe master

zip :
git archive --format zip --output thesis.zip master
100 changes: 36 additions & 64 deletions README.md
Expand Up @@ -4,88 +4,65 @@ SJTUThesis is an *unofficial* XeLaTeX template for preparing bachelor, master, o

# 上海交通大学学位论文模板

这是为撰写上海交通大学学士、硕士或博士论文而准备的 XeLaTeX 模板,非官方出品。生成的学位论文文件参见 [README.pdf][README]

P.S. 该 README 用于重要的文档更新,其他细节更新正考虑逐步搬移到 [SJTUThesis Wiki](https://github.com/weijianwen/SJTUThesis/wiki), 欢迎贡献你的力量。:-)
这是为撰写上海交通大学学士、硕士或博士论文而准备的 XeLaTeX 模板,非官方出品。生成的学位论文文件参见 [README.pdf][README],详细使用说明参见 [SJTUThesis Wiki](https://github.com/weijianwen/SJTUThesis/wiki),欢迎大家分享使用经验。

## 如何使用

使用方法大致可以分为在线和本地两种,在线编辑基于 ShareLaTeX 网站,下面分两种情况做详细说明。

### 在线编译 - ShareLaTeX

TeX 本地编译大家可能比较熟悉,但偶尔也会由于各种各样的原因导致你不能顺畅地在本地使用该模板写论文,这个时候不妨考虑下在 ShareLaTeX 上在线编辑,不受系统的影响,**无需本地安装 TeX 发行版**以及其他字体适配等工作。只要有一个稍微现代一点的浏览器如 Firefox, Chrome/Chromium 就行了。缺点是由于服务器在国外,访问起来不是很快,第一次编译可能会稍慢,这可能与 ShareLaTeX 后端的缓存策略有关。

模板地址 ==> [SJTUThesis Template - ShareLaTeX](https://www.sharelatex.com/templates/566ea0fb08f4ac510fbc6b9e).

如果直接从以上模板新建时显示『500 internal server error』的话说明 ShareLaTeX 的从模板新建的功能挂掉了,且登陆后出现的项目是错误的,务必及时删除。改从 [这里](https://www.sharelatex.com/project/56701ac8d63cd1d9646a622f) 以复制的形式新建你自己的项目。左侧菜单(Menu) -> Copy Project 即导入到自己的项目中。

其他详细截屏教程见 [Usage - 使用文档](https://github.com/weijianwen/SJTUThesis/wiki/Usage)
SJTUThesis可以在本地编译,也可以在线编译。

### 本地编译 - 系统需求

#### TeX 发行版

支持 XeTeX 的**完整** TeX 发行版。2013/2014/2015年的 [TeXLive](https://www.tug.org/texlive/)[MacTeX](https://www.tug.org/mactex/) 发行版都能编译此模板。据不完全统计,Windows 下的 CTeX(2.9.2) 也能顺利编译此模板。

以 TexLive/MacTeX 为例,根据你使用的发行版和宏包版本,你需要使用以下不同的分支:

- 2015 年的发行版:使用 [master(v0.9)](https://github.com/weijianwen/SJTUThesis/tree/master) 分支。
- 2014 年的发行版:建议使用 [v0.8](https://github.com/weijianwen/SJTUThesis/tree/v0.8) 分支。
- 2013 年的发行版:建议使用 [v0.7](https://github.com/weijianwen/SJTUThesis/tree/v0.7) 分支。

**Windows用户**请使用 [Babun](http://babun.github.io/) 作为命令行终端。Babun 已默认安装有这些工具:git(版本控制)、GNUmake(编译控制)、perl(字数统计)。
SJTUThesis 需要使用 XeTeX 引擎编译。2014和2015年的 [TeXLive](https://www.tug.org/texlive/)[MacTeX](https://www.tug.org/mactex/) 发行版都能编译此模板。Windows 下的 CTeX(2.9.2) 也能顺利编译此模板。**Windows用户**推荐使用 [Babun](http://babun.github.io/) 作为命令行终端。Babun 已默认安装有这些工具:git(版本控制)、GNUmake(编译控制)、perl(字数统计)。

#### 字体

中英文分别依赖 Adobe 的四套简体中文字体和 TeX Gyre Termes 西文字体。Adobe 的四套字体可以从 [GitCafe](https://gitcafe.com/billryan/resume/tree/zh_CN/fonts/zh_CN-Adobe) 或者 [GitHub](https://github.com/billryan/resume/tree/zh_CN/fonts/zh_CN-Adobe) 处下载。Tex Gyre Termes 则可以从 [CTAN](http://www.ctan.org/tex-archive/fonts/tex-gyre/fonts/opentype/public/tex-gyre) 中下载,共有 regular, bold, bolditalic, italic 四种不同的字型需要下载,四种字型的打包下载见 [这里](http://7xojrx.com1.z0.glb.clouddn.com/docs/TeX-Gyre-Termes.zip)。字体的安装双击即可,Linux 下可能需要刷新下字体缓存。
中英文分别依赖 Adobe 的四套简体中文字体和 TeX Gyre Termes 西文字体。Tex Gyre Termes 可从 [CTAN](http://www.ctan.org/tex-archive/fonts/tex-gyre/fonts/opentype/public/tex-gyre) 下载四种不同字型。出于版权考虑,需要大家自行解决 AdobeSongStd, AdobeKaitiStd, AdobeHeitiStd, AdobeFangsongStd 四款中文字体的授权问题。

### 在线编译 - ShareLaTeX

对中文字体的一点说明:Windows 下如果使用 Word 进行排版的话,中文衬线字体使用的一般是俗称「宋体」的「中易宋体」。实际上对于印刷体来说,Adobe 家的四款中文字体 AdobeSongStd, AdobeKaitiStd, AdobeHeitiStd, AdobeFangsongStd 效果更好,因此在绝大多数高校学位论文模板中默认使用这四套中文字体编译生成 PDF
[ShareLaTeX](https://www.sharelatex.com/) 是一个优秀的 LaTeX 在线编译站点,可以完成 SJTUThesis 0.8.1 版本的编译。在[SJTUThesis-0.8](https://www.sharelatex.com/project/56701ac8d63cd1d9646a622f)页面将该项目复制到自己的列表中,就可以开始在模版上工作了。更详细的使用说明,请参考[Usage - 使用文档](https://github.com/weijianwen/SJTUThesis/wiki/Usage)

### 获取模板

根据「系统需求」中情形选择适合你系统情况的分支,然后根据情况选择 git 克隆或者下载 GitHub 上的压缩包。尽管下载压缩包的方式简单粗暴,但为了能使用模板的最新功能,还是大力推荐终端中克隆的方式。不熟悉命令行没有关系,下文将详述方法
根据「系统需求」中情形选择适合你系统情况的分支,然后根据情况选择 git 克隆最新版代码或者下载稳定版压缩包

#### 终端中克隆
#### 终端中克隆最新版

打开终端,OS X 用户需要在 spotlight 中搜索`terminal`, Windows 用户则使用前文推荐的 Babun. 在终端下按如下步骤操作。
友情提示:Windows 下的 Babun 默认使用鼠标右键作为终端中的粘贴功能。

```bash
cd
git clone https://github.com/weijianwen/SJTUThesis.git
```
cd
git clone https://github.com/weijianwen/SJTUThesis.git

如果之前有克隆过此模板但是想与 GitHub 上的最新版本同步,以`master`分支为例,执行以下命令更新到最新版。
```
git pull origin master
```

git pull origin master

若是自己 fork 后克隆下来的,则执行以下命令。
```
git pull upstream master
```

#### 压缩包下载

- 2015 年的发行版:使用 [master(v0.9)](https://github.com/weijianwen/SJTUThesis/archive/master.zip) 分支。
- 2014 年的发行版:建议使用 [v0.8](https://github.com/weijianwen/SJTUThesis/archive/v0.8.zip) 分支。
- 2013 年的发行版:建议使用 [v0.7](https://github.com/weijianwen/SJTUThesis/archive/v0.7.zip) 分支。
SJTUThesis提供了多个稳定版供您使用,这些版本的输出结果具有相近的外观,但依赖不同的TeXLive发行版和参考文献处理程序。

### 编译模板
| TeXLive发行版 | 参考文献处理程序 | SJTUThesis版本 |
|---------------|------------------------------|----------------|
| 2015 | biber+biblatex+caspervector | [0.9.1][0.9.1] |
| 2015 | bibtex+GBT7714-2005NLang.bst | [0.7.5][0.7.5] |
| 2014 | biber+biblatex+caspervector | [0.8.5][0.8.5] |
| 2013 | bibtex+GBT7714-2005NLang.bst | [0.7.1][0.7.1] |

编译模板,生成学位论文PDF文件。GNUMake将调用`latexmk`程序,自动完成模板的多轮编译。平时写论文时推荐使用`make pvc`达到「持续集成」——持续监听文件改动,用户无需操心后台编译的问题,编译好后会自动打开 PDF 文档,这个特性在没定稿之前非常方便!由于 CTeX 下的 Miktex `texify/latexmk` 有可能有问题,故还是推荐 Windows 用户使用 TeXLive 发行版试试看。终端下执行以下命令即可。
### 编译模板

```
make pvc
```
编译模板,生成学位论文PDF文件。GNUMake将调用`latexmk`程序,自动完成模板的多轮编译。

由于`latexmk -pvc`使用系统默认的 PDF 阅读器打开编译好的 PDF,且默认不能自动更新 PDF 中的内容。你可以对这一行为进行定制,从而可使用能自动更新 PDF 的阅读器来预览学位论文,通过这种「曲线救国」的方式勉强可以达到「所见即所得」的效果。论文根目录下的`latexmkrc`中已经写好了 OS X 下使用 Skim 来预览 PDF 的配置文件(默认不启用)。其他如 Linux 和 Windows 系统可以参考`latexmk`的手册或是搜索下网路上其他人给出的配置文件进行测试。
make pvc

如果最终定稿,则使用以下命令编译
定稿后可使用以下命令生成最终版本

```
$ make clean thesis.pdf
```
make clean thesis.pdf

若需要生成用于提交盲审的论文(隐去作者、导师等信息),可在`thesis.tex`中为`sjtuthesis`文档类添加`review`选项。 若需要生成包含“原创性声明扫描件”和“授权书”签名扫描件的学位论文,请将扫描件分别保存为`pdf/origignal.pdf``pdf/authorization.pdf`,然后添加`submit`选项重新编译模板。

Expand All @@ -95,20 +72,17 @@ $ make clean thesis.pdf

### 字数统计

```
make wordcount
```
make wordcount

### 问题诊断

编译失败时,可以尝试手动逐次编译。
结合文档 [README.pdf][README] 中的说明,有助于定位故障。
```
$ xelatex -no-pdf thesis
$ biber --debug thesis
$ xelatex thesis
$ xelatex thesis
```

xelatex -no-pdf thesis
biber --debug thesis
xelatex thesis
xelatex thesis

## 反馈问题

Expand All @@ -122,14 +96,12 @@ $ xelatex thesis
* 精简代码;
* 改进开章页设计;

## 所有版本

* [v 0.9](https://github.com/weijianwen/SJTUThesis/tree/v0.9): 当前master分支,适配ctex 2.x宏包,需要使用2015年的TeX发行版,无法使用更早的发行版编译。
* [v 0.8](https://github.com/weijianwen/SJTUThesis/tree/v0.8):使用biber/biblatex处理参考文献,需要使用2014的TeX发行版,无法使用2013年和2015年的TeX发行版编译。
* [v 0.7](https://github.com/weijianwen/SJTUThesis/tree/v0.7):使用bibex处理参考文献(会产生错误信息,可忽略),需要使用2013或2014年的TeX发行版,无法使用2015年的TeX发行版编译。

## 软件许可证

上海交通大学校徽图片(`sjtulog.png`)和横幅图片(`sjtubanner.png`)的版权归原作者所有。其他部分使用 [Apache License 2.0](LICENSE) 授权。

[README]: https://s3.amazonaws.com/sjtuthesis/README.pdf
[0.9.1]: https://github.com/weijianwen/SJTUThesis/releases/tag/0.9.1
[0.8.5]: https://github.com/weijianwen/SJTUThesis/releases/tag/0.8.5
[0.7.5]: https://github.com/weijianwen/SJTUThesis/releases/tag/0.7.5
[0.7.1]: https://github.com/weijianwen/SJTUThesis/releases/tag/0.7.1
28 changes: 28 additions & 0 deletions figure/example/flow_chart.tex
@@ -0,0 +1,28 @@
\begin{tikzpicture}[node distance=2cm]
\node (pic) [startstop] {待测图片};
\node (bg) [io, below of=pic] {读取背景};
\node (pair) [process, below of=bg] {匹配特征点对};
\node (threshold) [decision, below of=pair, yshift=-0.5cm] {多于阈值};
\node (clear) [decision, right of=threshold, xshift=3cm] {清晰?};
\node (capture) [process, right of=pair, xshift=3cm, yshift=0.5cm] {重采};
\node (matrix_p) [process, below of=threshold, yshift=-0.8cm] {透视变换矩阵};
\node (matrix_a) [process, right of=matrix_p, xshift=3cm] {仿射变换矩阵};
\node (reg) [process, below of=matrix_p] {图像修正};
\node (return) [startstop, below of=reg] {配准结果};

%连接具体形状
\draw [arrow](pic) -- (bg);
\draw [arrow](bg) -- (pair);
\draw [arrow](pair) -- (threshold);

\draw [arrow](threshold) -- node[anchor=south] {否} (clear);

\draw [arrow](clear) -- node[anchor=west] {否} (capture);
\draw [arrow](capture) |- (pic);
\draw [arrow](clear) -- node[anchor=west] {是} (matrix_a);
\draw [arrow](matrix_a) |- (reg);

\draw [arrow](threshold) -- node[anchor=east] {是} (matrix_p);
\draw [arrow](matrix_p) -- (reg);
\draw [arrow](reg) -- (return);
\end{tikzpicture}
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
8 changes: 4 additions & 4 deletions sjtuthesis.cfg
Expand Up @@ -32,23 +32,23 @@
\def\sjtu@value@serialnumber{}
\def\sjtu@value@school{}
\ifsjtu@bachelor
\def\sjtu@value@degree{学士}
\def\sjtu@value@chinesedegree{学士}
\def\sjtu@value@englishdegree{Bachelor}
\else
\ifsjtu@master
\def\sjtu@value@degree{硕士}
\def\sjtu@value@chinesedegree{硕士}
\def\sjtu@value@englishdegree{Master}
\else
\ifsjtu@doctor
\def\sjtu@value@degree{博士}
\def\sjtu@value@chinesedegree{博士}
\def\sjtu@value@englishdegree{Doctor}
\else
\ClassError{sjtuthesis}%
{Unknown value for degree.}{}
\fi
\fi
\fi
\def\sjtu@label@statement{申请\sjtu@value@school\sjtu@value@degree\sjtu@label@thesis}
\def\sjtu@label@statement{申请\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}

% 论文原创性声明
\def\sjtu@label@original{学位论文原创性声明}
Expand Down
23 changes: 18 additions & 5 deletions sjtuthesis.cls
Expand Up @@ -72,6 +72,9 @@
\RequirePackage{pdfpages}
\RequirePackage{calc}
\RequirePackage{algorithm, algorithmic}
\RequirePackage{siunitx}
\RequirePackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}

%==========
% Segment 2. Define general-purpose LaTeX commands.
Expand Down Expand Up @@ -181,6 +184,16 @@
\renewcommand{\thetable}{\arabic{chapter}--\arabic{table}}
\renewcommand{\thealgorithm}{\arabic{chapter}--\arabic{algorithm}}

% 列表右缩进
\setlist[description]{leftmargin=\parindent,labelindent=\parindent}

% 流程图定义基本形状
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=2cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{io} = [trapezium, trapezium left angle=75, trapezium right angle=105, minimum width=1cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{process} = [rectangle, minimum width=2cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{decision} = [diamond, minimum width=2cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{arrow} = [thick,->,>=stealth]

% Setting Package listings/lstlistings
\lstset{tabsize=4, %
frame=shadowbox, %把代码用带有阴影的框圈起来
Expand Down Expand Up @@ -269,7 +282,7 @@
\newcommand\studentnumber[1]{\def\sjtu@value@studentnumber{#1}}
\newcommand\confidential[1]{\def\sjtu@value@confidential{#1}}
\newcommand\school[1]{\def\sjtu@value@school{#1}}
\newcommand\degree[1]{\def\sjtu@value@degree{#1}}
\newcommand\chinesedegree[1]{\def\sjtu@value@chinesedegree{#1}}
\renewcommand\title[2][\sjtu@value@title]{%
\def\sjtu@value@title{#2}
\def\sjtu@value@titlemark{\MakeUppercase{#1}}}
Expand Down Expand Up @@ -421,7 +434,7 @@
\if@twoside
%% 正文页眉页脚
\fancypagestyle{main}{
\fancyhead[LO, RE]{\small\kaishu\sjtu@value@school\sjtu@value@degree\sjtu@label@thesis}
\fancyhead[LO, RE]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[RO]{\nouppercase{\small\kaishu\leftmark}}
\fancyhead[LE]{\nouppercase{\small\kaishu\sjtu@value@titlemark}}
\fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
Expand All @@ -430,7 +443,7 @@
%% 开章页页眉页脚
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[LO,RE]{\nouppercase{\small\kaishu\sjtu@value@school\sjtu@value@degree\sjtu@label@thesis}}
\fancyhead[LO,RE]{\nouppercase{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}}
\fancyhead[RO]{\nouppercase{\small\kaishu\leftmark}}
\fancyhead[LE]{\nouppercase{\small\kaishu\sjtu@value@titlemark}}
\fancyfoot[C]{\small ---~{\bf\thepage}~---}
Expand All @@ -439,14 +452,14 @@
\else
%% 正文页
\fancypagestyle{main}{
\fancyhead[L]{\small\kaishu\sjtu@value@school\sjtu@value@degree\sjtu@label@thesis}
\fancyhead[L]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[R]{\nouppercase{\small\kaishu\leftmark}}
\fancyfoot[C]{\small ---~{\bf\thepage}~---}
\renewcommand{\headheight}{32pt}
}
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[L]{\nouppercase{\small\kaishu\sjtu@value@school\sjtu@value@degree\sjtu@label@thesis}}
\fancyhead[L]{\nouppercase{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}}
\fancyhead[R]{\nouppercase{\small\kaishu\leftmark}}
% \fancyhead[L]{\small {\it\sjtu@value@titlemark}}
\fancyfoot[C]{\small ---~{\bf\thepage}~---}
Expand Down

0 comments on commit 8d5ce2f

Please sign in to comment.