polytechnique.sty 13.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
%%
%% This is file `polytechnique.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% polytechnique.dtx  (with options: `package')
%% This is a generated file.
%% 
%% Copyright (C) 2015 by Denis Merigoux
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.2 of this license or (at your option) any later
%% version. The latest version of this license is in:
%% 
%% http://www.latex-project.org/lppl.txt
%% 
%% and version 1.2 or later is part of all distributions of
%% LaTeX version 1999/12/01 or later.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{polytechnique}
Denis Merigoux's avatar
Denis Merigoux committed
23
 [2015/07/04 v1.3.3, standard scientific documents layout for Ecole polytechnique (Palaiseau,France).]
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
%%\CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
\DeclareOption{a4paper}{
    \PassOptionsToPackage{a4paper}{geometry}
}
\DeclareOption{fancysections}{
    \AtEndOfPackage{
    \titleformat{\chapter}
        [display]
        {\Huge\bfseries\sffamily}
        {\LARGE\chaptertitlename{} \thechapter}
        {0em}
        {}
        []
    \titleformat{\section}
        [display]
        {\color{rouge485}\LARGE\bfseries\sffamily\filcenter}
        {\thesection}{0em}
        {\MakeUppercase}
        [\vspace*{-0.5\baselineskip}%
            \includegraphics{\polyfiletlongrouge}]
    \titleformat{\subsection}
        [hang]
        {\color{bleu315}\Large\scshape}
        {\thesubsection}
        {0.5em}
        {}
        [\vspace*{-0.3\baselineskip}%
            \includegraphics{\polyfiletcourtbleuclair}]
\titleformat{\subsubsection}
    [block]
    {\color{bleu303}\large\scshape}
    {\thesubsubsection}
    {0.5em}
    {\textbullet{} }
    []
    }
}
\DeclareOption{notitlepage}{
        \renewcommand*{\maketitle}{
            \notitlepagelayout{}
    }
}
\DeclareOption{titlepage}{
        \renewcommand*{\maketitle}{
            \titlepagelayout{}
    }
}
\DeclareOption{oneside}{
    \AtEndOfPackage{
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
88
        \geometry{inner=\margecote,outer=\margecote}
89 90 91 92 93 94 95 96 97 98
    }
}
\DeclareOption{twoside}{
    \AtEndOfPackage{
        \geometry{inner=\margecoteinterieur,
            outer=\margecoteexterieur}
    }
}
\DeclareOption{sectionmark}{
    \AtEndOfPackage{
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
99
        \renewcommand{\enteteexterieur}[1]{
100 101 102 103 104 105 106 107 108 109 110
            \ifthesection{
                \raisebox{\decalageverticalentete}
                    {\scshape\color{bleu303}
                        \thesection{}.~\sectiontitle}
            }{
            }
        }
    }
}
\DeclareOption{chaptermark}{
    \AtEndOfPackage{
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
111
        \renewcommand{\enteteexterieur}[1]{
112 113 114 115 116 117 118 119 120 121 122 123
            \ifthechapter{
                \raisebox{\decalageverticalentete}
                     {\scshape\color{bleu303}
                         \thechapter{}.~\chaptertitle}
            }{

            }
        }
    }
}
\DeclareOption{markboth}{
    \AtEndOfPackage{
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
124
        \renewcommand{\enteteexterieurimpair}{
125 126 127 128 129 130 131 132
            \ifthesection{%Si la section a ete definie
                \raisebox{\decalageverticalentete}
                    {\scshape\color{bleu303}
                        \thesection{}.~\sectiontitle}
            }{

            }
        }
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
133
        \renewcommand{\enteteexterieurpair}{
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
            \ifthechapter{
                \raisebox{\decalageverticalentete}
                    {\scshape\color{bleu303}
                        \thechapter{}.~\chaptertitle}
            }{

            }
        }
    }
}
\DeclareOption{pagenumber}{
    \AtEndOfPackage{
        \RequirePackage{lastpage}
        \renewcommand{\piedcentre}{
            \setlength{\largeurfiletpiedcentre}
                {2\largeurfiletpiedcentre}
            \textcolor{bleu303}{\shortstack[c]{
                \rule{\largeurfiletpiedcentre}{0.3mm}\\
                \thepage/\pageref{LastPage}}}
        }
    }
}
\DeclareOption*{
    \PassOptionsToPackage{\CurrentOption}{geometry}
}
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
159
\ExecuteOptions{a4paper,notitlepage,oneside}
Denis Merigoux's avatar
Denis Merigoux committed
160
\ProcessOptions*
161 162 163 164 165 166 167 168 169 170 171 172
\RequirePackage{calc}
\RequirePackage{color}
\RequirePackage{geometry}
\RequirePackage{graphicx}
\RequirePackage{ifthen}
\RequirePackage{ifpdf}
\RequirePackage{lmodern}
\RequirePackage[pagestyles]{titlesec}
\definecolor{bleu303}{RGB}{0,62,92}
\definecolor{rouge485}{RGB}{213,43,30}
\definecolor{bleu315}{RGB}{0,104,128}
\ifpdf
Denis Merigoux's avatar
Denis Merigoux committed
173 174
    \newcommand{\polyfiletlongrouge}
    {polytechnique-filetlongrouge.pdf}
