Skip to content

Commit

Permalink
增加对课程论文的支持 (sjtug#389)
Browse files Browse the repository at this point in the history
* *: Support course paper

Signed-off-by: Ce Gao <[email protected]>

* thesis.tex: Support coursepaper

Signed-off-by: Ce Gao <[email protected]>

* readme: Update

Signed-off-by: Ce Gao <[email protected]>

* coursename: Update

Signed-off-by: Ce Gao <[email protected]>

* README: Update

Signed-off-by: Ce Gao <[email protected]>
  • Loading branch information
gaocegege authored Dec 24, 2018
1 parent c60157b commit a605cff
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 124 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
[![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 模板,非官方出品。生成的学位论文文件参见 [README.pdf][README],详细使用说明参见 [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/master.pdf"><img src="./docs/images/master.png" height="330"></a>
<a href="http://sjtug.org/SJTUThesis/doctor.pdf"><img src="./docs/images/doctor.png" height="330"></a>
<a href="http://sjtug.org/SJTUThesis/coursepaper.pdf"><img src="./docs/images/coursepaper.png" height="330"></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>


Expand Down
Binary file added docs/coursepaper.pdf
Binary file not shown.
Binary file added docs/images/coursepaper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 28 additions & 16 deletions sjtuthesis.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,51 @@
\def\sjtu@label@coadvisor{副导师}
\def\sjtu@label@defenddate{答辩日期}
\def\sjtu@label@institute{学院(系)}
\def\sjtu@label@coursepaper{课程论文}
\ifsjtu@bachelor
\def\sjtu@label@author{学生姓名}
\def\sjtu@label@studentnumber{学生学号}
\def\sjtu@label@advisor{指导教师}
\else
\def\sjtu@label@author{论文作者}
\def\sjtu@label@studentnumber{学号}
\def\sjtu@label@advisor{导师}
\ifsjtu@coursepaper
\def\sjtu@label@author{姓名}
\def\sjtu@label@studentnumber{学号}
\def\sjtu@label@coursename{课程}
\else
\def\sjtu@label@author{论文作者}
\def\sjtu@label@studentnumber{学号}
\def\sjtu@label@advisor{导师}
\fi
\fi

%% string values filled in the title page
\def\sjtu@value@classification{}
\def\sjtu@value@confidential{}
\def\sjtu@value@serialnumber{}
\def\sjtu@value@school{}
\ifsjtu@bachelor
\def\sjtu@value@chinesedegree{学士}
\def\sjtu@value@englishdegree{Bachelor}
\ifsjtu@coursepaper
\def\sjtu@value@chinesedegree{}
\def\sjtu@value@englishdegree{}
\else
\ifsjtu@master
\def\sjtu@value@chinesedegree{硕士}
\def\sjtu@value@englishdegree{Master}
\ifsjtu@bachelor
\def\sjtu@value@chinesedegree{学士}
\def\sjtu@value@englishdegree{Bachelor}
\else
\ifsjtu@doctor
\def\sjtu@value@chinesedegree{博士}
\def\sjtu@value@englishdegree{Doctor}
\ifsjtu@master
\def\sjtu@value@chinesedegree{硕士}
\def\sjtu@value@englishdegree{Master}
\else
\ClassError{sjtuthesis}%
{Unknown value for degree.}{}
\fi
\ifsjtu@doctor
\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@chinesedegree\sjtu@label@thesis}
\fi
\def\sjtu@label@statement{申请\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}

%% 论文原创性声明
\def\sjtu@label@original{学位论文原创性声明}
Expand Down
183 changes: 127 additions & 56 deletions sjtuthesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{sjtuthesis}[2018/01/09 v0.10 Shanghai Jiao Tong University Template]
\def\version{v0.10}
\newif\ifsjtu@coursepaper\sjtu@coursepaperfalse
\newif\ifsjtu@bachelor\sjtu@bachelorfalse
\newif\ifsjtu@master\sjtu@masterfalse
\newif\ifsjtu@doctor\sjtu@doctorfalse
\newif\ifsjtu@english\sjtu@englishfalse
\newif\ifsjtu@review\sjtu@reviewfalse
\newif\ifsjtu@submit\sjtu@submitfalse
\DeclareOption{coursepaper}{\sjtu@coursepapertrue}
\DeclareOption{bachelor}{\sjtu@bachelortrue}
\DeclareOption{master}{\sjtu@mastertrue}
\DeclareOption{doctor}{\sjtu@doctortrue}
Expand All @@ -25,14 +27,18 @@
\else
\PassOptionsToClass{scheme=chinese}{ctexbook}
\fi
\ifsjtu@bachelor
\PassOptionsToClass{zihao=5}{ctexbook}
\else
\ifsjtu@coursepaper
\PassOptionsToClass{zihao=-4}{ctexbook}
\ifsjtu@master\relax\else
\ifsjtu@doctor\relax\else
\ClassError{sjtuthesis}%
{You have to specify one of thesis options: bachelor, master or doctor.}{}
\else
\ifsjtu@bachelor
\PassOptionsToClass{zihao=5}{ctexbook}
\else
\PassOptionsToClass{zihao=-4}{ctexbook}
\ifsjtu@master\relax\else
\ifsjtu@doctor\relax\else
\ClassError{sjtuthesis}%
{You have to specify one of thesis options: coursepaper, bachelor, master or doctor.}{}
\fi
\fi
\fi
\fi
Expand Down Expand Up @@ -65,6 +71,7 @@
\newcommand\advisor[1]{\def\sjtu@value@advisor{#1}}
\newcommand\coadvisor[1]{\def\sjtu@value@coadvisor{#1}}
\newcommand\major[1]{\def\sjtu@value@major{#1}}
\newcommand\coursename[1]{\def\sjtu@value@coursename{#1}}
\newcommand\submitdate[1]{\def\sjtu@value@submitdate{#1}}
\newcommand\defenddate[1]{\def\sjtu@value@defenddate{#1}}
\newcommand\institute[1]{\def\sjtu@value@institute{#1}}
Expand Down Expand Up @@ -169,7 +176,7 @@
\newcommand{\email}[1]{\href{mailto:#1}{\texttt{#1}}}

% upper math letter
\newcommand{\me}{\mathrm{e}}
\newcommand{\me}{\mathrm{e}}
\newcommand{\mi}{\mathrm{i}}
\newcommand{\mj}{\mathrm{j}}
\newcommand{\dif}{\mathrm{d}}
Expand All @@ -195,7 +202,7 @@
{}{}

% CJK-LaTeX Logo \CJKLaTeX
\newcommand{\CJKLaTeX}{CJK--\LaTeX}
\newcommand{\CJKLaTeX}{CJK--\LaTeX}

% cndash
\newcommand{\cndash}{\rule{0.0em}{0pt}\rule[0.35em]{1.4em}{0.05em}\rule{0.2em}{0pt}}
Expand Down Expand Up @@ -243,7 +250,7 @@
}

\floatname{algorithm}{\sjtu@label@algo}
\renewcommand{\algorithmicrequire}{\textbf{\sjtu@algorithmicrequire}}
\renewcommand{\algorithmicrequire}{\textbf{\sjtu@algorithmicrequire}}
\renewcommand{\algorithmicensure}{\textbf{\sjtu@algorithmicensure}}
\renewcommand{\listalgorithmname}{\sjtu@listalgorithmname}
\renewcommand{\lstlistingname}{\sjtu@value@listingname}
Expand Down Expand Up @@ -376,7 +383,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The following definitions add Switch statement to LaTeX algorithmicx package
% It's based on Werner's answer on stackoverflow
% http://tex.stackexchange.com/questions/53357/switch-cases-in-algorithmic
% http://tex.stackexchange.com/questions/53357/switch-cases-in-algorithmic

% New definitions
\algnewcommand\algorithmicswitch{\textbf{switch}}
Expand Down Expand Up @@ -407,11 +414,15 @@

\renewcommand\maketitle{%
\pdfbookmark[0]{\sjtu@titlepage}{titlepage}
\ifsjtu@bachelor
\makechinesetitle@bachelor
\ifsjtu@coursepaper
\makechinesetitle@coursepaper
\else
\makechinesetitle
\makeenglishtitle
\ifsjtu@bachelor
\makechinesetitle@bachelor
\else
\makechinesetitle
\makeenglishtitle
\fi
\fi
}

Expand Down Expand Up @@ -472,7 +483,7 @@
\cleardoublepage
\thispagestyle{empty}
\begin{center}
{\normalfont\zihao{4} \sjtu@label@englishstatement}
{\normalfont\zihao{4} \sjtu@label@englishstatement}
\vspace{20pt} \vskip\stretch{1}
{\huge\sjtu@value@englishtitle \vskip 1pt}
\vskip \stretch{1}
Expand All @@ -481,19 +492,19 @@
\vskip 3pt
\vskip \stretch{2}
\else
{\normalfont\zihao{4}\sjtu@value@englishauthor}
{\normalfont\zihao{4}\sjtu@value@englishauthor}
\vskip \stretch{1}
{\normalfont\zihao{4}\sjtu@label@englishadvisor}
{\normalfont\zihao{4}\sjtu@label@englishadvisor}
\vskip 2pt
{\normalfont\zihao{4}\sjtu@value@englishadvisor}
{\normalfont\zihao{4}\sjtu@value@englishadvisor}
\vskip 5pt
\ifx\sjtu@value@englishcoadvisor\undefined\else
{\normalfont\zihao{4}\sjtu@label@englishcoadvisor}
{\normalfont\zihao{4}\sjtu@label@englishcoadvisor}
\vskip 2pt
{\normalfont\zihao{4}\sjtu@value@englishcoadvisor}
{\normalfont\zihao{4}\sjtu@value@englishcoadvisor}
\vskip \stretch{2}
\fi
\fi
\fi
\normalfont\sjtu@value@englishinstitute \vskip 30pt
\normalfont\sjtu@value@englishdate \vskip 20pt
\end{center}
Expand Down Expand Up @@ -546,6 +557,41 @@
\cleardoublepage
}

% “绘制”课程论文标题页
\newcommand\makechinesetitle@coursepaper{%
\cleardoublepage
\thispagestyle{empty}
\begin{center}
\kaishu
\vspace*{20pt} \vskip 7pt
\includegraphics{sjtulogo}
\vskip 30pt
{\fontsize{32}{32}\sjtu@label@coursepaper}
\vskip 15pt
\includegraphics{sjtubadge}
\vskip \stretch{2}
{
\zihao{2}
\begin{tabular}{r@{:}l}
\sjtu@label@title & {\zihao{-2}\parbox[t]{320pt}{\sjtu@value@chinesecovertitle}}
\end{tabular}
}
\vskip \stretch{1}
{
\zihao{3}
\def\arraystretch{1.1}
\begin{tabular}{>{\begin{CJKfilltwosides}{4\ccwd}}r<{\end{CJKfilltwosides}}@{:}c}
\sjtu@label@coursename & \sjtu@value@coursename \\ \cline{2-2}
\sjtu@label@author & \sjtu@value@author \\ \cline{2-2}
\sjtu@label@studentnumber & \makebox[180pt]{\sjtu@value@studentnumber} \\ \cline{2-2}
\sjtu@label@institute & \sjtu@value@institute \\ \cline{2-2}
\sjtu@label@major & \sjtu@value@major \\ \cline{2-2}
\end{tabular}
}
\end{center}
\cleardoublepage
}

% 原创性声明
\newcommand\makeDeclareOriginal{%
\cleardoublepage
Expand Down Expand Up @@ -592,8 +638,9 @@
\fi
\def\markboxwidth{0.75\textwidth}
\AtBeginDocument{\pagenumbering{Alph}}
\ifsjtu@bachelor
%% 本科学位论文页眉页脚设置

\ifsjtu@coursepaper
%% 本科学位论文页眉页脚设置
%% 前言页眉页脚
\fancypagestyle{front}{%
\fancyhf{}
Expand All @@ -610,58 +657,82 @@
\fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.arabic}}}
\renewcommand{\headheight}{32pt}
}
%% 英文大摘要
\fancypagestyle{biglast}{%
\fancyhf{}
\fancyhead[L]{\includegraphics{figure/sjtubanner}}
\fancyhead[R]{\parbox[b]{\markboxwidth}{\raggedleft\nouppercase{\sjtu@fancyhead\sjtu@value@titlemark}}}
\fancyfoot[C]{\sjtu@fancyfoot{\theCurrentPageLocal}{\lastpageref{pagesLTS.roman.local}}}
\renewcommand{\headheight}{32pt}
}
\else
%% 研究生学位论文页眉页脚设置
\if@twoside
%% 双面打印页眉页脚
\ifsjtu@bachelor
%% 本科学位论文页眉页脚设置
%% 前言页眉页脚
\fancypagestyle{front}{%
\fancyhf{}
\fancyhead[LO,RE]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[LE,RO]{\nouppercase{\sjtu@fancyhead\leftmark}}
\fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
\fancyhead[L]{\includegraphics{figure/sjtubanner}}
\fancyhead[R]{\parbox[b]{\markboxwidth}{\raggedleft\nouppercase{\sjtu@fancyhead\sjtu@value@titlemark}}}
\fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.Roman}}}
\renewcommand{\headheight}{32pt}
}
%% 正文页眉页脚
\fancypagestyle{main}{%
\fancyhf{}
\fancyhead[LO,RE]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[LE,RO]{\nouppercase{\sjtu@fancyhead\leftmark}}
\fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
\renewcommand{\headheight}{32pt}
}
\else
%% 单面打印页眉页脚
\fancypagestyle{front}{%
\fancyhf{}
\fancyhead[L]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[R]{\nouppercase{\sjtu@fancyhead\leftmark}}
\fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
\fancyhead[L]{\includegraphics{figure/sjtubanner}}
\fancyhead[R]{\parbox[b]{\markboxwidth}{\raggedleft\nouppercase{\sjtu@fancyhead\sjtu@value@titlemark}}}
\fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.arabic}}}
\renewcommand{\headheight}{32pt}
}
\fancypagestyle{main}{%
%% 英文大摘要
\fancypagestyle{biglast}{%
\fancyhf{}
\fancyhead[L]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[R]{\nouppercase{\sjtu@fancyhead\leftmark}}
\fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
\fancyhead[L]{\includegraphics{figure/sjtubanner}}
\fancyhead[R]{\parbox[b]{\markboxwidth}{\raggedleft\nouppercase{\sjtu@fancyhead\sjtu@value@titlemark}}}
\fancyfoot[C]{\sjtu@fancyfoot{\theCurrentPageLocal}{\lastpageref{pagesLTS.roman.local}}}
\renewcommand{\headheight}{32pt}
}
\else
%% 研究生学位论文页眉页脚设置
\if@twoside
%% 双面打印页眉页脚
\fancypagestyle{front}{%
\fancyhf{}
\fancyhead[LO,RE]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[LE,RO]{\nouppercase{\sjtu@fancyhead\leftmark}}
\fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
\renewcommand{\headheight}{32pt}
}
\fancypagestyle{main}{%
\fancyhf{}
\fancyhead[LO,RE]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[LE,RO]{\nouppercase{\sjtu@fancyhead\leftmark}}
\fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
\renewcommand{\headheight}{32pt}
}
\else
%% 单面打印页眉页脚
\fancypagestyle{front}{%
\fancyhf{}
\fancyhead[L]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[R]{\nouppercase{\sjtu@fancyhead\leftmark}}
\fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
\renewcommand{\headheight}{32pt}
}
\fancypagestyle{main}{%
\fancyhf{}
\fancyhead[L]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
\fancyhead[R]{\nouppercase{\sjtu@fancyhead\leftmark}}
\fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
\renewcommand{\headheight}{32pt}
}
\fi
\fi
\fi

\renewcommand\frontmatter{%
\cleardoublepage
\@mainmatterfalse
\ifsjtu@bachelor
\ifsjtu@coursepaper
\pagestyle{front}
\else
\pagestyle{main}
\ifsjtu@bachelor
\pagestyle{front}
\else
\pagestyle{main}
\fi
\fi
\pagenumbering{Roman}
}
Expand Down
Loading

0 comments on commit a605cff

Please sign in to comment.