Skip to content

Commit

Permalink
Merge pull request #75 from PlexusChen/master
Browse files Browse the repository at this point in the history
Times New Roman fonts setting, draft option
  • Loading branch information
mengchaoheng authored Dec 5, 2024
2 parents ea5b09f + 4b203f5 commit 0489ec4
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 56 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ latex和office在写论文、写slides时只是不同的工具,就像是两把

2.使用TeXstudio,首次编译建议从主文件`scutthesis.tex`开始编译,首先在`TeXstudio的Options->Configure TeXstudio->build`中,编译器(Dufault Compiler)选择`XeLaTeX`,默认文献工具(Default Bibliography Tool)选`Biber`,构建并查看(build & view) 按照`scutthesis.pdf`中的图2-1进行设置(点击右侧扳手符号进行设置,分别选择`recompile-bibliography``Defualt compiler``Defualt Viewer`并点add到右侧栏中),也可以使用默认的Compile & View,只不过此时不会自动更新参考文献著录。(模板最初使用的编辑器,建议喜欢本地编辑、平时较少倒腾电脑、较少编程、追求稳定的同学使用)

3.使用编译脚本`all.bat`,记得关掉生成的pdf文档再双击`all.bat`。双击`clean.bat`删除临时文件。(此方法仅支持win,且多年未维护,但维护起来应该很简单,记事本打开`all.bat`编辑一下命令即可,具体命令可百度)
3.在Windows平台,使用编译脚本`all.bat`,记得关掉生成的pdf文档再双击`all.bat`。双击`clean.bat`删除临时文件。在Linux平台,执行`bash all.bat`进行编译,`bash clean.bat`清理临时文件。(此方法多年未维护,但维护起来应该很简单,记事本打开`all.bat`编辑一下命令即可,具体命令可百度)

4.使用overleaf,只需要在overleaf网页设置为XeLaTeX的编译方式即可。推荐无编程基础、不喜欢GitHub且能接受在线编辑的同学使用。又可以分为三种操作方法,选择你觉得最顺手的:

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion clean.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
del *.aux *.lo? *.toc *.ind *.inx *.gls *.glo *.ist *.idx *.ilg *.out *.bak *.bbl *.brf *.blg *.dvi *.ps *.xdv *.aux *.bcf *.run.xml *.synctex.gz
del *.aux *.lo? *.toc *.ind *.inx *.gls *.glo *.ist *.idx *.ilg *.out *.bak *.bbl *.brf *.blg *.dvi *.ps *.xdv *.aux *.bcf *.run.xml *.synctex.gz *.fdb_latexmk *.fls *.hd
18 changes: 11 additions & 7 deletions scutthesis.cls → dependencies/scutthesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesClass{scutthesis}[2011/03/31 2.0.1 The LaTeX class for the thesis of South China University of Technology]
\ProvidesClass{dependencies/scutthesis}[2011/03/31 2.0.1 The LaTeX class for the thesis of South China University of Technology]

%% import global options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -46,7 +46,7 @@
%% 加载几个常用的sty packages
\RequirePackage{ifpdf}
\RequirePackage{ifthen}
% \RequirePackage{doc} % delete for Package hypdoc Warning: hyperref has been loaded before with option 'hyperindex' enabled.
\RequirePackage{doc}
\RequirePackage{keyval}
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage{indentfirst}
Expand All @@ -59,8 +59,8 @@
%% 设置页面布局
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[left=2.5cm,right=2.5cm,bottom=2.5cm,top=2.5cm,%设置页面上下左右各为25mm
headheight=1.5cm,%页眉所占高度
footskip=1cm %页脚所占高度
headheight=1.5cm,%页眉所占高度
footskip=1cm %页脚所占高度
]{geometry}

%% 字体设置
Expand All @@ -71,10 +71,10 @@
%\@ifpackagelater {xeCJK} { 2008/12/29 }
\RequirePackage{CJKnumb} % used in recent TEX distribution
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-by MCH
\RequirePackage{xCJKnumb} %中文编号如第一章的“一”,利用xCJKnumb设置
\RequirePackage{dependencies/xCJKnumb} %中文编号如第一章的“一”,利用xCJKnumb设置
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\punctstyle{kaiming}
\setmainfont[Mapping=tex-text]{Times New Roman}%\rmfamily 使用的字体,默认英文和数字的字体。
% \setmainfont[Mapping=tex-text]{Times New Roman}%\rmfamily 使用的字体,默认英文和数字的字体。
\XeTeXlinebreaklocale "zh" %采用中文断行方式
\XeTeXlinebreakskip = 0pt plus 1pt %字元间可加入0pt~1pt 的弹性间距,这样才能排出左右对齐的段落。

