Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] 基于 v2.x 重构 v3.x #34

Merged
merged 9 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug Report
about: Create a report to help us improve
title: '[BUG] '
labels: bug
assignees: ''
---

**Bug 描述**
<!-- 简明扼要地描述这个bug -->

**复现步骤**
<!--
1. 第一步
2. 第二步
3. 发生错误
-->

**预期行为**
<!-- 描述你期望发生的事情 -->

**实际行为**
<!-- 描述实际发生的事情 -->

**截图**
<!-- 如果有的话,添加截图 -->

**环境信息:**
- 操作系统:[例如 Windows11]
- TeX 发行版:[例如 TeXLive]
- 版本:[例如 2024]

**其他信息**
<!-- 其他需要补充的信息 -->
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature Request
about: Suggest an idea for this project
title: '[FEATURE] '
labels: enhancement
assignees: ''
---

**需求描述**
<!-- 清晰简洁地描述你想要什么功能 -->

**解决方案**
<!-- 描述你期望的解决方案 -->

**其他信息**
<!-- 其他相关的信息或截图 -->
59 changes: 59 additions & 0 deletions .github/workflows/cd-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Create Release

on:
push:
tags:
- 'v*'
workflow_dispatch:

permissions:
contents: write

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Validate version and branch
run: |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
TAG_NAME=${{ github.ref_name }}
if [[ "$BRANCH_NAME" == "master" && ! "$TAG_NAME" =~ ^v3\. ]]; then
echo "Error: Tags on master branch must start with v3."
exit 1
fi

build:
needs: validate
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false

- name: Archive Repository
run: zip -r release.zip . -x '.git/*' '.github/*' '.git*'

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release.zip
asset_name: release.zip
asset_content_type: application/zip
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
*.idx
*.gls
*.hd
.vscode
.vscode
/build
Binary file removed FangSong.otf
Binary file not shown.
35 changes: 0 additions & 35 deletions Makefile

This file was deleted.

Binary file removed Microsoft YaHei Bold.otf
Binary file not shown.
62 changes: 30 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
# 关于 [SHU-Bachelor-Thesis-OSC](https://github.com/EnJiang/SHU-Bachelor-Thesis-OSC)
本模板是上海大学本科生毕业论文latex模板-开源社区版本。
# SHU Bachelor Thesis OSC