175
    \newcommand{\polyfiletcourtbleuclair}
Denis Merigoux's avatar
Denis Merigoux committed
176 177 178 179 180 181 182 183 184
        {polytechnique-filetcourtbleuclair.pdf}
    \newcommand{\polyfiletcourtbleu}
    {polytechnique-filetcourtbleu.pdf}
    \newcommand{\polylogovert}
    {polytechnique-logovert.pdf}
    \newcommand{\polylogohori}
    {polytechnique-logohori.pdf}
    \newcommand{\polyarmes}
    {polytechnique-armes.pdf}
185
\else
Denis Merigoux's avatar
Denis Merigoux committed
186 187
    \newcommand{\polyfiletlongrouge}
    {polytechnique-filetlongrouge.eps}
188
    \newcommand{\polyfiletcourtbleuclair}
Denis Merigoux's avatar
Denis Merigoux committed
189 190 191 192 193 194 195 196 197
        {polytechnique-filetcourtbleuclair.eps}
    \newcommand{\polyfiletcourtbleu}
    {polytechnique-filetcourtbleu.eps}
    \newcommand{\polylogovert}
    {polytechnique-logovert.eps}
    \newcommand{\polylogohori}
    {polytechnique-logohori.eps}
    \newcommand{\polyarmes}
    {polytechnique-armes.eps}
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
\fi
\newlength{\margehaut}
\setlength{\margehaut}{40mm}
\newlength{\hauteurentete}
\setlength{\hauteurentete}{27mm}
\newlength{\separationentete}
\setlength{\separationentete}{12mm}
\newlength{\margecote}
\setlength{\margecote}{20mm}
\newlength{\margecoteinterieur}
\setlength{\margecoteinterieur}{22.5mm}
\newlength{\margecoteexterieur}
\setlength{\margecoteexterieur}{17.5mm}
\newlength{\margebas}
\setlength{\margebas}{35mm}
\newlength{\separationpied}
\setlength{\separationpied}{17.5mm}
\newlength{\hauteurlogohori}
\setlength{\hauteurlogohori}{15mm}
\newlength{\separationtitre}
\setlength{\separationtitre}{15mm}
\newlength{\epaisseurtrait}
\setlength{\epaisseurtrait}{1pt}
\newlength{\separationlignestitre}
\setlength{\separationlignestitre}{3mm}
\newlength{\separationtitrecorps}
\setlength{\separationtitrecorps}{15mm}
\newlength{\hauteurlogopage}
\setlength{\hauteurlogopage}{0.6\textheight}
\newlength{\separationentetelogo}
\setlength{\separationentetelogo}{20mm}
\newlength{\largeurfiletpiedcentre}
\setlength{\largeurfiletpiedcentre}{4mm}
\newlength{\largeurlogovert}
\setlength{\largeurlogovert}{\paperwidth/\real{7}}
\newlength{\hauteurlogovert}
\setlength{\hauteurlogovert}{\largeurlogovert*\real{1.361}}
\newlength{\largeurlogohori}
\setlength{\largeurlogohori}{\hauteurlogohori*\real{1.859}}
\newlength{\distancetitrelogo}
\setlength{\distancetitrelogo}{\separationtitre-\margehaut}
\newlength{\separationlogotrait}
\setlength{\separationlogotrait}{-\baselineskip*2+10mm}
\newlength{\largeurminipage}
\setlength{\largeurminipage}
Denis Merigoux's avatar
Denis Merigoux committed
243
    {(\textwidth-\largeurlogovert-0.5cm)/\real{2}}
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
\newlength{\distancetitrecorps}
\setlength{\distancetitrecorps}
    {\separationtitrecorps-\baselineskip*2}
\newlength{\largeurtitreentete}
\setlength{\largeurtitreentete}{\textwidth-\largeurlogohori
    -\separationentetelogo}