Expand Down Expand Up @@ -300,6 +300,10 @@
\itemsep \parsep
\partopsep \p@ \@plus\z@ \@minus\p@}

\newenvironment{bracketedenum}
{\begin{enumerate}[topsep=0pt, itemsep=0pt, parsep=0pt, partopsep=0pt, leftmargin=0pt, itemindent=44pt, labelsep=6pt, listparindent=24pt, label=(\arabic*)]}
{\end{enumerate}}

%\RequirePackage{enumitem}
%\setlist{noitemsep,nolistsep,topsep=0pt,itemindent=1em}
%\setenumerate[1]{label=\arabic*), ref=\arabic*}
Expand All @@ -326,7 +330,7 @@



\RequirePackage{listings}
\RequirePackage[final]{listings}
\definecolor{mygray}{RGB}{245,245,245}
\lstset{
tabsize=4, %
Expand Down
2 changes: 1 addition & 1 deletion xCJKnumb.sty → dependencies/xCJKnumb.sty
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

\def\fileversion{4.7.0}
\def\filedate{2006/10/17}
\ProvidesPackage{xCJKnumb}[\filedate\space\fileversion]
\ProvidesPackage{dependencies/xCJKnumb}[\filedate\space\fileversion]

% we suppress any unwanted spaces produced by linefeeds.

Expand Down
101 changes: 55 additions & 46 deletions scutthesis.tex
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
\documentclass[unicode,master]{scutthesis} % 草稿封面,硕士则添加选项master,博士则去掉。使用正式封面时注释该行
% \documentclass[unicode,master,pdfcover]{scutthesis} % % 论文正式封面,pdfcover为可选项,终稿再添加,使用草稿封面时注释该行
\usepackage{fontspec,color,array,longtable,graphicx}
\usepackage{anyfontsize} %消除字体警告
\usepackage{enumitem}
% 草稿不显示图片,显示图片则去掉draft选项,硕士添加选项master,博士则去掉。使用正式封面时注释该行
\documentclass[unicode,master,draft]{dependencies/scutthesis} % 草稿
% \documentclass[unicode,master,pdfcover]{dependencies/scutthesis} % 正式

%% 加载各种宏包
\usepackage{fontspec, color, array, longtable}
\usepackage{anyfontsize} % 消除字体警告
\usepackage{enumitem} % 加载枚举设置包

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%——by MCH
%编译范围
% \includeonly{subcontent/chapter04}
%参考文献设置
\usepackage[backend=biber,style=gb7714-2015,gbalign=gb7714-2015,gbpub=false,gbnamefmt = lowercase]{biblatex}
\addbibresource[location=local]{dependencies/MyLibrary.bib} % 如果在其他盘,改为相对路径。比如F盘,改为:F/MyLibrary.bib
\addbibresource[location=local]{dependencies/mybibfile2.bib} % 无论什么来源的bib文件,只要由参考文献的BibTeX组成,都可以使用此模板。参考文献的BibTeX获取方法可百度
%页眉页脚设置
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage{xunicode}

%% 设置Times New Roman字体
% \rmfamily 使用的字体,默认英文和数字的字体。
\usepackage{mathptmx} % 加载公式的TIMES字体
\setmainfont[Mapping=tex-text]{Times New Roman}
% 如果系统缺少Times New Roman字体,解压dependencies目录下的TIMES.tar.gz,使用下面的命令
% \setmainfont[Mapping=tex-text, Path=./dependencies/, BoldFont=TIMESBD.TTF, ItalicFont=TIMESI.TTF]{TIMES.TTF}

%% 参考文献设置
\usepackage[backend=biber,style=gb7714-2015,gbalign=gb7714-2015,gbpub=false,gbnamefmt=lowercase]{biblatex} % 设置参考文献格式
\addbibresource[location=local]{biblibrary/MyLibrary.bib} % 如果在其他盘,改为绝对路径。比如F盘,改为:F/MyLibrary.bib
\addbibresource[location=local]{biblibrary/mybibfile2.bib} % 无论什么来源的bib文件,只要由参考文献的BibTeX组成,都可以使用此模板。参考文献的BibTeX获取方法可百度

%% 页眉页脚设置
\usepackage{fancyhdr} % 设置页眉和页脚的宏包
\usepackage{listings} % 代码列表的宏包
\usepackage{xunicode} % Unicode支持的宏包
\renewcommand{\lstlistingname}{列表}
\pagestyle{fancy}
\fancyfoot[C]{\headfont\thepage}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhead[RE]{}
\fancyhead[RO]{}
\fancyhead[LE]{}
\fancyhead[LO]{}
\fancyhead[CO]{\headfont{\leftmark}}
\fancyhead[CE]{\headfont{华南理工大学硕士学位论文}}%
\renewcommand{\headrulewidth}{1.5pt}
\renewcommand{\footrulewidth}{0pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[unicode=true,bookmarks=true,bookmarksnumbered=true,bookmarksopen=false,breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=true]{hyperref}
\pagestyle{fancy} % 使用fancy风格的页眉页脚
\fancyfoot[C]{\headfont\thepage} % 设置页脚中间部分显示页码
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ #1}{}} % 设置章标题标记
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} % 设置节标题标记
% 清空页眉左右侧的内容
\fancyhead[RE]{} \fancyhead[RO]{} \fancyhead[LE]{} \fancyhead[LO]{}
\fancyhead[CO]{\headfont{\leftmark}} % 页眉中间部分设置为左书签内容
\fancyhead[CE]{\headfont{华南理工大学硕士学位论文}}% 页眉中间部分设置为固定字符串
\renewcommand{\headrulewidth}{1.5pt} % 设置页眉下划线的宽度
\renewcommand{\footrulewidth}{0pt} % 设置页脚上划线的宽度为0,即不显示

%% 超链接设置
\usepackage[unicode=true,bookmarks=true,bookmarksnumbered=true,bookmarksopen=false,breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=true,draft=false]{hyperref}
\hypersetup{pdftitle={LaTeX模板使用说明},
pdfauthor={姓名},
pdfsubject={华南理工大学硕士学位论文},
%% pdfsubject={华南理工大学博士学位论文},
pdfkeywords={PDF关键字1;PDF关键字2},
pdfsubject={华南理工大学硕士学位论文},
%% pdfsubject={华南理工大学博士学位论文},
pdfkeywords={PDF关键字1;PDF关键字2},
%% linkcolor=black, anchorcolor=black, citecolor=black, filecolor=black, menucolor=black, urlcolor=black, pdfstartview=FitH}% 黑白,提交版
linkcolor=blue, anchorcolor=black, citecolor=red, filecolor=magenta, menucolor=red, urlcolor=magenta, pdfstartview=FitH}% 彩色

