forked from seL4/seL4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sel4.sty
313 lines (298 loc) · 9.72 KB
/
sel4.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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
% Copyright seL4 Project a Series of LF Projects, LLC
% SPDX-License-Identifier: CC-BY-SA-4.0
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sel4}[2020/09/24 v1.0 seL4 Foundation letterhead and title page]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Letterhead and title page for the seL4 Foundation
%
% Written 2020-03-23 by Gernot Heiser <[email protected]>
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% OPTIONS:
% noBanner: no black banner underneath the logo
% makeTitle: generate the title header even if there is no \maketitle command
% copyright: generate the copyright footer with the present year
%
%
% COMMANDS:
% - INPUTS:
% \title Document title in header, default: none
% \subtitle Document subtitle title in header, ignored if title is empty
% \author Document author, ignored if title is empty
% \authortitle Title of author, ignored if author is empty
% \email Contact email, ignored if author is empty
% \docversion Document version
% \date Date of document, default \today, ignored if title is empty
% \header Organisation/originator to go in TRHS of header, multiple lines
% default: "The seL4 Foundation"
% \theurl Org URL, default: seL4 Foundation URL
% \copyYear Year of copyright (default: this year)
% - OUTPUTS:
% \doCopyright Produces the copyright notice, must be placed
% right after \maketitle
% The `copyright' option is equivalent to \doCopyright immediately after \maketitle
% \thedocversion Document version string
% \thedate Date string
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifb@nner\b@nnertrue
\newif\ifm@aketitle\m@aketitlefalse
\newif\ifc@pyright\c@pyrightfalse
%% options section
\DeclareOption{noBanner}{\b@nnerfalse}
\DeclareOption{makeTitle}{\m@aketitletrue}
\DeclareOption{copyright}{\c@pyrighttrue}
\ProcessOptions\relax
%% package section
\RequirePackage[margin=25mm]{geometry}
\RequirePackage{fancyhdr}
\RequirePackage{enumitem}
\RequirePackage{parskip}
\RequirePackage{sfmath}
\RequirePackage{graphicx}
\usepackage[T1]{fontenc}
\usepackage[sfdefault]{roboto}
\RequirePackage{xcolor}
\RequirePackage[iso]{isodate}
\RequirePackage{hyperref}
% Coloured quoted text:
% \RequirePackage[breakable]{tcolorbox}
\usepackage[breakable]{tcolorbox}
\if@titlepage
\typeout{sel4 style with titlepage}
\else
\typeout{sel4 style without titlepage}
\fi
%% Foundation colour scheme:
\definecolor{greenLight}{HTML}{C0DF9A}
\definecolor{greenLogo}{HTML}{96CA50}
\definecolor{greenDark}{HTML}{668B37}
\definecolor{accentLight}{HTML}{D5AEAA}
\definecolor{accent}{HTML}{AC5D55}
\definecolor{accentDark}{HTML}{820C00}
\definecolor{emphasisLight}{HTML}{FFE0A2}
\definecolor{emphasis}{HTML}{FFCA5F}
\definecolor{emphasisDark}{HTML}{B78B41}
% white (already defined)
\definecolor{neutralLighter}{HTML}{D6DBE4}
\definecolor{neutralLight}{HTML}{8897AE}
\definecolor{neutral}{HTML}{385378}
\definecolor{neutralDark}{HTML}{263852}
% black (already defined)
\colorlet{logoGreen}{greenLogo}
\colorlet{seL4Green}{greenLogo}
% hyperref
\hypersetup{colorlinks, allcolors=neutral, anchorcolor=black,
citecolor=greenDark, linkcolor=greenDark}
% tcolorbox
\newtcolorbox{cquote}{colback=neutralLighter,boxrule=0pt,boxsep=0pt,breakable}
\renewenvironment{quote}
{\list{}{\rightmargin=2ex \leftmargin=4ex}%
\item\relax\cquote}
{\endcquote\endlist}
%% definitions
\renewcommand{\familydefault}{\sfdefault}
\def\h@eader{The seL4\textsuperscript\textregistered\ Foundation\\\\}
\def\u@rl{https://sel4.systems/Foundation}
\def\@title{}
\def\@subtitle{}
\def\@author{}
\def\@authortitle{}
\def\@email{}
\def\@docversion{}
\def\@date{\today}
\def\header#1{\def\h@eader{#1}}
\def\theurl#1{\def\u@rl{#1}}
\def\title#1{\def\@title{#1}}
\def\subtitle#1{\def\@subtitle{#1}}
\def\author#1{\def\@author{#1}}
\def\authortitle#1{\def\@authortitle{#1}}
\def\email#1{\def\@email{#1}}
\def\docversion#1{\def\@docversion{#1}}
\def\thedocversion{\@docversion}
\def\date#1{\def\@date{#1}}
\def\thedate{\value\@date}
\def\thanks{\undefined}
\newcommand{\Logo@FileName}{logos/seL4-Foundation-logo.pdf}
\newcommand{\Triang@FileName}{logos/blacktriangle.pdf}
\newcommand{\L@ogo}{\includegraphics[keepaspectratio=true,height=23mm]{\Logo@FileName}}
%%% Produces copyright notice as a pseudo footnote without a footnote mark
% Use it right at the top, or just after \maketitle. The optional argument is the year of the
% copyright, it defaults to the current year.
\newif\ifc@pyrightdone\c@pyrightdonefalse
\newcommand{\doCopyright}[1][\the\year]{%
\ifc@pyrightdone\else%
\let\s@makefnmark=\@makefnmark%
\let\@makefnmark\relax%
\footnote{%
\hspace*{-1.8em}% Magic number from article.cls/report.cls
Copyright \copyright~#1 seL4 Project a Series of LF Projects, LLC.\\
Distributed under the
\href{https://creativecommons.org/licenses/by-sa/4.0/legalcode}{Creative
Commons Attribution-ShareAlike 4.0 International (CC~BY-SA~4.0) License.}\\
seL4 is a trademark of LF Projects, LLC.
}
\let\@makefnmark=\s@makefnmark%
\c@pyrightdonetrue%
}
%% the part of the headers that's common with or without titlepage
\def\m@akeheader{%
\begin{minipage}[b]{\paperwidth}%
\hspace*{16mm}%
\raisebox{2.5mm}[38mm][0mm]{\L@ogo}%
\hfill
\raisebox{4mm}{%
\footnotesize%
\textcolor{greenLogo}{
\begin{tabular}[b]{r}\bf
\raisebox{0pt}[0pt][10mm]{\rule{0pt}{8mm}}%
\begin{tabular}[t]{r@{}}
\h@eader
\end{tabular}\\
% force URL colour to be green or black, irrespective of hyperref setup
\bf\href{\u@rl}{\textcolor{greenLogo}\u@rl}
\end{tabular}
}%
}\hspace*{5mm}
\end{minipage}%
}%
%% the main thing: \maketitle produces the letterhead
\if@titlepage
\renewcommand\maketitle{%
\noindent%
\begin{titlepage}%
\urlstyle{sf}
% to suppress Overfull \hbox warnings
\newlength{\saveHfuzz}
\setlength{\saveHfuzz}{\hfuzz}
\setlength{\hfuzz}{\paperwidth}
%
\let\footnotesize\small
\let\footnoterule\relax
\let \footnote \thanks
% laying out the background
\newlength{\img@raise}%
\newlength{\img@shift}%
% the black triangle
\setlength{\img@raise}{-\paperheight}%
\addtolength{\img@raise}{\Gm@tmargin}%
\addtolength{\img@raise}{4.2mm}% don't ask me why!
\setlength{\img@shift}{-\Gm@lmargin}%
% make black triangle extend 0.1mm beyond margins to prevent a white line
\newlength{\img@width}\setlength{\img@width}{1.001\paperwidth}%
\newlength{\img@height}\setlength{\img@height}{1.001\paperheight}%
\addtolength{\img@shift}{-0.0005\paperwidth}\addtolength{\img@raise}{-0.0005\paperheight}%
% \typeout{paperheight=\the\paperheight,
% paperwidth=\the\paperwidth,
% Gm@lmargin=\Gm@lmargin,
% Gm@tmargin=\Gm@tmargin,
% img@raise=\the\img@raise,
% hfuzz=\the\hfuzz}
\raisebox{\img@raise}[0pt][0pt]{\hspace*{\img@shift}%
\makebox[0pt][l]{%
\includegraphics[keepaspectratio=false,width=\img@width,height=\img@height]{\Triang@FileName}%
}%
}
% header
\raisebox{4mm}[0pt][0pt]{\hspace*{-\Gm@tmargin}%
\m@akeheader
}%
%
\null%\vfil
\raggedright% to prevent stuff shifting
\vskip 50mm%
~\hfill%
\makebox[0pt][r]{
\raisebox{0pt}[0pt][0pt]{
\begin{minipage}{150mm}
\raggedleft
\fontsize{36}{42}\selectfont \textcolor{greenLogo}{\@title}\\%
\if\@subtitle\empty
~
\else
\fontsize{36}{42}\selectfont \textcolor{emphasis}{\@subtitle}
\fi%
\end{minipage}
\hspace*{-10mm}
}
}
\vskip 70mm
\makebox[0pt][l]{
\hspace*{-13mm}
\raisebox{0pt}[0pt][0pt]{
\begin{minipage}{70mm}%
\raggedright%
\color{neutral}
\fontsize{20}{26}\selectfont%
\@author\par
\fontsize{14}{22}\selectfont%
\ifx\@authortitle\empty\else\@authortitle\par\fi
\ifx\@email\empty\else\@email\par\fi
\ifx\@docversion\empty\else\@docversion\par\fi
\ifx\@date\empty\else\@date\par\fi
\end{minipage}
}
}
\setcounter{page}{0}
\end{titlepage}%
\thispagestyle{fancyplain}
\setlength{\hfuzz}{\saveHfuzz}%
\setcounter{footnote}{0}%
\global\let\thanks\relax
\global\let\maketitle\relax
\global\let\@thanks\@empty
\global\let\@author\@empty
\global\let\@date\@empty
\global\let\@title\@empty
\global\let\title\relax
\global\let\author\relax
\global\let\date\relax
\global\let\and\relax
\setcounter{page}{0}
\m@aketitlefalse
}
\else% no titlepage
\def\maketitle{\urlstyle{sf}
% to suppress overfull bars in ``draft'' mode:
\newlength{\saveOverfullRule}
\setlength{\saveOverfullRule}{\overfullrule}
\setlength\overfullrule{0pt}
%
\noindent%
\raisebox{0mm}[0pt][0pt]{\hspace*{-25mm}%
\ifb@nner\makebox[0pt][l]{\rule{\paperwidth}{40mm}}\fi% black banner
\m@akeheader
}%
% reset overfull rule
\setlength{\overfullrule}{\saveOverfullRule}%
\vspace*{12mm}%
\ifx\@title\empty \else%
\begin{center}
{\LARGE\bf\@title\\[1ex]}
\ifx\@subtitle\empty \else{\Large\@subtitle} \\[1ex]\fi%
\ifx\@author\empty \else
{\Large\@author
\ifx\@authortitle\empty\else{\large\\\@authortitle}\fi
\ifx\@email\empty\else{\normalsize\\\@email}\fi
\\[1ex]}%
\fi%
\ifx\@docversion\empty\else\@docversion\\\fi
\ifx\@date\empty \else\@date \\\fi%
\vspace{5ex}%
\end{center}%
\fi%
\m@aketitlefalse
}%\maketitle
\fi% no titlepage
\AtBeginDocument{%
\ifm@aketitle%
\maketitle%
\let\maketitle\relax%
\m@aketitlefalse%
\fi%
\ifc@pyright%
\doCopyright%
\fi%
}