Skip to content

Commit d699c70

Browse files
committed
feat: update LaTeX tools and add build scripts
Renames LaTeX tools and updates settings for SYSUThesis. Adds Makefile for building and cleaning project files. Introduces build.lua and create_release.py for automated builds. Renames logo files for consistency.
1 parent 59e29dc commit d699c70

25 files changed

+398
-73
lines changed

.vscode/settings.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
{
44
"name": "latexmk (xelatex)",
55
"tools": [
6-
"unpack-thuthesis",
6+
"unpack-sysuthesis",
77
"xelatexmk"
88
]
99
},
1010
{
1111
"name": "latexmk (lualatex)",
1212
"tools": [
13-
"unpack-thuthesis",
13+
"unpack-thesis",
1414
"lualatexmk"
1515
]
1616
},
@@ -23,13 +23,13 @@
2323
],
2424
"latex-workshop.latex.tools": [
2525
{
26-
"name": "unpack-thuthesis",
26+
"name": "unpack-sysuthesis",
2727
"command": "xetex",
2828
"args": [
2929
"-file-line-error",
3030
"-halt-on-error",
3131
"-interaction=nonstopmode",
32-
"thuthesis.ins"
32+
"sysuthesis.ins"
3333
],
3434
"env": {}
3535
},
@@ -69,7 +69,7 @@
6969
}
7070
],
7171
"latex-workshop.latex.watch.files.ignore": [
72-
"**/thuthesis.cls",
72+
"**/sysuthesis.cls",
7373
"**/*.bbx",
7474
"**/*.bbl",
7575
"**/*.cbx",
@@ -100,5 +100,4 @@
100100
"**/Library/Application Support/MiKTeX/texmfs/**",
101101
"/dev/null"
102102
],
103-
"ros.distro": "humble",
104103
}

CHANGELOG.md

