Skip to content

Commit

Permalink
Merge pull request #17 from nanmu42/DevTools
Browse files Browse the repository at this point in the history
全平台makefile上线
  • Loading branch information
nanmu42 authored Jun 21, 2016
2 parents d0ca584 + 0f3bf27 commit 040d182
Show file tree
Hide file tree
Showing 11 changed files with 335 additions and 1,085 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ cquthesis.Rproj
*.gz(busy)
*.gz
*.equ
*.bat
dtx-style.sty
main.pdf
7 changes: 7 additions & 0 deletions .latexmkrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# vim: set ft=perl:
$clean_ext = '.aux .bbl equ glo gls hd idx ilg ind lof lot out blg log thm toc synctex.gz';
$makeindex = 'makeindex -s gind.ist %O -o %D %S';
add_cus_dep('glo', 'gls', 0, 'makeglo2gls');
sub makeglo2gls {
system("makeindex -s gglo.ist -o \"$_[0].gls\" \"$_[0].glo\"");
}
92 changes: 92 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Makefile for CQUThesis
# Adapted from Thuthesis Makefile

# Compiling method: latexmk/xelatex/pdflatex
METHOD = latexmk
# Set opts for latexmk if you use it
LATEXMKOPTS = -xelatex
# Basename of thesis
THESISMAIN = main


