Skip to content
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
>
> 设置完毕后进行编译即可得到PDF文件。

   注意:如果编译过程中出现XITS、LISU和YOUYUAN字体缺失错误,请在本项目的`fonts`目录中安装字体。
   注意:如果编译过程中出现XITS、LISU和YOUYUAN字体缺失错误,请在本项目的`fonts`目录中安装字体。部分字体根据系统进适配,如Windows下使用Arial,而Linux下使用Liberation Sans,请确保这些字体已经安装。

### macOS用户

Expand Down
Binary file modified main.pdf
Binary file not shown.
101 changes: 65 additions & 36 deletions shmtuthesis-graduate.ltx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

\ProvidesFile{shmtuthesis-graduate.ltx}
[2020/01/22 0.0.1 Shanghai Maritime University Thesis Template]

\ifshmtu@degree@master
\shmtu@def@label{degreetypeChi}{硕士}
\shmtu@def@label{degreetypeEng}{Master}
Expand All @@ -31,8 +31,32 @@
\shmtu@def@label{finisheddate}{完成日期}
\def\shmtu@label@thesistype{}
\shmtu@def@label{subject}{%
\shmtu@label@schoolChi\shmtu@label@degreetypeChi 学位论文
\shmtu@label@schoolChi\shmtu@label@degreetypeChi 学位论文
}

\ExplSyntaxOn
\makeatletter
\int_new:N\shmtu@@title@textindex
\int_new:N\shmtu@@title@textindexend
\int_new:N\shmtu@@title@textcount
\NewDocumentCommand{\shmtu@@title@tablecontent}{}{
\int_set:Nn\shmtu@@title@textindex{1}
\int_set:Nn\shmtu@@title@textindexend{10}
\int_set:Nn\shmtu@@title@textcount{\str_count:N \shmtu@value@title}
\tl_clear:N \l_tmpa_tl
\int_do_while:nn {\shmtu@@title@textcount>\shmtu@@title@textindex} {%
\tl_put_right:Nx \l_tmpa_tl {
\exp_not:N {}
\exp_not:N &
\str_range:Nnn \shmtu@value@title \shmtu@@title@textindex \shmtu@@title@textindexend
\exp_not:n { \\ \cline{2-2} }
}
\int_add:Nn \shmtu@@title@textindex {10}
\int_add:Nn \shmtu@@title@textindexend {10}
}
\l_tmpa_tl
}
\ExplSyntaxOff

% 纸张设置,根据《上海海事大学学位论文与摘要的统一要求》进行设置
\geometry{%
Expand All @@ -45,6 +69,15 @@
headsep = 0.5cm,
}

% 英文字体检测
\IfFontExistsTF{Arial}{
% Windows 特有字体
\shmtu@def@label{mainfont}{Arial}
}{
% 大部分 Linux 使用此字体代替 Arial。对 Arch/Gentoo/NixOS 等系统需要手动安装。
\shmtu@def@label{mainfont}{Liberation Sans}
}

% 设置行距(默认:1.5倍行距)
\renewcommand{\baselinestretch}{1.5}

