Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] 分离学位论文的使用文档和示例文档,准备提交到CTAN #47

Merged
merged 2 commits into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ acs-*.bib
*.gaux
*.gtex

# hypdoc
*.hd

# hyperref
*.brf

Expand Down Expand Up @@ -247,6 +250,5 @@ ehthumbs_vista.db
[Dd]esktop.ini

# Project specific
sjtuthesis.pdf
thesis.pdf
thesis-bot.yml
12 changes: 11 additions & 1 deletion .latexmkrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,15 @@ $pdf_mode = 5;
# $biber = 'biber -l zh__pinyin %O %S';
# $biber = 'biber -l zh__stroke %O %S';

# Process index.
$makeindex = 'makeindex -s gind.ist %O -o %D %S';

# Process glossary (change history).
add_cus_dep('glo', 'gls', 0, 'makeglo2gls');
sub makeglo2gls {
system("makeindex -s gglo.ist -o \"$_[0].gls\" \"$_[0].glo\"");
}
push @generated_exts, "glo", "gls";

# Files to clean.
$clean_ext = 'bbl loa run.xml xdv';
$clean_ext = 'bbl hd loa run.xml thm xdv';
617 changes: 416 additions & 201 deletions LICENSE

Large diffs are not rendered by default.

65 changes: 40 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,54 @@
# Makefile for SJTUThesis

# Basename of thesis
THESIS = thesis
# TEX, BIB, TEST dir
TEX_DIR = tex
BIB_DIR = bib
PACKAGE = sjtuthesis
CLSFILES = $(PACKAGE).cls $(PACKAGE)-bachelor.ltx $(PACKAGE)-graduate.ltx

# Option for latexmk
LATEXMK_OPT_BASE = -xelatex -gg -silent
LATEXMK_OPT = $(LATEXMK_OPT_BASE) -f
LATEXMK_OPT = -xelatex -silent -file-line-error -halt-on-error -interaction=nonstopmode
LATEXMK_OPT_PVC = $(LATEXMK_OPT_BASE) -pvc

all: $(THESIS).pdf
# make deletion work on Windows
ifdef SystemRoot
RM = del /Q
OPEN = start
else
RM = rm -f
OPEN = open
endif

.PHONY : all cls doc pvc validate view viewdoc wordcount cleana cleanall FORCE_MAKE

all : $(THESIS).pdf

cls : $(CLSFILES)

$(CLSFILES) : $(PACKAGE).dtx
xetex --interaction=batchmode $<

.PHONY : all cleanall pvc view wordcount git zip
doc : $(PACKAGE).pdf