此模板基于[SHU-Bachelor-Thesis](https://github.com/alfredbowenfeng/SHU-Bachelor-Thesis)修改得来。
上海大学本科生毕业论文 latex 模板-开源社区版本。

本身[SHU-Bachelor-Thesis](https://github.com/alfredbowenfeng/SHU-Bachelor-Thesis)又是由
[ShuThesis](https://github.com/ahhylau/shuthesis)修改得来的。
后者是一个支持上海大学硕士和博士毕业论文的latex模板,前者对其进行了一定的改进,但是还有诸多遗留问题。
## 1. 关于 SHU-Bachelor-Thesis-OSC

本模板对[SHU-Bachelor-Thesis](https://github.com/alfredbowenfeng/SHU-Bachelor-Thesis)
遗留的问题又进行了进一步改进,使其尽量与上海大学本科生论文的MS Word版本格式一致。
本模板基于[SHU-Bachelor-Thesis](https://github.com/alfredbowenfeng/SHU-Bachelor-Thesis)修改得来。

感谢前面几位同学的工作和开源精神。
希望本模板能帮助到本科生同学,希望越来越多的同学能加入到开源社区大家庭。
本身[SHU-Bachelor-Thesis](https://github.com/alfredbowenfeng/SHU-Bachelor-Thesis)又是由 [ShuThesis](https://github.com/ahhylau/shuthesis)修改得来的。后者是一个支持上海大学硕士和博士毕业论文的 latex 模板,前者对其进行了一定的改进,但是还有诸多遗留问题。

模板的维护是一个相当考验细节处理的工作,欢迎pull requests。
作者会尽可能尽快处理。
本模板对[SHU-Bachelor-Thesis](https://github.com/alfredbowenfeng/SHU-Bachelor-Thesis) 遗留的问题又进行了进一步改进,使其尽量与上海大学本科生论文的 MS Word 版本格式一致。

# 使用步骤
感谢前面几位同学的工作和开源精神。希望本模板能帮助到本科生同学,希望越来越多的同学能加入到开源社区大家庭。

## 本地
- 下载本模板到本地解压,或git clone本模板
- 用学院给的论文模板创建封面,命名为 cover.pdf 文件保存至根目录下(替换原文件)
- 修改 data 文件夹下的.tex文件,编辑论文内容
- 通过根目录下的 main.tex 文件添加或删去章节
- 通过根目录下的 main.tex 文件编译
模板的维护是一个相当考验细节处理的工作,欢迎 pull requests. 作者会尽可能尽快处理。

## Overleaf
- 下载本模板到本地解压,或git clone本模板
- 用学院给的论文模板创建封面,命名为 cover.pdf 文件保存至根目录下(替换原文件)
- 删除.otf文件(保证上传文件大小在50M以内)
- 将模板压缩为.zip文件
- 打开 Overleaf,点击创建新项目并上传项目,将zip文件拖入对话框
- 加载完成后,点击左上角菜单,在编译器处选择 XeLaTeX
- 按下 Ctrl-S 保存并编译

# 注意事项
## 2. 使用步骤

## 论文信息
### 2.1. 本地

你需要在 `main.tex` 的导言区修改你的个人信息, `data/cover.tex` 和 `data/declaration.tex` 不需要进行修改.
- 本地安装 Latex.
- 下载本模板到本地解压,或 clone 本模板。
- 修改 [contents](./contents/) 文件夹下的 .tex 文件,编辑论文内容。
- 通过根目录下的 main.tex 文件添加或删去章节。
- 编译:`bash scripts/build.sh xebib`.

### 2.2. Overleaf

- 下载 [Release Page](https://github.com/shuosc/SHU-Bachelor-Thesis-OSC/releases) 中最新的 zip 压缩包。
- 打开 Overleaf, 点击创建新项目并上传项目,将 zip 文件拖入对话框。
- 加载完成后,点击左上角菜单,在编译器处选择 XeLaTeX.
- 按下 Ctrl-S 保存并编译。

## 3. 注意事项

### 3.1. 论文信息

你需要在 `main.tex` 的导言区修改你的个人信息, `contents/cover.tex` 和 `contents/declaration.tex` 不需要进行修改。

```tex
% 下面是论文相关信息的填写:
Expand All @@ -55,10 +53,10 @@
% 指导老师:
\newcommand{\iSupervisorName}{余墨}
% 起讫时间:
\newcommand{\iThesisTime}{2024年1月15日起5月24日止}
\newcommand{\iThesisTime}{2024 年 1 月 15 日起 5 月 24 日止}
```

如果在签字后需要覆盖原创性声明部分,可以增加 pdf 文件后,修改 `main.tex` 文章区起始的代码.
如果在签字后需要覆盖原创性声明部分,可以增加 pdf 文件后,修改 `main.tex` 文章区起始的代码

```tex
% before:
Expand Down
20 changes: 0 additions & 20 deletions clean.bat

This file was deleted.

4 changes: 2 additions & 2 deletions data/abstract.tex → contents/abstract.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ \chapter*{摘\ 要}
点。

\vspace{8mm}
\textbf{关键词} \TeX, \LaTeX, Template, Thesis
\textbf{关键词}: \TeX, \LaTeX, Template, Thesis

\newpage
{
Expand All @@ -27,7 +27,7 @@ \chapter*{ABSTRACT}

Abstract in English.

The content of the abstract requires the author to briefly introduce the main content of this paper, mainly for my work and innovation.
\textbf{The content of the abstract requires the author to briefly introduce the main content of this paper, mainly for my work and innovation.}

\vspace{8mm}

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions data/appendix.tex → contents/appendix.tex
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ \chapter{经典不等式}
等号成立当且仅当存在一个常数~$c$ 满足~$a_i^p=cb_i^q$.\\

\noindent{\bfseries (PM Inequality)}
设~$x_1$, $x_2$, $\ldots$, $x_n$ 是~$n$ 个非负实数. 如果~$0<p<q$, 那么
设~$x_1$, $x_2$, $\ldots$, $x_n$ 是~$n$ 个非负实数如果~$0<p<q$, 那么
\[
\left(\frac{x_1^p+x_2^p+\cdots+x_n^p}{n}\right)^{\frac{1}{p}}\leq
\left(\frac{x_1^q+x_2^q+\cdots+x_n^q}{n}\right)^{\frac{1}{q}},
\]
等号成立当且仅当~$x_1=x_2=\cdots =x_n$.\\

\noindent{\bfseries (AM-GM Inequality)}
设~$x_1$, $x_2$, $\ldots$, $x_n$ 是~$n$ 个非负实数. 则有
设~$x_1$, $x_2$, $\ldots$, $x_n$ 是~$n$ 个非负实数则有
\[
\frac{x_1+x_2+\cdots+x_n}{n}\geq\sqrt[n]{x_1x_2\cdots x_n},
\]
Expand Down
77 changes: 77 additions & 0 deletions contents/chap01.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
% !Mode:: "TeX:UTF-8"
\chapter{模板介绍}
\label{cha:intro}

\section{\shuthesis 模板(本模板的基模板)介绍}
这是 \shuthesis\ 的示例文档,基本上覆盖了模板中所有格式的设置。建议大家在使用模板之
前,阅读一下 \texttt{shuthesis.pdf} 文档。\shuthesis\ 已经将 \LaTeX 的复杂性尽可
能地进行了封装,开放出简单的接口,以便于使用者可以轻易地使用。

\shuthesis\ 是为了帮助上海大学毕业生撰写学位论文而编写的 \LaTeX 模板,模板的开发
分为两个阶段:版本 v1.x 是由水寿松制作完成的,基于 CJK 宏包开发和使用 GBK 编码,
可在 \url{http://blog.lehu.shu.edu.cn/shuishousong/A209370.html} 下载。当前
版本是 v2.0, 由 ahhylau 制作完成,基于 XeCJK 宏包开发,文件使用 UTF-8 编码。
\shuthesis\ v2.0 使用文学化编程 (Literate Programming), 利用 \texttt{doc/DocStrip}
将代码和说明文档混合编写,便于以后的升级和维护。另外,作者重新制作了上海大学 logo 的
高清矢量图,看起来更加美观。

目前 \shuthesis\ 模板的代码托管在 \href{https://github.com/ahhylau/shuthesis}{GitHub}
上,如有修改建议或者其他要求欢迎在 GitHub 上提交 issue, 作者会尽快回复。非常期待有其
他上大的 \TeX\ 使用者加入到模板的开发与维护当中来,不断完善模板。

本模板是以清华大学学位论文模板 \textsc{ThuThesis} 为基础制作的衍生版,在此对代码的贡
献者表示感谢!

\section{\shubachelorthesisOSC\ 模板}
\shuthesis\ 仅支持硕博论文,后来 \href{https://github.com/alfredbowenfeng}{alfredbowenfeng}
在\shuthesis\ 的基础上修改出了\shubachelorthesis\ , 然而似乎格式和学习官方给出的版本有多处对不上。

因此,我们在 \href{https://github.com/alfredbowenfeng/SHU-Bachelor-Thesis}{\shubachelorthesis\ }
的基础上进一步制作了上海大学本科生毕业论文 Latex 模板开源社区版本
\href{https://github.com/EnJiang/SHU-Bachelor-Thesis-OSC}{\shubachelorthesisOSC\ }


感谢前面几位同学的工作和开源精神。希望本模板能帮助到本科生同学,希望越来越多的同学能加入到开源社区大家庭。

\section{目录内容}
模板的源文件即为研究生毕业论文中使用的模板,用户可以通过修改这些文件来编辑自己的毕业论文。
\begin{itemize}
\item{main.tex}: 主文件,包含封面部分和基本设置。
\item{data}: 包含本文正文中的所有章节。
\begin{itemize}
\item{abstract.tex}: 中英文摘要。
\item{denotation.tex}: 主要符号对照表。
\item{chap01.tex}: 第一章内容。
\item{chap02.tex}: 第二章内容。
\item{chap03.tex}: 第三章内容。
\item{chap04.tex}: 第四章内容。
\item{acknowledgement.tex}: 致谢。
\item{publications.tex}: 作者在攻读学位期间公开发表的论文。
\item{appendix.tex}: 附录。
\end{itemize}
\item{reference/refs.bib}: 存放论文所引用的全部参考文献信息。
\item{clean.bat}: 双击此文件,可以用来清理 main.tex 在编译之后生成的所有缓存文件,
如后缀名为~.aux~,~.log~,~.bak~的文件。
\item{make-doc.bat}: 双击此文件,一键生成用户手册 \texttt{shuthesis.pdf}.
\end{itemize}


\section{模板使用}
\label{sec:first}

本模板在 Windows 10 和 \TeX Live 2016 下开发,所使用的宏包均跟进到最新版本。本模板并
未在其他平台和发行版进行测试,如 MacOS \& Mac\TeX. 由于历史原因,目前国内使用 C\TeX\
套装的人还是很多。然而,C\TeX\ 套装自从 2012 年后就不再更新了,许多宏包已经很老旧了。
因此从 \shuthesis\ v2.0 开始,模板不再支持在 C\TeX 套装下使用 (C\TeX\ 2.9.2 及之前
的版本均无法使用). 如果用户需要在 C\TeX\ 下写作,可使用 \shuthesis\ v1.x. 在 Windows
系统和 Linux 系统下作者推荐使用 \TeX Live 进行编译; MacOS 系统可使用 Mac\TeX.










Loading