%% 自定义宏
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{\texorpdfstring%
Expand All @@ -45,34 +58,30 @@
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\makeatother
\begin{document}
%%%%%%%%%%%%%草稿封面设置%%%%%%%%%%%%%使用“正式封面”时不需要理会这部分
\title{LaTeX模板使用说明}
\author{作者姓名}
\supervisor{指导教师:xxx\ 教授}
\institute{华南理工大学}
\date{2020年5月20日}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\maketitle
\frontmatter %此后为罗马数字页码,页面类型为plain
\include{subcontent/abstract} % 中英文摘要
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% 草稿封面设置(使用“正式封面”时不需要理会这部分)
\title{LaTeX模板使用说明} % 论文标题
\author{作者姓名} % 作者姓名
\supervisor{指导教师:xxx\ 教授} % 指导教师
\institute{华南理工大学} % 所属研究机构
\date{2020年5月20日} % 日期

%% document
\begin{document}
% 目录、表格目录、插图目录这几个字本身的大纲级别是一级的,即和章名有相同的字号字体。目录表的内容通过titletoc宏包在。cls文件设置了。
%\cleardoublepage % pdfbookmark可能需要这一条才能正常工作
\pdfbookmark{\contentsname}{toc} %为目录添加pdf文件书签
\tableofcontents %目录
% \listoffigures %插图目录(可选)
% \listoftables %表格目录(可选)
\listoffigures %插图目录(可选)
\listoftables %表格目录(可选)

\begingroup
\renewcommand*{\addvspace}[1]{}
\newcommand{\loflabel}{图}
\renewcommand{\numberline}[1]{\loflabel~#1\hspace*{1em}}
\listoffigures

\newcommand{\lotlabel}{表}
\renewcommand{\numberline}[1]{\lotlabel~#1\hspace*{1em}}
\listoftables
\endgroup

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down

0 comments on commit 0489ec4

Please sign in to comment.