Skip to content

Commit

Permalink
feat: 新增插入外部校徽校名图片的方法
Browse files Browse the repository at this point in the history
- 修改测试和发布脚本
- 修改默认模板
- 修改声明页选项名称
  • Loading branch information
atxy-blip committed Dec 23, 2021
1 parent e3dda2d commit 9cf0b91
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 97 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
CTAN_URL: https://mirrors.rit.edu/CTAN
TL_PACKAGES: algorithms alphalph auxhook background biber biblatex biblatex-gb7714-2015 bibtex blindtext booktabs caption chemfig cleveref cm-unicode colortbl csquotes ctex dashundergaps diagbox emptypage enumitem everypage fancyhdr fancyvrb fandol float footmisc gbt7714 hologo hycolor hypdoc hyperref l3build latexmk libertinus-fonts listings lua-ul lualatex-math luatex85 makecell makeindex mathtools mhchem microtype multirow natbib newcomputermodern ninecolors njuvisual ntheorem pict2e physics preview psnfss setspace simplekv siunitx standalone symbol tex-gyre tex-gyre-math threeparttable translator underscore unicode-math url wrapfig xits xstring zhlipsum zref
TL_PACKAGES: algorithms alphalph auxhook background biber biblatex biblatex-gb7714-2015 bibtex blindtext booktabs caption chemfig cleveref cm-unicode colortbl csquotes ctex dashundergaps diagbox emptypage enumitem everypage fancyhdr fancyvrb fandol float footmisc gbt7714 hologo hycolor hypdoc hyperref l3build latexmk libertinus-fonts listings lua-ul lualatex-math luatex85 makecell makeindex mathtools mhchem microtype multirow natbib newcomputermodern ninecolors njuvisual ntheorem pict2e physics preview psnfss setspace simplekv siunitx standalone symbol tabularray tex-gyre tex-gyre-math threeparttable translator underscore unicode-math url wrapfig xits xstring zhlipsum zref

jobs:
build-on-ubuntu:
Expand Down Expand Up @@ -42,6 +42,8 @@ jobs:
run: |
${{ env.SET_PATH }}
cd test
mv ../scripts/* .
pdflatex --shell-escape "generate-img.tex"
latexmk -halt-on-error -time -pdfxe -jobname=test-xetex test.tex
latexmk -halt-on-error -time -pdflua -jobname=test-luatex test.tex
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ jobs:
${{ env.SET_PATH }}
xetex njuvisual.dtx
mv docs/* .
mv scripts/* .
mv build/unpacked/njuthesis.cls .
zip -r njuthesis-user-$VERSION.zip njuthesis-sample.tex njuthesis-sample.bib njuthesis.cls njuvisual.sty LICENSE README.md
pdflatex --shell-escape "generate-img.tex"
zip -r njuthesis-user-$VERSION.zip njuthesis-sample.tex njuthesis-sample.bib njuthesis.cls njuvisual.sty nju-emblem.pdf nju-name.pdf LICENSE README.md
- uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand Down
24 changes: 19 additions & 5 deletions docs/njuthesis-sample.tex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
% degree = ug|mg|mf|phd, % 学位类型,默认为本科
% type = thesis|design, % 文档类型,默认为毕业论文
% nlcover = true|false, % 是否需要国家图书馆封面,默认关闭
% orig-decl = true|false, % 是否需要诚信承诺书或原创性声明,默认关闭
% declaration = true|false, % 是否需要诚信承诺书或原创性声明,默认关闭
%
% 建议定稿前一直开启草稿模式以提升编译速度
% draft = true|false, % 是否开启草稿模式,默认关闭
Expand Down Expand Up @@ -106,10 +106,10 @@
% 导师职称
% 新版对选项名称进行了改动
%
supervisor-ii = {第二导师},
supervisor-ii* = {My Second Supervisor},
supervisor-ii-title = {副教授},
supervisor-ii-title* = {Associate professor},
% supervisor-ii = {第二导师},
% supervisor-ii* = {My Second Supervisor},
% supervisor-ii-title = {副教授},
% supervisor-ii-title* = {Associate professor},
% 第二导师
% 新版对选项名称进行了改动
% 如果确实没有第二导师,不填写即可
Expand Down Expand Up @@ -169,6 +169,20 @@
% 需要带扩展名的完整文件名
% 可使用逗号分隔多个文件
% 此条等效于 \addbibresource 命令
},
%
%
% style 类用于外观样式设置
style = {
emblem-img = {nju-emblem},
% 外置校徽图片路径
% 建议使用矢量图
% 使用外置图片有助于减少编译时间
% 空置时会自动导入 njuisual 宏包的矢量曲线
%
name-img = {nju-name}
% 外置校名图片路径
% 说明同上
}
}

Expand Down
12 changes: 10 additions & 2 deletions install-unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@ cd "mythesis"
cp -f "../docs/njuthesis-sample.tex" .
cp -f "../docs/njuthesis-sample.bib" .
cp -f "../source/njuthesis.dtx" .
cp -f "../scripts/generate-img.tex" .

wget -q "https://mirror.nju.edu.cn/CTAN/macros/latex/contrib/njuvisual/njuvisual.dtx"
wget -q "https://mirror.nju.edu.cn/CTAN/macros/latex/contrib/njuvisual/njuvisual-curves.dtx"

xetex "njuthesis.dtx" > /dev/null
xetex "njuvisual.dtx" > /dev/null
xetex "njuthesis.dtx" > /dev/null
xetex "njuvisual.dtx" > /dev/null
pdflatex --shell-escape "generate-img.tex" > /dev/null

rm *.aux
rm *.auxlock
rm *.dpth
rm *.dtx
rm *.ins
rm *.log
rm *.md5
rm generate-img.tex
rm generate-img.pdf

cd ..
12 changes: 10 additions & 2 deletions install-win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@ CD "mythesis"
COPY /Y "..\docs\njuthesis-sample.tex" .
COPY /Y "..\docs\njuthesis-sample.bib" .
COPY /Y "..\source\njuthesis.dtx" .
COPY /Y "..\scripts\generate-img.tex" .

curl -s -o "njuvisual.dtx" "https://mirror.nju.edu.cn/CTAN/macros/latex/contrib/njuvisual/njuvisual.dtx"
curl -s -o "njuvisual-curves.dtx" "https://mirror.nju.edu.cn/CTAN/macros/latex/contrib/njuvisual/njuvisual-curves.dtx"

xetex "njuthesis.dtx" > NUL
xetex "njuvisual.dtx" > NUL
xetex "njuthesis.dtx" > NUL
xetex "njuvisual.dtx" > NUL
pdflatex --shell-escape "generate-img.tex" > NUL

DEL "*.aux"
DEL "*.auxlock"
DEL "*.dpth"
DEL "*.dtx"
DEL "*.ins"
DEL "*.log"
DEL "*.md5"
DEL "generate-img.tex"
DEL "generate-img.pdf"

CD ..
13 changes: 13 additions & 0 deletions scripts/generate-img.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 本文件用于生成黑色的校徽和校名图片
% 编译命令为 pdflatex --shell-escape generate-img
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{njuvisual}
\usetikzlibrary{backgrounds,external}
\tikzexternalize[prefix=nju-]
\let\FIG=\tikzsetnextfilename
\begin{document}
\tikzsetnextfilename{emblem}\njuemblem[black]{!}{!}
\tikzsetnextfilename{name}\njuname[black]{!}{!}
\end{document}

0 comments on commit 9cf0b91

Please sign in to comment.