-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpstylingx.sty
128 lines (101 loc) · 3.08 KB
/
pstylingx.sty
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
\ProvidesPackage{pstylingx}[2021 Physics Styling]
%%% Scripting and macros
\RequirePackage{xparse} % Better functions
\RequirePackage{luacode} % Convenience macros for LuaTeX
\RequirePackage{import} % Make imports not includes
%%% Basic typesetting helpers
\RequirePackage{fontspec} % Font switching
\RequirePackage{polyglossia} % Modern babel replacement
\RequirePackage{listings} % Listings
\RequirePackage{verbatim} % Verbatim envs, also comments
\RequirePackage{float} % scale, shift, rotate, ... floats (tables, images, ...)
\RequirePackage{color} % colors
\RequirePackage{pdfpages} % Directly include pdf documents
\RequirePackage{biblatex} % Bibliography
%%% Basic mathematics
\RequirePackage{amsmath} % Additional mathematical formulas and environments
\RequirePackage{amssymb} % Additional mathematical symbols
\RequirePackage{amsfonts} % Additional mathematical fonts
\RequirePackage{unicode-math} % Better font switching for maths
%%% Specialised tools for maths
\RequirePackage{bigints} % Bigger integers
\RequirePackage{esint} % Mooooooore integrals
\RequirePackage{cancel} % Mostly for cancelto
\RequirePackage{tensor} % Fucking tensors
\RequirePackage[separate-uncertainty=true]{siunitx} % Support for quantities with errors and dimension
%%% Graphics
\RequirePackage{tikz} % Drawing
\RequirePackage{graphicx} % Images
%%% Physics
\RequirePackage{physics} % Physics package for beatiful vectors, matrices, ...
%%% Has to be the last one, what an edgy package :D
\RequirePackage{hyperref}
%%%%%
%%%%%
%%%%% Begin scripting
%%%%%
%%%%%
%%%
%%% Public variable storage
%%%
\luaexec{
psxVariables = {}
}
\NewDocumentCommand\psxSetVariable{m m}
{%
\luaexec{
psxVariables["#1"] = "#2"
}%
}
\NewDocumentCommand\psxGetVariable{m}
{%
\luaexec{
tex.print(psxVariables["#1"])
}%
}
%%%
%%% Private variable storage
%%%
\makeatletter
\luaexec{
p_psxVariables = {}
}
\NewDocumentCommand\@psxSetVariable{m m}
{%
\luaexec{
p_psxVariables["#1"] = "#2"
}%
}
\NewDocumentCommand\@psxGetVariable{m}
{%
\luaexec{
tex.sprint(p_psxVariables["#1"])
}%
}
\makeatother
%%%
%%% Footnotes
%%%
\newcounter{psxfootnote}
\NewDocumentEnvironment{psxFootenv}{}
{%
\setcounter{psxfootnote}{\thefootnote}%
\luaexec{
p_psxFootnotes = {}
}%
}
{%
\setcounter{footnote}{\thepsxfootnote}%
\luaexec{
for idx, fn in pairs(p_psxFootnotes) do
tex.print(string.format('\\stepcounter{footnote}\\footnotetext{\%s}', fn))
end
}%
}
\NewDocumentCommand\psxFootnote{m}
{%
\footnotemark%
\luaexec{
p_psxFootnotes[\thefootnote] = "#1"
}%
}