-
Notifications
You must be signed in to change notification settings - Fork 0
/
avimehra.sty.ts
73 lines (69 loc) · 1.64 KB
/
avimehra.sty.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { promises as fsPromises } from "fs";
const { readFile, writeFile } = fsPromises;
import * as path from "path";
import generateSty from "../../lib/generate-sty";
async function execute(encoding: BufferEncoding = "utf-8") {
const [
math,
computing,
color,
physics,
links,
handout,
theorem,
thin,
thmboxed,
footer,
page,
header,
] = await Promise.all(
[
"math",
"computing",
"color",
"physics",
"links",
"handout",
"theorem",
"thin",
"thmboxed",
"footer",
"page",
"header",
].map((name) =>
readFile(path.join(__dirname, `includes/${name}.sty`), encoding)
)
);
const rules = [
{ name: "nomath", else: math },
{
name: "nocolor",
else: color,
description: "% Prevents defining colors" as const,
},
{ name: "nohandout", else: handout },
{
name: "computing",
if: computing,
description: "% Computing\n% Requires `color`" as const,
},
{ name: "footnote", if: "\\RequirePackage[bottom]{footmisc}" },
{ name: "physics", if: physics },
{
name: "links",
if: links,
description: "% Color links, apply hyperref, and add graphic next to links called with \\href\n% Requires `color`" as const,
},
{ name: "header", if: header },
{ name: "footer", if: footer },
{ name: "theorem", if: theorem },
{ name: "thmboxed", if: thmboxed },
{ name: "page", if: page },
{ name: "thin", if: thin },
];
await writeFile(
path.join(__dirname, "../../../texmf/tex/latex/avimehra.sty"),
generateSty(rules)
);
}
execute();