Expand Down Expand Up @@ -115,8 +148,8 @@
\NewDocumentEnvironment{enabstract}{}{%
\cleardoublepage
\chapter*{%
\bfseries
\MakeUppercase\shmtu@value@entitle \vskip 2ex
\bfseries
\setmainfont{\shmtu@label@mainfont} \textbf{\shmtu@value@entitle} \vskip 2ex
\begingroup
\MakeUppercase\shmtu@label@abstractEng
\endgroup
Expand All @@ -125,12 +158,12 @@
\vskip 2ex
\@mkboth{\shmtu@label@abstractEng}%
{\shmtu@label@abstractEng}%
\zihao{-4}
\zihao{5}\setmainfont{\shmtu@label@mainfont}
}{%
\vskip 1ex
\noindent\hfill\shmtu@value@enauthor(\shmtu@value@enmajor)
\vskip 1ex
\noindent\hfill Directed by \shmtu@value@ensupervisor
\noindent\hfill Supervised by \shmtu@value@ensupervisor
\vskip 6ex \noindent
\begingroup
\bfseries\MakeUppercase
Expand All @@ -156,9 +189,9 @@
\cleardoublepage
\thispagestyle{shmtu@title}
\begin{minipage}{.45\linewidth}
\vskip -2mm % 设置上边距为27-2=25mm
\vskip -2mm % 设置上边距为27-2=25mm
\begin{flushleft}
\includegraphics[width=0.45\textwidth]{images/shmtu-badge}
\includegraphics[width=0.4\textwidth]{images/shmtu-badge}
\end{flushleft}
\end{minipage}
\hfill
Expand All @@ -169,38 +202,34 @@
\linespread{1.2}\selectfont\zihao{4}\kaishu
\begin{tabularx}{\textwidth}
{>{\begin{CJKfilltwosides}[t]{4\ccwd}}r<{\end{CJKfilltwosides}:}
>{\raggedright\arraybackslash}X}
学校代码 & 10254 \\
学号 & \shmtu@value@studentid \\
密级 & \\
\end{tabularx}
\endgroup
\end{flushright}
>{\raggedright\arraybackslash}X}
学校代码 & 10254 \\
学号 & \shmtu@value@studentid \\
密级 & \\
\end{tabularx}
\endgroup
\end{flushright}
\end{minipage}
\begin{center}
% TODO:重写vskip直至与学校要求保持一致
\vspace*{60bp}
\includegraphics{images/shmtu-name}
\vskip \stretch{0.4}
{\zihao{2}SHANGHAI MARITIME UNIVERSITY}
\vskip \stretch{0.4}
{\zihao{1}\ziju{0.65}\bfseries\lishu \shmtu@label@degreetypeChi 学位论文}
\vskip \stretch{0.4}
{\zihao{-2}\MakeUppercase{\shmtu@label@degreetypeEng}'S THESIS}

\vskip \stretch{5}
\vspace*{86bp}
\includegraphics{images/shmtu-name}\vspace{-0.5em}\\
{\zihao{2}SHANGHAI MARITIME UNIVERSITY}\\
\vspace{0.5em}{\zihao{1}\ziju{0.65}\bfseries\lishu \shmtu@label@degreetypeChi 学位论文}\\
\vspace{0.5em}{\zihao{-2}\MakeUppercase{\shmtu@label@degreetypeEng}'S THESIS}\\

\vspace{7em}
\begingroup
\makebox[0.85\textwidth][c]{
\linespread{1.2}\selectfont\zihao{2}\bfseries\kaishu
\begin{tabularx}{0.85\textwidth}
{r<{}>{\centering\arraybackslash}X}
\shmtu@label@degreecategory & \shmtu@value@degreecategory \\ \cline{2-2}
\shmtu@label@thesistitle & \shmtu@value@title \\ \cline{2-2}
\shmtu@label@major & \shmtu@value@major \\ \cline{2-2}
\shmtu@label@author & \shmtu@value@author \\ \cline{2-2}
\shmtu@label@supervisor & \shmtu@value@supervisor \\ \cline{2-2}
\shmtu@label@finisheddate & \shmtu@value@finisheddate \\ \cline{2-2}
\end{tabularx}
\linespread{1.2}\selectfont\zihao{2}\bfseries\kaishu
\begin{tabularx}{0.85\textwidth}
{r<{}>{\centering\arraybackslash}X}
\shmtu@label@degreecategory{:} & \shmtu@value@degreecategory \\ \cline{2-2}
\shmtu@label@thesistitle{:} \shmtu@@title@tablecontent
\shmtu@label@major{:} & \shmtu@value@major \\ \cline{2-2}
\shmtu@label@author{:} & \shmtu@value@author \\ \cline{2-2}
\shmtu@label@supervisor{:} & \shmtu@value@supervisor \\ \cline{2-2}
\shmtu@label@finisheddate{:} & \shmtu@value@finisheddate \\ \cline{2-2}
\end{tabularx}
}
\endgroup
\end{center}
Expand Down
62 changes: 34 additions & 28 deletions shmtuthesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

% 依赖库
\RequirePackage{etoolbox}
\RequirePackage{xparse} % 提供\NewDocumentCommand命令
\RequirePackage{xparse} % 提供\NewDocumentCommand命令
\RequirePackage{environ}
\RequirePackage{geometry}
\RequirePackage{fancyhdr}
Expand All @@ -113,7 +113,7 @@
\RequirePackage{caption}
\RequirePackage[list=off]{bicaption}
\RequirePackage{subcaption}
\RequirePackage[backend=biber, style=\shmtu@bibstyle]{biblatex}
\RequirePackage[gbpub=false,doi=false,backend=biber,style=\shmtu@bibstyle,gbnamefmt=lowercase]{biblatex}
\RequirePackage{titletoc}
\RequirePackage[titles]{tocloft}
\RequirePackage[inline]{enumitem}
Expand Down Expand Up @@ -153,7 +153,7 @@
\shmtu@def@label{schoolEng}{Shanghai Maritime University}
\shmtu@def@label{originalityChi}{论文独创性声明}
\shmtu@def@label{originalityEng}{Declaration of Originality}
\shmtu@def@label{authorizationChi}{论文使用授权声明}
\shmtu@def@label{authorizationChi}{学位论文版权使用授权书}
\shmtu@def@label{authorizationEng}{Declaration of Authorization}
\shmtu@def@label{origtitle}{\shmtu@label@originalityChi}
\shmtu@def@label{authtitle}{\shmtu@label@authorizationChi}
Expand All @@ -163,10 +163,16 @@
已经发表或撰写过的研究成果。其他同志对本研究的启发和所做的贡献
均已在论文中作了明确的声明并表示了感谢。}
\shmtu@def@label{authbody}{%
本人同意上海海事大学有关保留、使用学位论文的规定,即:学校
有权保留送交论文复印件,允许论文被查阅和借阅;学校可以上网公布
论文的全部和部分内容,可以采用影印、缩印或者其他复制手段保存论
文。保密的论文在解密后遵守此规定。}
本学位论文作者完全了解学校有关保留、使用学位论文的规定,即:学校有权保留并向国家
有关部门或机构送交论文的复印件和电子版,允许论文被查阅和借阅。本人授权上海海事大
学可以将本学位论文的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫
描等复制手段保存和汇编本学位论文。

本学位论文属于(请在以下相应方框内打“\checkmark”)

$\square$保密,在\phantom{xx}年解密后适用本使用授权书。

$\square$不保密。}
\shmtu@def@label{abstractChi}{摘\quad 要}
\shmtu@def@label{abstractEng}{Abstract}
\shmtu@def@label{keywordsChi}{关键词:}
Expand Down Expand Up @@ -210,7 +216,7 @@
\shmtu@def@label{projects}%
{攻读\shmtu@label@degreetypeChi 学位期间参与的项目}
\shmtu@def@label{awards}%
{攻读\shmtu@label@degreetypeChi 学位期间获奖情况}
{攻读\shmtu@label@degreetypeChi 学位期间获奖情况}
\fi

\NewDocumentCommand\shmtuSetLabel{}{\setkeys{shmtulabel}}
Expand Down Expand Up @@ -438,7 +444,7 @@
{\endgroup}
\NewDocumentCommand{\shmtuSetFloatFontOn}{}{\shmtu@setfloatfonttrue}
\NewDocumentCommand{\shmtuSetFloatFontOff}{}{\shmtu@setfloatfontfalse}
\DeclareCaptionFont{shmtucaptionfont}{\zihao{5}\kaishu}
\DeclareCaptionFont{shmtucaptionfont}{\zihao{5}\normalfont}
\DeclareCaptionFont{shmtusubcaptionfont}{\zihao{5}\normalfont}
\captionsetup{%
format = plain,
Expand All @@ -450,7 +456,7 @@
\captionsetup[sub]{%
format = hang,
labelformat = parens,
labelsep = space,
labelsep = space,
justification = justified,
font = shmtusubcaptionfont
}
Expand Down Expand Up @@ -494,26 +500,27 @@
% 签名框
\newcommand{\shmtu@signbox}[2][作者]{%
\makebox[\textwidth][r]{%
#1 签名:\underline{\hbox to 4em{}}%
#1 签名:\underline{\hbox to 5em{}}%
\ifthenelse{\equal{#2}{作者}}%
{}{#2 签名:\underline{\hbox to 4em{}}}%
日期:\underline{\hbox to 4em{}}%
{}{#2 签名:\underline{\hbox to 5em{}}}%
日期:\underline{\hbox to 6em{}}%
}
}

% 原创性声明
\NewDocumentCommand{\makeDeclareOriginality}{o}{%
\ifshmtu@review
\relax
\relax
\else
\pdfbookmark[0]{\shmtu@label@originality}{origtitle}
\IfNoValueTF{#1}{%
\thispagestyle{empty}
\chapter*{\normalfont\zihao{3}\songti\shmtu@label@origtitle}
\vspace{16pt}
\begingroup
\zihao{4}
\shmtu@label@origbody
\vskip 10ex

\noindent
\shmtu@signbox{作者}
\endgroup
Expand All @@ -525,19 +532,18 @@
% 使用授权书
\NewDocumentCommand{\makeDeclareAuthorization}{o}{%
\ifshmtu@review
\relax
\relax
\else
\pdfbookmark[0]{\shmtu@label@authorization}{authtitle}
\IfNoValueTF{#1}{%
\thispagestyle{empty}
\vskip 16ex
{\let\clearpage\relax\par\chapter*{\normalfont\zihao{3}\songti\shmtu@label@authtitle}}
\vspace{16pt}
\begingroup
\zihao{4}
\shmtu@label@authbody
%\vskip 1ex
%\shmtu@authconf
\vskip 10ex

\noindent
\shmtu@signbox{导师}
\endgroup
Expand All @@ -562,7 +568,7 @@
\Collect@Body\shmtu@acknowledgements
}{%
\ifshmtu@review
\relax
\relax
\else
\cleardoublepage
\chapter*{\shmtu@label@acknowledgements}
Expand Down Expand Up @@ -603,7 +609,7 @@
\Collect@Body\shmtu@publications
}{%
\ifshmtu@review
\relax
\relax
\else
\begin{shmtu@bibliolist}{#1}{\shmtu@label@publications}
\shmtu@publications@body
Expand All @@ -628,7 +634,7 @@
\Collect@Body\shmtu@projects
}{%
\ifshmtu@review
\relax
\relax
\else
\begin{shmtu@bibliolist}{#1}{\shmtu@label@projects}
\shmtu@projects@body
Expand All @@ -653,7 +659,7 @@
\Collect@Body\shmtu@patents
}{%
\ifshmtu@review
\relax
\relax
\else
\begin{shmtu@bibliolist}{#1}{\shmtu@label@patents}
\shmtu@patents@body
Expand All @@ -678,7 +684,7 @@
\Collect@Body\shmtu@awards
}{%
\ifshmtu@review
\relax
\relax
\else
\begin{shmtu@bibliolist}{#1}{\shmtu@label@awards}
\shmtu@awards@body
Expand Down Expand Up @@ -923,8 +929,8 @@
\renewcommand{\listofalgorithms}{%
\cleardoublepage%
\makeatletter
\renewcommand{\@dotsep}{\cftdotsep}
\makeatother
\renewcommand{\@dotsep}{\cftdotsep}
\makeatother
\chapter*{\listalgorithmcfname}%
\addcontentsline{toc}{chapter}{\listalgorithmcfname}
\@mkboth{\listalgorithmcfname}{\listalgorithmcfname}%
Expand Down Expand Up @@ -961,8 +967,8 @@
\renewcommand{\listofalgorithms}{%
\cleardoublepage%
\makeatletter
\renewcommand{\@dotsep}{\cftdotsep}
\makeatother
\renewcommand{\@dotsep}{\cftdotsep}
\makeatother
\chapter*{\listalgorithmname}%
\addcontentsline{toc}{chapter}{\listalgorithmname}
\@mkboth{\listalgorithmname}{\listalgorithmname}%
Expand Down
7 changes: 2 additions & 5 deletions shmtuthesis.sty
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
\ProvidesPackage{shmtuthesis}
[2020/01/22 0.0.1 Shanghai Maritime University Thesis Template]

\RequirePackage{expl3}

% 确定浮动对象的位置,可以使用 [H],强制将浮动对象放到这里(可能效果很差)
% \RequirePackage{float}

% 中文乱假文
\RequirePackage{zhlipsum}
% 英文乱假文
\RequirePackage{lipsum}

% 固定宽度的表格
\RequirePackage{tabularx}

Expand Down
Loading