Skip to content

Commit

Permalink
Merge branch 'refactor-for-typst-universe' into 'main'
Browse files Browse the repository at this point in the history
refactor!: 在 howardlau1999/sysu-thesis-typst 基础上基于 nju-lug/modern-nju-thesis 重构

See merge request sysu-gitlab/thesis-template/better-thesis!1
  • Loading branch information
huangjj27 committed May 15, 2024
2 parents d8b53c4 + 335ff92 commit 364d854
Show file tree
Hide file tree
Showing 65 changed files with 2,282 additions and 334 deletions.
5 changes: 3 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
compile.bat text eol=crlf
install_typst.ps1 text eol=crlf
compile.bat text eol=crlf
install_typst.ps1 text eol=crlf
**/*.otf filter=lfs diff=lfs merge=lfs -text
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- name: Checkout master
uses: actions/checkout@v3
with:
with:
fetch-depth: 0
- name: Setup Pages
uses: actions/configure-pages@v2
Expand All @@ -35,7 +35,7 @@ jobs:
# run: 'sudo apt-get update && sudo apt install -y ripgrep wget curl && (curl -s https://api.github.com/repos/typst/typst/releases | rg "browser_download_url.*typst-x86_64-unknown-linux-gnu.tar.gz" | head -1 | cut -d : -f 2,3 | tr -d \" | wget -qi -) && tar xf typst-x86_64-unknown-linux-gnu.tar.gz && sudo mv typst-x86_64-unknown-linux-gnu/typst /usr/local/bin/typst'
run: 'cargo install --git https://github.com/typst/typst typst-cli'
- name: Build PDF
run: 'mkdir build && typst compile --font-path fonts thesis.typ build/thesis.pdf'
run: 'mkdir build && typst compile --root=. --font-path=fonts template/thesis.typ build/thesis.pdf'
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
with:
name: github-pages
- name: Extract artifact
run: |
run: |
mkdir -p $RUNNER_TEMP/gitee_pages
tar -C $RUNNER_TEMP/gitee_pages -xf artifact.tar
- name: Deploy to Gitee Pages
Expand All @@ -77,7 +77,7 @@ jobs:
git config --global user.name "Howard Lau"
git config --global user.email "howardlau1999@hotmail.com"
cd $RUNNER_TEMP/gitee_pages
git init
git checkout -b gh-pages
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/gitee.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
thesis.pdf
**/*.pdf
.vscode
29 changes: 6 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# sysu-thesis-typst

