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
Select Git revision
  • master
  • dev
  • type-debug
  • create-theorem
  • bib
  • xtemplate
  • legacy
  • v0.10.0
  • v0.10.1
  • v0.11.0
  • v0.11.1
  • v0.11.2
  • v0.11.3
  • v0.12.0
  • v0.12.1
  • v0.12.2
  • v0.12.3
  • v0.13.0
  • v0.13.1
  • v0.14.0
  • v0.15.0
  • v0.16.0
  • v0.16.1
  • v0.17.0
  • v0.18.0
  • v0.19.0
  • v0.20.0
  • v0.3.0
  • v0.3.3
  • v0.4.0
  • v0.5.0
  • v0.6.0
  • v0.6.1
  • v0.7.0
  • v0.7.1
  • v0.7.2
  • v0.7.4
  • v0.8.0
  • v0.8.1
  • v0.8.2
  • v0.8.3
  • v0.8.4
  • v0.9.0
  • v0.9.1
  • v0.9.2
  • v0.9.3
  • v0.9.4
  • v1.0.0
  • v1.1.0
  • v1.1.1
  • v1.1.2
  • v1.2.0
  • v1.2.1
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.3.3
  • v1.4.0
  • v1.4.1
  • v1.4.2
  • v1.4.3
61 results

Target

Select target project
No results found
Select Git revision
  • master
  • bib
  • xtemplate
  • legacy
  • v0.10.0
  • v0.10.1
  • v0.11.0
  • v0.11.1
  • v0.11.2
  • v0.11.3
  • v0.12.0
  • v0.12.1
  • v0.12.2
  • v0.12.3
  • v0.13.0
  • v0.13.1
  • v0.14.0
  • v0.3.0
  • v0.3.3
  • v0.4.0
  • v0.5.0
  • v0.6.0
  • v0.6.1
  • v0.7.0
  • v0.7.1
  • v0.7.2
  • v0.7.4
  • v0.8.0
  • v0.8.1
  • v0.8.2
  • v0.8.3
  • v0.8.4
  • v0.9.0
  • v0.9.1
  • v0.9.2
  • v0.9.3
  • v0.9.4
37 results
Show changes

Commits on Source 518

418 additional commits have been omitted to prevent performance issues.
70 files
+ 13844
1463
Compare changes
  • Side-by-side
  • Inline

Files

.editorconfig

0 → 100644
+11 −0
Original line number Diff line number Diff line
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
+89 −0
Original line number Diff line number Diff line

# 贡献者公约

## 我们的承诺

身为项目成员、贡献者、负责人,我们保证参与此社区的每个人都不受骚扰,不论其年龄、体型、身体条件、民族、性征、性别认同与表现、经验水平、教育程度、社会地位、国籍、相貌、种族、宗教信仰及性取向如何。

我们承诺致力于建设开放、友善、多元、包容、健康的社区环境。

## 我们的准则

有助于促进本社区积极环境的行为包括但不限于:

* 与人为善、推己及人
* 尊重不同的主张、观点和经历
* 积极提出、耐心接受有益批评
* 面对过失,承担责任、认真道歉、从中学习
* 关注社区共同诉求,而非一己私利

不当行为包括但不限于:

* 发布与性有关的言论或图像,以及任何形式的献殷勤或勾引
* 挑衅行为、侮辱或贬损的言论、人身及政治攻击
* 公开或私下骚扰
* 未获明确授权擅自发布他人的资料,如地址、电子邮箱等
* 其他有理由认定为违反职业操守的不当行为

## 落实之义务

社区负责人有责任诠释何谓“妥当行为”,并据此准则,妥善公正地认定与处置不当、威胁、冒犯及有害的行为。

社区负责人有权利和义务删除、编辑、拒绝违背本公约的评论(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
+102 −0
Original line number Diff line number Diff line
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)。
Original line number Diff line number Diff line
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)。
+5 −0
Original line number Diff line number Diff line
blank_issues_enabled: true
contact_links:
  - name: 讨论
    url: https://github.com/nju-lug/NJUThesis/discussions/new
    about: 使用上的疑惑可以发在论坛哦
+0 −21
Original line number Diff line number Diff line
name: Build LaTeX document using LuaLaTeX
on: [push, pull_request]
jobs:
  build_latex:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Git repository
        uses: actions/checkout@v2

      - name: Compile to PDF
        uses: HermitSun/latex-action@v3
        with:
          root_file: njuthesis.tex
          latexmk_use_lualatex: true
          args: '-bibtex'

      - name: Upload PDF
        uses: actions/upload-artifact@v2
        with:
          name: PDF
          path: njuthesis.pdf

.github/workflows/build-xetex.yml

deleted100644 → 0
+0 −21
Original line number Diff line number Diff line
name: Build LaTeX document
on: [push, pull_request]
jobs:
  build_latex:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Git repository
        uses: actions/checkout@v2

      - name: Compile to PDF
        uses: HermitSun/latex-action@v3
        with:
          root_file: njuthesis.tex
          latexmk_use_xelatex: true
          args: '-bibtex'

      - name: Upload PDF
        uses: actions/upload-artifact@v2
        with:
          name: PDF
          path: njuthesis.pdf
+63 −0
Original line number Diff line number Diff line
name: Build

