Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cloustile/njuthesis
  • GGbond/njuthesis
  • caomeng/njuthesis
  • yilye/njuthesis
  • kopanswer/njuthesis
  • Dansen/njuthesis
  • junjimy/njuthesis
  • wuqizuo123/njuthesis
  • zxlll-/njuthesis
  • Michael/njuthesis
  • bcbhfz/njuthesis
  • LingDu/njuthesis
  • jiejiangwu/njuthesis
  • Tilnel/njuthesisundergraduate
  • nju-lug/nju-latex-templates/njuthesis
15 results
Show changes
Showing with 698 additions and 786 deletions
@article{preskill2018,
title = {Quantum {{Computing}} in the {{NISQ}} Era and Beyond},
author = {Preskill, John},
author+an = {1=thesisauthor},
date = {2018-08-06},
journaltitle = {Quantum},
volume = {2},
pages = {79},
publisher = {{Verein zur Förderung des Open Access Publizierens in den Quantenwissenschaften}},
doi = {10.22331/q-2018-08-06-79},
url = {https://quantum-journal.org/papers/q-2018-08-06-79/},
urldate = {2022-10-27},
langid = {british}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% njuthesis 示例模板 v1.4.2 2024-11-08
% https://github.com/nju-lug/NJUThesis
%
% 贡献者
% Yu XIONG @atxy-blip Yichen ZHAO @FengChendian
% Song GAO @myandeg Chang MA @glatavento
% Yilun SUN @HermitSun Yinfeng LIN @linyinfeng
% Yukai Chou @Muzimuzhi
%
% 许可证
% LaTeX Project Public License(版本 1.3c 或更高)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%---------------------------------------------------------------------
% 一些提升使用体验的小技巧:
% 1. 请务必使用 UTF-8 编码编写和保存本文档
% 2. 请务必使用 XeLaTeX 或 LuaLaTeX 引擎进行编译
% 3. 不保证接口稳定,写作前一定要留意版本号
% 4. 以百分号(%)开头的内容为注释,可以随意删除
%---------------------------------------------------------------------
%---------------------------------------------------------------------
% 请先阅读使用手册:
% http://mirrors.ctan.org/macros/unicodetex/latex/njuthesis/njuthesis.pdf
%---------------------------------------------------------------------
\documentclass[
% 模板选项(注意右端逗号):
%
% type = bachelor|master|doctor|postdoc, % 文档类型,默认为本科生
% degree = academic|professional, % 学位类型,默认为学术型
%
% nl-cover, % 是否需要国家图书馆封面,默认关闭
% decl-page, % 是否需要诚信承诺书或原创性声明,默认关闭
%
% 页面模式,详见手册说明
% draft, % 开启草稿模式
% anonymous, % 开启盲审模式
% minimal, % 开启最小化模式
%
% 单双面模式,默认为适合印刷的双面模式
% oneside, % 单面模式,无空白页
% twoside, % 双面模式,每一章从奇数页开始
%
% 字体设置,不填写则自动调用系统预装字体,详见手册
% fontset = win|mac|macoffice|fandol|none,
]{njuthesis}
% 模板选项设置,包括个人信息、外观样式等
% 较为冗长且一般不需要反复修改,我们把它放在单独的文件里
\input{njuthesis-setup.def}
% 自行载入所需宏包
% \usepackage{subcaption} % 嵌套小幅图像,比 subfig 和 subfigure 更新更好
% \usepackage{siunitx} % 标准单位符号
% \usepackage{physics} % 物理百宝箱
% \usepackage[version=4]{mhchem} % 绘制分子式
% \usepackage{listings} % 展示代码
% \usepackage{algorithm,algorithmic} % 展示算法伪代码
% 在导言区随意定制所需命令
% \DeclareMathOperator{\spn}{span}
% \NewDocumentCommand\mathbi{m}{\textbf{\em #1}}
% 开始编写论文
\begin{document}
%---------------------------------------------------------------------
% 封面、摘要、前言和目录
%---------------------------------------------------------------------
% 生成封面页
\maketitle
% 模板默认使用 \flushbottom,即底部平齐
% 效果更好,但可能出现 underfull \vbox 信息
% 以下命令用于抑制这些信息
\raggedbottom
\begin{abstract}
中文摘要
\end{abstract}
\begin{abstract*}
English abstract
\end{abstract*}
% 生成目录
\tableofcontents
% 生成图片清单
% \listoffigures
% 生成表格清单
% \listoftables
%---------------------------------------------------------------------
% 正文部分
%---------------------------------------------------------------------
\mainmatter
% 符号表
% 语法与 description 环境一致
% 两个可选参数依次为说明区域宽度、符号区域宽度
% 带星号的符号表(notation*)不会插入目录
% \begin{notation}[10cm]
% \item[DFT] 密度泛函理论 (Density functional theory)
% \item[DMRG] 密度矩阵重正化群 (Density-Matrix Reformation-Group)
% \end{notation}
% 建议将论文内容拆分为多个文件
% 即新建一个 chapters 文件夹
% 把每一章的内容单独放入一个 .tex 文件
% 然后在这里用 \include 导入,例如
% \include{chapters/introduction}
% \include{chapters/environments}
\chapter{引言}
\section{量子计算}
John Preskill 认为我们现在处于“含噪声的中型量子时代”。\cite{preskill2018}
量子位的不稳定性和有限的量子比特数量限制了量子计算机的复杂度和纠错能力。
%---------------------------------------------------------------------
% 参考文献
%---------------------------------------------------------------------
% 生成参考文献页
\printbibliography
%---------------------------------------------------------------------
% 致谢
%---------------------------------------------------------------------
\begin{acknowledgement}
感谢 \href{https://git.nju.edu.cn/nju-lug/lug-introduction}{LUG@NJU}
\end{acknowledgement}
%---------------------------------------------------------------------
% 学术简历
%---------------------------------------------------------------------
% 详见手册中“成果列表”一节
% \njuchapter{学术成果}
% \njupaperlist[攻读博士学位期间发表的学术论文]{preskill2018}
%---------------------------------------------------------------------
% 附录部分
%---------------------------------------------------------------------
% 附录部分使用单独的字母序号
\appendix
% 可以在这里插入补充材料
\chapter{正文中涉及的数据及源代码}
\dots
% 完工
\end{document}
% njuthesis 参数设置文件 v1.4.2 2024-11-08
% 一些提醒:
% 1. \njusetup 内部千万不要有空行
% 2. 使用英文半角逗号(,)分隔选项
% 3. 等于号(=)两侧的空格会被忽略
% 3.1. 为避免歧义,请用花括号({})包裹内容
% 4. 本科生无需填写的项目已被特别标注
% 5. 可以尽情删除本注释
% info 类用于录入个人信息
% 带*号的为对应英文字段
\njusetup[info]{
title = {第一行标题\\第二行标题\\第三行标题},
% 中文题目
% 直接填写标题就是自动换行
% 可以使用换行控制符(\\)手动指定换行位置
%
title* = {My Title in English},
% 英文题目
%
author = {姓名},
% 作者姓名
%
author* = {Ming Xing},
% 作者英文姓名
% 一般使用拼音
%
keywords = {我,就是,充数的,关键词},
% 中文关键词列表
% 使用英文半角逗号(,)分隔
%
keywords* = {Dummy,Keywords,Here,{It Is}},
% 英文关键词
% 使用英文半角逗号(,)分隔
%
grade = {2018},
% 年级
%
student-id = {181850195},
% 学号或工号
% 研究生请斟酌大小写字母格式
% 本模板并不会自动更正大小写
%
department = {化学化工学院},
department* = {School of Chemistry and Chemical Engineering},
% 院系
%
major = {化学},
major* = {Chemistry},
% 专业
%
% major = {封面专业,摘要专业},
% 研究生专业型学位可能遇到两处内容不一致的情况
%
supervisor = {导师姓名,教授},
supervisor*= {Professor My Supervisor},
% 导师全称
% 使用英文半角逗号(,)分隔中文姓名和职称
%
% supervisor-ii = {第二导师姓名,副教授},
% supervisor-ii* = {Associate professor My Second Supervisor},
% 第二导师全称
% 如果确实没有第二导师,不填写即可
%
submit-date = {2022-05-20},
% 提交日期
% 格式为 yyyy-mm-dd
% 不填就是编译当天日期
%
%
% 以下均为研究生项
%
% degree = {工程硕士},
% degree* = {Master of Engineering},
% 覆盖默认学位名称
%
field = {物理化学},
field* = {Physical Chemistry},
% 研究领域
%
chairman = {某某某~教授},
% 答辩委员会主席
% 推荐使用波浪号(~)分隔姓名和职称
%
reviewer = {
某某某~教授,
某某某~教授
},
%
% 答辩委员会成员
% 一般为四名,使用英文半角逗号(,)分隔
%
clc = {O643.12},
% 中国图书分类号
%
udc = {544.4},
% 国际图书分类号
%
secret-level = {公开},
% 密级
%
defend-date = {2022-05-21},
% 答辩日期
% 格式为 yyyy-mm-dd
% 不填就是编译当天日期
%
email = {xyz@smail.nju.edu.cn},
% 电子邮箱地址
% 只用于出版授权书
%
%
% 以下用于国家图书馆封面
confer-date = {2022-05-22},
% 学位授予日期
%
bottom-date = {2022-05-23},
% 封面底部日期
%
supervisor-contact = {
南京大学~
江苏省南京市栖霞区仙林大道163号
}
% 导师联系方式
}
% bib 类用于参考文献设置
\njusetup[bib]{
% style = numeric|author-year,
% 参考文献样式
% 默认为顺序编码制(numeric)
% 可选著者-出版年制(author-year)
%
resource = {njuthesis-sample.bib},
% 参考文献数据源
% 需要带扩展名的完整文件名
% 可使用逗号分隔多个文件
% 此条等效于 \addbibresource 命令
%
% option = {
% doi = false,
% isbn = false,
% url = false,
% eprint = false,
% 关闭部分无用文献信息
%
% refsection = chapter,
% 将参考文献表置于每章后
%
% gbnamefmt = lowercase
% 使用仅首字母大写的姓名
% }
% 额外的 biblatex 宏包选项
}
% image 类用于载入外置的图片
\njusetup[image]{
% path = {{./figure/}{./image/}},
% 图片搜索路径
%
nju-emblem = {nju-emblem},
nju-name = {nju-name},
% 校徽和校名图片路径
% 建议使用 PDF 格式的矢量图
% 使用外置图片有助于减少编译时间
% 空置时会自动使用 njuvisual 宏包绘制
%
% nju-emblem = {nju-emblem-purple},
% nju-name = {nju-name-purple},
% 替换为紫色版本
% 这个选项只能填写一次
% 切换时要注释掉上方的黑色版本
}
% abstract 类用于设置摘要样式
\njusetup[abstract]{
toc-entry = false,
% 摘要是否显示在目录条目中
%
% underline = false,
% 研究生英文摘要页条目内容是否添加下划线
%
% title-style = strict|centered|natural
% 研究生摘要标题样式,详见手册
}
% 目录自身是否显示在目录条目中
\njusetup{
% tableofcontents/toc-entry = false,
% listoffigures/toc-entry = false,
% listoftables/toc-entry = false
}
% 为目录中的章标题添加引导线
\njusetup[tableofcontents/dotline]{chapter}
% math 类用于设置数学符号样式,功能详见手册
\njusetup[math]{
% style = TeX|ISO|GB,
% 整体风格,缺省值为国标(GB)
% 相当于自动设置以下若干项
%
% integral = upright|slanted,
% integral-limits = true|false,
% less-than-or-equal = slanted|horizontal,
% math-ellipsis = centered|lower,
% partial = upright|italic,
% real-part = roman|fraktur,
% vector = boldfont|arrow,
% uppercase-greek = upright|italic
}
% theorem 类用于设置定理类环境样式,功能详见手册
\njusetup[theorem]{
% define,
% 默认创建内置的七种定理环境
%
% style = remark,
% header-font = \sffamily \bfseries,
% body-font = \normalfont,
% qed-symbol = \ensuremath { \male },
% counter = section,
% share-counter = true,
% type = {...}
% 以上设置项在重新调用 theorem/define 后生效
}
% footnote 类用于设置脚注样式,功能详见手册
\njusetup[footnote]{
% style = pifont|circled,
% 使用圈码编号
%
% hang = false,
% 不使用悬挂缩进
}
% 页眉页脚内容设置
\njusetup{
% header/content = {
% {OR}{\thepage},{OL}{\rightmark},
% {EL}{\thepage},{ER}{\leftmark}
% },
% 页眉设置,详见手册
% 奇数页页眉:左侧章名,右侧页码
% 偶数页页眉:左侧页码,右侧节名
%
% footer/content = {}
}
% 页眉页脚的字体样式
% \njusetformat{header}{\small\kaishu}
% \njusetformat{footer}{}
% 在盲审模式下隐藏学校信息
% \njusetup{anonymous-mode/no-nju}
% 一些灵活调整
% \njusetname{type}{本科毕业设计} % 我做的是毕业设计
% \njusetname{notation}{术语表} % 更改符号表名称
% \njusetlength{crulewd}{240pt} % 加长封面页下划线
% \njusetformat{tabular}{\zihao{-4}\bfseries} % 修改表格环境的字号
% \EditInstance{nju}{u/cover/emblem-img}{align=l} % 左对齐的本科生封面校徽
File deleted
File deleted
#!/usr/bin/env sh
mkdir -p mythesis
cd mythesis
cp -f ../docs/njuthesis-sample.tex .
cp -f ../docs/njuthesis-sample.bib .
cp -f ../docs/njuthesis-setup.def .
cp -f ../docs/nju-emblem*.pdf .
cp -f ../docs/nju-name*.pdf .
cp -f ../source/njuthesis.dtx .
xetex njuthesis.dtx > /dev/null
rm *.dtx
rm *.ins
rm *.log
rm njuthesis-doc.cls
cd ..
@ECHO OFF
MKDIR "mythesis"
CD "mythesis"
COPY /Y "..\docs\njuthesis-sample.tex" .
COPY /Y "..\docs\njuthesis-sample.bib" .
COPY /Y "..\docs\njuthesis-setup.def" .
COPY /Y "..\docs\nju-emblem*.pdf" .
COPY /Y "..\docs\nju-name*.pdf" .
COPY /Y "..\source\njuthesis.dtx" .
xetex "njuthesis.dtx" > NUL
DEL "*.dtx"
DEL "*.ins"
DEL "*.log"
DEL "njuthesis-doc.cls"
CD ..
@ARTICLE{njuthesis,
title={南京大学学士学位论文LaTex模板},
AUTHOR = {NJU-LUG},
JOURNALTITLE = {Github},
YEAR = {2021}
}
\ No newline at end of file
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{njuthesis}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=njuthesis,
prefix=
}
\LoadClass[
a4paper,
twoside,
UTF8,
scheme=chinese,
linespread=1.625,% laTex默认1.2行距,word默认行距是1.3,要求1.5倍word行距,故1.5/1.2*1.3 = 1.625
fontset=none,
zihao=-4
]{ctexbook}[2018/04/01]
\DeclareStringOption[1]{TitleLength}
\DeclareStringOption[UG]{Degree}
\DeclareStringOption[thesis]{Type}
\ProcessKeyvalOptions*\relax
% 输入配置文件
\RequirePackage{profile/packages}
\RequirePackage{coverinfo}
\RequirePackage{profile/font}
\RequirePackage{profile/page}
\RequirePackage{profile/reference}
\RequirePackage{profile/components}
\RequirePackage{profile/cover}
\RequirePackage{profile/abstract}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NJU Thesis Undergraduate
% 南京大学本科生毕业论文LaTeX模板
% Version 0.1 (2021/09/07)
%
% 请关注项目地址以获取最新变化
% https://github.com/nju-lug/NJUThesisUndergraduate
% https://git.nju.edu.cn/nju-lug/nju-latex-templates/njuthesisundergraduate
%
% 贡献者
% @atxy
% @FengChendian
% @HermitSun
% @glatavento
%
% 许可证
% LaTeX Project Public License(版本 1.3c 或更高)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[
TitleLength=1,% 选择标题行数,范围是1~3
Degree=UG,% 学位 本科:UG
Type=thesis% thesis:毕业论文,design:毕业设计
]{njuthesis}
% 导入参考文献源
\addbibresource{njuthesis.bib}
\begin{document}
%----------------------------------------------------------------------------------------
% 封面、摘要和目录
%----------------------------------------------------------------------------------------
\maketitle % 请在coverpage.sty输入封面信息
\begin{abstract}
\zhlipsum[76][name=zhufu]
\keywords{驾驶;星际穿越}
\end{abstract}
\begin{englishabstract}
\blindtext
% 英文关键词。关键词之间用英文半角逗号隔开,末尾无符号。
\englishkeywords{Drive, Interstellar travel}
\end{englishabstract}
\tableofcontents
%----------------------------------------------------------------------------------------
% 正文部分
%----------------------------------------------------------------------------------------
\mainmatter
\chapter{绪论}
\section{简介}
南京大学学士学位论文\LaTeX 模板\cite{njuthesis}基于本科生院的论文撰写规范修改,用于生成符合南京大学学位论文排版要求和相应的国家规范、行业标准的学位论文。
此模板旨在为同学提供毕业论文书写的方便,如有模板问题或者版权问题,请于Github上提出issue。
\section{表格示例}
\begin{table}[htbp]
\caption{经过测试的环境}
\label{tab:mytab}
\begin{tabular}{ccc}
\toprule
OS & Tex & 测试情况 \\
\midrule
Windows 10 & TexLive 2021 &\\
Windows 10 & MikTex &\\
Windows 10 & TexLive 2020 &\\
Ubuntu 20.04 & TexLive 2021 &\\
南大Tex & Overleaf &\\
\bottomrule
\end{tabular}
\end{table}
你可以使用\lstinline|table|环境插入标准三线表,如\cref{tab:mytab}所示,代码如下:
\begin{lstlisting}[language=TeX]
\begin{table}[htbp]
\caption{经过测试的环境}
\begin{tabular}{ccc}
\toprule
OS & Tex & 测试情况 \\
\midrule
Windows 10 & TexLive 2021 &\\
Windows 10 & MikTex &\\
Windows 10 & TexLive 2020 &\\
Ubuntu 20.04 & TexLive 2021 &\\
南大Tex & Overleaf &\\
\bottomrule
\end{tabular}
\end{table}
\end{lstlisting}
\section{图片示例}
\label{sec:figures}
\begin{figure}[htbp]
\includegraphics[width=0.5\textwidth]{njuname}
\caption{南京大学名称}
\label{fig:njuname}
\end{figure}
你可以使用\lstinline|figure|环境插入图片,如\cref{fig:njuname},代码如下:
\begin{lstlisting}[language=TeX]
\begin{figure}
\includegraphics[width=0.5\textwidth]{njuname}
\caption{南京大学名称}
\end{figure}
\end{lstlisting}
\subsection{文字环绕图像}
% wrapfigure后面不能有空行
\begin{wrapfigure}{r}{0cm}
\includegraphics[width=.3\textwidth]{njulogo}
\caption{环绕图像测试}
\label{fig:njulogo}
\end{wrapfigure}
\zhlipsum[4][name=xiangyu]
你可以使用\lstinline|wrapfigure|环境插入图片,类似于\cref{sec:figures}的普通图片插入方法,代码如下:
\begin{lstlisting}[language=TeX]
\begin{wrapfigure}{r}{0cm}
\includegraphics[width=.3\textwidth]{njulogo}
\caption{环绕图像测试}
\label{fig:njulogo}
\end{wrapfigure}
\end{lstlisting}
\section{公式示例}
\begin{equation}\label{eq:dewitt}
\int e^{ax} \tanh bx\ dx =
\begin{cases}
\displaystyle{ \frac{ e^{(a+2b)x}}{(a+2b)}
{_2F_1}\left[ 1+\frac{a}{2b},1,2+\frac{a}{2b}, -e^{2bx}\right] }& \\
\displaystyle{
\hspace{1cm}-\frac{1}{a}e^{ax}{_2F_1}\left[ 1, \frac{a}{2b},1+\frac{a}{2b}, -e^{2bx}\right]
}
& a\ne b \\
\displaystyle{\frac{e^{ax}-2\tan^{-1}[e^{ax}]}{a} } & a = b
\end{cases}
\end{equation}
你可以使用\lstinline|equation|环境插入公式,如\cref{eq:dewitt},代码如下:
\begin{lstlisting}[language=TeX]
\begin{equation}\label{eq:dewitt}
\int e^{ax} \tanh bx\ dx =
\begin{cases}
\displaystyle{ \frac{ e^{(a+2b)x}}{(a+2b)}
{_2F_1}\left[ 1+\frac{a}{2b},1,2+\frac{a}{2b}, -e^{2bx}\right] }& \\
\displaystyle{
\hspace{1cm}-\frac{1}{a}e^{ax}{_2F_1}\left[ 1, \frac{a}{2b},1+\frac{a}{2b}, -e^{2bx}\right]
}
& a\ne b \\
\displaystyle{\frac{e^{ax}-2\tan^{-1}[e^{ax}]}{a} } & a = b
\end{cases}
\end{equation}
\end{lstlisting}
%----------------------------------------------------------------------------------------
% 参考文献
%----------------------------------------------------------------------------------------
\printbibliography[heading=bibintoc, title=参考文献] % 输出参考文献列表并将本页插入目录条目
%----------------------------------------------------------------------------------------
% 致谢
%----------------------------------------------------------------------------------------
% \chapter*{致谢}
% \addcontentsline{toc}{chapter}{致谢}
% 感谢\href{https://git.nju.edu.cn/nju-lug/lug-introduction}{NJU LUG}。
%----------------------------------------------------------------------------------------
% 附录部分
%----------------------------------------------------------------------------------------
\appendix
\end{document}
\ No newline at end of file
\ProvidesExplPackage{profile/abstract}{2021-09-04}{0.1}{NJU Thesis Undergraduate abstract design}
% 拼合标题
\tl_const:Nn \Title {\TitleA\TitleB\TitleC}
% 摘要环境
\NewDocumentEnvironment{abstract} {}
{%
\pagestyle{plain}
\pagenumbering{Roman}
\begin{center}
\kaishu\zihao{-2}{\textbf{\uuline{南京大学本科生毕业论文(设计、作品)中文摘要}}}
\end{center}
{\bgroup
\kaishu\zihao{-4}
\tl_set:Nn \tabcolsep {0pt}
\tl_set:Nn \arraystretch {0.8}
\noindent
题目: \Title \\
院系: \Department \\
专业: \Major \\
本科生姓名: \StudentName \\
指导教师(姓名、职称): \Mentor\ \MentorTitle \\
摘要:
\egroup
}
\kaishu\zihao{-4}\par%
}{%
\newpage
}
% 中文关键词
\NewDocumentCommand \keywords {m} {%
\par\vspace{2ex}\noindent%
{\kaishu\zihao{-4}\makebox[4em][s]{关键词{}}}~{#1}%
}
% 英文摘要
\NewDocumentEnvironment{englishabstract} {}
{%
\pagestyle{plain}
\begin{center}
\kaishu\zihao{-2}{\textbf{\uuline{南京大学本科生毕业论文(设计、作品)英文摘要}}}
\end{center}
{
\bgroup
THESIS: ~~\Title_EN \\
DEPARTMENT: ~~\Department_EN \\
SPECIALIZATION: ~~\Major_EN \\
UNDERGRADUATE:~~\StudentName_EN \\
MENTOR:~~\Mentor_EN \ \MentorTitle_EN\\
ABSTRACT:
\egroup
}
\zihao{-4}\par%
}{%
\cleardoublepage
\newpage
}
% 英文关键词
\NewDocumentCommand \englishkeywords {m} {%
\par\vspace{2ex}\noindent%
{KEYWORDS{:}}~~{#1}%
}
\ No newline at end of file
\ProvidesExplPackage{profile/components}{2021-09-04}{0.1}{NJU Thesis Undergraduate components configuration}
% 图表位置调整
\floatsetup[lstlisting]{ % Captions for lstlistings
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
}
\floatsetup[figure]{ % Captions for figures
capposition=bottom,%
margins=centering,%
floatwidth=\textwidth%
}
\floatsetup[table]{ % Captions for tables
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
}
% 代码样式
\lstset{
basicstyle=\ttfamily\linespread{1}\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
}
% 图表标题样式
\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
}
% list configuration
\renewcommand{\labelitemi}{\small$\blacktriangleright$}
\renewcommand{\labelitemii}{\textbullet}
\setlist[itemize]{noitemsep}
\setlist[enumerate]{noitemsep}
\setlist[description]{noitemsep}
\ProvidesExplPackage{profile/cover}{2021-09-04}{0.1}{NJU Thesis Undergraduate cover design}
% 封面下划线
\cs_new:Npn \cover_underline:nn #1 #2 {
\uline{\makebox[#1]{#2}}
}
% 封面表格边框
\cs_new:Npn \coverbox:n #1 {
\makebox[4.2em][s]{#1}
}
% 封面信息栏
\tl_new:N \cover_personalinfo
\tl_set:Nn \cover_personalinfo {
\begin{tabular}{p{4.2em}c}
\coverbox:n {\hfill}
& \cover_underline:nn {250pt}{\songti\Department}\\
\coverbox:n {\hfill}
& \cover_underline:nn {250pt}{\songti\Major}\\
\int_case:nn {\TitleLength}
{
{ 1 } {
\coverbox:n {\hfill}
& \cover_underline:nn {250pt}{\textbf{\songti\TitleA}} \\ }
{ 2 } {
\coverbox:n {\hfill}
& \cover_underline:nn {250pt}{\textbf{\songti\TitleA}} \\
& \cover_underline:nn {250pt}{\textbf{\songti\TitleB}} \\ }
{ 3 } {
\coverbox:n {\hfill}
& \cover_underline:nn {250pt}{\textbf{\songti\TitleA}} \\
& \cover_underline:nn {250pt}{\textbf{\songti\TitleB}} \\
& \cover_underline:nn {250pt}{\textbf{\songti\TitleC}} \\}
}
\end{tabular}\\
\begin{tabular}{p{4.2em}cp{4.2em}c}
\coverbox:n {\hfill}
& \cover_underline:nn {90pt}{\Grade}
& \coverbox:n {\hfill}
& \cover_underline:nn {90pt}{\songti\StudentID}\\
\end{tabular}\\
\begin{tabular}{p{4.2em}c}
\coverbox:n {\hfill\hfill\hfill}
& \cover_underline:nn {250pt}{\StudentName}
\end{tabular}\\
\begin{tabular}{p{4.2em}cp{4.2em}c}
\coverbox:n {\hfill}
& \cover_underline:nn {90pt}{\Mentor}
& \coverbox:n {\hfill}
& \cover_underline:nn {90pt}{\MentorTitle}\\
\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}\\
\end{tabular}
}
% 判断类型
\str_if_eq:eeTF {\Degree} {UG}
{\tl_const:Nn \Degreename {\hfill\hfill }}{}
\str_if_eq:eeTF {\Type} {thesis}
{\tl_const:Nn \typename {\Degreename\hfill\hfill\hfill}}
{\tl_const:Nn \typename {\Degreename\hfill\hfill\hfill}}
% 重定义maketitle生成封面
\RenewDocumentCommand \maketitle {} {%
\thispagestyle{empty}
\pagenumbering{Roman}
% Start
\begin{spacing}{1.25}
\vskip 0mm
\hspace{-10mm}
\includegraphics[height=3cm]{njulogo}\smallskip
\begin{center}
\includegraphics[height=3.35cm]{njuname}
\vskip 10mm
{\zihao{1}\makebox[9em][s]{\textbf{\songti\typename}}}
\vfill
\vskip\stretch{0}
{\bgroup
\kaishu\zihao{3}
\def\tabcolsep{1pt}
\def\arraystretch{1.5}
\cover_personalinfo % 绘制信息框
\egroup}
\vfill
\end{center}
\end{spacing}
\cleardoublepage
\vfill
% \newpage
}
\ProvidesExplPackage{profile/font}{2021-09-04}{0.1}{NJU Thesis Undergraduate font configuration}
% \RequireXeTeX
% \RequireLuaTeX
% 设置西文字体
\NewDocumentCommand\set_latin_fontset_windows{}{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Courier~New}[Scale=MatchLowercase]
}
\NewDocumentCommand\set_latin_fontset_macos{}{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Menlo}[Scale=MatchLowercase]
}
\NewDocumentCommand\set_latin_fontset_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]
}
% 设置中文字体
\NewDocumentCommand\set_chinese_fontset_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]
}
\NewDocumentCommand\set_chinese_fontset_macos{}{
\msg_redirect_name:nnn {fontspec} {no-script} {info} % 移除 does not contain script "CJK" 警告
\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}
\setCJKfamilyfont{zhkai}{Kaiti~SC}[BoldFont=Kaiti~SC~Bold]
\setCJKfamilyfont{zhnewhei}{PingFang~SC}
}
\NewDocumentCommand\set_chinese_fontset_fandol{}{
\msg_redirect_name:nnn {fontspec} {no-script} {info} % 移除 does not contain script "CJK" 警告
\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]
}
% 方正字符集
\NewDocumentCommand\set_chinese_fontset_founder{}{
\setCJKmainfont{FZSSK}[
Extension=.ttf,
BoldFont=FZXBSK,
ItalicFont=FZKTK]
\setCJKsansfont{FZXH1K}[
Extension=.ttf,
BoldFont=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}[
Extension=.ttf,
BoldFont=FZYouHK_511M]
}
\NewDocumentCommand\set_chinese_fontset_noto{}{
% 思源宋体 https://www.google.com/get/noto/#serif-hans
\setCJKmainfont[
UprightFont=NotoSerifCJKsc-Regular,
BoldFont=NotoSerifCJKsc-Bold,
ItalicFont=NotoSerifCJKsc-Regular,
BoldItalicFont=NotoSerifCJKsc-Bold,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{Noto~Serif~CJK~SC}
% 思源黑体 https://www.google.com/get/noto/#sans-hans
\setCJKsansfont[
UprightFont=NotoSansCJKsc-Regular,
BoldFont=NotoSansCJKsc-Bold,
ItalicFont=NotoSansCJKsc-Regular,
BoldItalicFont=NotoSansCJKsc-Bold,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{Noto~Sans~CJK~SC}
% 包含于上述思源黑体
\setCJKmonofont[
UprightFont=NotoSansMonoCJKsc-Regular,
BoldFont=NotoSansMonoCJKsc-Bold,
ItalicFont=NotoSansMonoCJKsc-Regular,
BoldItalicFont=NotoSansMonoCJKsc-Bold,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{Noto~Sans~Mono~SC}
\setCJKfamilyfont{zhsong}{Noto~Serif~CJK~SC}
\setCJKfamilyfont{zhhei}{Noto~Sans~CJK~SC}
% 方正楷体、方正仿宋为免费商用字体,且支持CJK字符集
% 方正仿宋 http://www.foundertype.com/index.php/FontInfo/index/id/128.html
% 方正楷体 http://www.foundertype.com/index.php/FontInfo/index/id/137.html
\setCJKfamilyfont{zhfs}{方正仿宋简体}[AutoFakeBold=2.17]
\setCJKfamilyfont{zhkai}{方正楷体简体}[AutoFakeBold=2.17]
}
% 检测是否是 Windows
\sys_if_platform_windows:TF
{
\set_latin_fontset_windows
\set_chinese_fontset_windows
}
{
% 检测是否是 MacOS
\ctex_if_platform_macos:TF
{
\set_latin_fontset_macos
\set_chinese_fontset_macos
}
% 其余系统一律使用自由字体
{
\set_latin_fontset_gyre
\set_chinese_fontset_fandol
}
}
% 使用方正字体
% \set_chinese_fontset_founder
% 使用思源宋体+思源黑体
% \set_chinese_fontset_noto
\NewDocumentCommand\songti{}{\CJKfamily{zhsong}}
\NewDocumentCommand\heiti{}{\CJKfamily{zhhei}}
\NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}}
\NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}}
% \NewDocumentCommand\lishu{}{\CJKfamily{zhli}}
\ProvidesExplPackage{profile/packages}{2021-09-04}{0.1}{NJU Thesis Undergraduate packages used}
\RequirePackage{expl3}
\RequirePackage{ifxetex}
\RequirePackage{fontspec}
\RequirePackage[
top=2.5cm,
bottom=2.5cm,
left=3.2cm,
right=3.2cm
]{geometry}
\RequirePackage{ifthen}
\RequirePackage{xparse}
% \RequirePackage{etoolbox}
\RequirePackage{titlesec} % 修改章节标题功能由CTeX提供
\RequirePackage{titletoc}
\RequirePackage{appendix} % 定义附录样式
\RequirePackage{fancyhdr} % 调整页眉页脚
\RequirePackage[hyphens]{url} % generate better linebreaks in the url
\RequirePackage{ulem} % 绘制下划线
\RequirePackage{setspace}
\RequirePackage{lastpage}
\RequirePackage{emptypage} % 清除空白页的页码
\RequirePackage{listings} % 代码环境
\RequirePackage{enumitem} % 用于修改列表环境
\RequirePackage{caption}
\RequirePackage{floatrow} % 用于图表等页面元素的定位
\RequirePackage{booktabs} % 用于绘制三线表
\RequirePackage{siunitx} % 用于书写单位符号
\RequirePackage[version=4]{mhchem} % 用于绘制分子式
\RequirePackage{hologo} % 用于生成可以被插入书签的LaTeX logo
\RequirePackage{needspace} % Required to prevent page break right after a sectioning command
\RequirePackage{xspace} % Better print trailing whitespace
\RequirePackage{microtype}
\RequirePackage{blindtext} % 生成用于测试的大段无意义英文文字
\RequirePackage{zhlipsum} % 生成用于测试的大段无意义中文文字
% \RequirePackage{showframe} % 加载以后展示内容边界
\RequirePackage{amssymb} % Must be loaded before unicode-math
\RequirePackage{unicode-math} % Math fonts in xetexorluatex
\RequirePackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png}
\graphicspath{{figure/}}
\RequirePackage{wrapfig} % Wrap text around figures
% 必须以该顺序加载以下三个包
% \RequirePackage{varioref}
\RequirePackage[hidelinks,bookmarksnumbered=true]{hyperref}
\RequirePackage[capitalise,nameinlink,noabbrev]{cleveref}
\ProvidesExplPackage{profile/page}{2021-09-04}{0.1}{NJU Thesis Undergraduate page layout}
% 论文页码 页脚居中、五号阿拉伯数字(新罗马体)连续编码
\fancypagestyle{njuplain}{%
\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}} % 无页眉页脚
% ctex格式设置
% 目录标题 三号宋体加粗
% 各部分标题 四号黑体
\ctexset{
contentsname = \songti\bfseries\zihao{3}\hspace{2em} 录,
chapter/format = \zihao{4}\heiti\centering,
section/format = \zihao{4}\heiti\raggedright,
subsection/format = \zihao{4}\heiti\raggedright,
subsubsection/format = \zihao{4}\heiti\raggedright
}
% 重定义目录中章节标题样式
% 目录内容中章的标题 四号黑体
% 目录中其他内容 小四号宋体
\titlecontents{chapter}% 标题级别
[5em]% 标题左间距
{\heiti\zihao{4}\vspace{10pt}}% 标题格式
{\contentslabel{4em}}% 标题标志
{\hspace*{-4em}}% 无序号标题
{~\titlerule*[0.6pc]{$.$}~\contentspage}% 指引线与页码
\titlecontents{section}
[5em]
{\zihao{-4}\vspace{0pt}}
{\contentslabel{2.5em}}
{\hspace*{-4em}}
{~\titlerule*[0.6pc]{$.$}~\contentspage}
\titlecontents{subsection}
[8em]
{\zihao{-4}\vspace{0pt}}
{\contentslabel{3em}}
{\hspace*{-4em}}
{~\titlerule*[0.6pc]{$.$}~\contentspage}
\ProvidesExplPackage{profile/reference}{2021-09-04}{0.1}{NJU Thesis Undergraduate bibliography and reference}
% biblatex设置
\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)
]{biblatex}
% Remove some unwanted entries from the bibliography
\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}}{}
}
% 修改标签名称
\crefdefaultlabelformat{#2#1#3~} % 默认在名称后面添加空格
\creflabelformat{equation}{#2#1#3~} % 删除公式编号的空格
\crefname{theorem}{定理}{定理}
\crefname{lemma}{引理}{引理}
\crefname{definition}{定义}{定义}
\crefname{figure}{}{}
\crefname{table}{}{}
\crefname{equation}{公式}{公式}
\crefname{chapter}{§}{§}
\crefname{section}{§}{§}
\crefname{subsection}{§}{§}
\crefname{subsubsection}{§}{§}
\ No newline at end of file
# https://github.com/stone-zeng/tl-depend-analysis/
if [ -z "$1" ]; then
MIRROR=https://mirror.ctan.org
else
MIRROR=$1
fi
curl -o texlive.tlpdb $MIRROR/systems/texlive/tlnet/tlpkg/texlive.tlpdb
curl -o texlive.tlpdb.sha512 $MIRROR/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512
sha512sum -c texlive.tlpdb.sha512
rm texlive.tlpdb.sha512
if [ ! -d data ]; then
mkdir data
fi
mv texlive.tlpdb data/
# https://github.com/stone-zeng/tl-depend-analysis/
import os
import re
import sys
from typing import TextIO
LUA_MODULE_PATTERN = re.compile(r'''
\brequire\s*
\(?\s*["'](.+?)["']
''', re.VERBOSE)
LUALIBS_MODULE_PATTERN = re.compile(r'''
loadmodule\s*
\(*\s*["'](.+\.lua)["']
''', re.VERBOSE)
CLASS_PATTERN = re.compile(r'''
\\(?:LoadClass|LoadClassWithOptions|documentclass)\s*
(?:\[.*\]\s*)?
\{\s*(.+?)\s*\}
''', re.VERBOSE)
PACKAGE_PATTERN = re.compile(r'''
\\(?:RequirePackage|RequirePackageWithOptions|usepackage)\s*
(?:\[.*\]\s*)?
\{\s*(.+?)\s*\}
''', re.VERBOSE)
USEFONT_PATTERN = re.compile(r'''
\\usefont\s*
\{\s*(.+?)\s*\}\s*
\{\s*(.+?)\s*\}
''', re.VERBOSE)
class Parser:
def __init__(self, path: str):
self.path = path
self.state = State()
self.depend: set[str] = set()
def parse(self):
try:
with open(self.path, 'r', encoding='utf-8', errors='replace') as fp:
match os.path.splitext(self.path)[1]:
case '.tex' | '.ltx' | '.cls' | '.sty' | '.def' | '.clo':
self._parse_tex(fp)
case '.lua':
self._parse_lua(fp)
case _:
print('Unknown file type:', self.path, file=sys.stderr)
except FileNotFoundError:
print('File not found:', self.path, file=sys.stderr)
def _parse_lua(self, fp: TextIO):
comment_flag = False
for line in fp:
line = line.strip()
if line.startswith('--[['):
comment_flag = True
continue
if line.endswith(']]') or line.endswith(']]--'):
comment_flag = False
continue
if not comment_flag and not line.startswith('--'):
self.depend.update(self._parse_lua_line(line))
def _parse_lua_line(self, line: str) -> list[str]:
if match := LUA_MODULE_PATTERN.findall(line):
return [match[0] + '.lua']
if match := LUALIBS_MODULE_PATTERN.findall(line):
return [match[0]]
return []
def _parse_tex(self, fp: TextIO):
for line in fp:
if line.rstrip() == '\\endinput':
return
if not line.strip().startswith('%'):
self.depend.update(self._parse_tex_line(line))
def _parse_tex_line(self, line: str) -> list[str]:
if self.state.stack == '':
# Classes (single line)
# - \LoadClass[...]{class}
# - \documentclass[...]{class}
if match := CLASS_PATTERN.findall(line):
return self._parse_cls_sty_match(match, suffix='.cls')
# Packages (single line)
# - \RequirePackage[...]{package}
# - \usepackage[...]{package}
if match := PACKAGE_PATTERN.findall(line):
return self._parse_cls_sty_match(match, suffix='.sty')
# Packages (multiple line)
if '\\RequirePackage' in line or '\\usepackage' in line:
self.state.update(line.split('%')[0].strip())
if match := USEFONT_PATTERN.findall(line):
return self._parse_font_match(match)
return []
self.state.update(line.split('%')[0].strip())
if self.state.is_braces_closed():
match = PACKAGE_PATTERN.findall(self.state.stack)
self.state.reset()
return self._parse_cls_sty_match(match, suffix='.sty')
return []
@staticmethod
def _parse_cls_sty_match(match: list[str], suffix: str) -> list[str]:
res = []
for m in match:
for s in map(str.strip, m.split(',')):
if Parser._is_valid_name(s):
res.append(s + suffix)
return res
@staticmethod
def _parse_font_match(match: list[str]) -> list[str]:
res = []
for m in match:
encoding, family = m
if Parser._is_valid_name(encoding) and Parser._is_valid_name(family):
res.append(f'{encoding.strip()}{family.strip()}.fd'.lower())
return res
@staticmethod
def _is_valid_name(name: str) -> bool:
return (
name != ''
and '\\' not in name and '#' not in name
and not name.startswith('.')
)
class State:
def __init__(self):
self.stack = ''
self.braces_count = 0
self.braces_open = False
self.brackets_count = 0
self.brackets_open = False
def __repr__(self) -> str:
return ', '.join([
f'stack = "{self.stack}"',
f'braces_count = {self.braces_count}',
f'braces_open = {self.braces_open}',
f'brackets_count = {self.brackets_count}',
f'brackets_open = {self.brackets_open}',
])
def update(self, line: str):
self.stack += line
for c in line:
match c:
case '{':
self.braces_count += 1
self.braces_open = True
case '}':
self.braces_count -= 1
case '[':
self.brackets_count += 1
self.brackets_open = True
case ']':
self.brackets_count -= 1
self.brackets_open = False
def is_braces_closed(self):
return self.braces_count == 0 and self.braces_open and not self.brackets_open
def reset(self):
self.stack = ''
self.braces_count = 0
self.braces_open = False
self.brackets_count = 0
self.brackets_open = False
def _main():
if len(sys.argv) < 2:
print('Usage: python file_parser.py <file>', file=sys.stderr)
sys.exit(1)
parser = Parser(sys.argv[1])
parser.parse()
for d in sorted(parser.depend):
print(d)
if __name__ == '__main__':
_main()
@ECHO OFF
pdflatex --shell-escape generate-img
DEL "generate-img.pdf"
DEL "*.aux"
DEL "*.auxlock"
DEL "*.dpth"
DEL "*.log"
DEL "*.md5"