100755100644
Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,52 @@
1-
# Changelog
2-
3-
此处记载了 SYSUThesis 中所有值得留意的改动,格式参照 [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
4-
5-
点击版本号即可在 GitHub 上查看相邻版本间的代码变动。
6-
7-
## [Unreleased]
8-
9-
## [v1.2.0] - 2024-06-06
10-
### Update
11-
- 更新lyx模板
12-
### Merge
13-
- 合并ThuThesis v7.5.1
14-
15-
## [v1.1.1] - 2023-10-18
16-
### Add
17-
- 添加封面和封底扫描版
18-
### Merge
19-
- 合并ThuThesis v7.4.0
20-
21-
## [v1.1.0] - 2022-11-16
22-
### Merge
23-
- 合并ThuThesis v7.3.1
24-
25-
## [v1.0.1] - 2021-10-09
26-
### Added
27-
- 增加SYSU Logo
28-
- 增加课程实验报告模板
29-
- 增加Lyx模板
30-
31-
## [v1.0.0] - 2021-06-16
32-
### Released
33-
- sysuthesis v1.0.0 发布
34-
35-
### Added
36-
- 支持\makecover[1]插入扫描封面
37-
38-
### Changed
39-
- 改变研究生的titlepage和copyrightpage
40-
41-
42-
[Unreleased]: https://github.com/DapengFeng/sysuthesis/compare/v1.2.0...HEAD
43-
[v1.2.0]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.2.0
44-
[v1.1.1]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.1.1
45-
[v1.1.0]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.1.0
46-
[v1.0.1]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.0.1
47-
[v1.0.0]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.0.0
1+
# Changelog
2+
3+
此处记载了 SYSUThesis 中所有值得留意的改动,格式参照 [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
4+
5+
点击版本号即可在 GitHub 上查看相邻版本间的代码变动。
6+
7+
## [Unreleased]
8+
9+
## [v1.2.1] - 2024-12-14
10+
### Merge
11+
- 合并ThuThesis v7.5.2
12+
13+
## [v1.2.0] - 2024-06-06
14+
### Update
15+
- 更新lyx模板
16+
### Merge
17+
- 合并ThuThesis v7.5.1
18+
19+
## [v1.1.1] - 2023-10-18
20+
### Add
21+
- 添加封面和封底扫描版
22+
### Merge
23+
- 合并ThuThesis v7.4.0
24+
25+
## [v1.1.0] - 2022-11-16
26+
### Merge
27+
- 合并ThuThesis v7.3.1
28+
29+
## [v1.0.1] - 2021-10-09
30+
### Added
31+
- 增加SYSU Logo
32+
- 增加课程实验报告模板
33+
- 增加Lyx模板
34+
35+
## [v1.0.0] - 2021-06-16
36+
### Released
37+
- sysuthesis v1.0.0 发布
38+
39+
### Added
40+
- 支持\makecover[1]插入扫描封面
41+
42+
### Changed
43+
- 改变研究生的titlepage和copyrightpage
44+
45+
46+
[Unreleased]: https://github.com/DapengFeng/sysuthesis/compare/v1.2.1...HEAD
47+
[v1.2.1]: https://github.com/DapengFeng/sysuthesis/compare/v1.2.0...v1.2.1
48+
[v1.2.0]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.2.0
49+
[v1.1.1]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.1.1
50+
[v1.1.0]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.1.0
51+
[v1.0.1]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.0.1
52+
[v1.0.0]: https://github.com/DapengFeng/sysuthesis/releases/tag/v1.0.0

Makefile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Makefile for SYSUThesis
2+
3+
PACKAGE = sysuthesis
4+
THESIS = sysuthesis-example
5+
SPINE = spine
6+
7+
SOURCES = $(PACKAGE).ins $(PACKAGE).dtx
8+
CLSFILE = dtx-style.sty $(PACKAGE).cls
9+
10+
LATEXMK = latexmk
11+
SHELL := /usr/bin/env bash
12+
13+
# make deletion work on Windows
14+
ifdef SystemRoot
15+
RM = del /Q
16+
else
17+
RM = rm -f
18+
endif
19+
20+
.PHONY: all all-dev clean distclean dist thesis viewthesis doc viewdoc cls check FORCE_MAKE
21+
22+
thesis: $(THESIS).pdf
23+
24+
all: thesis
25+
26+
all-dev: doc all
27+
28+
cls: $(CLSFILE)
29+
30+
$(CLSFILE): $(SOURCES)
31+
xetex $(PACKAGE).ins
32+
33+
doc: $(PACKAGE).pdf
34+
35+
$(PACKAGE).pdf: cls FORCE_MAKE
36+
$(LATEXMK) $(PACKAGE).dtx
37+
38+
$(THESIS).pdf: cls FORCE_MAKE
39+
$(LATEXMK) $(THESIS)
40+
41+
viewdoc: doc
42+
$(LATEXMK) -pv $(PACKAGE).dtx
43+
44+
viewthesis: thesis
45+
$(LATEXMK) -pv $(THESIS)
46+
47+
48+
clean:
49+
$(LATEXMK) -c $(PACKAGE).dtx $(THESIS)
50+
-@$(RM) -rf *~ main-survey.* main-translation.* _markdown_sysuthesis* sysuthesis.markdown.*
51+
52+
cleanall: clean
53+
-@$(RM) $(PACKAGE).pdf $(THESIS).pdf
54+
55+
distclean: cleanall
56+
-@$(RM) $(CLSFILE)
57+
-@$(RM) -r dist
58+
59+
check: FORCE_MAKE
60+
ifeq ($(version),)
61+
@echo "Error: version missing: \"make [check|dist] version=X.Y.Z\""; exit 1
62+
else
63+
@[[ $(shell grep -E -c '$(version) Sun Yat-sen University Thesis Template|\\def\\version\{$(version)\}' sysuthesis.dtx) -eq 3 ]] || (echo "bump version with \"l3build tag\" before release"; exit 1)
64+
endif
65+
66+
dist: check all-dev
67+
# use l3build for CTAN release (zip with .tds.zip)
68+
l3build ctan --config utils/build-ctan
69+
# use gulp for GitHub release (zip with generated file)
70+
python3 utils/create_release.py --version="v$(version)"

build.lua

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/usr/bin/env texlua
2+
3+
module = "sysuthesis"
4+
5+
-- supportdir = "./testfiles/support"
6+
checksuppfiles = {"*.tex"}
7+
8+
docfiles = {
9+
"CHANGELOG.md",
10+
"sysuthesis-example.tex",
11+
"spine.tex",
12+
"sysusetup.tex",
13+
"data",
14+
"ref"
15+
}
16+
installfiles = {"*.cls", "*.bst", "*.bbx", "*.cbx", "logo", "scan"}
17+
sourcefiles = {"*.dtx", "*.ins", "*.bst", "*.bbx", "*.cbx", "logo", "scan"}
18+
tagfiles = {"*.dtx", "CHANGELOG.md", "package.json"}
19+
textfiles = {"*.md"}
20+
typesetdemofiles = {"sysuthesis-example.tex", "spine.tex"}
21+
22+
checkengines = {"xetex"}
23+
stdengine = "xetex"
24+
25+
-- include .tds.zip in build output
26+
packtdszip = true
27+
28+
-- specify some files of their correct TDS locations
29+
tdslocations = {
30+
"bibtex/bst/sysuthesis/*.bst",
31+
"tex/latex/sysuthesis/logo/sysu_*.pdf",
32+
"tex/latex/sysuthesis/scan/scan-*.pdf",
33+
}
34+
35+
typesetexe = "xelatex"
36+
unpackexe = "xetex"
37+
bibtexexe = "bibtex"
38+
bibtexopts = ""
39+
biberopts = "--quiet"
40+
41+
specialtypesetting = specialtypesetting or {
42+
["sysuthesis-example.tex"] = {
43+
func = function (file)
44+
local name = jobname(file)
45+
local errorlevel = tex(file)
46+
if errorlevel == 0 then
47+
-- Return a non-zero errorlevel if anything goes wrong
48+
errorlevel =(
49+
bibtex(name) +
50+
bibtex(name .. "-appendix-a") +
51+
tex(file) +
52+
bibtex(name) +
53+
bibtex(name .. "-appendix-a") +
54+
tex(file) +
55+
tex(file)
56+
)
57+
end
58+
return errorlevel
59+
end
60+
}
61+
}
62+
63+
checkopts = "-file-line-error -halt-on-error -interaction=nonstopmode"
64+
typesetopts = "-shell-escape -file-line-error -halt-on-error -interaction=nonstopmode"
65+
66+
lvtext = ".tex"
67+
68+
maxprintline = 79 -- keep compatibility with existing test files
69+
70+
function docinit_hook()
71+
for _, file in pairs({"dtx-style.sty"}) do
72+
cp(file, unpackdir, typesetdir)
73+
end
74+
return 0
75+
end
76+
77+
function update_tag(file, content, tagname, tagdate)
78+
local url = "https://github.com/DapengFeng/sysuthesis"
79+
local date = string.gsub(tagdate, "%-", "/")
80+
if string.match(file, "%.dtx$") then
81+
if string.match(content, "%d%d%d%d/%d%d/%d%d [0-9.]+") then
82+
content = string.gsub(content, "%d%d%d%d/%d%d/%d%d [0-9.]+",
83+
date .. " " .. tagname)
84+
end
85+
if string.match(content, "\\def\\version{[0-9.]+}") then
86+
content = string.gsub(content, "\\def\\version{[0-9.]+}",
87+
"\\def\\version{" .. tagname .. "}")
88+
end
89+
90+
elseif string.match(file, "CHANGELOG.md") then
91+
local previous = string.match(content, "/compare/(.*)%.%.%.HEAD")
92+
local gittag = 'v' .. tagname
93+
94+
if gittag == previous then return content end
95+
content = string.gsub(content,
96+
"## %[Unreleased%]",
97+
"## [Unreleased]\n\n## [" .. gittag .."] - " .. tagdate)
98+
content = string.gsub(content,
99+
previous .. "%.%.%.HEAD",
100+
gittag .. "...HEAD\n" ..
101+
string.format("%-14s", "[" .. gittag .. "]:") .. url .. "/compare/"
102+
.. previous .. "..." .. gittag)
103+
104+
elseif string.match(file, "package.json") then
105+
content = string.gsub(content,
106+
"\"version\": \"[0-9.]+\"",
107+
"\"version\": \"" .. tagname .. "\"")
108+
end
109+
110+
return content
111+
end
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)