Skip to content

Commit 2303783

Browse files
committed
➕ Add font-awesome
1 parent 01fe973 commit 2303783

File tree

8 files changed

+475
-47
lines changed

8 files changed

+475
-47
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19+
- uses: typst-community/setup-typst@v3
1920
- uses: actions/checkout@v4
2021
with:
2122
repository: chengda/popular-fonts
@@ -24,8 +25,13 @@ jobs:
2425
with:
2526
repository: StellarCN/scp_zh
2627
path: fonts/scp_zh
27-
- uses: typst-community/setup-typst@v3
28+
- uses: actions/checkout@v4
29+
with:
30+
repository: siaimes/pytorch
31+
path: fonts/pytorch
2832
- run: |
33+
sudo apt-get -y update
34+
sudo apt-get -y install fonts-font-awesome
2935
mkdir -p ~/.local/share
3036
mv fonts ~/.local/share
3137
typst compile main.typ

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ repos:
7272
- id: markdownlint-cli2
7373
additional_dependencies:
7474
- markdown-it-texmath
75+
- repo: https://github.com/Enter-tainer/typstyle
76+
rev: v0.12.14
77+
hooks:
78+
- id: typstyle
7579
- repo: https://github.com/NixOS/nixfmt
7680
rev: 8d4bd690c247004d90d8554f0b746b1231fe2436
7781
hooks:

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,19 @@
3131

3232
- [华文字体](https://github.com/chengda/popular-fonts)
3333
- [中易字体](https://github.com/StellarCN/scp_zh/tree/master/fonts)
34+
- [Times New Roman](https://github.com/siaimes/pytorch/tree/main/fonts)
35+
- [font-awesome](https://github.com/FortAwesome/Font-Awesome)
3436

3537
## Build
3638

39+
Download all fonts, then
40+
3741
```sh
3842
typst compile main.typ
3943
```
44+
45+
Or use Nix:
46+
47+
```sh
48+
nix run '.#build'
49+
```

flake.lock

Lines changed: 150 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
{
2+
description = "ustc-proposal";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
7+
typix = {
8+
url = "github:loqusion/typix";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
11+
12+
flake-utils.url = "github:numtide/flake-utils";
13+
14+
typst-packages = {
15+
url = "github:typst/packages";
16+
flake = false;
17+
};
18+
19+
fonts-popular-fonts = {
20+
url = "github:chengda/popular-fonts";
21+
flake = false;
22+
};
23+
24+
fonts-scp_zh = {
25+
url = "github:StellarCN/scp_zh";
26+
flake = false;
27+
};
28+
29+
fonts-pytorch = {
30+
url = "github:siaimes/pytorch";
31+
flake = false;
32+
};
33+
};
34+
35+
outputs =
36+
inputs@{
37+
nixpkgs,
38+
typix,
39+
flake-utils,
40+
...
41+
}:
42+
flake-utils.lib.eachDefaultSystem (
43+
system:
44+
let
45+
pkgs = nixpkgs.legacyPackages.${system};
46+
typixLib = typix.lib.${system};
47+
48+
src = typixLib.cleanTypstSource ./.;
49+
commonArgs = {
50+
typstSource = "main.typ";
51+
52+
fontPaths = [
53+
"${pkgs.font-awesome}/share/fonts/opentype"
54+
"${inputs.fonts-popular-fonts}"
55+
"${inputs.fonts-scp_zh}/fonts"
56+
"${inputs.fonts-pytorch}/fonts"
57+
];
58+
59+
virtualPaths = [
60+
# Add paths that must be locally accessible to typst here
61+
# {
62+
# dest = "icons";
63+
# src = "${inputs.font-awesome}/svgs/regular";
64+
# }
65+
];
66+
};
67+
typstPackagesSrc = pkgs.symlinkJoin {
68+
name = "typst-packages-src";
69+
paths = [
70+
"${inputs.typst-packages}/packages"
71+
# More Typst packages can be added here
72+
];
73+
};
74+
typstPackagesCache = pkgs.stdenvNoCC.mkDerivation {
75+
name = "typst-packages-cache";
76+
src = typstPackagesSrc;
77+
dontBuild = true;
78+
installPhase = ''
79+
mkdir -p "$out/typst/packages"
80+
cp -LR --reflink=auto --no-preserve=mode -t "$out/typst/packages" "$src"/*
81+
'';
82+
};
83+
84+
# Compile a Typst project, *without* copying the result
85+
# to the current directory
86+
build-drv = typixLib.buildTypstProject (
87+
commonArgs
88+
// {
89+
inherit src;
90+
XDG_CACHE_HOME = typstPackagesCache;
91+
}
92+
);
93+
94+
# Compile a Typst project, and then copy the result
95+
# to the current directory
96+
build-script = typixLib.buildTypstProjectLocal (
97+
commonArgs
98+
// {
99+
inherit src;
100+
XDG_CACHE_HOME = typstPackagesCache;
101+
}
102+
);
103+
104+
# Watch a project and recompile on changes
105+
watch-script = typixLib.watchTypstProject commonArgs;
106+
in
107+
{
108+
checks = {
109+
inherit build-drv build-script watch-script;
110+
};
111+
112+
packages.default = build-drv;
113+
114+
apps = rec {
115+
default = watch;
116+
build = flake-utils.lib.mkApp {
117+
drv = build-script;
118+
};
119+
watch = flake-utils.lib.mkApp {
120+
drv = watch-script;
121+
};
122+
};
123+
124+
devShells.default = typixLib.devShell {
125+
inherit (commonArgs) fontPaths virtualPaths;
126+
packages = [
127+
# WARNING: Don't run `typst-build` directly, instead use `nix run .#build`
128+
# See https://github.com/loqusion/typix/issues/2
129+
# build-script
130+
watch-script
131+
# More packages can be added here, like typstfmt
132+
# pkgs.typstfmt
133+
];
134+
};
135+
}
136+
);
137+
}

main.typ

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
11
#import "template.typ": project
22

3-
#show: project.with(
4-
)
3+
#show: project.with()
4+
5+
= 选题依据
6+
7+
阐述该选题的研究意义,分析该研究课题国内外研究的概况和发展趋势。
8+
9+
== 研究意义
10+
11+
== 国内外研究现状和发展趋势
12+
13+
国内外主要参考文献(列出作者、论文名称、期刊名称、出版年月)。
14+
15+
= 已取得的与论文研究内容相关的成果
16+
17+
已发表或被接收发表的文章目录或其它相关研究成果。
18+
19+
= 研究内容和研究方法
20+
21+
主要研究内容及预期成果,拟采用的研究方法、技术路线、实验方案的可行性分析。
22+
23+
== 研究内容
24+
25+
== 技术路线和可行性分析
26+
27+
=== 1
28+
29+
=== 2
30+
31+
=== 3
32+
33+
= 课题研究的创新之处
34+
35+
研究内容、拟采用的研究方法、技术路线等方面有哪些创新之处。
36+
37+
= 研究工作进度安排
38+
39+
应包括文献调研,工程设计,新工艺、新材料、新设备、新产品的研制和调试,实验操作,实验数据的分析处理,撰写论文等。
40+
41+
预期成果

shell.nix

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)