$(THESIS).pdf : $(THESIS).tex $(TEX_DIR)/*.tex $(BIB_DIR)/*.bib sjtuthesis.cls sjtuthesis.cfg Makefile
-latexmk $(LATEXMK_OPT) $(THESIS)
$(PACKAGE).pdf : $(PACKAGE).dtx FORCE_MAKE
latexmk $(LATEXMKOPTS) $<

pvc :
$(THESIS).pdf : $(THESIS).tex $(CLSFILES) FORCE_MAKE
latexmk $(LATEXMKOPTS) $<

pvc : $(THESIS).tex $(CLSFILES)
latexmk $(LATEXMK_OPT_PVC) $(THESIS)

validate :
validate : $(THESIS).tex $(CLSFILES)
xelatex -no-pdf -halt-on-error $(THESIS)
biber --debug $(THESIS)

view : $(THESIS).pdf
open $<
$(OPEN) $<

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

wordcount: $(THESIS).tex
wordcount : $(THESIS).tex
@if grep -v ^% $< | grep -qz '\\documentclass\[[^\[]*english'; then \
texcount $< -inc -char-only | awk '/total/ {getline; print "英文字符数\t\t\t:",$$4}'; \
else \
Expand All @@ -34,19 +57,11 @@ wordcount: $(THESIS).tex
@texcount $< -inc -chinese | awk '/total/ {getline; print "总字数(英文单词 + 中文字)\t:",$$4}'

clean :
-@latexmk -c -silent 2> /dev/null
-@latexmk -c -silent $(THESIS).tex 2> /dev/null
-@latexmk -c -silent $(PACKAGE).dtx 2> /dev/null
-@rm -f $(TEX_DIR)/*.aux 2> /dev/null || true

cleanall :
-@latexmk -C -silent 2> /dev/null
-@latexmk -C -silent $(THESIS).tex 2> /dev/null
-@latexmk -C -silent $(PACKAGE).dtx 2> /dev/null
-@rm -f $(TEX_DIR)/*.aux 2> /dev/null || true

s3 : $(THESIS).pdf
s3cmd put $< s3://sjtuthesis/README.pdf

git :
git push --tags github; git push github;
git push --tags gitlab; git push gitlab;

zip :
git archive --format zip --output thesis.zip master
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,15 @@
[![GitHub Release Date](https://img.shields.io/github/release-date/sjtug/SJTUThesis.svg)](https://github.com/sjtug/SJTUThesis/releases)
[![Join the chat at https://gitter.im/sjtug/SJTUThesis](https://badges.gitter.im/sjtug/SJTUThesis.svg)](https://gitter.im/sjtug/SJTUThesis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

这是为撰写上海交通大学学士、硕士、博士学位论文或课程论文而准备的 XeLaTeX 模板,非官方出品。生成的学位论文文件参见 [README.pdf][README],详细使用说明参见 [SJTUThesis Wiki](https://github.com/sjtug/SJTUThesis/wiki)。
这是为撰写上海交通大学学士、硕士、博士学位论文或课程论文而准备的 XeLaTeX 模板,非官方出品。使用文档参见 [sjtuthesis.pdf](./docs/sjtuthesis.pdf),详细使用说明参见 [SJTUThesis Wiki](https://github.com/sjtug/SJTUThesis/wiki)。

## 封面展示

<div align="center">
<a href="http://sjtug.org/SJTUThesis/bachelor.pdf"><img src="./docs/images/bachelor.png" height="330"></a>
<a href="http://sjtug.org/SJTUThesis/coursepaper.pdf"><img src="./docs/images/coursepaper.png" height="330"></a>
<a href="./docs/bachelor.pdf"><img src="./docs/images/bachelor.png" height="300"></a>
<a href="./docs/master.pdf"><img src="./docs/images/master.png" height="300"></a>
</div>

<div align="center">
<a href="http://sjtug.org/SJTUThesis/master.pdf"><img src="./docs/images/master.png" height="305"></a>
<a href="http://sjtug.org/SJTUThesis/doctor.pdf"><img src="./docs/images/doctor.png" height="305"></a>
</div>


## 如何使用

SJTUThesis 共有三种编译方式支持:
Expand Down Expand Up @@ -124,7 +118,6 @@ SJTUThesis 是一个由诸多感兴趣的同学一起维护的开源项目,我

## 软件许可证

上海交通大学校徽图片(`sjtulogo.pdf` 等)的版权归上海交通大学所有。其他部分使用 [Apache License 2.0](LICENSE) 授权。
上海交通大学校徽图片(`sjtulogo.pdf` 等)的版权归上海交通大学所有。

[README]: http://sjtug.org/SJTUThesis/README.pdf
[0.9.5]: https://github.com/sjtug/SJTUThesis/releases/tag/0.9.5
其他部分使用 [LPPL](LICENSE) 授权。
12 changes: 3 additions & 9 deletions README_en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,7 @@ We are hearing from:

## License

The copyright of image sources including SJTU badge (`sjtulog.png`) and
banner (`sjtubanner.png`) belongs to the original owner.
The copyright of image sources including SJTU logo (`sjtulogo.pdf` etc.)
belongs to Shanghai Jiao Tong University.

The remain part is under [Apache License 2.0](LICENSE)

[README]: https://s3.amazonaws.com/sjtuthesis/README.pdf
[0.9.3]: https://github.com/sjtug/SJTUThesis/releases/tag/0.9.3
[0.8.7]: https://github.com/sjtug/SJTUThesis/releases/tag/0.8.7
[0.7.7]: https://github.com/sjtug/SJTUThesis/releases/tag/0.7.7
[0.7.1]: https://github.com/sjtug/SJTUThesis/releases/tag/0.7.1
The remain part is under [LPPL](LICENSE)
Binary file removed docs/README.pdf
Binary file not shown.
Binary file modified docs/bachelor.pdf
Binary file not shown.
Binary file removed docs/coursepaper.pdf
Binary file not shown.
Binary file removed docs/doctor.pdf
Binary file not shown.
Binary file modified docs/images/bachelor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/coursepaper.png
Binary file not shown.
Binary file removed docs/images/doctor.png
Binary file not shown.
Binary file modified docs/images/master.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/master.pdf
Binary file not shown.
Binary file added docs/sjtuthesis.pdf
Binary file not shown.
195 changes: 195 additions & 0 deletions sjtuthesis-bachelor.ltx
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
%%
%% This is file `sjtuthesis-bachelor.ltx',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% sjtuthesis.dtx (with options: `bachelor')
%%
%% Copyright (C) 2009-2017 by weijianwen <[email protected]>
%% (C) 2018-2019 by SJTUG
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This file has the LPPL maintenance status "maintained".
%%
%% The Current Maintainer of this work is Alexara Wu.
%%
\ProvidesFile{sjtuthesis-bachelor.ltx}
[2019/06/16 1.0.0rc Shanghai Jiao Tong University Thesis Template]
\ifsjtu@course
\sjtu@def@label{degreetypeChi}{}
\sjtu@def@label{degreetypeEng}{}
\else
\sjtu@def@label{degreetypeChi}{学士}
\sjtu@def@label{degreetypeEng}{Bachelor}
\fi
\sjtu@def@label{authorChi}{学生姓名}
\sjtu@def@label{studentidChi}{学生学号}
\sjtu@def@label{supervisorChi}{指导教师}
\sjtu@def@label{coursenameChi}{课程名称}
\sjtu@def@label{majorChi}{专业}
\sjtu@def@label{departmentChi}{学院(系)}
\ifsjtu@course
\sjtu@def@label{thesiscat}{课程论文}
\def\sjtu@label@thesistype{\sjtu@label@thesiscat}
\sjtu@def@label{subjectChi}{\sjtu@label@thesiscat}
\sjtu@def@label{subjectEng}{Course Paper}
\else
\sjtu@def@label{thesiscat}{学位论文}
\def\sjtu@label@thesistype{毕业设计(论文)}
\sjtu@def@label{subjectChi}{\sjtu@label@degreetypeChi\sjtu@label@thesiscat}
\sjtu@def@label{subjectEng}{Thesis of \sjtu@label@degreetypeEng}
\fi
\sjtu@def@label{bigabstract}{英文大摘要}
\geometry{%
paper = a4paper,
top = 84bp,
bottom = 72bp,
hmargin = 90bp,
headheight = 60bp,
headsep = 12bp}
\ifsjtu@english
\def\sjtu@titlemark{\sjtu@value@entitle}
\newcommand{\sjtu@fancyhead}{%
\parbox[b]{0.75\textwidth}{%
\raggedleft\nouppercase{\footnotesize\heiti\sjtu@titlemark}}}
\newcommand{\sjtu@fancyfoot}[2]{%
\small --~~Page~~{\bfseries{#1}}~~of~~{\bfseries{#2}}~~--}
\else
\def\sjtu@titlemark{\sjtu@value@title}
\newcommand{\sjtu@fancyhead}{%
\parbox[b]{0.75\textwidth}{%
\raggedleft\nouppercase{\small\heiti\sjtu@titlemark}}}
\newcommand{\sjtu@fancyfoot}[2]{%
\small 第~{\bfseries{#1}}~页\,共~{\bfseries{#2}}~页}
\fi
\fancypagestyle{sjtu@front}{%
\fancyhf{}
\fancyhead[L]{\includegraphics{figure/sjtubanner.pdf}}
\fancyhead[R]{\sjtu@fancyhead}
\fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.Roman}}}
}
\fancypagestyle{sjtu@plain}{%
\fancyhf{}
\fancyhead[L]{\includegraphics{figure/sjtubanner.pdf}}
\fancyhead[R]{\sjtu@fancyhead}
\fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.arabic}}}
}
\fancypagestyle{sjtu@biglast}{%
\fancyhf{}
\fancyhead[L]{\includegraphics{figure/sjtubanner.pdf}}
\fancyhead[R]{\sjtu@fancyhead}
\fancyfoot[C]{\sjtu@fancyfoot{\theCurrentPageLocal}%
{\lastpageref{pagesLTS.roman.local}}}
}
\renewcommand{\frontmatter}{%
\cleardoublepage
\@mainmatterfalse
\pagenumbering{Roman}
\pagestyle{sjtu@front}}
\renewcommand{\mainmatter}{%
\cleardoublepage
\@mainmattertrue
\pagenumbering{arabic}
\pagestyle{sjtu@plain}}
\ctexset{%
subsection/format = \zihao{-4}\normalfont,
}
\renewcommand{\cftchapfont}{\normalfont}
\renewcommand{\cftchapleader}{\normalfont\cftdotfill{\cftdotsep}}
\renewcommand{\cftchappagefont}{\normalfont}
\NewDocumentEnvironment{abstract}{}%
{\cleardoublepage
\pdfbookmark[0]{\sjtu@label@abstract}{abstract}
\chapter*{%
\sjtu@value@title \vskip 2ex
{\zihao{4}\sjtu@label@abstractChi}
}
\markboth{\sjtu@label@abstractChi}%
{\sjtu@label@abstractChi}
}{%
\vspace{3ex}\noindent
{\zihao{-4}\heiti\sjtu@label@keywordsChi}{\zihao{5}\sjtu@value@keywords}
}
\NewDocumentEnvironment{enabstract}{}{%
\cleardoublepage
\chapter*{%
\MakeUppercase\sjtu@value@entitle \vskip 2ex
{\zihao{4}\MakeUppercase\sjtu@label@abstractEng}}
\markboth{\sjtu@label@abstractEng}%
{\sjtu@label@abstractEng}
}{%
\vspace{3ex}\noindent
{\zihao{-4}\bfseries\sjtu@label@keywordsEng}
{\zihao{5}\sjtu@value@enkeywords}}
\newcommand{\sjtu@bigabstract}[1]{\long\gdef\sjtu@bigabstract@body{#1}}
\NewDocumentEnvironment{bigabstract}{}
{\Collect@Body\sjtu@bigabstract}
{\ifsjtu@course\relax\else%
\ifsjtu@english\relax\else%
\AtEndDocument{%
\cleardoublepage
\pagenumbering{roman}
\pagestyle{sjtu@biglast}
\pdfbookmark[0]{\sjtu@label@bigabstract}{bigabstract}%
\chapter*{\MakeUppercase\sjtu@value@entitle}
\sjtu@bigabstract@body}
\fi
\fi}
\RenewDocumentCommand\maketitle{}{%
\pdfbookmark[0]{\sjtu@label@titlepage}{titlepage}
\sjtu@makechinesetitle%
}
\newcommand{\sjtu@makechinesetitle}{
\cleardoublepage
\thispagestyle{empty}
\begin{center}
\kaishu
\vspace*{48bp}
\includegraphics{figure/sjtulogo.pdf}
\vskip 28bp
{\fontsize{32}{32}\sjtu@label@subjectChi}
\vskip 16bp
{\zihao{-2}\MakeUppercase\sjtu@label@subjectEng}
\vskip 16bp
\includegraphics{figure/sjtubadge.pdf}
\vskip \stretch{2}
{\zihao{2}
\begin{tabular}{r@{:}l}
论文题目 &
\begin{minipage}[t]{300pt}
\zihao{-2}
\begin{center}
\sjtu@uline\sjtu@value@title
\end{center}
\end{minipage}
\end{tabular}}
\vskip \stretch{1}
{\zihao{3}
\def\arraystretch{1.1}
\begin{tabular}
{>{\begin{CJKfilltwosides}{4\ccwd}}r<{\end{CJKfilltwosides}}@{:}c}
\sjtu@label@authorChi & \sjtu@value@author \\ \cline{2-2}
\sjtu@label@studentidChi & \makebox[180pt]{\sjtu@value@studentid} \\
\cline{2-2}
\ifsjtu@course
\sjtu@label@coursenameChi & \sjtu@value@coursename \\ \cline{2-2}
\else
\sjtu@label@majorChi & \sjtu@value@major \\ \cline{2-2}
\fi
\sjtu@label@supervisorChi & \sjtu@value@supervisor \\ \cline{2-2}
\sjtu@label@departmentChi & \sjtu@value@department \\ \cline{2-2}
\end{tabular}}
\vskip 40bp
\end{center}
\cleardoublepage}
\endinput
%%
%% End of file `sjtuthesis-bachelor.ltx'.
Loading