-
Notifications
You must be signed in to change notification settings - Fork 0
/
specifications.cls
264 lines (239 loc) · 8.26 KB
/
specifications.cls
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
%-------------------------------------------------------------------------------
% Identification
%-------------------------------------------------------------------------------
\ProvidesClass{specifications}[2020/10/01 v1.0.0 Software Specifications Class]
\NeedsTeXFormat{LaTeX2e}
%-------------------------------------------------------------------------------
% Class options
%
% (need to be done before the external package loading, for example because
% we need \paperwidth, \paperheight and \@ptsize to be defined before loading
% geometry)
%-------------------------------------------------------------------------------
% Inherit options of article
\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{article}
}
\ProcessOptions\relax
\LoadClass{article}
%-------------------------------------------------------------------------------
% Class options
%
% (need to be done before the external package loading, for example because
% we need \paperwidth, \paperheight and \@ptsize to be defined before loading
% geometry and fancyhdr)
%-------------------------------------------------------------------------------
% Needed to configure page layout
\RequirePackage{geometry}
% Needed to put a background to the document
\RequirePackage[pages=some]{background}
\RequirePackage{graphicx}
\RequirePackage{blindtext}
% Needed to manage fonts
\RequirePackage[quiet]{fontspec}
% Needed to use icons from font-awesome
% (https://github.com/posquit0/latex-fontawesome)
\RequirePackage{fontawesome}
\RequirePackage[default,opentype]{sourcesanspro}
% Needed to put boxes
\RequirePackage[skins]{tcolorbox}
% Needed to set section font
\RequirePackage{sectsty}
% Needed to define colors
\RequirePackage{xcolor}
% Needed to customize ToC
\RequirePackage{tocloft}
\RequirePackage{calc}
% Needed to write text at specific location
\RequirePackage[absolute,quiet,overlay]{textpos}
% Needed to deal hyperlink
\RequirePackage[hidelinks,unicode]{hyperref}
\hypersetup{%
pdftitle={},
pdfauthor={},
pdfsubject={},
pdfkeywords={}
}
%-------------------------------------------------------------------------------
% Configuration for directory locations
%-------------------------------------------------------------------------------
% Configure a directory location for fonts(default: 'fonts/')
\newcommand*{\fontdir}[1][fonts/]{\def\@fontdir{#1}}
\fontdir
%-------------------------------------------------------------------------------
% Configuration for layout
%-------------------------------------------------------------------------------
%% Page Layout
% Configure page margins with geometry
\geometry{left=2.0cm, top=4.5cm, right=2.0cm, bottom=3.0cm, footskip=1.0cm}
%-------------------------------------------------------------------------------
% Configuration for colors
%-------------------------------------------------------------------------------
% Gray-scale colors
\definecolor{white}{HTML}{FFFFFF}
\definecolor{black}{HTML}{000000}
\definecolor{darkgray}{HTML}{333333}
\definecolor{gray}{HTML}{5D5D5D}
\definecolor{lightgray}{HTML}{999999}
% Basic colors
\definecolor{green}{HTML}{C2E15F}
\definecolor{orange}{HTML}{FDA333}
\definecolor{purple}{HTML}{D3A4F9}
\definecolor{red}{HTML}{FB4485}
\definecolor{blue}{HTML}{6CE0F1}
% Text colors
\definecolor{darktext}{HTML}{414141}
\colorlet{text}{darkgray}
\colorlet{graytext}{gray}
\colorlet{lighttext}{lightgray}
% Project colors
\definecolor{orangecrab}{HTML}{E55934}
\definecolor{bluewave}{HTML}{3F72AC}
\definecolor{clearocean}{HTML}{1B97D1}
\definecolor{darkora}{HTML}{282830}
\sectionfont{\color{orangecrab}}
\subsectionfont{\color{bluewave}}
%-------------------------------------------------------------------------------
% Configuration for fonts
%-------------------------------------------------------------------------------
% Set the FontAwesome font to be up-to-date
\newfontfamily\FontAwesome[Path=\@fontdir]{FontAwesome}
% Set font for header (default is Roboto)
\newfontfamily\robotofont[
Path=\@fontdir,
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Bold,
BoldItalicFont=*-BoldItalic,
]{Roboto}
\newfontfamily\robotofontlight[
Path=\@fontdir,
UprightFont=*-Thin,
ItalicFont=*-ThinItalic,
BoldFont=*-Medium,
BoldItalicFont=*-MediumItalic,
]{Roboto}
\newcommand*{\bodyfont}{\sourcesanspro}
\newcommand*{\bodyfontlight}{\sourcesansprolight}
%-------------------------------------------------------------------------------
% Commands for organization information
%-------------------------------------------------------------------------------
% Define background images
% Usage: \firstpage{<path-to-image>}
% Usage: \background{<path-to-image>}
\newcommand*{\firstpage}[1]{\def\@firstpage{#1}}
\newcommand*{\background}[1]{\def\@background{#1}}
\newcommand*{\logo}[1]{\def\@logo{#1}}
\newcommand*{\lheader}[1]{\def\@lheader{#1}}
\newcommand*{\rheader}[1]{\def\@rheader{#1}}
\let\@team\@empty
\let\@university\@empty
\let\@homepage\@empty
\let\@email\@empty
\let\@github\@empty
\let\@gitlab\@empty
% Define project's basic properties
% Usage: \team{<team name>}
% Usage: \university{<university name>}
\newcommand*{\team}[1]{\def\@team{#1}}
\newcommand*{\university}[1]{\def\@university{#1}}
% Defines project's homepage (optional)
% Usage: \homepage{<url>}
\newcommand*{\homepage}[1]{\def\@homepage{#1}}
% Defines project's email (optional)
% Usage: \email{<email address>}
\newcommand*{\email}[1]{\def\@email{#1}}
% Defines project's github (optional)
% Usage: \github{<github-nick>}
\newcommand*{\github}[1]{\def\@github{#1}}
% Defines project's gitlab (optional)
% Usage: \gitlab{<gitlab-nick>}
\newcommand*{\gitlab}[1]{\def\@gitlab{#1}}
%\newenvironment{boxed}[1]{
% \begin{center}
% #1
% \makebox[\textwidth]{\includegraphics[width=0.9\linewidth,height=0.9\textheight]{box.png}}
% \end{center}
%}
\newtcolorbox{boxed}[2][]{
before = \begin{center},
enhanced,
center title,
hbox,
toprule = 10pt,
titlerule = 10pt,
boxrule = 3pt,
outer arc = 0pt,
arc = 0pt,
colframe = darkora,
colback = white,
coltitle = white,
title = {\MakeUppercase{#2}},
fonttitle = \bfseries\fontsize{20}{20}\selectfont,
after = \end{center},
#1
}
% -------------------------------------------------------------------------
\AddEverypageHook{
\ifnum\value{page}=1\relax
\backgroundsetup{
scale=1,
angle=0,
opacity=1.0,
contents={
\includegraphics[width=\paperwidth,height=\paperheight]{\@firstpage}
}
}
\else
\backgroundsetup{
scale=1,
angle=0,
opacity=1.0,
contents={
\includegraphics[width=\paperwidth,height=\paperheight]{\@background}
}
}
\TPoptions{absolute=true,showboxes=false}
\begin{center}
\begin{textblock*}{10cm}(-0.5cm,1.0cm)
{\color{white}\fontsize{20}{25}\selectfont\MakeUppercase\@lheader}
\end{textblock*}
\begin{textblock*}{10cm}(11.2cm,1.0cm)
{\color{white}\fontsize{20}{25}\selectfont\MakeUppercase\@rheader}
\end{textblock*}
\end{center}
\fi
\BgMaterial
}
\renewcommand\maketitle{
\begin{center}
\includegraphics[scale=0.08]{\@logo}
\end{center}
\begin{center}
{\Huge\color{white}\bfseries\@title\par}
\vspace*{2ex}
{\ifx\@team\@empty\else\Large\color{white}\bfseries\@team\par\fi}
\vspace*{2ex}
{\ifx\@university\@empty\else\large\color{white}\@university\par\fi}
\vspace*{2ex}
{\ifx\@homepage\@empty\else\large\color{white}\FontAwesome\href{\@homepage}{}\fi}
{\ifx\@github\@empty\else\large\color{white}\FontAwesome\href{\@github}{}\fi}
{\ifx\@gitlab\@empty\else\large\color{white}\FontAwesome\href{\@gitlab}{}\fi}
{\ifx\@email\@empty\else\large\color{white}\FontAwesome\href{\@email}{}\fi}
\par
\vspace*{8ex}
{\color{white}\@author\par}
\end{center}
\TPoptions{absolute=true,showboxes=false}
\begin{center}
\begin{textblock*}{10cm}(5.5cm,20.1cm)
{\color{white}\bfseries\fontsize{20}{25}\selectfont Réalisé le \@date}
\end{textblock*}
\end{center}
}
\let\stdl@section\l@section
\renewcommand*{\l@section}[2]{%
\stdl@section{\textcolor{orangecrab}{#1}}{\textcolor{orangecrab}{#2}}}
\let\stdl@subsection\l@subsection
\renewcommand*{\l@subsection}[2]{%
\stdl@subsection{\bfseries\textcolor{bluewave}{#1}}{\textcolor{bluewave}{#2}}}