\newlength{\decalageverticalentete}
\setlength{\decalageverticalentete}
    {\hauteurlogohori/\real{2.6}}
\geometry{
    top=\margehaut,headheight=\hauteurentete,
    headsep=\separationentete,
    bottom=\margebas,footskip=\separationpied
}
\newcommand{\piedcentre}{
    \textcolor{bleu303}{\shortstack[c]
        {\rule{\largeurfiletpiedcentre}{0.3mm}\\\thepage}}
}
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
262
\newcommand{\enteteexterieur}[1]{
263 264 265
    \raisebox{\decalageverticalentete}
        {\begin{minipage}[b]{\largeurtitreentete}
            \scshape#1\textcolor{bleu303}
w2ak's avatar
w2ak committed
266
            \polytitrecourtsave
267 268
        \end{minipage}}
}
w2ak's avatar
w2ak committed
269 270
\newcommand{\enteteinterieur}[1]{
    \includegraphics[height=\hauteurlogohori]{#1}
271
}
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
272 273
\newcommand{\enteteexterieurpair}{
    \enteteexterieur{\flushright}
274
}
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
275 276
\newcommand{\enteteexterieurimpair}{
    \enteteexterieur{}
277
}
w2ak's avatar
w2ak committed
278 279 280 281 282 283
\newcommand{\enteteinterieurpair}{
    \enteteinterieur{\polylogohori}
}
\newcommand{\enteteinterieurimpair}{
    \enteteinterieur{\polylogohori}
}
284 285
\newcommand{\entetes}{
    \newpagestyle{polytechnique}{
w2ak's avatar
w2ak committed
286
    \sethead[\enteteinterieurpair]% left even
287
            []% center even
Denis Merigoux's avatar
Bugfix  
Denis Merigoux committed
288 289
            [\enteteexterieurpair]% right even
            {\enteteexterieurimpair}% left odd
290
            {}% center odd
w2ak's avatar
w2ak committed
291
            {\enteteinterieurimpair}% right odd
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
    \setfoot{}% left odd
             {\piedcentre}% center odd
             {}% right odd
    }
    \pagestyle{polytechnique}
}
\renewpagestyle{plain}{
    \sethead{}% left
            {}% center
            {}% right
    \setfoot{}% left
            {\piedcentre}% center
            {}% right
}
\pagestyle{plain}
\newboolean{subtitle}\setboolean{subtitle}{false}
\newcommand{\polysoustitresave}{}
w2ak's avatar
w2ak committed
309 310
\def\subtitle{}
\renewcommand*{\subtitle}[1]{
311 312 313 314
    \renewcommand*{\polysoustitresave}{#1}
    \setboolean{subtitle}{true}
}
\newcommand{\polytitresave}{}
w2ak's avatar
w2ak committed
315 316 317
\newcommand{\polytitrecourtsave}{}
\renewcommand*{\title}[2][{}]{
    \renewcommand*{\polytitresave}{#2}
w2ak's avatar
w2ak committed
318
    \ifthenelse{\equal{#1}{}}{
w2ak's avatar
w2ak committed
319 320
        \renewcommand*{\polytitrecourtsave}{#2}
    }{
w2ak's avatar
w2ak committed
321
        \renewcommand*{\polytitrecourtsave}{#1}
w2ak's avatar
w2ak committed
322
    }
323 324 325 326 327 328 329 330 331 332 333
    \entetes
}
\newcommand{\polyauthorsave}{}
\renewcommand*{\author}[1]{
    \renewcommand*{\polyauthorsave}{#1}
}
\newcommand{\polydatesave}{\today}
\renewcommand*{\date}[1]{
    \renewcommand*{\polydatesave}{#1}
}

w2ak's avatar
w2ak committed
334 335 336 337 338 339
\newcommand{\logo}[2][{}]{
    \ifthenelse{\equal{#1}{headers}}{
        \renewcommand{\enteteinterieurimpair}{
            \enteteinterieur{#2}
        }
    }{}
340
    \renewcommand{\titlepagebottomline}{
Denis Merigoux's avatar
Denis Merigoux committed
341 342 343 344 345 346 347 348 349 350
     \begin{minipage}{5\largeurlogohori}
         \centering
         \raisebox{-0.5\height}{
                \includegraphics[width=1.5\largeurlogohori]
                    {\polylogohori}
            }
            \hspace{0.25\largeurlogohori}
            \raisebox{-0.5\height}{
                \includegraphics[height=\hauteurlogovert,
                    width=1.5\largeurlogohori,
w2ak's avatar
w2ak committed
351
                    keepaspectratio]{#2}
Denis Merigoux's avatar
Denis Merigoux committed
352 353
            }
        \end{minipage}
354 355
    }
    \renewcommand{\notitlepageupperline}{
Denis Merigoux's avatar
Denis Merigoux committed
356
        \noindent%
357
        \begin{minipage}{\textwidth}
Denis Merigoux's avatar
Denis Merigoux committed
358
            \centering
w2ak's avatar
w2ak committed
359
            \begin{minipage}{0.33\textwidth}
Denis Merigoux's avatar
Denis Merigoux committed
360
                \raisebox{-0.5\height}
361 362 363
                    {\includegraphics[width=\largeurlogovert]
                        {\polylogovert}
                    }
Denis Merigoux's avatar
Denis Merigoux committed
364 365 366 367 368 369 370 371 372
            \end{minipage}%
            %    \end{macrocode}
            \begin{minipage}{0.33\textwidth}
                \centering\polydatesave{}\\
                \polyauthorsave{}\\
                \includegraphics{\polyfiletcourtbleu}
            \end{minipage}%
            \begin{minipage}{0.33\textwidth}
                    \flushright\raisebox{-0.5\height}
373
                    {\includegraphics[height=\hauteurlogovert,
Denis Merigoux's avatar
Denis Merigoux committed
374
                        width=1.75\largeurlogohori,
w2ak's avatar
w2ak committed
375
                        keepaspectratio]{#2}
376
                    }
Denis Merigoux's avatar
Denis Merigoux committed
377 378
            \end{minipage}
        \end{minipage}
379 380 381 382 383 384
    }
}
\newcommand{\notitlepageupperline}{
    \noindent
    \begin{minipage}[b]{\largeurminipage}
        \hspace{0cm}\polyauthorsave
Denis Merigoux's avatar
Denis Merigoux committed
385
    \end{minipage}%
386 387
    \hspace*{\fill}
    \includegraphics[width=\largeurlogovert]{\polylogovert}
Denis Merigoux's avatar
Denis Merigoux committed
388
    \hspace*{\fill}%
389 390
    \begin{minipage}[b]{\largeurminipage}
        \flushright\hspace{0cm}\polydatesave
Denis Merigoux's avatar
Denis Merigoux committed
391
    \end{minipage}%
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
}
\newcommand{\notitlepagelayout}{
\thispagestyle{plain}
            \vspace*{\distancetitrelogo}
            \notitlepageupperline{}
            \\[\separationlogotrait]
            \begin{center}
                    \textcolor{bleu303}
                        {\rule{\textwidth}{\epaisseurtrait}}
                    \\
                    \color{bleu303}\Huge\scshape
                    \MakeUppercaseWithNewline{\polytitresave}
                \ifthenelse{\boolean{subtitle}}{
                    \\[\separationlignestitre]
                    \Large\upshape\polysoustitresave\\\normalsize
                }{
                    \\
                    \normalsize
                }
                \textcolor{bleu303}
                    {\rule{\textwidth}{\epaisseurtrait}}
            \end{center}
            \vspace*{\distancetitrecorps}
}
\newcommand{\titlepagebottomline}{
\includegraphics[height=\hauteurlogovert]{\polylogovert}
}
\newcommand{\titlepagelayout}{
        \noindent\makebox[\textwidth][c]{%
          \raisebox{-\totalheight}[0pt][0pt]{%
        \includegraphics[height=\hauteurlogopage]{\polyarmes}}}
        \vspace*{0.125\textheight}
        \begin{center}
            \Huge\sffamily\bfseries\color{bleu303}
            \MakeUppercaseWithNewline{\polytitresave}\\
            \vspace*{0.2\textheight}
            \LARGE\hspace{0cm}\polysoustitresave\\
            \vspace*{0.15\textheight}
            \Large\mdseries\hspace{0cm}\polydatesave\\
            \includegraphics{\polyfiletcourtbleu}
            \\[0.4\baselineskip]
            \rmfamily\hspace{0cm}\polyauthorsave\\[\fill]
            $\;$\titlepagebottomline{}
            \vspace*{-0.5\margebas}
        \end{center}
        \thispagestyle{empty}
        \clearpage
}
\newcommand{\MakeUppercaseWithNewline}[1]{
      \begingroup
        \let\SavedOrgNewline\\%
        \DeclareRobustCommand{\\}{\SavedOrgNewline}%
        \MakeUppercase{#1}%
    \endgroup
}
\endinput
%%
%% End of file `polytechnique.sty'.