PACKAGE=cquthesis
SOURCES=$(PACKAGE).ins $(PACKAGE).dtx
THESISCONTENTS=$(THESISMAIN).tex contents/*.tex $(FIGURES)
# NOTE: update this to reflect your local file types.
# 注意:下列内容可能需要根据你的实际情况调整
FIGURES=$(wildcard figures/*.eps figures/*.pdf figures/*.jpg figures/*.jpeg figures/*.png)
BIBFILE=ref/refs.bib
SHUJICONTENTS=$(SHUJIMAIN).tex
CLSFILES=dtx-style.sty $(PACKAGE).cls $(PACKAGE).cfg

# make deletion work on Windows
ifdef SystemRoot
RM = del /Q
OPEN = start
else
RM = rm -f
OPEN = open
endif

.PHONY: all clean cls check doc distclean thesis viewthesis viewdoc FORCE_MAKE

all: doc thesis

cls: $(CLSFILES)

doc: $(PACKAGE).pdf

$(CLSFILES): $(SOURCES)
latex $(PACKAGE).ins

viewdoc: doc
$(OPEN) $(PACKAGE).pdf

viewthesis: thesis
$(OPEN) $(THESISMAIN).pdf

thesis: $(THESISMAIN).pdf

ifeq ($(METHOD),latexmk)

$(PACKAGE).pdf: $(CLSFILES)
xelatex $(PACKAGE).dtx
makeindex -s gind.ist -o $(PACKAGE).ind $(PACKAGE).idx
makeindex -s gglo.ist -o $(PACKAGE).gls $(PACKAGE).glo
xelatex $(PACKAGE).dtx
xelatex $(PACKAGE).dtx
xelatex $(PACKAGE).dtx

$(THESISMAIN).pdf: $(CLSFILES)
$(METHOD) $(LATEXMKOPTS) $(THESISMAIN)

else ifneq (,$(filter $(METHOD),xelatex pdflatex))

$(PACKAGE).pdf: $(CLSFILES)
$(METHOD) $(PACKAGE).dtx
makeindex -s gind.ist -o $(PACKAGE).ind $(PACKAGE).idx
makeindex -s gglo.ist -o $(PACKAGE).gls $(PACKAGE).glo
$(METHOD) $(PACKAGE).dtx
$(METHOD) $(PACKAGE).dtx
$(METHOD) $(PACKAGE).dtx

$(THESISMAIN).pdf: $(CLSFILES) $(THESISCONTENTS) $(THESISMAIN).bbl
$(METHOD) $(THESISMAIN)
$(METHOD) $(THESISMAIN)

$(THESISMAIN).bbl: $(BIBFILE)
$(METHOD) $(THESISMAIN)
-bibtex $(THESISMAIN)
$(RM) $(THESISMAIN).pdf

else
$(error Unknown METHOD: $(METHOD))

endif

clean:
latexmk -c $(PACKAGE).dtx $(THESISMAIN)
-@$(RM) *~

cleanall: clean
-@$(RM) $(PACKAGE).pdf $(THESISMAIN).pdf
43 changes: 29 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ CQUThesis根据重庆大学《重庆大学本科设计(论文)撰写规范
* 支持重庆大学本科(文学、理工)、硕士(学术、专业)、博士的毕业论文格式;
* 内置封面、目录、索引、授权书等论文部件,可按需自动生成;
* 自动侦测文档页数,生成相应的单面打印/双面打印PDF文件;
* 预置一批按毕业论文环境优化过的宏包和小功能,包含国际标准单位、化学式支持、三线表等,可按需开启。
* 预置一批按毕业论文环境优化过的宏包和小功能,包含国际标准单位、化学式支持、三线表等,可按需开启;
* 支持基于cwl文件的代码着色和补全,makefile功能能够在Linux, Mac, Windows三平台通用。

![CQUThesis-Poster](https://cloud.githubusercontent.com/assets/8143068/15363773/68c6b380-1d4c-11e6-9627-4d892facb333.png)

Expand All @@ -23,32 +24,46 @@ CQUThesis根据重庆大学《重庆大学本科设计(论文)撰写规范
排版示例和用户文档随版本发布,如果需要单独下载,请参阅后文。

## 部署
为了降低新手使用模板的难度,默认情况下,模板文件`cquthesis.cls`, `cquthesis.cfg`已经先行从`cquthesis.dtx`中提取出来,您无需再执行任何操作。但如果您确实需要(如更新或自己编译用户文档)或者对`cquthesis.dtx`文件感兴趣,您可参阅和本文件同目录的`README-English.md`,内有详情。
CQUThesis的安装十分便利。下载CQUThesis的.zip压缩包后请将整个文件夹解压出来,进入文件夹后:

请编译`main.tex`获得排版示例,如果您对LaTeX比较熟悉,请直接参照排版示例进行部署。其中`图1.1`为CQUThesis文件结构。下面是一些相对详细的提示。
* Windows用户请在文件夹空白处按住Shift键再点击书鼠标右键,选择“在此处打开命令窗口”,运行下列命令:
```
makewin build
```
* Linux 和 Mac 用户请在Bash窗口中进行如下操作:
```
cd cquthesis
make thesis
```

请创建一个新的文件夹作为根目录
即可完成 CQUThesis 的安装和示例文档的编译

必要文件列举如下:
* 模板文件:`cquthesis.cls`, `cquthesis.cfg`, `cquthesis.sty`以及`cqunumberical.bst`,位于根目录;
* 内容文件夹:`contents`, `figures`, `ref`(推荐),都位于根目录;
* `contents`内的必要文件:`ack.tex`, `appendix.tex`, `cover.tex`, `denotation.tex`,将这些文件按文件结构安排至根目录中;
* 最后请将`main.tex`置于根目录,工作即可开始。

## 更新
需要更新时,请从Github下载zip文档后解压,覆盖掉原始的模板文件,使用命令行定位到文件夹,运行:
`latex cquthesis.ins`
即可完成更新。
CQUThesis的升级很方便,下载最新的开发版,将zip文件中的cquthesis.dtx和cquthesis.ins覆盖掉工作文件夹中的相应文件后:

* Windows用户请在文件夹空白处按住Shift键再点击书鼠标右键,选择“在此处打开命令窗口”,运行下列命令:
```
makewin extract
```

* Linux 和 Mac 用户请在 Bash 窗口中进行如下操作:
```
cd cquthesis
make cls
```
即可完成 CQUThesis 的升级。


# 文档
文档 | 描述
--- | ---
排版示例 | 请编译`main.tex`获得
用户文档 | 随模板发布,也可[点我下载](https://github.com/nanmu42/CQUThesis/files/308798/cquthesis.pdf)
用户文档 | 随模板发布,也可[点我下载](https://github.com/nanmu42/CQUThesis/raw/master/cquthesis.pdf)

# 提问和支持
* [Github Issues](https://github.com/nanmu42/CQUThesis/issues)
* 造访重庆大学7117工作室寻求支持
* 造访重庆大学创新实践中心寻求支持

# 用户协议
1. 本模板按照[LaTeX Project Public License](https://latex-project.org/lppl/lppl-1-3.txt)发布,协议版本号为1.3或以后的任何版本(随你意)。本条款不适用于重庆大学LaTeX模板工具箱(CQUThesis Toolkit);
Expand Down
Loading

0 comments on commit 040d182

Please sign in to comment.