[Gitee 仓库镜像](https://gitee.com/howardlau/sysu-thesis-typst)(自动同步 [GitHub 主仓库](https://github.com/howardlau1999/sysu-thesis-typst),仅供只读访问)

中山大学学位论文 Typst 模板,项目基于 [PKUTHSS-Typst](https://github.com/lucifer1004/pkuthss-typst) 重构。
# 基于 Typst 的中山大学学位论文模板
[![GitLab 仓库](https://img.shields.io/badge/gitlab-%23181717.svg?style=for-the-badge&logo=gitlab&logoColor=white)](https://gitlab.com/sysu-gitlab/thesis-template/better-thesis)
[![GitHub 仓库](https://img.shields.io/badge/gitlab-%23181717.svg?style=for-the-badge&logo=gitlab&logoColor=white)](https://github.com/sysu/better-thesis)

当前还未完全符合学位论文格式要求,欢迎同学们贡献代码!模板交流 QQ 群:797942860([点此直接加入](https://jq.qq.com/?_wv=1027&k=m58va1kd)

输出成品文件预览(每 6 小时自动更新):[thesis.pdf](https://liuhaohua.com/sysu-thesis-typst/thesis.pdf)

**Q:我不会 LaTeX,可以用这个模板写论文吗?**

**A:完全可以!Typst 是一个比 LaTeX 更简单的排版语言,同时安装更加方便,编译更加快速!**
Expand All @@ -16,6 +12,8 @@

**由于 Typst 还处于初期的快速开发阶段,本项目需要使用从源码编译的 Typst 版本才能正常生成 PDF。仓库提供了一键安装脚本,按照使用说明运行即可。**

<!-- TODO: 提供 typst.universe 版本 -->

### Windows 用户

1. [下载本仓库](https://github.com/howardlau1999/sysu-thesis-typst/archive/refs/heads/master.zip),或者使用 `git clone https://github.com/howardlau1999/sysu-thesis-typst` 命令克隆本仓库。
Expand Down Expand Up @@ -51,19 +49,4 @@ cargo install --git https://ghproxy.com/https://github.com/typst/typst.git
4. 执行 `make` 命令,即可生成 `thesis.pdf` 文件。

## 项目结构

### 主要文件

- `info.typ` 文件中包含论文的基本信息,包括作者、学位、导师、学位论文题目等。
- `custom.typ` 文件中包含论文的自定义设置,包括行距,字体等。
- `thesis.typ` 文件是论文的主体,包含论文的各个章节。在添加或者删除章节文件后,需要同步修改这个文件中的 `#include` 命令。
- `template.typ` 文件是论文的模板,包含论文的各个部分的格式。一般不需要修改。

### 文件夹

- `chapters` 文件夹包含了论文的各个章节文件,你可以自由地增加或删除章节文件,按你自己需要的方式组织文件。在添加或删除文件后,需要同步修改 `thesis.typ` 文件中的 `#include` 命令。
- `templates` 文件夹包含了论文的各个部分的模板文件,你可以自由地增加或删除模板文件,按你自己需要的方式组织文件。在添加或删除文件后,需要同步修改 `template.typ` 文件中的 `#include` 命令。欢迎贡献新的模板文件。
- `functions` 文件夹包含了模板使用到的各种自定义辅助函数,如果你想贡献代码,可以在这个文件夹中添加新的辅助函数。
- `fonts` 文件夹包含了模板使用到的字体文件,你可以按需要添加或者删除字体文件。在添加或删除文件后,可以运行 `typst --font-path fonts fonts` 查看 Typst 检测到的字体文件。
- `bibs` 文件夹包含了论文的参考文献文件,你可以按需要添加或者删除参考文献文件,目录结构没有特殊需求。
- `images` 文件夹包含了论文中使用到的图片文件,你可以按需要添加或者删除图片文件,目录结构没有特殊需求。`vi` 文件夹包含了校徽的矢量图文件。
详见 `template\thesis.typ`
1 change: 1 addition & 0 deletions assets/vi/sysu_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions compile.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
@echo off
@echo off
chcp 65001>nul
set Path=%cd%\;%Path%
set TYPST_FONT_PATHS=%cd%\fonts
echo 编译中……
typst compile --font-path fonts thesis.typ
typst compile --root=%cd% --font-path=fonts template/thesis.typ
echo 命令运行完毕,按任意键退出
pause>nul
pause>nul
11 changes: 0 additions & 11 deletions custom.typ

This file was deleted.

Binary file modified fonts/AdobeFonts/AdobeFangSongStd-Regular.otf
Binary file not shown.
Binary file modified fonts/AdobeFonts/AdobeHeitiStd-Regular.otf
Binary file not shown.
Binary file modified fonts/AdobeFonts/AdobeKaitiStd-Regular.otf
Binary file not shown.
Binary file modified fonts/Arial/Arial.otf
Binary file not shown.
Binary file modified fonts/Inconsolata/Inconsolata-Bold.otf
Binary file not shown.
Binary file modified fonts/Inconsolata/Inconsolata-Regular.otf
Binary file not shown.
Binary file modified fonts/Inconsolata/Inconsolata-SemiBold.otf
Binary file not shown.
Binary file modified fonts/SourceHan/SourceHanSansHWSC-Bold.otf
Binary file not shown.
Binary file modified fonts/SourceHan/SourceHanSansHWSC-Regular.otf
Binary file not shown.
Binary file modified fonts/SourceHan/SourceHanSerifSC-Bold.otf
Binary file not shown.
Binary file modified fonts/SourceHan/SourceHanSerifSC-Regular.otf
Binary file not shown.
2 changes: 1 addition & 1 deletion functions/helpers.typ
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
} else {
let ret = ()
let len = lists.fold(
lists.first().len(),
lists.first().len(),
(a, b) => if a > b.len() { b.len() } else { a }
)

Expand Down
Loading

0 comments on commit 364d854

Please sign in to comment.