Newer
Older
%
%
% \subsection{参考文献}
%
% 符合GB7714-2015规范。使用\hologo{biber}作为\hologo{BibTeX}后端。需要使用|biber|命令手动编译才会显示
%
% \begin{function}{\addbibresource}
% \begin{syntax}
% \tn{addbibresource}\Arg{文件}
% \end{syntax}
% 默认参考文献存储于主目录下的\file{njuthesis.bib},直接向其中粘贴新的参考文献即可。如果希望额外添加参考文献列表,可以在导言区中多次调用\tn{addbibresource}命令。注意本命令与|\bibliography{bibfile1,bibfile2}|不同,不可以用逗号分隔多个输入文件,且必须使用带扩展名的完整文件名。
% \end{function}
%
% 南京大学信息化建设管理服务中心已购买\href{https://itsc.nju.edu.cn/EndNote/list.htm}{EndNote}供全校师生免费试用,最新版为EndNote 20。
%
%
%
%
%
%
% \href{https://www.zotero.org/}{Zotero}是一款免费的文献管理软件,支持所有桌面平台。
%
% 在保持Zotero程序运行的情况下,点击浏览器工具栏的Zotero Connector插件即可自动从网页抓取参考文件信息。Zotero也有知网插件
%
% \subsubsection{文段内引用}
%
% \begin{function}{\cite,\citeauthor,\citeyear}
% \begin{syntax}
% \tn{cite}\Arg{文献}
% \tn{citeauthor}\Arg{文献}
% \tn{citeyear}\Arg{文献}
% \end{syntax}
% 引用文献
% \end{function}
% \begin{function}[added=2021-09-24]{njuviolet,njumagenta,njublue,njuyellow}
% \begin{syntax}
% \tn{color}\Arg{颜色}
% \end{syntax}
% 定义并使用南京大学视觉形象规范化标准中给定的四种标准色:
%
% {\color{njuviolet}紫色}\hspace{1em}{\color{njumagenta}洋红}\hspace{1em}
% {\color{njublue}蓝色}\hspace{1em}{\color{njuyellow}黄色}
%
% \end{function}
%
% \begin{function}[added=2021-09-24]{\njuemblem}
% \begin{syntax}
% \tn{njuemblem}\oarg{颜色}\Arg{宽度}\Arg{高度}
% \end{syntax}
%
% 生成指定颜色和大小的南京大学校徽
% \end{function}
%
% \begin{function}[added=2021-09-24]{\njuname}
% \begin{syntax}
% \tn{njuname}\oarg{颜色}\Arg{宽度}\Arg{高度}
% \tn{njuname*}\oarg{颜色}\Arg{宽度}\Arg{高度}
% \end{syntax}
%
% 生成指定颜色和大小的南京大学校名,加星号的为英文校名
% \end{function}
%
% \begin{function}[added=2021-09-24]{\njumotto}
% \begin{syntax}
% \tn{njumotto}\oarg{颜色}\Arg{宽度}\Arg{高度}
% \end{syntax}
%
% 生成指定颜色和大小的南京大学校训
% \end{function}
%
%
% \begin{function}[added=2021-09-24]{\njuspirit}
% \begin{syntax}
% \tn{njuspirit}\oarg{颜色}\Arg{宽度}\Arg{高度}
% \end{syntax}
%
% 生成指定颜色和大小的南京大学校徽
% \end{function}
%
%
%
% \end{documentation}
%
% \begin{implementation}
%
% @@在l3docstrip中表示名空间,在生成cls时会被相应字段替换,譬如在\pkg{njuthesis}中|@@=nju|。
% \begin{variable}{\l_@@_info_degree_tl,\l_@@_info_type_tl}
% 用于存储学位名称的变量,注意宏的命名,l代表局部变量,g代表全局变量
% \begin{macrocode}
\tl_new:N \l_@@_info_degree_tl
\tl_new:N \l_@@_info_type_tl
% \end{macrocode}
% \end{variable}
% \begin{variable}{\g_@@_latin_fontset_tl,\g_@@_cjk_fontset_tl}
% 用于存储所使用字体名称的全局变量
% \begin{macrocode}
\tl_new:N \g_@@_latin_fontset_tl
\tl_new:N \g_@@_cjk_fontset_tl
% \end{macrocode}
% \end{variable}
%
% \end{macrocode}
%
% \begin{macro}{degree}
% 学位类型。
% \begin{macrocode}
degree .choices:nn =
{ ug, mg, mg, phd }
{ \tl_set_eq:NN \l_@@_info_degree_tl \l_keys_choice_tl },
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{type}
% 论文类型。
% \begin{macrocode}
type .choices:nn =
{ thesis, design }
{ \tl_set_eq:NN \l_@@_info_type_tl \l_keys_choice_tl },
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{nlcover}
% 是否需要国家图书馆封面的设置。
% \begin{macrocode}
nlcover .bool_set:N = \g_@@_nlcover_bool,
nlcover .initial:n = false,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{customlatinfont,customchinesefont}
% 定义字体选项
% \begin{macrocode}
customlatinfont .choices:nn =
{ gyre, macos, windows, none }
{ \tl_set_eq:NN \g_@@_latin_fontset_tl \l_keys_choice_tl },
customchinesefont .choices:nn =
{ fandol, founder, macos, noto, windows, none }
{ \tl_set_eq:NN \g_@@_cjk_fontset_tl \l_keys_choice_tl },
%
% \begin{macro}{\ProcessKeysOptions}
% 在定义完全部设置以后从tex文件导言区输入参数
% \begin{macrocode}
\ProcessKeysOptions { nju }
% \end{macrocode}
% \end{macro}
%
% \end{macrocode}
%
% \begin{macro}{info/TitleA,info/TitleB,info/TitleC,info/Title*}
% 题目
% \begin{macrocode}
TitleA .tl_set:N = \l_@@_info_title_a_tl,
TitleB .tl_set:N = \l_@@_info_title_b_tl,
TitleC .tl_set:N = \l_@@_info_title_c_tl,
Title* .tl_set:N = \l_@@_info_title_en_tl,
% \begin{macro}{info/Grade,info/StudentID,info/StudentName,info/StudentName*}
Grade .tl_set:N = \l_@@_info_grade_tl,
StudentID .tl_set:N = \l_@@_info_id_tl,
StudentName .tl_set:N = \l_@@_info_author_tl,
StudentName* .tl_set:N = \l_@@_info_author_en_tl,
% \begin{macro}{info/Department,info/Department*,info/Major,info/Major*,info/Field,info/Field*}
Department .tl_set:N = \l_@@_info_dept_tl,
Department* .tl_set:N = \l_@@_info_dept_en_tl,
Major .tl_set:N = \l_@@_major_tl,
Major* .tl_set:N = \l_@@_major_en_tl,
Field .tl_set:N = \l_@@_field_tl,
Field* .tl_set:N = \l_@@_field_en_tl,
% \begin{macro}{info/SupervisorA,info/SupervisorA*,info/SupervisorATitle,info/SupervisorATitle*}
SupervisorA .tl_set:N = \l_@@_info_supv_a_tl,
SupervisorA* .tl_set:N = \l_@@_info_supv_a_en_tl,
SupervisorATitle .tl_set:N = \l_@@_info_supv_a_title_tl,
SupervisorATitle* .tl_set:N = \l_@@_info_supv_a_title_en_tl,
% \begin{macro}{info/SupervisorB,info/SupervisorB*,info/SupervisorBTitle,info/SupervisorBTitle*}
SupervisorB .tl_set:N = \l_@@_info_supv_b_tl,
SupervisorB* .tl_set:N = \l_@@_info_supv_b_en_tl,
SupervisorBTitle .tl_set:N = \l_@@_info_supv_b_title_tl,
SupervisorBTitle* .tl_set:N = \l_@@_info_supv_b_title_en_tl,
% \begin{macro}{info/DefendDate,info/ReviewerChairman,info/ReviewerA,info/ReviewerB,info/ReviewerC,info/ReviewerD}
% 答辩 TODO: 用clist处理答辩委员会成员名称
DefendDate .tl_set:N = \l_@@_defend_date_tl,
ReviewerChairman .tl_set:N = \l_@@_info_chairman_tl,
ReviewerA .tl_set:N = \l_@@_info_reviewer_a_tl,
ReviewerB .tl_set:N = \l_@@_info_reviewer_b_tl,
ReviewerC .tl_set:N = \l_@@_info_reviewer_c_tl,
ReviewerD .tl_set:N = \l_@@_info_reviewer_d_tl,
% \begin{macro}{info/Classification,info/SecurityLevel,info/UDC,info/SupervisorContact}
SecurityLevel .tl_set:N = \l_@@_info_seclv_tl,
UDC .tl_set:N = \l_@@_info_udc_tl,
SupervisorContact .tl_set:N = \l_@@_info_supv_cont_tl,
\NewDocumentCommand \njusetup { m }
{ \keys_set:nn { nju } { #1 } }
% \end{macrocode}
%
\LoadClass[
a4paper,
twoside,
UTF8,
scheme=chinese,
% \end{macrocode}
% 关于行距,\hologo{LaTeX}默认1.2行距,word默认行距是1.3,要求1.5倍word行距,故
% \[ 1.5\times\frac{1.3}{1.2} = 1.625\]
% \begin{macrocode}
linespread=1.625,
% \end{macrocode}
% 默认不载入任何字体,供模板自行设置
% \begin{macrocode}
fontset=none,
zihao=-4
]{ctexbook}[2018/04/01]
\RequirePackage
{
geometry,
caption,
floatrow,
setspace,
lastpage,
emptypage,
fancyhdr,
}
\RequirePackage[titles]{tocloft}
\RequirePackage[hyphens]{url} % generate better linebreaks in the url
% \begin{macrocode}
\RequirePackage{hologo}
% \end{macrocode}
%
% \begin{macrocode}
% Required to prevent page break right after a sectioning command
% \RequirePackage{needspace}
% \RequirePackage{xspace} % Better print trailing whitespace
% 针对编译引擎,使用不同的宏包构建可以对中文正常换行的下划线命令。\pkg{lua-ul}中需要在结尾使用\tn{null}保护尾部空白。
% 数学,\pkg{amsmath}必须在\pkg{unicode-math}前加载。
% \pkg{unicode-math}指定了\hologo{XeTeX}和\hologo{LuaTeX}下所使用的数学字体。
% 用于配置数学环境的\pkg{mathtools}会与\pkg{unicode-math}发生冲突,此处手动消除其警告。
\RequirePackage[hidelinks,bookmarksnumbered=true]{hyperref}
\RequirePackage[capitalise,nameinlink,noabbrev]{cleveref}
% \end{macrocode}
%
% 载入南京大学识别视觉系统。
% \begin{macrocode}
\RequirePackage{njuvisual}
% \end{macrocode}
%
\RequirePackage{blindtext,zhlipsum}
% \RequirePackage{showframe}
% \end{macrocode}
% \end{variable}
%
% 判断用户是否自定义了中英文字体,如果其中任意一种未被定义,
% \begin{macrocode}
\tl_if_empty:NTF \g_@@_latin_fontset_tl
% \end{macrocode}
%
% 进行系统检测。
% 检测 Windows 的命令由\pkg{l3kernal}提供,
% 检测 macOS 的命令由\pkg{ctex}提供,
% 这两种情况外的系统被判断为 Linux,一律使用自由字体。
% \begin{macrocode}
{
\sys_if_platform_windows:TF
{
\tl_set:Nn \g_@@_latin_fontset_tl { windows }
\tl_set:Nn \g_@@_cjk_fontset_tl { windows }
}
{
\ctex_if_platform_macos:TF
{
\tl_set:Nn \g_@@_latin_fontset_tl { macos }
\tl_set:Nn \g_@@_cjk_fontset_tl { macos }
}
{
\tl_set:Nn \g_@@_latin_fontset_tl { gyre }
\tl_set:Nn \g_@@_cjk_fontset_tl { fandol }
}
}
}
% \end{macrocode}
%
%
% \begin{macro}{\@@_load_latin_font_windows:}
% Windows 西文字体
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_latin_font_windows:
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Courier~New}[Scale=MatchLowercase]
}
%
% \begin{macro}{\@@_load_latin_font_macos:}
\cs_new_protected:Npn \@@_load_latin_font_macos:
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Menlo}[Scale=MatchLowercase]
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
\cs_new_protected:Npn \@@_load_latin_font_gyre:
{
\setmainfont{texgyretermes}[
Extension=.otf,
UprightFont=*-regular,
BoldFont=*-bold,
ItalicFont=*-italic,
BoldItalicFont=*-bolditalic]
\setsansfont{texgyreheros}[
Extension=.otf,
UprightFont=*-regular,
BoldFont=*-bold,
ItalicFont=*-italic,
BoldItalicFont=*-bolditalic]
\setmonofont{texgyrecursor}[
Extension=.otf,
UprightFont=*-regular,
BoldFont=*-bold,
ItalicFont=*-italic,
BoldItalicFont=*-bolditalic,
Scale=MatchLowercase,
Ligatures=CommonOff]
\cs_new_protected:Npn \@@_load_cjk_font_windows:
{
\setCJKmainfont{SimSun}[
AutoFakeBold=2.17,
ItalicFont=KaiTi]
\setCJKsansfont{SimHei}
\setCJKmonofont{FangSong}
\setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17]
\setCJKfamilyfont{zhhei}{SimHei}
\setCJKfamilyfont{zhfs}{FangSong}
\setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17]
% \setCJKfamilyfont{zhnewhei}{Microsoft~YaHei}[
% BoldFont=Microsoft~YaHei~Bold]
% macOS 字体。
% TODO: 参考CTeX手册第9节 LuaLATEX 下的中文支持方式解决 issue \#5 问题。
\cs_new_protected:Npn \@@_load_cjk_font_macos:
{
% 移除 does not contain script "CJK" 警告
\msg_redirect_name:nnn {fontspec} {no-script} {info}
\setCJKmainfont{Songti~SC~Light}[
BoldFont=Songti~SC~Bold,
ItalicFont=Kaiti~SC,
BoldItalicFont=Kaiti~SC~Bold]
\setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium]
\setCJKmonofont{STFangsong}
\setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold]
\setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium]
\setCJKfamilyfont{zhfs}{STFangsong}
%
% \begin{macro}{\@@_load_cjk_font_fandol:}
% Fandol 字体
\cs_new_protected:Npn \@@_load_cjk_font_fandol:
{
% 移除 does not contain script "CJK" 警告
\msg_redirect_name:nnn {fontspec} {no-script} {info}
\setCJKmainfont{FandolSong-Regular}[
Extension=.otf,
BoldFont=FandolSong-Bold,
ItalicFont=FandolKai-Regular]
\setCJKsansfont{FandolHei-Regular}[
Extension=.otf,
BoldFont=FandolHei-Bold]
\setCJKmonofont{FandolFang-Regular}[Extension=.otf]
\setCJKfamilyfont{zhsong}{FandolSong-Regular}[
Extension=.otf,
BoldFont=FandolSong-Bold]
\setCJKfamilyfont{zhhei}{FandolHei-Regular}[
Extension=.otf,
BoldFont=FandolHei-Bold]
\setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf]
\setCJKfamilyfont{zhkai}{FandolKai-Regular}[
Extension=.otf,
AutoFakeBold=2.17]
%
% \begin{macro}{\@@_load_cjk_font_founder:}
% 方正字库(简繁扩展)
% FZYouHK_508R \href{http://www.foundertype.com/index.php/FontInfo/index/id/244}{方正悠黑508R} 设计师非商免费,
% FZYouHK_511M \href{http://www.foundertype.com/index.php/FontInfo/index/id/244}{方正悠黑511M} 设计师非商免费
\cs_new_protected:Npn \@@_load_cjk_font_founder:
{
BoldFont=FZXBSK,% 方正小标宋
ItalicFont=FZKTK]% 方正楷体
\setCJKsansfont{FZXH1K}[% 方正细黑一
BoldFont=FZHTK]% FZHTK 方正黑体
\setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋
\setCJKfamilyfont{zhsong}
{FZSSK}[
Extension=.ttf,
BoldFont=FZXBSK]
\setCJKfamilyfont{zhhei}
{FZHTK}[
Extension=.ttf,
AutoFakeBold=2.17]
\setCJKfamilyfont{zhfs}
{FZFSK}[Extension=.ttf]
\setCJKfamilyfont{zhkai}
{FZKTK}[Extension=.ttf]
% \setCJKfamilyfont{zhnewhei}
% {FZYouHK_508R}[% 方正悠黑508R
% Extension=.ttf,
% BoldFont=FZYouHK_511M]% 方正悠黑511M
\cs_new_protected:Npn \@@_load_cjk_font_noto:
{
UprightFont=NotoSerifSC-Regular,
BoldFont=NotoSerifSC-Bold,
ItalicFont=NotoSerifSC-Regular,
BoldItalicFont=NotoSerifSC-Bold,
UprightFont=NotoSansSC-Regular,
BoldFont=NotoSansSC-Bold,
ItalicFont=NotoSansSC-Regular,
BoldItalicFont=NotoSansSC-Bold,
\setCJKfamilyfont{zhsong}{Noto~Serif~SC}
\setCJKfamilyfont{zhhei}{Noto~Sans~SC}
\setCJKfamilyfont{zhfs}
{FZFSK}[Extension=.ttf]
\setCJKfamilyfont{zhkai}
{FZKTK}[Extension=.ttf]
\use:c { @@_load_latin_font_ \g_@@_latin_fontset_tl : }
\use:c { @@_load_cjk_font_ \g_@@_cjk_fontset_tl : }
% \end{macrocode}
% 自行定义C\hologo{TeX}中的四类字体命令。
% \begin{macrocode}
\NewDocumentCommand\songti{}{\CJKfamily{zhsong}}
\NewDocumentCommand\heiti{}{\CJKfamily{zhhei}}
\NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}}
\NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}}
% \end{macrocode}
%
% 载入设置的字体。
% \begin{macrocode}
% \setmathfont{STIXTwoMath-Regular}[Extension = .otf]
\setmathfont{XITSMath-Regular}[
BoldFont = XITSMath-Bold,
Extension = .otf]
% 使用\pkg{geometry}设置页边距。
% \begin{macrocode}
\geometry{
vmargin = 2.5 cm,
hmargin = 3.2 cm,
}
% \end{macrocode}
%
\fancypagestyle{njuplain}{%
\fancyhead{}
\fancyfoot[C]{\zihao{5}\thepage} % 页脚居中 五号新罗马体数字
}
\fancypagestyle{njuheadings}{%
\fancyhead{}
\fancyfoot[C]{\zihao{5}\thepage}
}
{
% the header line
\tl_set:Nn \headrulewidth {0pt}
% the footer line
\tl_set:Nn \footrulewidth {0pt}
\AtBeginDocument{\pagestyle{njuplain}\flushbottom} % 本科无页眉页脚
}
{
% the header line
\tl_set:Nn \headrulewidth {1pt}
% the footer line
\tl_set:Nn \footrulewidth {0pt}
\AtBeginDocument{\pagestyle{fancy}\flushbottom} % 研究生有页眉页脚
chapter/format = \zihao{4}\heiti\centering\selectfont,
chapter/beforeskip = 10pt,
chapter/afterskip = 60pt,
section/format = \zihao{4}\heiti\raggedright\selectfont,
subsection/format = \zihao{4}\heiti\raggedright\selectfont,
subsubsection/format = \zihao{4}\heiti\raggedright\selectfont,
\ctexset{
contentsname = 目录,
listfigurename = 插图清单,
listtablename = 表格清单,
%
% \pkg{tocloft}定制目录文字格式
% \begin{macrocode}
\cftsetpnumwidth{2em}
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}
\renewcommand{\cftchapdotsep}{\cftdotsep}
\setlength{\cftsecindent}{2em}
\setlength{\cftsubsecindent}{52pt}
\setlength{\cftsubsecnumwidth}{2em}
% \end{macrocode}
%
\raggedbottom
\begingroup
\ctexset{
contentsname = {目\hspace{2em}录},
chapter/format = {\centering\songti\bf\zihao{3}\selectfont},
}%
\chapter*{\contentsname}%
\endgroup
\addcontentsline{toc}{chapter}{\contentsname}
\vskip 20pt
\@starttoc{toc}%
}
% \end{macrocode}
%
% 重定义插图目录命令,修改标题格式并插入书签。
% \begin{macrocode}
\begingroup
\ctexset{
chapter/format = {\centering\songti\bf\zihao{3}\selectfont},
}%
\chapter*{\listfigurename}%
\endgroup
\addcontentsline{toc}{chapter}{\listfigurename}
\vskip 20pt
\@starttoc{lof}%
}
% \end{macrocode}
%
% 重定义表格目录命令,修改标题格式并插入书签。
% \begin{macrocode}
\begingroup
\ctexset{
chapter/format = {\centering\songti\bf\zihao{3}\selectfont},
}%
\chapter*{\listtablename}%
\endgroup
\addcontentsline{toc}{chapter}{\listtablename}
\vskip 20pt
\@starttoc{lot}%
}
{%
\chapter*{前言}
\addcontentsline{toc}{chapter}{前言}
{%
\chapter*{致谢}
\addcontentsline{toc}{chapter}{致谢}
\RequirePackage[
style=gb7714-2015,
%style=numeric-comp,
%citestyle=authortitle-icomp,
% citestyle=numeric-comp,
%bibstyle=authoryear,
% bibstyle=numeric,
sorting=none,
%sorting=nyt,
%sortcites=true,
%autocite=footnote,
backend=biber, % Compile the bibliography with biber
hyperref=true,
backref=false,
citecounter=true,
pagetracker=true,
citetracker=true,
ibidtracker=context,
autopunct=true,
autocite=plain,
% gbpub=false, % Uncomment if you do NOT want '[S.l. : s.n.]'
% in reference entries, GitHub Issue (#47)
% gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author
% names in reference entries, GitHub Issue (#23)
\AtEveryBibitem{
\clearfield{abstract}
\clearfield{issn}
\clearfield{isbn}
\clearfield{archivePrefix}
\clearfield{arxivId}
\clearfield{pmid}
\clearfield{eprint}
\ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}}
% \ifentrytype{book}{\clearfield{doi}}{}
}
\crefname{figure}{图}{图}
\crefname{table}{表}{表}
% \crefname{equation}{公式}{公式}
\crefformat{chapter}{第#2#1#3章}
\crefformat{section}{第~#2#1#3~节}
\crefformat{subsection}{第~#2#1#3~小节}
\crefformat{subsubsection}{第~#2#1#3~小节}
\crefname{appendix}{附录}{附录}
% \crefname{definition}{定义}{定义}
% \crefname{axiom}{公理}{公理}
% \crefname{property}{性质}{性质}
% \crefname{proposition}{命题}{命题}
% \crefname{lemma}{引理}{引理}
% \crefname{corollary}{推论}{推论}
% \crefname{remark}{注解}{注解}
% \crefname{condition}{条件}{条件}
% \crefname{conclusion}{结论}{结论}
% \crefname{assumption}{假设}{假设}
\floatsetup[figure]{ % Captions for figures
capposition=bottom,%
margins=centering,%
floatwidth=\textwidth%
}
\floatsetup[table]{ % Captions for tables
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
}
%
% 图表标题样式
% \begin{macrocode}
\DeclareCaptionFont{songticap}{\zihao{5}\bf\songti}
\captionsetup{
font=small,%
labelfont=songticap,
textfont=songticap,
strut=no,%
hypcap=true, % Links point to the top of the figure
% indention=0pt, % Suppress indentation
% % parindent=0pt, % Suppress space between paragraphs
aboveskip=6pt, % Increase the space between the figure and the caption
belowskip=6pt, % Increase the space between the caption and the table
}
% \end{macrocode}
\floatsetup[lstlisting]{ % Captions for lstlistings
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
}
\lstset{
basicstyle=\ttfamily\linespread{1}\small\selectfont,
keywordstyle=\bfseries,% use bold style for keywords
commentstyle=\rmfamily\itshape,% use italic style for comments
stringstyle=\ttfamily,% 字符串风格
flexiblecolumns,% ?
numbers=left,% left-aligned numbering
showspaces=false,% hide markers for spaces
showstringspaces=false,
captionpos=t,% place the caption at the top
% frame=lrtb,% show all four sides of the frame
% linewidth=.8\textwidth,
% breakatwhitespace=true,
breaklines=true,
xleftmargin=2em,xrightmargin=2em,% set the width of the code environment
}
morekeywords={
begin, caption, label, mathrm, frac,
toprule, midrule, bottomrule, includegraphics}