Skip to content
Snippets Groups Projects
Commit d82393fa authored by Koishi Jinguji's avatar Koishi Jinguji
Browse files

Merge branch 'master' of github.com:myandeg/NJUThesisUndergraduate

parents c1bf89ac e5d103d9
No related branches found
No related tags found
No related merge requests found
......@@ -139,7 +139,7 @@ sudo apt install ttf-mscorefonts-installer
\subsection{修改字体配置}
本模板提供了若干个字体相关的控制选项,已于\cref{sec:classoptions}初步进行介绍。如果希望覆盖检测系统字体的命令(譬如在Linux编译时使用Windows字体样式),请将
UseSysFont设置为false,并通过CustomEnFont和CustomZhFont进行选择。
systemfont设置为false,并通过customlatinfont和customchinesefont进行选择。
全部字符集命令如下所示。
......
......@@ -46,13 +46,13 @@
\section{自定义选项}
\label{sec:classoptions}
njuthesis类提供了5个可以自定义的选项,如下所示。
njuthesis类提供了若干个可以自定义的选项,如下所示。
\begin{description}
\item[\texttt{TitleLength}] 标题长度,用于控制封面标题的行数。可选值为1、2、3,缺省值为1。
\item[\texttt{Degree}] 学位类型,本科生为UG,即Undergraduate的缩写。
\item[\texttt{Type}] 用于选择文档类型并将相关字段输出在封面和摘要页。可选值包括thesis(表示毕业论文)和design(表示毕业设计),缺省值为thesis。
\item[\texttt{UseSysFont}] Bool类型,用于选择是否使用系统预装字体,缺省值为true。
\item[\texttt{CustomEnFont}] 用于选择自定义英文字符集。可选值包括windows, macos, gyre, null,缺省值为windows。
\item[\texttt{CustomZhFont}] 用于选择自定义中文字符集。可选值包括windows, macos, fandol, founder, noto, null,缺省值为windows。
\item[\texttt{titlelength}] 标题长度,用于控制封面标题的行数。可选值为1、2、3,缺省值为1。
\item[\texttt{secondsupervisor}] 是否有第二导师,用于在封面和摘要添加第二导师,缺省值为false。
\item[\texttt{degree}] 学位类型,本科生为UG,即Undergraduate的缩写。
\item[\texttt{type}] 用于选择文档类型并将相关字段输出在封面和摘要页。可选值包括thesis(表示毕业论文)和design(表示毕业设计),缺省值为thesis。
\item[\texttt{systemfont}] 是否用系统字体,用于自动检测运行系统并使用预装字体,缺省值为true。
\item[\texttt{customlatinfont}] 用于选择自定义英文字符集。可选值包括windows, macos, gyre, null,缺省值为windows。
\item[\texttt{customchinesefont}] 用于选择自定义中文字符集。可选值包括windows, macos, fandol, founder, noto, null,缺省值为windows。
\end{description}
......@@ -8,33 +8,61 @@
\texttt{cover.sty}中定义了生成封面的相关命令
\subsection{文档类型}
如果编写的是毕业设计,请参考\cref{sec:classoptions},将Type选项改为design。
\subsection{多行标题}
为了使较长的论文题目也能美观地呈现在封面页上,njuthesis类提供了\texttt{TitleLength}这一选项,用于控制封面标题的行数。该命令已于\cref{sec:classoptions}进行介绍,可以在\texttt{njuthesis.tex}文件开头的类定义中找到,可选值为1、2、3,缺省值为单行标题。
\subsection{第二导师}
secondsupervisor用于指定是否在封面打印第二导师
\subsection{输入个人信息}
主目录下的\texttt{coverinfo.sty}文件定义了用于文档封面的诸多属性参数,包括
主目录下的\texttt{coverinfo.sty}文件定义了用于文档封面的诸多属性参数。
写作时在此文件中修改相应字符串即可。
\subsubsection{论文标题}
\begin{description}
\item[\texttt{\textbackslash TitleA}] 单行标题,或多行标题的第一行。关于是否应该折行,单行能容纳的最长标题为\emph{15个中文字符},请自行选择合适的截断处。
\item[\texttt{\textbackslash TitleB}] 多行标题的第二行
\item[\texttt{\textbackslash TitleC}] 多行标题的第三行
\item[\texttt{\textbackslash Title\textunderscore EN}] 英文标题,注意空格要用波浪线(\textasciitilde)替代
\end{description}
\subsubsection{个人年级、学号、姓名}
\begin{description}
\item[\texttt{\textbackslash Grade}] 年级
\item[\texttt{\textbackslash StudentID}] 9位数字学号
\item[\texttt{\textbackslash StudentName}] 姓名
\item[\texttt{\textbackslash StudentName\textunderscore EN}] 姓名拼音
\end{description}
\subsubsection{就读院系专业}
\begin{description}
\item[\texttt{\textbackslash Department}] 学院名称
\item[\texttt{\textbackslash Department\textunderscore EN}] 学院英文名称
\item[\texttt{\textbackslash Major}] 专业名称
\item[\texttt{\textbackslash Major\textunderscore EN}] 专业英文名称
\item[\texttt{\textbackslash Mentor}] 导师姓名
\item[\texttt{\textbackslash Mentor\textunderscore EN}] 导师姓名的英文拼音
\item[\texttt{\textbackslash MentorTitle}] 导师职称
\item[\texttt{\textbackslash MentorTitle\textunderscore EN}] 导师职称英文
\item[\texttt{\textbackslash SubmitDate}] 论文提交日期
\end{description}
写作时在此文件中修改相应字符串即可。
为了使较长的论文题目也能美观地呈现在封面页上,njuthesis类提供了\texttt{TitleLength}这一选项,用于控制封面标题的行数。该命令已于\cref{sec:classoptions}进行介绍,可以在\texttt{njuthesis.tex}文件开头的类定义中找到,可选值为1、2、3,缺省值为单行标题。
\subsubsection{导师信息}
注意标注A的为第一导师
\begin{description}
\item[\texttt{\textbackslash Mentor<A/B>}] 导师姓名
\item[\texttt{\textbackslash Mentor<A/B>\textunderscore EN}] 导师姓名的英文拼音
\item[\texttt{\textbackslash Mentor<A/B>Title}] 导师职称
\item[\texttt{\textbackslash Mentor<A/B>Title\textunderscore EN}] 导师职称英文
\end{description}
如果编写的是毕业设计,请参考\cref{sec:classoptions},将Type选项改为design。
\subsubsection{提交日期}
\begin{description}
\item[\texttt{\textbackslash SubmitDate}] 论文提交日期
\end{description}
\section{摘要页}
......
% 设置用于封面的个人信息
%----------------------------------------
% 个人信息
%----------------------------------------
% 标题
\setTitleA{一种使用南京大学\hologo{LaTeX}模版}%第一行标题
\setTitleB{编写本科生毕业论文的经验性方法}%第二行标题
\setTitleC{}%第三行标题
\setTitleC{没有第三行就不用填这个哦}%第三行标题
\setTitleEN{An~Empirical~Way~of~Composing~Undergraduate~Thesis~with~NJU~\hologo{LaTeX}~Template}%注意英文名中空格必须替换为波浪线
% 姓名学号
\setGrade{2018}
\setStudentID{181114514}
\setStudentName{周煜华}
\setStudentNameEN{Zhou~Yuhua}
% 院系专业
\setDepartment{拉太赫科学与技术学院}
\setDepartmentEN{School~of~\hologo{LaTeX}}
\setMajor{拉太赫语言学}
\setMajorEN{\hologo{LaTeX}~Linguistics}
\setMentor{李成殿}
\setMentorEN{Li~Chengdian}
\setMentorTitle{教授}
\setMentorTitleEN{Professor}
% 导师
\setMentorA{李成殿}
\setMentorAEN{Li~Chengdian}
\setMentorATitle{教授}
\setMentorATitleEN{Professor}
% 第二导师
\setMentorB{孙赫弥}
\setMentorBEN{Sun~Hemi}
\setMentorBTitle{副教授}
\setMentorBTitleEN{Associate professor}
% 提交时间
\setSubmitDate{2021年8月10日}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{njuthesis}
\ProvidesClass{njuthesis}[2021/09/10 NJU Thesis Undergraduate LaTeX Template]
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=njuthesis,
prefix=,% 故意留空防止出现大量@,但估计要发布CTAN还得加回
prefix=nju@,% 故意留空防止出现大量@,但估计要发布CTAN还得加回nju@。
setkeys=\kvsetkeys
}
......@@ -20,12 +20,13 @@
zihao=-4
]{ctexbook}[2018/04/01]
\DeclareStringOption[1]{TitleLength}
\DeclareStringOption[UG]{Degree}
\DeclareStringOption[thesis]{Type}
\DeclareBoolOption[true]{UseSysFont}
\DeclareStringOption[windows]{CustomEnFont}
\DeclareStringOption[windows]{CustomZhFont}
\DeclareStringOption[1]{titlelength}
\DeclareBoolOption[false]{secondsupervisor}
\DeclareStringOption[UG]{degree}
\DeclareStringOption[thesis]{type}
\DeclareBoolOption[true]{systemfont}
\DeclareStringOption[windows]{customlatinfont}
\DeclareStringOption[windows]{customchinesefont}
\ProcessKeyvalOptions*\relax
......
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NJU Thesis Undergraduate
% 南京大学本科生毕业论文LaTeX模板
% Version 0.4.0 (2021-09-10)
% Version 0.5.0 (2021-09-10)
%
% 请关注项目地址以获取最新变化
% https://github.com/nju-lug/NJUThesisUndergraduate
......@@ -16,18 +16,19 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[
TitleLength=2,% 选择标题行数,范围是1~3
Degree=UG,% UG: 本科
Type=thesis,% thesis: 毕业论文,design: 毕业设计
% UseSysFont=false,% 自定义字体请反注释此项
% CustomEnFont=windows,% 设置英文字符集
% CustomZhFont=windows,% 设置中文字符集
titlelength=2,% 选择标题行数,范围是1~3
secondsupervisor=true,% 有第二导师请反注释此项
% degree=UG,% UG: 本科 本项不需更改
type=thesis,% thesis: 毕业论文,design: 毕业设计
% systemfont=false,% 自定义字体请反注释此项
% customlatinfont=windows,% 设置英文字符集
% customchinesefont=windows,% 设置中文字符集
]{njuthesis}
% 添加自定义配置
\input{custom.tex}
% 输入个人信息
% 输入封面信息
\input{coverinfo.tex}
% 导入参考文献源
......
......@@ -19,7 +19,12 @@
院系: \Department \\
专业: \Major \\
本科生姓名: \StudentName \\
指导教师(姓名、职称): \Mentor\ \MentorTitle \\
指导教师(姓名、职称): \MentorA\ \MentorATitle
% 第二导师
\ifnju@secondsupervisor
\ \MentorB\ \MentorBTitle
\fi
\\
摘要:
\egroup
}
......@@ -49,7 +54,12 @@
DEPARTMENT: ~~\Department_EN \\
SPECIALIZATION: ~~\Major_EN \\
UNDERGRADUATE:~~\StudentName_EN \\
MENTOR:~~\Mentor_EN \ \MentorTitle_EN\\
MENTOR:~~\MentorA_EN \ \MentorATitle_EN
% 第二导师
\ifnju@secondsupervisor
\ \MentorB_EN\ \MentorBTitle_EN
\fi
\\
ABSTRACT:
\egroup
}
......
......@@ -4,19 +4,28 @@
\NewDocumentCommand\setTitleA{m}{\tl_const:Nn \TitleA {#1}}% 第一行标题
\NewDocumentCommand\setTitleB{m}{\tl_const:Nn \TitleB {#1}}% 第二行标题
\NewDocumentCommand\setTitleC{m}{\tl_const:Nn \TitleC {#1}}% 第三行标题
\NewDocumentCommand\setTitleEN{m}{\tl_const:Nn \Title_EN {#1}} % 注意英文名中空格必须替换为波浪线
\NewDocumentCommand\setTitleEN{m}{\tl_const:Nn \Title_EN {#1}}
\NewDocumentCommand\setGrade{m}{\tl_const:Nn \Grade {#1}}
\NewDocumentCommand\setStudentID{m}{\tl_const:Nn \StudentID {#1}}
\NewDocumentCommand\setStudentName{m}{\tl_const:Nn \StudentName {#1}}
\NewDocumentCommand\setStudentNameEN{m}{\tl_const:Nn \StudentName_EN {#1}}
\NewDocumentCommand\setDepartment{m}{\tl_const:Nn \Department {#1}}
\NewDocumentCommand\setDepartmentEN{m}{\tl_const:Nn \Department_EN {#1}}
\NewDocumentCommand\setMajor{m}{\tl_const:Nn \Major {#1}}
\NewDocumentCommand\setMajorEN{m}{\tl_const:Nn \Major_EN {#1}}
\NewDocumentCommand\setMentor{m}{\tl_const:Nn \Mentor {#1}}
\NewDocumentCommand\setMentorEN{m}{\tl_const:Nn \Mentor_EN {#1}}
\NewDocumentCommand\setMentorTitle{m}{\tl_const:Nn \MentorTitle {#1}}
\NewDocumentCommand\setMentorTitleEN{m}{\tl_const:Nn \MentorTitle_EN {#1}}
\NewDocumentCommand\setMentorA{m}{\tl_const:Nn \MentorA {#1}}
\NewDocumentCommand\setMentorAEN{m}{\tl_const:Nn \MentorA_EN {#1}}
\NewDocumentCommand\setMentorATitle{m}{\tl_const:Nn \MentorATitle {#1}}
\NewDocumentCommand\setMentorATitleEN{m}{\tl_const:Nn \MentorATitle_EN {#1}}
\NewDocumentCommand\setMentorB{m}{\tl_const:Nn \MentorB {#1}}
\NewDocumentCommand\setMentorBEN{m}{\tl_const:Nn \MentorB_EN {#1}}
\NewDocumentCommand\setMentorBTitle{m}{\tl_const:Nn \MentorBTitle {#1}}
\NewDocumentCommand\setMentorBTitleEN{m}{\tl_const:Nn \MentorBTitle_EN {#1}}
\NewDocumentCommand\setSubmitDate{m}{\tl_const:Nn \SubmitDate {#1}}
% 拼合标题
......@@ -41,7 +50,8 @@
\coverbox:n {\hfill}
& \cover_underline:nn {250pt}{\songti\Major}\\
\int_case:nn {\TitleLength}
% 标题换行
\int_case:nn {\nju@titlelength}
{
{ 1 } {
\coverbox:n {\hfill}
......@@ -71,19 +81,19 @@
\end{tabular}\\
\begin{tabular}{p{4.2em}cp{4.2em}c}
\coverbox:n {\hfill}
& \cover_underline:nn {90pt}{\Mentor}
& \cover_underline:nn {90pt}{\MentorA}
& \coverbox:n {\hfill}
& \cover_underline:nn {90pt}{\MentorATitle}\\
% 第二导师
\ifnju@secondsupervisor
\coverbox:n {\hfill\hfill\hfill}
& \cover_underline:nn {90pt}{\MentorB}
& \coverbox:n {\hfill}
& \cover_underline:nn {90pt}{\MentorTitle}\\
& \cover_underline:nn {90pt}{\MentorBTitle}\\
\fi
\end{tabular}\\
% % 第二导师
% \ifnjut@title@twosupervisors
% \begin{tabular}{p{4.2em}cp{4.2em}c}
% \coverbox:n {\njut@cap@cover@secondsupervisor}
% & \njutunderline[90pt]{\songti\njut@value@secondsupervisor}
% & \coverbox:n {\njut@cap@cover@secondsupervisortitle}
% & \njutunderline[90pt]{\songti\njut@value@secondsupervisortitle}\\
% \end{tabular}
% \fi
\begin{tabular}{p{4.2em}c}
\coverbox:n {\hfill\hfill\hfill}
& \cover_underline:nn {250pt}{\SubmitDate}\\
......@@ -91,10 +101,10 @@
}
% 判断类型
\str_if_eq:eeTF {\Degree} {UG}
\str_if_eq:eeTF {\nju@degree} {UG}
{\tl_const:Nn \Degreename {\hfill\hfill }}{}
\str_if_eq:eeTF {\Type} {thesis}
\str_if_eq:eeTF {\nju@type} {thesis}
{\tl_const:Nn \typename {\Degreename\hfill\hfill\hfill}}
{\tl_const:Nn \typename {\Degreename\hfill\hfill\hfill}}
......
......@@ -160,8 +160,9 @@
\setCJKfamilyfont{zhkai}{方正楷体简体}[AutoFakeBold=2.17]
}
% 根据操作系统选择相应字体
\ifUseSysFont
% 字体判断
\ifnju@systemfont
% 根据操作系统自动选择相应字体
% 检测是否是 Windows
\sys_if_platform_windows:TF
{
......@@ -181,30 +182,23 @@
\set_chinese_fontset_fandol
}
}
\else% 如果用户需要自定义
% tl_case:Nn 只能实现宏和宏之间的比较,不能直接实现字符串和宏的比较,无奈出此下策,希望之后能找到更优雅的写法
\tl_const:Nn \usingwindows {windows}
\tl_const:Nn \usingmacos {macos}
\tl_const:Nn \usingfandol {fandol}
\tl_const:Nn \usinggyre {gyre}
\tl_const:Nn \usingfounder {founder}
\tl_const:Nn \usingnoto {noto}
\tl_const:Nn \usingnull {null}
\tl_case:Nn {\CustomEnFont}
\else% 如果用户需要自定义字体
% 此处需要使用\str_case_e而不是\str_case使宏展开为字符串
\str_case_e:nn { \nju@customlatinfont }
{
\usingwindows{\set_latin_fontset_windows}
\usingmacos{\set_latin_fontset_macos}
\usinggyre{\set_latin_fontset_gyre}
\usingnull{}
{ windows } { \set_latin_fontset_windows }
{ macos} { \set_latin_fontset_macos }
{ gyre } { \set_latin_fontset_gyre }
{ null } {}
}
\tl_case:Nn {\CustomZhFont}
\str_case_e:nn { \nju@customchinesefont }
{
\usingwindows{\set_chinese_fontset_windows}
\usingmacos{\set_chinese_fontset_macos}
\usingfandol{\set_chinese_fontset_fandol}
\usingfounder{\set_chinese_fontset_founder}% 使用方正字体
\usingnoto{\set_chinese_fontset_noto}% 使用思源宋体+思源黑体
\usingnull{}
{ windows } { \set_chinese_fontset_windows }
{ macos} { \set_chinese_fontset_macos }
{ gyre } { \set_chinese_fontset_gyre }
{ founder } { \set_chinese_fontset_founder }
{ noto } { \set_chinese_fontset_noto }
{ null } {}
}
\fi
% 选择其他字体,请确保相应字体已安装
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment