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
Commits on Source (447)
Showing
with 1324 additions and 442 deletions
root = true
[*]
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf
indent_style = space
[*.{dtx,tex,bib,def}]
indent_size = 2
# 贡献者公约
## 我们的承诺
身为项目成员、贡献者、负责人,我们保证参与此社区的每个人都不受骚扰,不论其年龄、体型、身体条件、民族、性征、性别认同与表现、经验水平、教育程度、社会地位、国籍、相貌、种族、宗教信仰及性取向如何。
我们承诺致力于建设开放、友善、多元、包容、健康的社区环境。
## 我们的准则
有助于促进本社区积极环境的行为包括但不限于:
* 与人为善、推己及人
* 尊重不同的主张、观点和经历
* 积极提出、耐心接受有益批评
* 面对过失,承担责任、认真道歉、从中学习
* 关注社区共同诉求,而非一己私利
不当行为包括但不限于:
* 发布与性有关的言论或图像,以及任何形式的献殷勤或勾引
* 挑衅行为、侮辱或贬损的言论、人身及政治攻击
* 公开或私下骚扰
* 未获明确授权擅自发布他人的资料,如地址、电子邮箱等
* 其他有理由认定为违反职业操守的不当行为
## 落实之义务
社区负责人有责任诠释何谓“妥当行为”,并据此准则,妥善公正地认定与处置不当、威胁、冒犯及有害的行为。
社区负责人有权利和义务删除、编辑、拒绝违背本公约的评论(comment)、提交(commit)、代码、维基(wiki)编辑、问题(issue)等贡献。如有必要,需告知采取措施之理由。
## 适用范围
此行为标准适用于本社区全部场合,以及在其他场合代表本社区的个人。
代表本社区的情形包括但不限于:使用官方电子邮件与社交平台、作为指定代表参与在线或线下活动。
## 贯彻落实
如遇滥用、骚扰等不当行为,请通过 [git+nju-lug-email-3104-issue-@yaoge123.cn](mailto:git+nju-lug-email-3104-issue-@yaoge123.cn) 向纪律检查委员举报。
纪委将迅速审议并调查全部投诉。
社区全体负责人有义务保密举报者信息。
## 指导方针
社区负责人将依据下列方案判断并处置违纪行为:
### 一、督促
**社区影响**:用语不当、举止不符合职业道德或不受社区欢迎。
**处理意见**:由社区负责人予以非公开的书面警告,阐明违纪事由、解释举止如何不妥。或将要求公开道歉。
### 二、警告
**社区影响**:一起或多起事件中的违纪行为。
**处理意见**:警告继续违纪之后果、违纪者在特定时间内禁止与当事人往来、不得擅自与社区执法者往来,禁令涵盖社区内外、社交网络在内的一切联络。如有违反,可致封禁乃至开除。
### 三、封禁
**社区影响**:严重违纪行为,包括屡教不改。
**处理意见**:违纪者在特定时间内禁止与社区的任何往来或公开联络,禁止任何与当事人公开或私下往来,不得擅自与社区执法者往来。如有违反,可致开除。
### 四、开除
**社区影响**:典型违纪行为,例如屡教不改、骚扰某个人、敌对或贬低某个群体。
**处理意见**:无限期禁止违纪者与项目社区的一切公开往来。
## 来源
本行为标准改编自[参与者公约][homepage]2.0版,可在此查阅:[https://www.contributor-covenant.org/zh-cn/version/2/0/code_of_conduct.html][v2.0]
指导方针借鉴自[Mozilla纪检分级][Mozilla CoC]
此行为标准常见问题请洽:[https://www.contributor-covenant.org/faq][FAQ]
另有诸译本:[https://www.contributor-covenant.org/translations][translations]
[homepage]:https://www.contributor-covenant.org
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
name: 报告问题
description: 描述需要修复的问题
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
请使用此模板来报告*模板运行问题*,并尽可能多地提供信息。
- type: checkboxes
id: prerequisites
attributes:
label: 先决条件
options:
- label: |-
我已尝试更新[模板版本](https://github.com/nju-lug/NJUThesis/blob/master/CHANGELOG.md)
required: true
- label: |-
我已检索[模板手册](http://mirrors.ctan.org/macros/unicodetex/latex/njuthesis/njuthesis.pdf)
required: true
- label: |-
我已检索[项目 wiki](https://github.com/nju-lug/NJUThesis/wiki)
required: true
- label: |-
我已确认这个问题没有在[其他 issues](https://github.com/nju-lug/NJUThesis/issues) 中提出过。
required: true
- type: textarea
id: expected_behavior
attributes:
label: 期望的现象
placeholder: 本来应该是什么效果
validations:
required: true
- type: textarea
id: what_happened
attributes:
label: 发生了什么
placeholder: 实际发生了什么偏差,此处不妨拖拽上传截图
validations:
required: true
- type: textarea
id: minimal_working_example
attributes:
label: 最小工作示例
description: |
一段*完整的可供编译*的 LaTeX 代码,用来复现上述问题。这段代码应当从 `\documentclass` 开始,到 `\end{document}` 结束。请删除*所有不会引起该问题的内容*。譬如,对于正文格式出现的问题,不必添加 `\njusetup` `\tableofcontents` 等命令。删除无关内容是一个 debug 的过程,能帮助你我更准确地问题的根源 : D
placeholder: |
\documentclass[]{njuthesis}
...
\end{document}
render: TeX
validations:
required: true
- type: input
id: njuthesis_version
attributes:
label: njuthesis 模板版本
placeholder: v1.0.0
description: 模板版本可以在 `.log` 文件中搜索 `njuthesis` 得到。
validations:
required: true
- type: dropdown
id: source
attributes:
label: 模板获取途径
options:
- <https://tex.nju.edu.cn>
- 使用包管理器从 CTAN 安装
- 通过 GitHub Releases 或镜像站下载
- 从 Git 仓库下载
- type: dropdown
id: operating_system
attributes:
label: 操作系统
options:
- Windows
- macOS
- Linux
- type: input
id: tex_distribution
attributes:
label: TeX 发行版
placeholder: TeX Live 2022 / MiKTeX 22.1
- type: dropdown
id: compiler
attributes:
label: 编译程序
options:
- XeLaTeX
- LuaLaTeX
- type: textarea
id: more_info
attributes:
label: 额外信息
placeholder: 任何你认为有帮助的信息
- type: markdown
attributes:
value: |
-----
在提交这篇 issue 时,您将默认服从我们的[行为准则](https://github.com/nju-lug/NJUThesis/blob/master/.github/CODE_OF_CONDUCT.md)。
name: 请求新功能
description: 提出可以改进的要点
title: "[Feature]: "
labels: ["enhancement"]
body:
- type: checkboxes
id: prerequisites
attributes:
label: 先决条件
options:
- label: |-
我已尝试更新模板版本
required: true
- label: |-
我已检索[模板手册](http://mirrors.ctan.org/macros/unicodetex/latex/njuthesis/njuthesis.pdf)
required: true
- label: |-
我已检索[项目 wiki](https://github.com/nju-lug/NJUThesis/wiki)
required: true
- label: |-
我已确认这个请求没有在[其他 issues](https://github.com/tuna/issues/issues)中提出过。
required: true
- type: textarea
id: inconvenience
attributes:
label: 现有模板的不便之处
placeholder: 你的请求是否来自于使用上有不好的体验?请简要进行描述。
- type: textarea
id: possible_solution
attributes:
label: 提出可能的解决方案
placeholder: 你认为需要采取什么措施,或者你希望改进后将呈现出什么效果。
validations:
required: true
- type: textarea
id: considerations
attributes:
label: 提出考虑过的方案
placeholder: 请描述你进行过的相关尝试。
- type: textarea
id: more_info
attributes:
label: 额外信息
placeholder: 任何你认为有帮助的信息
- type: markdown
attributes:
value: |
在提交这篇 issue 时,我们默认您服从我们的[行为准则](https://github.com/nju-lug/NJUThesis/blob/master/.github/CODE_OF_CONDUCT.md)。
blank_issues_enabled: true
contact_links:
- name: 讨论
url: https://github.com/nju-lug/NJUThesis/discussions/new
about: 使用上的疑惑可以发在论坛哦
name: Build LaTeX document name: Build
on:
on:
push: push:
branches:
- master
pull_request: pull_request:
branches:
- master
env:
CTAN_URL: https://mirrors.rit.edu/CTAN
PACKAGES: latexmk cleveref enumitem footmisc tex-gyre xits biblatex-gb7714-2015 biber
jobs: jobs:
build_latex: build-on-ubuntu:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: if: "!startsWith(github.ref, 'refs/tags/v')"
matrix: env:
latex: [xelatex, lualatex] SET_PATH: |
export PATH=/tmp/texlive/bin/x86_64-linux:$PATH
steps: steps:
- name: Set up Git repository - name: Set up Git repository
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Compile to PDF - name: Install TeX Live
uses: HermitSun/latex-action@v3 run: |
with: ${{ env.SET_PATH }}
root_file: njuthesis.tex wget ${{ env.CTAN_URL }}/systems/texlive/tlnet/install-tl-unx.tar.gz
latexmk_use_${{ matrix.latex }}: true tar -xzf install-tl-unx.tar.gz
args: '-bibtex' cd install-tl-20* && ./install-tl --profile ../.github/workflows/texlive.profile
- name: Upload PDF - name: Install latest njuthesis
uses: actions/upload-artifact@v2 run: |
with: ${{ env.SET_PATH }}
name: PDF_${{ matrix.latex }} tlmgr option repository ${{ env.CTAN_URL }}/systems/texlive/tlnet/
path: njuthesis.pdf tlmgr install xetex l3build
l3build install
cd scripts
bash download.sh ${{ env.CTAN_URL }}
cd data
wget https://raw.githubusercontent.com/stone-zeng/tl-depend-analysis/data/data/tl-depend.json
cd ..
python3 main.py --pkg "${{ env.PACKAGES }}" --exclude "njuthesis-doc.cls"
tlmgr update --self --all --no-auto-install
release: - name: Compile test file
needs: build_latex
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Set up Git repository
uses: actions/checkout@v2
- name: Zip Source
run: | run: |
zip -r njuthesis.zip . -x ".github/*" ".gitignore" ${{ env.SET_PATH }}
cd test
- name: Download artifact latexmk -xelatex -halt-on-error test-xetex-undergraduate
uses: actions/download-artifact@v2 xelatex -halt-on-error test-xetex-graduate
with: xelatex -halt-on-error test-xetex-graduate-nlcover
name: PDF_xelatex # latexmk -lualatex -halt-on-error test-luatex
- uses: "marvinpinto/action-automatic-releases@latest" - name: Upload CLS Files
uses: actions/upload-artifact@v4
with: with:
repo_token: "${{ secrets.GITHUB_TOKEN }}" name: "njuthesis-cls-${{ github.sha }}"
prerelease: false path: |
files: | build/unpacked/njuthesis.cls
njuthesis.pdf build/unpacked/*.def
njuthesis.zip
name: Release
on:
push:
branches:
- master
tags:
- v*
env:
CTAN_URL: https://mirrors.rit.edu/CTAN
PACKAGES: cm-unicode tex-gyre tex-gyre-math lexend xits natbib makeindex
jobs:
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
env:
SET_PATH: |
export PATH=/tmp/texlive/bin/x86_64-linux:$PATH
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Set Version
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Install TeX Live
run: |
${{ env.SET_PATH }}
wget ${{ env.CTAN_URL }}/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xzf install-tl-unx.tar.gz
cd install-tl-20* && ./install-tl --profile ../.github/workflows/texlive.profile
- name: Install latest njuthesis
run: |
${{ env.SET_PATH }}
tlmgr option repository ${{ env.CTAN_URL }}/systems/texlive/tlnet/
tlmgr install xetex l3build
l3build install
cd scripts
bash download.sh ${{ env.CTAN_URL }}
cd data
wget https://raw.githubusercontent.com/stone-zeng/tl-depend-analysis/data/data/tl-depend.json
cd ..
python3 main.py --pkg "${{ env.PACKAGES }}" --exclude "njuthesis.cls"
tlmgr update --self --all --no-auto-install
- name: Install latest ctex
run: |
${{ env.SET_PATH }}
git clone https://github.com/CTeX-org/ctex-kit.git
cd ctex-kit/ctex
l3build install
- name: Install fonts
run: |
mkdir fonts
wget https://github.com/adobe-fonts/source-han-serif/raw/release/OTF/SimplifiedChinese/SourceHanSerifSC-SemiBold.otf
wget https://github.com/adobe-fonts/source-han-serif/raw/release/OTF/SimplifiedChinese/SourceHanSerifSC-Bold.otf
wget https://github.com/adobe-fonts/source-han-serif/raw/release/OTF/SimplifiedChinese/SourceHanSerifSC-Heavy.otf
wget https://github.com/be5invis/Iosevka/releases/download/v15.6.3/ttf-iosevka-15.6.3.zip
unzip ttf-iosevka-15.6.3.zip
cp *.otf /usr/share/fonts/
cp iosevka-lightitalic.ttf /usr/share/fonts/
cp iosevka-light.ttf /usr/share/fonts/
cp iosevka-semibold.ttf /usr/share/fonts/
chmod -x /usr/share/fonts/*.otf
chmod -x /usr/share/fonts/*.ttf
fc-cache -fv
- name: Zip CTAN package
run: |
${{ env.SET_PATH }}
l3build ctan
mv njuthesis-ctan.zip njuthesis-ctan-$VERSION.zip
mv njuthesis.pdf njuthesis-$VERSION.pdf
- name: Zip USER package
run: |
${{ env.SET_PATH }}
mv docs/* .
mv build/unpacked/* .
zip -r njuthesis-user-$VERSION.zip *.def njuthesis-sample* njuthesis.cls nju-*.pdf LICENSE CHANGELOG.md README.md
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
files: |
njuthesis-v*.pdf
njuthesis-user-v*.zip
njuthesis-ctan-v*.zip
# From latex3
# https://github.com/latex3/latex3/blob/main/support/texlive.profile
selected_scheme scheme-infraonly
TEXDIR /tmp/texlive
TEXMFSYSCONFIG /tmp/texlive/texmf-config
TEXMFSYSVAR /tmp/texlive/texmf-var
TEXMFLOCAL /tmp/texlive/texmf-local
TEXMFHOME ~/texmf
TEXMFCONFIG ~/.texlive/texmf-config
TEXMFVAR ~/.texlive/texmf-var
option_doc 0
option_src 0
tlpdbopt_autobackup 0
...@@ -12,17 +12,41 @@ ...@@ -12,17 +12,41 @@
*.cb2 *.cb2
.*.lb .*.lb
## DocStrip generated file
*.cls
*.def
*.ins
*.sty
!docs/njuthesis-setup.def
## Zip file
*.zip
## Fonts
*.ttf
*.otf
## Intermediate documents: ## Intermediate documents:
*.hd
*.dvi *.dvi
*.xdv *.xdv
*-converted-to.* *-converted-to.*
# these rules might exclude image files for figures etc. # these rules might exclude image files for figures etc.
# *.ps # *.ps
# *.eps # *.eps
# *.pdf njuthesis*.pdf
test*.pdf
## Generated if empty string is given at "Please type another file name for output:"
njuthesis.pdf # Folders
build/
release/
support/
scripts/data
TDS/
temp/
mythesis/
__pycache__/
## Bibliography auxiliary files (bibtex/biblatex/biber): ## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl *.bbl
......
{ {
"latex-workshop.latex.autoBuild.run": "never", // 禁止自动编译
"latex-workshop.latex.recipe.default": "lastUsed", // 使用前一次的编译方法
"latex-workshop.latex.tools": [ "latex-workshop.latex.tools": [
{ {
"name": "xelatex", "name": "xelatex",
"command": "xelatex", "command": "xelatex",
"args": [ "args": [
"-synctex=1", "-synctex=1",
"-shell-escape",
"-interaction=nonstopmode", "-interaction=nonstopmode",
"-file-line-error", "-file-line-error",
"%DOCFILE%" "%DOCFILE%"
] ]
}, },
{ {
"name": "latexmk", "name": "latexmk-xe",
"command": "latexmk", "command": "latexmk",
"args": [ "args": [
"-xelatex" "-xelatex",
"-time",
"-interaction=nonstopmode",
"%DOCFILE%"
]
},
{
"name": "latexmk-lua",
"command": "latexmk",
"args": [
"-lualatex",
"-time",
"-interaction=nonstopmode",
"%DOCFILE%"
] ]
}, },
{ {
...@@ -28,15 +44,17 @@ ...@@ -28,15 +44,17 @@
"name": "lualatex", "name": "lualatex",
"command": "lualatex", "command": "lualatex",
"args": [ "args": [
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%" "%DOCFILE%"
] ]
} },
], ],
"latex-workshop.latex.recipes": [ "latex-workshop.latex.recipes": [
{ {
"name": "latexmk 🔃", "name": "latexmk(xe)",
"tools": [ "tools": [
"latexmk" "latexmk-xe"
] ]
}, },
{ {
...@@ -45,6 +63,21 @@ ...@@ -45,6 +63,21 @@
"xelatex" "xelatex"
] ]
}, },
{
"name": "xe->bib->xe->xe",
"tools": [
"xelatex",
"biber",
"xelatex",
"xelatex"
]
},
{
"name": "latexmk(lua)",
"tools": [
"latexmk-lua"
]
},
{ {
"name": "lualatex", "name": "lualatex",
"tools": [ "tools": [
...@@ -52,13 +85,13 @@ ...@@ -52,13 +85,13 @@
] ]
}, },
{ {
"name": "xe->bib->xe->xe", "name": "lua->bib->lua->lua",
"tools": [ "tools": [
"xelatex", "lualatex",
"biber", "biber",
"xelatex", "lualatex",
"xelatex" "lualatex"
] ]
} },
] ]
} }
This diff is collapsed.
###############################################################################
#
# Makefile for the user manual of njuthesis
#
# Copyright (C) 2013 Haixing Hu,
# Department of Computer Science and Technology, Nanjing University.
#
# Home Page of the Project: https://github.com/Haixing-Hu/nju-thesis
#
###############################################################################
PROJECT=njuthesis
TEXSOURCE=$(shell ls *.tex)
BIB=njuthesis.bib
.PHONY: all clean
all: $(PROJECT).pdf
$(PROJECT).pdf: $(PROJECT).tex $(BIB) $(TEXSOURCE)
xelatex $(PROJECT).tex
biber $(PROJECT)
xelatex $(PROJECT).tex
xelatex $(PROJECT).tex
###### clean
clean:
-@rm -f \
*.aux \
*.bak \
*.bbl \
*.blg \
*.dvi \
*.glo \
*.gls \
*.idx \
*.ilg \
*.ind \
*.ist \
*.log \
*.out \
*.ps \
*.thm \
*.toc \
*.lof \
*.lot \
*.loe \
*.sty \
*.cfg \
*.cls \
*.sty \
*.pdf
The `njuthesis` class
=====================
The `njuthesis` class is intended for typesetting Nanjing University
dissertations with LaTeX, providing support for bachelor, master,
doctoral thesis and postdoctoral report. Compilation of this class
requires either `xelatex` or `lualatex` engine.
Usage
-----
A minimal example of this document class should look like
```LaTeX
\documentclass{njuthesis}
\njusetup{}
\begin{document}
\maketitle
\tableofcontents
\mainmatter
\chapter{Welcome}
Hello \LaTeX{}
\printbibliography
\end{document}
```
Contributing
------------
[Issues](https://github.com/nju-lug/NJUThesis/issues) and
[pull requests](https://github.com/nju-lug/NJUThesis/pulls)
are always welcome.
Wiki
----
Please see [Chinese wiki](https://github.com/nju-lug/NJUThesis/wiki).
License
-------
This work may be distributed and/or modified under the conditions of
the [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
either version 1.3c of this license or (at your option) any later
version.
-----
Copyright (C) 2021 - 2025 by NJU LUG.
# NJU Thesis # NJU Thesis: 南京大学学位论文 LaTeX 模板
[![njuthesis](https://img.shields.io/badge/njuthesis-latex-blue)](https://git.nju.edu.cn/nju-lug/nju-latex-templates)
[![overleaf](https://img.shields.io/badge/overleaf-supported-brightgreen)](https://tex.nju.edu.cn)
![build status](https://github.com/nju-lug/NJUThesis/actions/workflows/build.yml/badge.svg) ![build status](https://github.com/nju-lug/NJUThesis/actions/workflows/build.yml/badge.svg)
[![CTAN](https://img.shields.io/ctan/v/njuthesis.svg)](https://www.ctan.org/pkg/njuthesis)
[![GitHub release](https://img.shields.io/github/release/nju-lug/NJUThesis/all.svg)](https://github.com/nju-lug/NJUThesis/releases/latest)
[![overleaf](https://img.shields.io/badge/online_editor-supported-brightgreen)](https://tex.nju.edu.cn/template)
[![nju-git](https://img.shields.io/gitlab/stars/nju-lug/nju-latex-templates/njuthesis?gitlab_url=https%3A%2F%2Fgit.nju.edu.cn&style=social)](https://git.nju.edu.cn/nju-lug/nju-latex-templates/njuthesis)
> 此项目是基于[NJU thesis 2021](https://github.com/FengChendian/NJUThesis2021)的重构版本,目前本科生版本**已经基本重构完成**,硕博论文因为学校没有统一的格式规定,暂未编写 `njuthesis` 是制作南京大学本科生毕业论文、研究生学位论文、博士后出站报告的 LaTeX 文档类。本模板基于本科生院的论文撰写规范制作,同时参考研究生院提供的硕士、博士学位材料包,用于生成符合南京大学排版要求和相应的国家标准的学位论文,力求通过 LaTeX3 语法实现清晰的实现逻辑、较高的可定制性以及友好的用户接口
原来的[NJU thesis 2021](https://github.com/FengChendian/NJUThesis2021)模板太过古老并且不支持硕士、博士论文,目前难以维护,因此为了模板的可持续发展,现在将对该项目进行重构,项目挂载于[NJU-LUG](https://github.com/nju-lug)组织仓库下。 ## 快速开始
相关文档请参见[本项目wiki](https://github.com/nju-lug/NJUThesis/wiki) 请首先阅读[用户手册](http://mirrors.ctan.org/macros/unicodetex/latex/njuthesis/njuthesis.pdf),其中详尽阐述了模板的特性和使用方法
## 快速开始 对于普通用户,首要推荐使用下述的**南大 TeX 编译方法**
### 本地编译 ### 南大 TeX 编译
1. 推荐[从南大镜像站下载](https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F)并安装TeXLive或者MiKTeX最新版 [南大 TeX](https://tex.nju.edu.cn)[eScience 中心](https://sci.nju.edu.cn)为南大在校师生提供的在线 LaTeX 写作平台,已*安装有本模板的最新版*。注册登录后,只需在**创建新项目**菜单中选择**论文模板**即可开始写作。
2. 下载[模板全部文件](https://github.com/nju-lug/NJUThesis/releases/latest)
3. 根据需要更改`njuthesis.tex`文件中的内容
4. 在模板根目录下运行`latexmk -xelatex`编译文件,得到对应的PDF
#### **关于本地编译** **使用本平台时,请积极备份自己的文稿。**
- 模板支持`latexmk``xelatex``lualatex`三种编译方式 ### 本地编译
- 如果使用`latexmk`,请务必使用完整的命令`latexmk -xelatex`以免产生不必要的问题
- 如果使用`xelatex``lualatex`,需要按照`xelatex/lualatex` -> `biber` -> `xelatex/lualatex` -> `xelatex/lualatex`的顺序编译四次
- 仓库中.vscode附带一份VScode的LaTeX WorkShop的配置文件,可根据需要使用
### [南大TeX](https://tex.nju.edu.cn)编译 推荐使用包管理器安装 `njuthesis``njuvisual` 的最新版。
1. 下载[模板全部文件](https://github.com/nju-lug/NJUThesis/releases/latest) 新手同学不妨直接使用以下流程:
2. 登录[南大TeX](https://tex.nju.edu.cn),点击New Project -> Upload Project上传刚刚得到的zip文件,上传后`njuthesis.tex``njuthesis.cls`等文件应在根目录,目录结构如下所示:
```bash 1. [从南大镜像站下载](https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F)并安装最新的 TeX 发行版,并更新所有宏包
NJUThesis-master/ 2. 下载包含[模板全部文件](https://github.com/nju-lug/NJUThesis/releases/latest)的压缩包 `njuthesis-user-v*.zip`
3. 根据需要更改 `njuthesis-sample.tex` 文件中的内容
├─figure/ 4. 在模板根目录下运行 `latexmk -xelatex` 运行编译,得到对应的 PDF 文件
│ njulogo.pdf
│ njuname.pdf
├─profile/
│ abstract.sty
│ components.sty
│ cover.sty
│ font.sty
│ packages.sty
│ page.sty
│ reference.sty
│ njuthesis.bib
│ njuthesis.cls
│ njuthesis.tex
```
3. 在南大TeX项目内页面左上角的`Menu`中,将编译器改为`XeLaTeX` ### 典型结构
4. 编写tex文档
### 其他 ```LaTeX
\documentclass{njuthesis}
\njusetup{}
\begin{document}
\maketitle
\tableofcontents
\mainmatter
\chapter{欢迎}
使用 \LaTeX{}
\printbibliography
\end{document}
```
更多内容请参见项目Wiki中的[使用说明](https://github.com/nju-lug/NJUThesis/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E) ## 反馈
## 常见问题 在你遇到模板问题时,请遵守以下步骤:
请参见[常见问题](https://github.com/nju-lug/NJUThesis/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) 1. 在《[修订记录](https://github.com/nju-lug/NJUThesis/blob/master/CHANGELOG.md)》查看该问题是否已经修复但未发布;
- 若是,则可以使用仓库中的开发版本解决问题
1.[GitHub Issues](https://github.com/nju-lug/NJUThesis/issues)[Discussions](https://github.com/nju-lug/NJUThesis/discussions) 中搜索该问题的关键词;
1. 浏览[本项目 Wiki](https://github.com/nju-lug/NJUThesis/wiki)[用户手册](http://mirrors.ctan.org/macros/unicodetex/latex/njuthesis/njuthesis.pdf)
1. 在你确定这是一个新问题时
- 对于模板 bug、请求新功能、文档笔误等提出[新 issue](https://github.com/nju-lug/NJUThesis/issues/new/choose)
- 对于用法的疑惑、格式上的斟酌等提出[新 discussion](https://github.com/nju-lug/NJUThesis/discussions/new)
- 两个划分不绝对,区别在于 issue 是解决即关闭的
- 如果确实重复了,会打上 duplicate 标签并将你引导至本问题首条提问
如果导师或院系有额外要求,请一同附上要求原文或格式截图。
## 贡献 ## 贡献
如果你发现了模板的问题,欢迎在Github中提交issue或者PR 欢迎提交 [PR](https://github.com/nju-lug/NJUThesis/pulls)
## 许可 ## 许可
本模板的发布遵守 LaTeX Project Public License(版本 1.3c 或更高)。 本模板的发布遵守 [LaTeX Project Public License(版本 1.3c 或更高)](https://www.latex-project.org/lppl/lppl-1-3c/)
## TODO
- [x] 主要代码转为LaTeX3,使用`expl3`宏包
- [x] 基于CTeX宏集重构所有页面以符合学校论文要求
- [x] Github Action自动化构建预览PDF
- [x] 完善文档
- [ ] CTAN发布宏包
#!/usr/bin/env texlua
-- Build script for njuthesis.
-- run with `l3build`
module = "njuthesis"
checkengines = {"xetex", "luatex"}
checkopts = "-interaction=batchmode"
textfiles = {"LICENSE", "README*.md", "*.ins"}
ctanreadme = "README-CTAN.md"
sourcefiledir = "source"
sourcefiles = {"*.dtx"}
installfiles = {"*.cls", "*.def"}
typesetexe = "xelatex"
typesetfiles = {"njuthesis.dtx"}
unpackexe = "xetex"
unpackfiles = {"njuthesis.dtx"}
\begin{abstract}
\zhlipsum[76][name=zhufu]
% 中文关键词,每个关键词之间用“;”分开,最后一个关键词不打标点符号
\keywords{我;就是;充数的;关键词}
\end{abstract}
\begin{englishabstract}
\blindtext
% 英文关键词。关键词之间用英文半角逗号隔开,末尾无符号。
\englishkeywords{Dummy; Keywords; Here}
\end{englishabstract}
\chapter*{致谢}
\addcontentsline{toc}{chapter}{致谢}
感谢\href{https://git.nju.edu.cn/nju-lug/lug-introduction}{NJU Linux User Group}
\chapter{管理参考文献}
\label{chap:bibliography}
使用\hologo{biber}作为\hologo{BibTeX}后端。相关定义位于\lstinline|profile/reference.sty|。
\section{添加和管理}
默认参考文献存储于主目录下的\lstinline|njuthesis.bib|。如果有其他来源,也可以在\lstinline|njuthesis.tex|中修改以下命令:
\begin{lstlisting}[language=TeX]
\addbibresource{njuthesis.bib}
\end{lstlisting}
\subsection{使用EndNote}
南京大学信息化建设管理服务中心已购买\href{https://itsc.nju.edu.cn/EndNote/list.htm}{EndNote}供全校师生免费试用,最新版为EndNote 20.。
\subsection{使用Zotero}
\href{https://www.zotero.org/}{Zotero}是一款免费的文献管理软件,支持所有桌面平台。
在保持Zotero程序运行的情况下,点击浏览器工具栏的Zotero Connector插件即可自动从网页抓取参考文件信息。
Zotero也有知网插件
\section{文段内引用}
\lstinline|\cite{myref}|
\lstinline|\citesuthor{myref}|
\section{引用格式}
符合GB7714-2015规范
\chapter{配置环境}
下表是目前经过测试的环境。如果有其他可用不可用的环境,欢迎补充。
\begin{table}[ht]
\caption{经过测试的环境}
% \label{tab:1}
\begin{tabular}{ccc}
\toprule
OS & TeX & 测试情况 \\
\midrule
Windows 10 & \hologo{TeX}\,Live 2021 & 通过 \\
Windows 10 & \hologo{MiKTeX} & 通过 \\
Windows 10 & \hologo{TeX}\,Live 2020 & cref存在格式问题 \\
macOS 10.15 & \hologo{TeX}\,Live 2021 & 通过 \\
Ubuntu 20.04 & \hologo{TeX}\,Live 2021 & 通过 \\
南大\hologo{TeX} & \hologo{TeX}\,Live 2021 & 通过 \\
Overleaf & \hologo{TeX}\,Live 2020 & cref存在格式问题 \\
\bottomrule
\end{tabular}
\end{table}
\section{本地编译}
\subsection{安装\hologo{TeX}发行版}
首先需要下载\hologo{TeX}软件发行版,校园网环境中使用\href{https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F}{南大镜像站}可以获得最好的体验。\textbf{推荐使用最新的\hologo{TeX}\,Live 2021或者\hologo{MiKTeX} 21以避免潜在的兼容性问题。}
\begin{itemize}
\item 为了避免不必要的麻烦,请尽可能下载 full 版本,如 texlive-full。简而言之,下载大的那个。
\item 并且,尽可能使用最新版(截至目前是 2021)。2020 及之前版本使用 PDF 格式的图片可能会出现加粗问题。
\end{itemize}
\subsection{选择编辑器}
配置完编译器后,还需要一个\textbf{文本编辑器}作为前端来完成\texttt{.tex}文件内容的写作。
至今仍有相当一部分人认为Windows自带的\textit{记事本}是最好的文本编辑器,但对于本项目而言,在此诚心诚意地推荐你使用\textbf{更现代更美观更多功能}的编辑器,譬如\emph{安装了 LaTeX Workshop 插件 的 \href{https://code.visualstudio.com/}{Visual Studio Code}},来完成论文编写。你也可以根据个人的喜好随便使用其他编辑器,如 TeXworks、TeX Studio 等,顺手就行。
若使用 LaTeX Workshop 插件,本项目在\lstinline|.vscode/|中提供一份简易配置,可以省略初始配置步骤直接使用。
\subsection{编译顺序}
应采用以下命令顺序进行编译,以生成正确的目录、编号和参考文献条目。
\begin{enumerate}
\item \lstinline|xelatex| / \lstinline|lualatex|
\item \lstinline|biber|
\item \lstinline|xelatex| / \lstinline|lualatex|
\item \lstinline|xelatex| / \lstinline|lualatex|
\end{enumerate}
编译产物\footnote{作为化学学生,俺认为用“产物”代替“编译生成的文件”是一个通俗易懂的说法}\lstinline|njuthesis.pdf|,位于主目录下。此外还会生成一系列中间文件,可以选择使用\lstinline|latexmk -c|进行清理。
\section{在线编译}
相信你在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如\hologo{TeX}编译器安装过程较为漫长,占用空间过大,而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{其实这三点都是对广大的Windows用户说的,同一个模板在Linux编译可以节省一半耗时}。拒绝接受这些麻烦的同学不妨尝试本节介绍的在线编译方法。
\subsection{南大\hologo{TeX}平台简介}
\href{https://tex.nju.edu.cn}{南大\hologo{TeX}}基于开源的ShareLaTeX平台\footnote{理论上在\href{https://doc.nju.edu.cn/books/latex}{这个网站}能找到一段平台简介,实际上大家都有意无意地鸽了,下次一定补上。},于2021年3月4日正式上线,面向南京大学全体师生开放,首次使用需凭学校邮箱自助注册账号。
\subsection{操作步骤}
\begin{enumerate}
\item 下载\href{https://github.com/nju-lug/NJUThesisUndergraduate/archive/refs/heads/master.zip}{模板全部文件}
\item 访问\href{https://tex.nju.edu.cn}{南大\hologo{TeX}},点击界面右上方Register,使用\emph{南京大学邮箱}注册账号并登录
\item 点击New Project -> Upload Project上传刚刚得到的zip文件,上传后njuthesis.tex、njuthesis.cls等文件应在根目录,目录结构如\cref{{sec:directory}}所示
\item 在项目页面左上角的Menu中,将编译器改为\hologo{XeLaTeX}或者\hologo{LuaLaTeX}
\item 编写论文
\item 点击Compile按钮进行编译和预览
\item 点击编译按钮右侧第三个按钮下载产物
\end{enumerate}
\subsection{关于Overleaf平台}
由于\href{https://www.overleaf.com/}{Overleaf平台}\hologo{TeX}\,Live版本停留在2020,\texttt{cleveref}包在引用章节时会生成错误的标签,引发格式错误;而南大\hologo{TeX}通过及时更新规避了这一问题。因此\emph{请务必不要使用Overleaf官网进行编译}
\section{字体}
学校论文格式要求使用的字体一般已经预装在各个操作系统,本模板针对不同平台进行了自动检测适配,可以开箱即用。
各个系统的默认字体请参考\cref{tab:defaultfontset}。可以看到,不同系统上使用的字体有所差别,实际输出结果可能存在细微不同, 使用时请注意。例如,在Linux平台或者使用了Ubuntu后端的南大\hologo{TeX}上,宋体加粗效果更明显;另一方面,在Windows平台进行编译的效果更接近Word加粗\footnote{因为SimSun没有原生粗体,通过AutoFakeBold=2.17进行模仿}
% \begin{enumerate}
% \item Ubuntu 下遇到缺失字体 WenQuanYi Zen Hei Mono 或 Times New Roman的问题:
% 安装对应字体即可。使用以下指令下载:
% \begin{lstlisting}
% sudo apt install fonts-wqy-zenhei ttf-mscorefonts-installer
% \end{lstlisting}
% \item macOS 下提示 Package fontspec Warning: Font "STSong" does not contain requested Script "CJK"
% 忽略即可,不影响使用。该警告已被抑制。
% \end{enumerate}
指定字体的相关命令写于\texttt{profile/font.sty}
该文件中也预留有使用方正字体或者思源字体的命令,涉及的字体见\cref{tab:userfontset},可根据个人喜好进行修改选择。
\begin{table}[htbp]
\caption{操作系统预装字体清单}
\label{tab:defaultfontset}
\begin{tabular}{cccc}
\toprule
类型 & Windows & macOS & Linux \\
\midrule
西文衬线 & Times~New~Roman & Times~New~Roman & TeX~Gyre~Termes \\
西文无衬线 & Arial & Arial & TeX~Gyre~Heros \\
西文等宽 & Courier~New & Menlo & TeX~Gyre~Cursor \\
宋体 & SimSun & Songti~SC~Light &FandolSong-Regular \\
黑体 & SimHei & Heiti~SC~Light & FandolHei-Regular \\
仿宋 & FangSong & STFangsong & FandolFang-Regular \\
楷体 & KaiTi & Kaiti~SC & FandolKai-Regular \\
\bottomrule
\end{tabular}
\end{table}
如果 Ubuntu 下遇到缺失字体 Times New Roman 的问题,安装对应字体即可。使用以下指令下载:
\begin{lstlisting}
sudo apt install ttf-mscorefonts-installer
\end{lstlisting}
\begin{table}[htbp]
\caption{预留的自定义中文字体清单}
\label{tab:userfontset}
\begin{tabular}{ccc}
\toprule
类型 & 方正 & 思源 \\
\midrule
宋体 & FZSSK & Noto~Serif~CJK~SC \\
黑体 & FZHTK & Noto~Sans~CJK~SC \\
仿宋 & FZFSK & 方正仿宋简体 \\
楷体 & FZKTK & 方正楷体简体 \\
\bottomrule
\end{tabular}
\end{table}
\subsection{修改字体配置}
本模板提供了若干个字体相关的控制选项,已于\cref{sec:classoptions}初步进行介绍。如果希望覆盖检测系统字体的命令(譬如在Linux编译时使用Windows字体样式),请将
systemfont设置为false,并通过customlatinfont和customchinesefont进行选择。
全部字符集命令如下所示。
\begin{description}
\item[\texttt{\textbackslash set\textunderscore latin\textunderscore fontset\textunderscore windows}] Windows英文字符集
\item[\texttt{\textbackslash set\textunderscore chinese\textunderscore fontset\textunderscore windows}] Windows中文字符集
\item[\texttt{\textbackslash set\textunderscore latin\textunderscore fontset\textunderscore macos}] macOS英文字符集
\item[\texttt{\textbackslash set\textunderscore chinese\textunderscore fontset\textunderscore macos}] macOS中文字符集
\item[\texttt{\textbackslash set\textunderscore latin\textunderscore fontset\textunderscore gyre}] Linux英文字符集
\item[\texttt{\textbackslash set\textunderscore chinese\textunderscore fontset\textunderscore fandol}] Linux中文字符集
\item[\texttt{\textbackslash set\textunderscore chinese\textunderscore fontset\textunderscore founder}] 方正中文字符集
\item[\texttt{\textbackslash set\textunderscore chinese\textunderscore fontset\textunderscore noto}] 思源中文字符集
\end{description}
对于需要进一步自定义的同学,可以将CustomEnFont和CustomZhFont设置为null,自行在导言区设置字体。
\chapter{图片、表格与代码}
\section{图片示例}
所有图片默认存放在主目录下的\texttt{figure/}文件夹内
\begin{figure}[htbp]
\includegraphics[width=0.5\textwidth]{njuname}
\caption{南京大学名称}
\label{fig:njuname}
\end{figure}
你可以使用\lstinline|figure|环境插入图片,如\cref{fig:njuname},代码如下:
\begin{lstlisting}[style=LaTeX]
\begin{figure}
\includegraphics[width=0.5\textwidth]{njuname}
\caption{南京大学名称}
\end{figure}
\end{lstlisting}
\subsection{文字环绕图像}
% wrapfigure后面不能有空行
\begin{wrapfigure}{r}{0cm}
% \label{fig:njulogo}
\includegraphics[width=.15\textwidth]{njulogo}
\caption{校徽}
\end{wrapfigure}
\zhlipsum[3][name=xiangyu]
\section{表格示例}
\begin{table}[htbp]
\caption{经过测试的环境}
\label{tab:testtab}
\begin{tabular}{ccc}
\toprule
OS & TeX & 测试情况 \\
\midrule
Windows 10 & TeXLive 2021 &\\
Windows 10 & MiKTeX &\\
Windows 10 & TeXLive 2020 & ×\footnote{cleveref在引用章节时不能正常工作} \\
Ubuntu 20.04 & TeXLive 2021 &\\
南大TeX & Overleaf &\\
\bottomrule
\end{tabular}
\end{table}
你可以使用\lstinline|table|环境插入标准三线表,如\cref{tab:testtab}所示,代码如下:
\begin{lstlisting}[style=LaTeX]
\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{代码示例}
\subsection{行内代码}
The new command pretty-prints the code. The exclamation marks delimit
the code and can be replaced by any character not in the code;
\lstinline$var i:integer;$ gives the same result.
使用\lstinline!\lstinline|\textit{<Your code>}|!,只要使用在代码中未出现的符号将代码包括在内即可。