summaryrefslogtreecommitdiff
path: root/microstructure.cls
blob: 50c92e74d0e7126b2f7f1aa3cb318c54edebf79a (plain)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{microstructure}

\RequirePackage[letterpaper]{geometry}
\geometry{
	top	= 1in,
	bottom	= 1in,
	left	= 1in,
	right	= 1in
}

\RequirePackage{graphicx,amsmath,amssymb,ulem}

\newlength{\unit}
\setlength{\unit}{12bp}

\setlength{\parindent}{0bp}
\setlength{\parskip}{\unit}

\renewcommand{\normalsize}{\fontsize{12bp}{18bp}\selectfont}
\newcommand{\footnotesize}{\fontsize{9bp}{12bp}\selectfont}

\newcommand{\tiny}{\normalsize}
\newcommand{\scriptsize}{\normalsize}
\newcommand{\small}{\normalsize}
\newcommand{\large}{\normalsize}
\newcommand{\Large}{\normalsize}
\newcommand{\LARGE}{\normalsize}
\newcommand{\huge}{\normalsize}
\newcommand{\Huge}{\normalsize}

\RequirePackage[quiet]{mathspec}
\RequirePackage{realscripts}
\RequirePackage{microtype}
\defaultfontfeatures{
	Language	= English,
	Script		= Latin
}
\newcommand{\case}{\addfontfeature{Letters=Uppercase}}
\setmainfont{Neue Haas Grotesk Text Pro}[
	BoldFont 	= NHaasGroteskTXPro-75Bd,
	ItalicFont	= NHaasGroteskTXPro-56It, 
	Mapping 	= tex-text,
	StylisticSet 	= {1,3},
	Contextuals	= Alternate
]
\newfontfamily\display{Neue Haas Grotesk Display Pro}[
	BoldFont 	= NHaasGroteskDSPro-75Bd,
	ItalicFont	= NHaasGroteskDSPro-56It, 
	Mapping		= tex-text,
	StylisticSet 	= {1,3},
	Contextuals	= Alternate
]
\setmonofont{JetBrains Mono}
\setmathfont(Latin)[Uppercase=Plain,Lowercase=Plain,Arabic=Plain]{Neue Haas Grotesk Text Pro}
\renewcommand{\bold}[1]{{\bfseries #1}}
\newcommand{\italic}[1]{{\itshape #1}}
\newcommand{\mono}[1]{{\ttfamily #1}}

\RequirePackage{returntogrid}
\returntogridsetup{
	step	= 0.5\unit,
	offset	= 0bp
}
\newcommand{\reset}{\returntogrid}
\newcommand{\resetv}[1]{\rule{0bp}{0bp}\vspace{#1}\reset}

\renewcommand{\ULthickness}{1bp}

\newcommand{\inmath}[1]{{\fontsize{15bp}{12bp}\selectfont $#1$}}

\newcommand{\section}[1]{{\fontsize{32bp}{36bp}\selectfont \bfseries \display #1 \par}}
\newcommand{\subsection}[1]{{\fontsize{24bp}{24bp}\selectfont \bfseries \display #1 \par}}
\newcommand{\subsubsection}[1]{{\fontsize{16bp}{18bp}\selectfont \bfseries \display #1 \par}}

\newcommand{\hr}{\vspace{-1.5\unit}\reset\rule{\textwidth}{0.5bp}\vspace{-0.5\unit}\par}

\@ifundefined{thepage}{\def\thepage{\arabic{page}}}{}
\RequirePackage[hidelinks]{hyperref}
\newcommand{\link}[2]{{\bfseries\href{#1}{#2}}{{\ttfamily\textsuperscript* ↗}}}

\RequirePackage[hang,multiple]{footmisc}
\renewcommand\footnoterule{\smash{\rule[4bp]{2in}{0.5bp}}}
\renewcommand{\hangfootparskip}{\unit}
\renewcommand{\footnotemargin}{\unit}
\setlength{\skip\footins}{\unit}

\newenvironment{description}{}{}
\RequirePackage{enumitem}
\setlist[itemize,enumerate]{
	align		= parleft,
	labelsep	= 1.5\unit,
	leftmargin	= \labelsep
}
\setlist[itemize,1]{label=\raisebox{1bp}{$\bullet$}}
\setlist[itemize,2]{label=\raisebox{1bp}{$\circ$}}
\setlist[itemize,3]{label=\raisebox{1bp}{$\diamond$}}
\newcommand{\labelenumi}{\theenumi.}
\newcommand{\labelenumii}{\theenumii.}
\newcommand{\labelenumiii}{\theenumiii.}
\renewcommand{\theenumi}{\@arabic\c@enumi}
\renewcommand{\theenumii}{\@Alph\c@enumii}
\renewcommand{\theenumiii}{\@Roman\c@enumiii}
\setlist[description]{
	align		= left,
	labelsep	= \unit,
	labelwidth	= \dimexpr1in-\labelsep,
	leftmargin	= \labelsep
}

\RequirePackage{listings}
\lstdefinestyle{code}{
	basicstyle		= \ttfamily,
	tabsize			= 4,
	breaklines, breakatwhitespace,
	breakindent		= 0bp,
	aboveskip		= \dimexpr1.5\unit-1.5bp,
	belowskip		= 0bp,
	frame			= single,
	xleftmargin		= \unit,
	xrightmargin		= \unit,
	framesep		= 0bp,
	framextopmargin		= \dimexpr\unit-0.5bp,
	framexbottommargin	= \dimexpr0.5\unit+0.5bp,
	framexleftmargin	= \unit,
	framexrightmargin	= \unit,
	framerule		= 0.5bp
}
\lstdefinestyle{enum}{
	numbers			= right,
	numbersep		= -0.5\unit,
	numberstyle		= {\textsuperscript}
}
\lstnewenvironment{codeblock}[1][]{\lstset{style=code,#1}}{}
\lstnewenvironment{codeblockenum}[1][]{\lstset{style=code,style=enum,#1}}{}
\newcommand{\inputblock}[2][]{\lstinputlisting[style=code,#1]{#2}}
\newcommand{\inputblockenum}[2][]{\lstinputlisting[style=code,style=enum,#1]{#2}}

\setlength{\abovedisplayskip}{0bp}
\setlength{\belowdisplayskip}{0bp}
\renewenvironment{math}{
	\begingroup
	\fontsize{15bp}{12bp}\selectfont
	\setlength{\jot}{\unit}
	\nonumber\align
}{
	\endalign\endgroup
}

\RequirePackage{tabularx}
\setlength{\arrayrulewidth}{0.5bp}
\setlength{\tabcolsep}{6bp}
\renewcommand{\arraystretch}{1.666667}
\newcolumntype{x}{>{\raggedright\arraybackslash}X}
\newenvironment{table}[1]{
	\vspace{-0.5\unit}\hspace{\unit}\tabularx{\dimexpr\textwidth-2\unit}{#1}
}{
	\endtabularx\par
}

\newcommand{\aligntwo}{\hspace{0.5\textwidth}\=\kill}
\newcommand{\alignthree}{\hspace{0.333333\textwidth}\=\hspace{0.333333\textwidth}\=\kill}
\newcommand{\alignfour}{\hspace{0.25\textwidth}\=\hspace{0.25\textwidth}\=\hspace{0.25\textwidth}\=\kill}

\setkeys{Gin}{
	width = \textwidth,
	height = \dimexpr\textheight-6\unit,
	keepaspectratio
}
\renewcommand{\caption}[1]{\\{\footnotesize\italic{#1}}\vspace{1.5\unit}}
\newenvironment{figure}{
	\setlength{\parskip}{1.5\unit}\centering
}{
	\par
}

\RequirePackage{lastpage,datetime2}
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\DTMnewdatestyle{yyyymmdd}{\renewcommand{\DTMdisplaydate}[4]{\number##1\DTMtwodigits{##2}\DTMtwodigits{##3}}}
\DTMsetdatestyle{yyyymmdd}
\renewcommand{\headruleskip}{2bp}
\renewcommand{\footruleskip}{0bp}
\renewcommand{\headrulewidth}{0bp}
\renewcommand{\footrulewidth}{0bp}
\setlength{\headheight}{\unit}
\setlength{\headsep}{\unit}
\setlength{\topmargin}{\dimexpr 0bp-\headsep-\headheight}
\setlength{\footskip}{\dimexpr \headsep+0.5\unit}
\fancyhead[R]{\raisebox{0.666667bp}{\case\footnotesize \today--\hspace{0bp}--\hspace{0bp}--\hspace{0bp}--\@author}}
\fancyfoot[C]{}
\fancyfoot[R]{\case\footnotesize \thepage/\pageref{LastPage}}

\RequirePackage{tikz,eso-pic}
\DeclareOption{debug}{
	\AddToShipoutPicture{\begin{tikzpicture}[overlay,remember picture]
		\draw[black!30!white,thin,shift={(current page.north west)}]
		(current page.north west) grid[step=0.5\unit]
		(current page.south east);
	\end{tikzpicture}}
}
\DeclareOption{fleqn}{
	\AtBeginDocument{\@mathmargin1.5\unit\relax}
}
\DeclareOption{nohf}{
	\fancyhead[L,C,R]{}
	\fancyfoot[L,C,R]{}
}
\ProcessOptions\relax

% vim:ft=tex