-
Notifications
You must be signed in to change notification settings - Fork 0
/
karlito.cls
191 lines (144 loc) · 4.48 KB
/
karlito.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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{karlito}
%definition des options
\RequirePackage{ifthen}
\RequirePackage{kvoptions}
\newboolean{load-remplissage}
\newboolean{load-impression}
\DeclareOption{remplissage}{\setboolean{load-remplissage}{true}}
\DeclareOption{impression}{\setboolean{load-impression}{true}}
\ProcessKeyvalOptions{karlito}\relax
\ProcessOptions\relax
\LoadClass[a4paper,12pt,onecolumn,twoside]{report}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Mise en page %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{fancyhdr} %permet de faire des entêtes et pieds de page
\setlength{\headheight}{15pt} %définit la taille du header et footer (15pt minimum)
\ifthenelse{\boolean{load-remplissage}}{ %mode remplissage
\RequirePackage[parfill]{parskip}
\RequirePackage[a4paper,left=3cm,right=3cm,top=4cm,bottom=4cm]{geometry} %géometrie de la mise en page
}{ %mode normal
\RequirePackage[a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} %géometrie de la mise en page
}
\ifthenelse{\boolean{load-impression}}{ %mode impression
%\setlength{\oddsidemargin}{5mm}
%\setlength{\evensidemargin}{-\oddsidemargin}
\AtEndDocument{
\ifthenelse{\isodd{\thepage}}{}{\clearpage~\clearpage}
}
}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Pour les symboles des equations %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{gensymb}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{xcolor}
\RequirePackage{tikz}
\RequirePackage{verbatim}
\RequirePackage{kpfonts}
\RequirePackage[explicit]{titlesec}
\RequirePackage{varwidth}
\newlength{\margeBordCadre}
\setlength{\margeBordCadre}{1cm}
\usetikzlibrary{calc, backgrounds}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\renewcommand{\maketitle}{
\begin{titlepage}%
\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-\paperheight+\margeBordCadre, xshift=\margeBordCadre] at (current page.north west){
\begin{tikzpicture}[remember picture, overlay]
\draw[line width=5pt] (0,0) rectangle(\paperwidth-2*\margeBordCadre,\paperheight-2*\margeBordCadre);
\draw node[align=center, yshift=0.5\paperheight-\margeBordCadre, xshift=0.5*\paperwidth-\margeBordCadre, anchor=center]{
\begin{varwidth}{\linewidth}\begin{center}
\huge \textbf{\@title}\\[2cm]
\LARGE \@author
\end{center}\end{varwidth}%
};
\end{tikzpicture}
};
\end{tikzpicture}
\end{titlepage}%
\setcounter{footnote}{0}%
}
\newcommand{\ps@otherpage}{%
\pagestyle{fancy}
\fancyhead{} % vide l’en-tête
\fancyhead[RE, LO]{\@title}
\fancyhead[LE]{\leftmark}
\fancyhead[RO]{\rightmark}
\fancyfoot{} % vide le pied~de~page
\fancyfoot[LE, RO]{\thepage}
%\fancyfoot[LO,CE]{de : H. Dupont}
\fancyfoot[LO,RE]{\@author}
\renewcommand{\headrulewidth}{1mm}
\renewcommand{\footrulewidth}{1mm}
}% otherpage style
\pagestyle{otherpage}% doit être placé après les définitions précédentes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Définition du style de chapitre %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{xcolor}
\hfuzz=100pt %on génère un warning si on a une boxe trop pleinne de plus de 100pt
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\@makechapterhead#1{%
\reset@font
\parindent \z@
\vspace*{10\p@}%
\hbox{%
\vbox{%
\hsize=1.5cm%
\begin{tabular}{c}
\scshape \strut \@chapapp{} \\
\colorbox{black}{\vbox{
\hbox{\vbox to 1mm{}}
\hbox{\color{white} \LARGE \bfseries \hspace{1mm}\thechapter\hspace{1mm}}
\hbox{\vbox to 2cm{}}
}}%
\end{tabular}%
}%
\vbox{%
\advance\hsize by -2cm
\hrule height 0.4pt depth 0pt width \hsize
\par
\vskip 6pt%
\hspace{20pt}%
\parbox{400pt}{%
\Huge \bfseries #1
}%
}%
}%
\vskip 20\p@
}
\def\@makeschapterhead#1{%
\reset@font
\parindent \z@
\vspace*{10\p@}%
\hbox{%
\vbox{%
\hsize=1.5cm%
\begin{tabular}{c}
\scshape \strut \phantom{\@chapapp{}} \\
\colorbox{black}{\vbox{
\hbox{\vbox to 1mm{}}
\hbox{\color{white} \LARGE \bfseries \hspace{1mm}\phantom{\thechapter}\hspace{1mm}}
\hbox{\vbox to 2cm{}}
}}%
\end{tabular}%
}%
\vbox{%
\advance\hsize by -2cm
\hrule height 0.4pt depth 0pt width \hsize
\par
\vskip 6pt%
\hspace{20pt}%
\parbox{400pt}{%
\Huge \bfseries #1
}%
}%
}%
\vskip 100\p@
}
\makeatother