on:
  push:
    branches:
      - master

  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:
  build-on-ubuntu:
    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: 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-doc.cls"
          tlmgr update --self --all --no-auto-install

      - name: Compile test file
        run: |
          ${{ env.SET_PATH }}
          cd test
          latexmk -xelatex  -halt-on-error test-xetex-undergraduate
          xelatex           -halt-on-error test-xetex-graduate
          xelatex           -halt-on-error test-xetex-graduate-nlcover
          # latexmk -lualatex -halt-on-error test-luatex

      - name: Upload CLS Files
        uses: actions/upload-artifact@v4
        with:
          name: "njuthesis-cls-${{ github.sha }}"
          path: |
            build/unpacked/njuthesis.cls
            build/unpacked/*.def
+94 −0
Original line number Diff line number Diff line
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
+14 −0
Original line number Diff line number Diff line
# 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
+28 −4
Original line number Diff line number Diff line
@@ -12,17 +12,41 @@
*.cb2
.*.lb

## DocStrip generated file
*.cls
*.def
*.ins
*.sty
!docs/njuthesis-setup.def

## Zip file
*.zip

## Fonts
*.ttf
*.otf

## Intermediate documents:
*.hd
*.dvi
*.xdv
*-converted-to.*

# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf

## Generated if empty string is given at "Please type another file name for output:"
njuthesis.pdf
njuthesis*.pdf
test*.pdf

# Folders
build/
release/
support/
scripts/data
TDS/
temp/
mythesis/
__pycache__/

## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
Original line number Diff line number Diff line
{
    "latex-workshop.latex.autoBuild.run": "never", // 禁止自动编译
    "latex-workshop.latex.recipe.default": "lastUsed", // 使用前一次的编译方法
    "latex-workshop.latex.tools": [
        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-shell-escape",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "latexmk",
            "name": "latexmk-xe",
            "command": "latexmk",
            "args": [
                "-xelatex"
                "-xelatex",
                "-time",
                "-interaction=nonstopmode",
                "%DOCFILE%"
            ]
        },
        {
            "name": "latexmk-lua",
            "command": "latexmk",
            "args": [
                "-lualatex",
                "-time",
                "-interaction=nonstopmode",
                "%DOCFILE%"
            ]
        },
        {
@@ -28,15 +44,17 @@
            "name": "lualatex",
            "command": "lualatex",
            "args": [
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        }
        },
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "latexmk 🔃",
            "name": "latexmk(xe)",
            "tools": [
                "latexmk"
                "latexmk-xe"
            ]
        },
        {
@@ -45,6 +63,21 @@
                "xelatex"
            ]
        },
        {
            "name": "xe->bib->xe->xe",
            "tools": [
                "xelatex",
                "biber",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "latexmk(lua)",
            "tools": [
                "latexmk-lua"
            ]
        },
        {
            "name": "lualatex",
            "tools": [
@@ -52,13 +85,13 @@
            ]
        },
        {
            "name": "xe->bib->xe->xe",
            "name": "lua->bib->lua->lua",
            "tools": [
                "xelatex",
                "lualatex",
                "biber",
                "xelatex",
                "xelatex"
                "lualatex",
                "lualatex"
            ]
        }
        },
    ]
}

CHANGELOG.md

0 → 100644
+736 −0

File added.

Preview size limit exceeded, changes collapsed.

README-CTAN.md

0 → 100644
+49 −0
Original line number Diff line number Diff line
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.
+48 −56
Original line number Diff line number Diff line
# NJU Thesis Undergraduate
# 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/NJUThesisUndergraduate/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/NJUThesisUndergraduate/wiki)
请首先阅读[用户手册](http://mirrors.ctan.org/macros/unicodetex/latex/njuthesis/njuthesis.pdf),其中详尽阐述了模板的特性和使用方法

## 快速开始
对于普通用户,首要推荐使用下述的**南大 TeX 编译方法**

### 南大 TeX 编译

[南大 TeX](https://tex.nju.edu.cn)[eScience 中心](https://sci.nju.edu.cn)为南大在校师生提供的在线 LaTeX 写作平台,已*安装有本模板的最新版*。注册登录后,只需在**创建新项目**菜单中选择**论文模板**即可开始写作。

**使用本平台时,请积极备份自己的文稿。**

### 本地编译

1. 推荐[从南大镜像站下载](https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F)并安装TexLive或者MikTex最新版
2. 下载[模板全部文件](https://github.com/nju-lug/NJUThesisUndergraduate/archive/refs/heads/master.zip)
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)编译

1. 下载[模板全部文件](https://github.com/nju-lug/NJUThesisUndergraduate/archive/refs/heads/master.zip)
2. 登录[南大TeX](https://tex.nju.edu.cn),点击New Project -> Upload Project上传刚刚得到的zip文件,上传后`njuthesis.tex``njuthesis.cls`等文件应在根目录,目录结构如下所示:

    ```bash
    │  coverinfo.sty
    │  njuthesis.bib
    │  njuthesis.cls
    │  njuthesis.tex

    ├─figure
    │      njulogo.pdf
    │      njuname.pdf

    └─profile
           abstract.sty
           components.sty
           cover.sty
           font.sty
           packages.sty
           page.sty
           reference.sty
    ```
推荐使用包管理器安装 `njuthesis``njuvisual` 的最新版。

3. 在南大TeX项目内页面左上角的`Menu`中,将编译器改为`LuaLaTeX`
4. 编写tex文档
新手同学不妨直接使用以下流程:

### 其他
1. [从南大镜像站下载](https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F)并安装最新的 TeX 发行版,并更新所有宏包
2. 下载包含[模板全部文件](https://github.com/nju-lug/NJUThesis/releases/latest)的压缩包 `njuthesis-user-v*.zip`
3. 根据需要更改 `njuthesis-sample.tex` 文件中的内容
4. 在模板根目录下运行 `latexmk -xelatex` 运行编译,得到对应的 PDF 文件

更多内容请参见项目Wiki中的[使用说明](https://github.com/nju-lug/NJUThesisUndergraduate/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)
### 典型结构

## 常见问题
```LaTeX
\documentclass{njuthesis}
\njusetup{}
\begin{document}
\maketitle
\tableofcontents
\mainmatter
\chapter{欢迎}
使用 \LaTeX{}
\printbibliography
\end{document}
```

请参见[常见问题](https://github.com/nju-lug/NJUThesisUndergraduate/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)
## 反馈

## 贡献
在你遇到模板问题时,请遵守以下步骤:

如果你发现了模板的问题,欢迎在Github中提交issue或者PR。
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 标签并将你引导至本问题首条提问

## 许可
如果导师或院系有额外要求,请一同附上要求原文或格式截图。

本模板的发布遵守 LaTeX Project Public License(版本 1.3c 或更高)。
## 贡献

欢迎提交 [PR](https://github.com/nju-lug/NJUThesis/pulls)

## TODO
## 许可

- [x] 主要代码转为LaTeX3,使用`expl3`宏包
- [x] 基于CTeX宏集重构所有页面以符合学校论文要求
- [x] Github Action自动化构建预览PDF
- [x] 完善文档
- [ ] CTAN发布宏包
本模板的发布遵守 [LaTeX Project Public License(版本 1.3c 或更高)](https://www.latex-project.org/lppl/lppl-1-3c/)

build.lua

0 → 100644
+22 −0
Original line number Diff line number Diff line
#!/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"}

chapters/Abstract.tex

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
\begin{abstract}
    \zhlipsum[76][name=zhufu]
    % 中文关键词,每个关键词之间用“;”分开,最后一个关键词不打标点符号
    \keywords{我;就是;充数的;关键词}
\end{abstract}

\begin{englishabstract}
    \blindtext
    % 英文关键词。关键词之间用英文半角逗号隔开,末尾无符号。
    \englishkeywords{Dummy; Keywords; Here}
\end{englishabstract}

chapters/Acknowledgement.tex

deleted100644 → 0
+0 −4
Original line number Diff line number Diff line
\chapter*{致谢}
\addcontentsline{toc}{chapter}{致谢}

感谢\href{https://git.nju.edu.cn/nju-lug/lug-introduction}{NJU Linux User Group}

chapters/Environments.tex

deleted100644 → 0
+0 −151
Original line number Diff line number Diff line
\chapter{配置环境}

\section{概述}
下表是目前经过测试的环境。如果有其他可用不可用的环境,欢迎补充。

\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存在格式问题  \\
        Ubuntu 20.04 & \hologo{TeX}\,Live 2021 & 通过 \\
        南大\hologo{TeX} & \hologo{TeX}\,Live 2021 & 通过 \\
        \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{配置前端}

配置完编译器后,还需要一个文本编辑器作为前端来完成\texttt{.tex}文件内容的写作。

至今仍有相当一部分人认为Windows自带的记事本是最好的文本编辑器,但对于本项目而言,在此诚心诚意地推荐你使用\textbf{更现代更美观更多功能}的编辑器,譬如\emph{安装了 LaTeX Workshop 插件 的 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|,位于主目录下。

\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}


各个系统的默认字体请参考\cref{tab:defaultfontset}。指定字体的相关命令写于\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 & Courier~New & 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{修改字体配置}

如果希望覆盖检测系统字体的命令(譬如在Linux编译时使用Windows字体样式),在\texttt{profile/font.sty}中注释掉操作系统判断语句,并保留希望使用的字符集即可。全部字符集命令如下所示。

\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}

chapters/FigTabCode.tex

deleted100644 → 0
+0 −81
Original line number Diff line number Diff line
\chapter{图片、表格与代码}

\section{图片示例}

图片存放目录的定义为
\begin{lstlisting}[language=TeX]
\RequirePackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png}
\graphicspath{{figure/}} % 图片路径
\end{lstlisting}

所有图片默认存放在主目录下的\texttt{figure/}文件夹内

\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}
    % \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}[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{代码示例}


\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>}|!,只要使用在代码中未出现的符号将代码包括在内即可。

chapters/Introduction.tex

deleted100644 → 0
+0 −55
Original line number Diff line number Diff line
\chapter{绪论}

\section{简介}
南京大学学士学位论文\hologo{LaTeX}模板\cite{njuthesis}基于本科生院的论文撰写规范修改,用于生成符合南京大学学位论文排版要求和相应的国家规范、行业标准的学位论文。

此模板通过LPPL协议开源,旨在为同学提供毕业论文书写的方便,如有模板问题或者版权问题,请于Github上提出issue。

\section{开发环境}

本模板的开发维护主要在\hologo{MiKTeX}\hologo{TeX}\,Live\,2021下进行,内部代码主要由\lstinline|expl3|宏包提供的\hologo{LaTeX3}语法实现。

\section{目录结构}
\label{sec:directory}

\begin{lstlisting}[language=bash]
    │  coverinfo.sty
    │  njuthesis.bib
    │  njuthesis.cls
    │  njuthesis.tex

    ├─figure
    │      njulogo.pdf
    │      njuname.pdf

    └─profile
           abstract.sty
           components.sty
           cover.sty
           font.sty
           packages.sty
           page.sty
           reference.sty
\end{lstlisting}

\subsection{文件说明}
\begin{description}
    \item [\texttt{abstract.sty}] 定义中英文摘要环境及相关格式
    \item [\texttt{components.sty}] 定义图表标题格式
    \item [\texttt{cover.sty}] 定义论文封面内容
    \item [\texttt{font.sty}] 负责重定义CTeX宏集的默认字体,因为CTeX字体加粗要求不满足论文规定
    \item [\texttt{package.sty}] 存放所有被引用的包
    \item [\texttt{page.sty}] 定义正文页面、标题以及目录条目格式
    \item [\texttt{reference.sty}] 定义引文格式
\end{description}

\section{自定义选项}
\label{sec:classoptions}

njuthesis类提供了三个可以自定义的选项,如下所示。
\begin{description}
    \item[\texttt{TitleLength}] 标题长度,用于控制封面标题的行数。可选值为1、2、3,缺省值为1。
    \item[\texttt{Degree}] 学位类型,本科生为UG,即Undergraduate的缩写。
    \item[\texttt{Type}] 用于选择文档类型并将相关字段输出在封面和摘要页。可选值包括thesis(表示毕业论文)和design(表示毕业设计),缺省值为thesis。
\end{description}

chapters/Layout.tex

deleted100644 → 0
+0 −76
Original line number Diff line number Diff line
\chapter{页面布局}

本模板格式依照《11-南京大学毕业论文(设计)的撰写规范和装订要求》进行调整,文件内容详见\cref{chap:standard}

\section{封面页}

\subsection{封面格式}

\texttt{cover.sty}中定义了生成封面的相关命令

\subsection{输入个人信息}

主目录下的\texttt{coverinfo.sty}文件定义了用于文档封面的诸多属性参数,包括

\begin{description}
    \item[\texttt{\textbackslash TitleA}] 单行标题,或多行标题的第一行。关于是否应该折行,单行能容纳的最长标题为\emph{15个中文字符},请自行选择合适的截断处。
    \item[\texttt{\textbackslash TitleB}] 多行标题的第二行
    \item[\texttt{\textbackslash TitleC}] 多行标题的第三行
    \item[\texttt{\textbackslash Title\textunderscore EN}] 英文标题,注意空格要用波浪线(\textasciitilde)替代
    \item[\texttt{\textbackslash Grade}] 年级
    \item[\texttt{\textbackslash StudentID}] 9位数字学号
    \item[\texttt{\textbackslash StudentName}] 姓名
    \item[\texttt{\textbackslash StudentName\textunderscore EN}] 姓名拼音 
    \item[\texttt{\textbackslash Department}] 学院名称
    \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,缺省值为单行标题。

如果编写的是毕业设计,请参考\cref{sec:classoptions},将Type选项改为design。

\section{摘要页}

\texttt{profile/abstract.sty}提供了摘要页格式的定义。

摘要页一般不插入目录,默认只添加pdf书签。如确实有插入目录的需求,请在\texttt{abstract.sty}文件中定位到如下语句
\begin{lstlisting}[language=TeX]
% \phantomsection\addcontentsline{toc}{chapter}{中文摘要}
\pdfbookmark[0]{中文摘要}{中文摘要}
\end{lstlisting}
将其修改为
\begin{lstlisting}[language=TeX]
\phantomsection\addcontentsline{toc}{chapter}{中文摘要}
% \pdfbookmark[0]{中文摘要}{中文摘要}
\end{lstlisting}

\section{目录页}

目录页格式定制于\texttt{profile/page.sty}

\section{正文}

正文格式定制于\texttt{profile/page.sty},页边距在\texttt{profile/packages.sty}

\section{参考文献页}

需要使用biber手动编译才会显示,具体内容参考\cref{chap:reference}

\section{致谢页}

致谢页采用无编号章节形式,需要手动插入目录
\begin{lstlisting}[language=TeX]
\chapter*{致谢}
\addcontentsline{toc}{chapter}{致谢}
\end{lstlisting}

\section{附录页}

附录放在\lstinline|\appendix|命令后,以英文字母进行编号

chapters/Mathematics.tex

deleted100644 → 0
+0 −68
Original line number Diff line number Diff line
\chapter{数学公式与定理}

\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}

\section{定理环境}

\begin{proof}
    证明我是我
\end{proof}

\begin{definition}[他人]
    定义他人即地狱
\end{definition}

全部数学环境如下所示

\begin{table}[htbp]
    \caption{数学环境}
    \label{tab:mathenv}
    \begin{tabular}{cc}
        \toprule
        标签 & 名称 \\
        \midrule
        algorithm & 算法 \\
        assumption & 假设 \\
        axiom & 公理 \\
        conclusion & 结论 \\
        condition & 条件 \\
        corollary & 推论 \\
        definition & 定义 \\
        example &\\ 
        lemma & 引理 \\
        proof & 证明 \\
        property & 性质 \\
        proposition & 命题 \\
        remark & 注解 \\
        theorem & 定理 \\
        \bottomrule
    \end{tabular}
\end{table}

chapters/Reference.tex

deleted100644 → 0
+0 −53
Original line number Diff line number Diff line
\chapter{引用参考材料}
\label{chap:reference}

\hologo{LaTeX}的一大优势在于可以自动生成带超链接的引用条目。

\section{文档内容的引用}

使用\lstinline|cleveref|宏包实现了带图、表等项目名称的智能引用,仅需使用\lstinline|\cref{<label>}|命令。相关定义位于\lstinline|profile/reference.sty|。

\subsection{图片}

\lstinline|\label{tab:mytab}|

\subsection{表格}

\lstinline|\label{fig:myfig}|

\subsection{公式}

\lstinline|\label{eq:myeq}|


\subsection{其他数学环境}

\lstinline|\label{def:mydef}|

\subsection{章节}


\lstinline|\label{sec:mysec}|

\section{参考文献}

使用\hologo{biber}作为\hologo{BibTeX}后端。相关定义位于\lstinline|profile/reference.sty|。

\subsection{添加和管理}

默认参考文献存储于主目录下的\lstinline|njuthesis.bib|。如果有其他来源,也可以在\lstinline|njuthesis.tex|中修改以下命令:
\begin{lstlisting}[language=TeX]
\addbibresource{njuthesis.bib}
\end{lstlisting}

使用Zotero

\subsection{文段内引用}

\lstinline|\cite{myref}|

\lstinline|\citesuthor{myref}|

\subsection{引用格式}

符合GB7714-2015规范

conf.txsprofile

0 → 100644
+1408 −0

File added.

Preview size limit exceeded, changes collapsed.

coverinfo.sty

deleted100644 → 0
+0 −19
Original line number Diff line number Diff line
\ProvidesExplPackage{coverinfo}{2021-09-04}{0.1}{NJU Thesis Undergraduate cover information}

\tl_const:Nn \TitleA {一种使用南京大学\hologo{LaTeX}模版}% 第一行标题
\tl_const:Nn \TitleB {编写本科生毕业论文的经验性方法}% 第二行标题
\tl_const:Nn \TitleC {}% 第三行标题
\tl_const:Nn \Title_EN {An~Empirical~Way~of~Composing~Undergraduate~Thesis~with~NJU~\hologo{LaTeX}~Template} % 注意英文名中空格必须替换为波浪线
\tl_const:Nn \Grade {2018}
\tl_const:Nn \StudentID {181114514}
\tl_const:Nn \StudentName {周煜华}
\tl_const:Nn \StudentName_EN {Zhou~Yuhua}
\tl_const:Nn \Department {拉太赫科学与技术学院}
\tl_const:Nn \Department_EN {School~of~\hologo{LaTeX}}
\tl_const:Nn \Major {拉太赫语言学}
\tl_const:Nn \Major_EN {\hologo{LaTeX}~Linguistics}
\tl_const:Nn \Mentor {李成殿}
\tl_const:Nn \Mentor_EN {Li~Chengdian}
\tl_const:Nn \MentorTitle {教授}
\tl_const:Nn \MentorTitle_EN {Professor}
\tl_const:Nn \SubmitDate {2021年8月10日}
+14 −0
Original line number Diff line number Diff line
@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}
}
+159 −0
Original line number Diff line number Diff line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% njuthesis 示例模板 v1.4.3 2025-05-21
% 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}
+264 −0
Original line number Diff line number Diff line
% njuthesis 参数设置文件 v1.4.3 2025-05-21

% 一些提醒:
%   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          = {...},
    % define,
    % 以上设置项在重新调用 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{subsection}{\normalfont\bfseries} % 修改 subsection 为小四号粗体宋体
% \njusetformat{tabular}{\zihao{-4}\bfseries}     % 修改表格环境的字号
% \EditInstance{nju}{u/cover/emblem-img}{align=l} % 左对齐的本科生封面校徽

install-unix.sh

0 → 100755
+20 −0
Original line number Diff line number Diff line
#!/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 ..

install-win.bat

0 → 100644
+20 −0
Original line number Diff line number Diff line
@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 ..

njuthesis.bib

deleted100644 → 0
+0 −6
Original line number Diff line number Diff line
@ARTICLE{njuthesis,
 title={南京大学学士学位论文LaTex模板},
 AUTHOR = {NJU-LUG},
 JOURNALTITLE = {Github},
 YEAR   = {2021}
}
 No newline at end of file

njuthesis.cls

deleted100644 → 0
+0 −36
Original line number Diff line number Diff line
\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}

njuthesis.tex

deleted100644 → 0
+0 −69
Original line number Diff line number Diff line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NJU Thesis Undergraduate
% 南京大学本科生毕业论文LaTeX模板
% Version 0.2.0 (2021-09-09)
%
% 请关注项目地址以获取最新变化
% 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=2,% 选择标题行数,范围是1~3
    Degree=UG,% UG: 本科
    Type=thesis% thesis: 毕业论文,design: 毕业设计
]{njuthesis}

% 导入参考文献源
\addbibresource{njuthesis.bib}

\begin{document}

%----------------------------------------------------------------------------------------
%	封面、摘要和目录
%----------------------------------------------------------------------------------------

\maketitle % 请在coverpage.sty输入封面信息
\input{chapters/Abstract.tex}
\tableofcontents

%----------------------------------------------------------------------------------------
%	正文部分
%----------------------------------------------------------------------------------------
\mainmatter

\input{chapters/Introduction.tex}
\input{chapters/Environments.tex}
\input{chapters/Layout.tex}
\input{chapters/FigTabCode.tex}
\input{chapters/Mathematics.tex}
\input{chapters/Reference.tex}

%----------------------------------------------------------------------------------------
%	参考文献
%----------------------------------------------------------------------------------------
\printbibliography[heading=bibintoc, title=参考文献] % 输出参考文献列表并将本页插入目录条目

%----------------------------------------------------------------------------------------
%	致谢
%----------------------------------------------------------------------------------------

\input{chapters/Acknowledgement.tex}

%----------------------------------------------------------------------------------------
%	附录部分
%----------------------------------------------------------------------------------------
\appendix

\input{chapters/Standard.tex}

\end{document}

profile/abstract.sty

deleted100644 → 0
+0 −69
Original line number Diff line number Diff line
\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}
  % \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签
  \pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存
  \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}
  % \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签
  \pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存
  \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}%
}

profile/components.sty

deleted100644 → 0
+0 −168
Original line number Diff line number Diff line
\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}

% 数学环境
\declaretheoremstyle[
    	%spaceabove=.5\thm@preskip,
    	%spacebelow=.5\thm@postskip,
    	headfont=\bf\songti,%\scshape,
    	notefont=\songti,% notebraces={ (}{)},
    	bodyfont=\songti,
    	%headformat={\NAME\space\NUMBER\space\NOTE},
    	headpunct={},
    	%postheadspace={.5em plus .1em minus .1em},
    	%prefoothook={\hfill\qedsymbol}
    ]{njuthm}

\theoremstyle{njuthm}

\let\oldproofname=\proofname
\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}} % 修改证明环境标题

\declaretheorem[
	name=算法,
	style=njuthm,
	refname={算法,算法},
	Refname={算法,算法},
	% numberwithin=section,
]{algorithm}
\declaretheorem[
	name=假设,
	style=njuthm,
	refname={假设,假设},
	Refname={假设,假设},
	% numberwithin=section,
]{assumption}
\declaretheorem[
	name=公理,
	style=njuthm,
	refname={公理,公理},
	Refname={公理,公理},
	% numberwithin=section,
]{axiom}
\declaretheorem[
	name=结论,
	style=njuthm,
	refname={结论,结论},
	Refname={结论,结论},
	% numberwithin=section,
]{conclusion}
\declaretheorem[
	name=条件,
	style=njuthm,
	refname={条件,条件},
	Refname={条件,条件},
	% numberwithin=section,
]{condition}
\declaretheorem[
	name=推论,
	style=njuthm,
	refname={推论,推论},
	Refname={推论,推论},
	% numberwithin=section,
]{corollary}
\declaretheorem[
	name=定义,
	style=njuthm,
	refname={定义,定义},
	Refname={定义,定义},
	% numberwithin=section,
]{definition}
\declaretheorem[
    	name=例,
    	style=njuthm,
    	refname={例,例},
    	Refname={例,例},
    	% numberwithin=section,
]{example}
\declaretheorem[
	name=引理,
	style=njuthm,
	refname={引理,引理},
	Refname={引理,引理},
	% numberwithin=section,
]{lemma}
\declaretheorem[
	name=性质,
	style=njuthm,
	refname={性质,性质},
	Refname={性质,性质},
	% numberwithin=section,
]{property}
\declaretheorem[
	name=命题,
	style=njuthm,
	refname={命题,命题},
	Refname={命题,命题},
	% numberwithin=section,
]{proposition}
\declaretheorem[
	name=注解,
	style=njuthm,
	refname={注解,注解},
	Refname={注解,注解},
	% numberwithin=section,
]{remark}
\declaretheorem[
	name=定理,
	style=njuthm,
	refname={定理,定理},
	Refname={定理,定理},
	numberwithin=section,
]{theorem}

profile/cover.sty

deleted100644 → 0
+0 −107
Original line number Diff line number Diff line
\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
  \pdfbookmark{封面}{封面} % 将封面插入pdf书签
  \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
}

profile/font.sty

deleted100644 → 0
+0 −191
Original line number Diff line number Diff line
\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

% 设置数学字体 (XITS, 或者 STIX, 与 Times New Roman 最为相近)
% \setmathfont{STIXTwoMath-Regular}[Extension = .otf]
\setmathfont{XITSMath-Regular}[
  BoldFont = XITSMath-Bold,
  Extension = .otf]


\NewDocumentCommand\songti{}{\CJKfamily{zhsong}}
\NewDocumentCommand\heiti{}{\CJKfamily{zhhei}}
\NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}}
\NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}}
% \NewDocumentCommand\lishu{}{\CJKfamily{zhli}}

profile/packages.sty

deleted100644 → 0
+0 −62
Original line number Diff line number Diff line
\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{multirow} % Cells occupying multiple rows in tables
\RequirePackage{multicol} % Multiple columns in dictionary
\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
\sys_if_engine_xetex:T{ \RequirePackage{microtype} }
% \sys_if_engine_luatex:T{ 
%     \RequirePackage{emoji} 
%     \setemojifont{Segoe UI Emoji} % For windows. 
%                                   % Shipped with the best `grinning-face-with-sweat' support.
%                                   % Use `Apple Color Emoji' for macos 
%                                   % or `Noto Color Emoji' if you prefer.
% }

\RequirePackage{blindtext} % 生成用于测试的大段无意义英文文字
\RequirePackage{zhlipsum} % 生成用于测试的大段无意义中文文字
% \RequirePackage{showframe} % 加载以后展示内容边界

\RequirePackage{amsmath} % Must be loaded before unicode-math
\RequirePackage{amsthm} % Mathematical environments
\RequirePackage{thmtools} % Theorem styles
\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}

profile/page.sty

deleted100644 → 0
+0 −54
Original line number Diff line number Diff line
\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}

% 将目录页插入pdf书签
\let\savedtableofcontents\tableofcontents
\renewcommand{\tableofcontents}{%
  \pdfbookmark{目录}{目录}
  \savedtableofcontents}

profile/reference.sty

deleted100644 → 0
+0 −68
Original line number Diff line number Diff line
\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\,} % 默认在名称后面添加空格

\crefname{figure}{}{}
\crefname{table}{}{}
% \crefname{equation}{公式}{公式}
\crefformat{equation}{公式~#2#1#3~} % 删除公式编号的括号

\crefformat{chapter}{第#2#1#3章}
\crefformat{section}{第~#2#1#3~节}
\crefformat{subsection}{第~#2#1#3~小节}
\crefformat{subsubsection}{第~#2#1#3~小节}
% \crefname{chapter}{§}{§}
% \crefname{section}{§}{§}
% \crefname{subsection}{§}{§}
% \crefname{subsubsection}{§}{§}
\crefname{appendix}{附录}{附录}

% \crefname{definition}{定义}{定义}
% \crefname{axiom}{公理}{公理}
% \crefname{property}{性质}{性质}
% \crefname{proposition}{命题}{命题}
% \crefname{lemma}{引理}{引理}
% \crefname{corollary}{推论}{推论}
% \crefname{remark}{注解}{注解}
% \crefname{condition}{条件}{条件}
% \crefname{conclusion}{结论}{结论}
% \crefname{assumption}{假设}{假设}

scripts/download.sh

0 → 100644
+18 −0
Original line number Diff line number Diff line
# 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/

scripts/file_parser.py

0 → 100644
+196 −0

File added.

Preview size limit exceeded, changes collapsed.

+9 −0
Original line number Diff line number Diff line
@ECHO OFF

pdflatex --shell-escape generate-img
DEL "generate-img.pdf"
DEL "*.aux"
DEL "*.auxlock"
DEL "*.dpth"
DEL "*.log"
DEL "*.md5"
+9 −0
Original line number Diff line number Diff line
#!/usr/bin/env sh

pdflatex --shell-escape generate-img
rm generate-img.pdf
rm *.aux
rm *.auxlock
rm *.dpth
rm *.log
rm *.md5
+16 −0
Original line number Diff line number Diff line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 本文件用于生成校徽和校名图片
% 编译命令为 pdflatex --shell-escape generate-img
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{njuvisual}
\usetikzlibrary{external}
\tikzexternalize[prefix=nju-]
\begin{document}
% 黑色
\tikzsetnextfilename{emblem}         \njuemblem[black]{!}{!}
\tikzsetnextfilename{name}           \njuname  [black]{!}{!}
% 紫色
\tikzsetnextfilename{emblem-purple}  \njuemblem[njupurple]{!}{!}
\tikzsetnextfilename{name-purple}    \njuname  [njupurple]{!}{!}
\end{document}

scripts/main.py

0 → 100644
+186 −0

File added.

Preview size limit exceeded, changes collapsed.

source/latexmkrc

0 → 100644
+28 −0
Original line number Diff line number Diff line
# Latexmk configuration file for njuthesis documentation.
# vim: set ft=perl:

# Use XeLaTeX to compile.
$pdf_mode = 5;
$xelatex = "xelatex -shell-escape -file-line-error -halt-on-error -interaction=nonstopmode -no-pdf -synctex=1 %O %S";
$xdvipdfmx = "xdvipdfmx -q -E -o %D %O %S";

$bibtex_use = 1.5;

# Clean auxiliary files .
$clean_ext = "hd loe ptc run.xml synctex.gz thm xdv";

# Process index.
$makeindex = "makeindex %O -s gind.ist -o %D %S";
add_cus_dep('glo','gls',0,'makeindex');
sub makeindex {
  if ( $silent ) {
    system( "makeindex -q -s gglo.ist -o \"$_[0].gls\" \"$_[0].glo\"" );
  }
  else {
    system( "makeindex -s gglo.ist -o \"$_[0].gls\" \"$_[0].glo\"" );
  };
}
$makeindex_silent_switch = "-q";

# Show CPU time used.
$show_time = 1;

source/njuthesis.dtx

0 → 100644
+9426 −0

File added.

Preview size limit exceeded, changes collapsed.

+11 −0
Original line number Diff line number Diff line
\njuchapter{攻读博士学位期间研究成果及参与项目情况}

\njupaperlist[攻读博士学位期间发表的学术论文]{Nemec1997-209-214,Chiani1998-2998-3008,Chiani1998a}

\section*{攻读博士学位期间参与的科研课题}

\begin{enumerate}[label=\arabic*., labelindent=0em, leftmargin=*]
    \item 2020.1-2023.12, 国家自然科学基金, 12345678, 这是项目名称, 负责人: 老板1, 60 万.
    \item 2020.1-2022.12, 国家自然科学基金, 23456789, 这是项目名称, 负责人: 老板2, 25 万.
    \item 2020.1-2023.12, 国家自然科学基金, 34567890, 这是项目名称, 负责人: 老板3, 66 万.
\end{enumerate}
+13 −0
Original line number Diff line number Diff line
\chapter{引用参考文献}
\label{chap:bibliography}

\section{引用命令}

顺序编码制的 \cite{qiujinhengetal2010,njuthesis,riedl2009quasi}(上标可设置页码)、\parencite{qiujinhengetal2010}(非上标可设置页码)、\pagescite{qiujinhengetal2010}(上
标加自动页码)、\textcite{qiujinhengetal2010}(提供作者为主语加非上标编号)、\authornumcite{qiujinhengetal2010}(提供作
者为主语加上标编号)、\footfullcite{qiujinhengetal2010}(脚注方式)

著者-年份制的\cite{qiujinhengetal2010,njuthesis,riedl2009quasi}(作者加年份用
括号包围可设置页码)、\pagescite{qiujinhengetal2010}(作者加年份用括号包围自动页码)、\yearcite{qiujinhengetal2010}(提供
年份用括号包围)、\yearpagescite{qiujinhengetal2010}(提供年份用括号包围自动页码)、\textcite{qiujinhengetal2010}(提供主
语作者加括号包围年份)、\footfullcite{qiujinhengetal2010}(脚注方式)。
+83 −0
Original line number Diff line number Diff line
\chapter{图片、表格与代码}

\section{图片}

插入一张图片,就像\cref{fig:arcaea}这样。

\begin{figure}[htbp]
    \centering
    \includegraphics[width=0.5\textwidth]{test.png}
    \caption{火热劲爆 Arcaea}
    \label{fig:arcaea}
\end{figure}
\zhlipsum[3][name=aspirin]

% \subsection{文字环绕图像}
% % wrapfigure后面不能有空行
% \begin{wrapfigure}{r}{0cm}
%     \label{fig:arcaeaedge}
%     \includegraphics[width=.15\textwidth]{test.png}
%     \caption{闊靛緥婧愮偣}
% \end{wrapfigure}
% \zhlipsum[2][name=simp]

% \subsection{多个图像}
% \begin{figure}[htbp]
%     \centering
%     \begin{subfigure}{.32\textwidth}
%         \centering
%         \includegraphics[width=\textwidth]{test.png}
%         \caption{闊靛緥婧愮偣}
%     \end{subfigure}
%     \begin{subfigure}{.32\textwidth}
%         \centering
%         \includegraphics[width=\textwidth]{test.png}
%         \caption{Arcaea}
%     \end{subfigure}

%     \begin{subfigure}{.32\textwidth}
%         \centering
%         \includegraphics[width=\textwidth]{test.png}
%         \caption{闊虫父}
%     \end{subfigure}
%     \caption{新概念空间立体节奏游戏}
% \end{figure}

\section{表格}

你可以使用 |table| 环境插入标准三线表,如\cref{tab:testtab}所示。

\begin{table}[htbp]
    % \centering
    \caption{经过测试的环境}
    \label{tab:testtab}
    \begin{tabular}{ccc}
        \toprule
        OS           & TeX           & 测试情况 \\
        \midrule
        Windows 10   & TeX Live 2021 &\\
        Windows 10   & MiKTeX        &\\
        Windows 10   & TeX Live 2020 & ×        \\
        Ubuntu 20.04 & TeX Live 2021 &\\
        南大 TeX     & Overleaf      &\\
        \bottomrule
    \end{tabular}
\end{table}

全部预定义的数学环境如\cref{tab:mathenv}所示。

\begin{table}[htbp]
    % \centering
    \caption{数学环境}
    \label{tab:mathenv}
    \begin{tabular}{cc|cc}
        \toprule
        标签       & 名称 & 标签       & 名称 \\
        \midrule
        axiom      & 公理 & lemma      & 引理 \\
        corollary  & 推论 & proof      & 证明 \\
        definition & 定义 & theorem    & 定理 \\
        example    &&            &      \\
        \bottomrule
    \end{tabular}
\end{table}
Original line number Diff line number Diff line
\chapter{南京大学本科毕业论文(设计)的
撰写规范和装订要求(试行)}
\chapter[本科毕业论文格式规定]{南京大学本科毕业论文(设计)的撰写规范和装订要求(试行)}
\label{chap:standard}

本科毕业论文(设计)是本科教学中的重要环节,为规范本科毕业论文(设计)的工作,特制订毕业论文(设计)的撰写和装订要求,请同学们按照要求执行。如各院系已经制定了相应的规范,则按照院系的要求执行。
@@ -82,7 +81,8 @@

\subsection{注释}
毕业论文(设计)中有个别名词或情况需要解释时,可加注说明。注释采用脚注,每页独立编号,即每页都从1开始编码,编号用1,2,3……,文中编号用上标。
(十)参考文献

\subsection{参考文献}
参考文献的著录应符合国家标准,参考文献的序号左顶格,并用数字加方括号表示,如“[1]”。每一条参考文献著录均以“.”结束。

\section{毕业论文(设计)装订要求}

test/test-luatex.tex

0 → 100644
+4 −0
Original line number Diff line number Diff line
\def\TEST{}
\documentclass{njuthesis}
\njusetup{bib/style=author-year}
\input{test.tex}
+3 −0
Original line number Diff line number Diff line
\def\TEST{}
\documentclass[type=doctor,nl-cover]{njuthesis}
\input{test.tex}

test/test.bib

0 → 100644
+67 −0

File added.

Preview size limit exceeded, changes collapsed.

test/test.tex

0 → 100644
+274 −0

File added.

Preview size limit exceeded, changes collapsed.