Created
July 21, 2017 01:57
-
-
Save MayeulC/c92e06d316c0c8791b0b21eb6cc01216 to your computer and use it in GitHub Desktop.
Classe LaTeX pour rapport CPE Lyon (version alpha 0.1, je ferai un dépot git propre plus tard)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\NeedsTeXFormat{LaTeX2e} | |
\ProvidesClass{rapportcpe}[2017/07/18 Rapport de stage pour CPE Lyon] | |
% Note: testé avec lualatex, vous aurez sans-doute au minimum besoin du support utf-8 sinon | |
% Passe toutes les options à la classe "article" et la charge | |
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} | |
\ProcessOptions\relax | |
\LoadClass[a4paper]{article} | |
% Packets utilisés | |
\usepackage{xstring} % Comparaison de chaînes de caractères | |
\usepackage{amsfonts} % Pour symboles supplémentaires (cases à cocher: \checkmark) | |
\usepackage{makecell} % Rend plus facile le saut de ligne dans un tableau | |
% Variables qui seront modifiables par l'utilisateur: | |
\newtoks\anneestage | |
\newtoks\specialite | |
\newtoks\debutstage | |
\newtoks\finstage | |
\newtoks\titre | |
\newtoks\entreprise | |
\newtoks\ville | |
\newtoks\pays | |
\newtoks\maitrestage | |
\newtoks\maitrestagefonction | |
\newtoks\typestage % EXP, EXE, INGE, CES, CES1, CES2 ou PFE | |
\def\logo#1{\def\@logo{#1}} | |
\newif\ifconfidential | |
\renewcommand\cellalign{{p{200pt}}c} %TODO: pourquoi cela est-ce nécessaire pour que le tableau foncionne? | |
% Raccourcis pour les cases à cocher | |
\def\ticked{\mbox{\rlap{\square}\checkmark}} % mbox prévient le retour à la ligne. case et "V" supperposés. | |
\def\untick{\square} | |
\def\isstagexp{\IfStrEq{\the\typestage}{EXP}{\ticked}{\untick}} | |
\def\isstagexe{\IfStrEq{\the\typestage}{EXE}{\ticked}{\untick}} | |
\def\isstageeleveinge{\IfStrEq{\the\typestage}{INGE}{\ticked}{\untick}} | |
\def\isstagecesunan{\IfStrEq{\the\typestage}{CES}{\ticked}{\untick}} | |
\def\isstagecessemun{\IfStrEq{\the\typestage}{CES1}{\ticked}{\untick}} | |
\def\isstagecessemdeux{\IfStrEq{\the\typestage}{CES2}{\ticked}{\untick}} | |
\def\isstagepfe{\IfStrEq{\the\typestage}{PFE}{\ticked}{\untick}} | |
\usepackage{geometry} %utiliser [showframe] pour montrer les marges. | |
\usepackage{fancyhdr} | |
\fancyhf{} | |
\fancyhead[R]{\thepage} % Marque le numéro de page à droite | |
\renewcommand{\headrulewidth}{0pt} % Retire la ligne horizontale de l'en-tête | |
\def\nomprenomformatte{\textbf{Nom et Prénom du stagiaire :} \@author} % Raccourci pour nom et prénom prêt à l'affichage | |
\def\specialitetabular{ % Raccourci pour insérer la spécialité. Doit être dans un tabular lll | |
Spécialité : & | |
\IfStrEq{\the\specialite}{CGP}{\ticked}{\untick} CGP % coché si CGP | |
& | |
\IfStrEq{\the\specialite}{ETI}{\ticked}{\untick} ETI \\ | |
} | |
\def\tableau{ % Raccourci pour le tableau d'en-tête | |
\begin{tabular}{|p{0.25\textwidth}|p{0.5\textwidth}|@{}c@{}|} | |
\hline | |
\makecell{\vskip0.5ex\includegraphics[width=0.25\textwidth]{logo_cpe_vert.png}} & | |
\makecell{ | |
\textbf{Stage d'exépérience} \isstagexp{} \\ | |
\textbf{Stage d'exécution} \isstagexe{} \\ | |
\textbf{Stage élève-ingénieur} \isstageeleveinge{}\\ | |
\textbf{Stage année en entreprise :}\\ | |
\isstagecesunan{} \textbf{12 mois} \isstagecessemun{} \textbf{1\textsuperscript{er} semestre} \isstagecessemdeux{} \textbf{2\textsuperscript{ème} semestre}\\ | |
\textbf{Stage projet de fin d’études} \isstagepfe{} | |
\vskip0.5ex | |
} | |
& | |
\begin{tabular}{>{\centering\arraybackslash}p{0.25\textwidth}} % Le "field format" > permet de spécifier l'alignement. \arraybackslash est nécessaire pour restaurer l'alignement original | |
\makecell{ | |
\\ | |
Date du stage \\ | |
du \the\debutstage\\ | |
au \the\finstage | |
\vskip0.5ex | |
}\\ | |
\hline | |
\makecell{ | |
\\ | |
Année \\ | |
\the\anneestage | |
\vskip0.5ex | |
} | |
\end{tabular} | |
\\ | |
\hline | |
\end{tabular} | |
} | |
\fancypagestyle{firststyle} | |
{ | |
\fancyhf{} | |
\newgeometry{top=5.2cm,headheight=4.2cm} | |
\fancyhead[C]{ | |
\begin{flushright} | |
\thepage | |
\end{flushright} | |
\tableau | |
} | |
%\fancyhead[R]{\thepage} %\raisebox{1cm} | |
} | |
\pagestyle{fancy} | |
\AtBeginDocument { | |
\sffamily\setlength\extrarowheight{4pt} %TODO: trouver le mode d'action et décider sur son inclusion | |
\thispagestyle{firststyle} % En-têtes dans le style de la première page | |
% Dessous le cadre supérieur: | |
\noindent | |
\nomprenomformatte | |
\begin{tabular}{lll} | |
\specialitetabular | |
Confidentialité du rapport : & | |
\ifconfidential \ticked{} \else \untick{} \fi OUI & | |
\ifconfidential \untick{} \else \ticked{} \fi NON | |
\end{tabular} | |
\\\\ | |
\noindent | |
\textbf{Titre du rapport en français :} | |
\the\titre | |
\\\\ | |
\textbf{Titre du rapport en anglais :} | |
\@title | |
\topskip0pt | |
\vspace*{\fill} % S'étend pour remplir l'espace vertical | |
\ifdefined\@logo | |
\includegraphics[width=\textwidth]{\@logo} | |
\fi | |
\vspace*{\fill} | |
\noindent | |
\textbf{Nom de l'entreprise/organisme : } \the\entreprise | |
\\\\ | |
Ville : \the\ville \hfill Pays : \the\pays | |
Nom et Prénom du maître de stage : \the\maitrestage | |
Fonction : \the\maitrestagefonction | |
\pagebreak | |
\restoregeometry | |
} | |
\AtEndDocument { | |
\pagebreak | |
\thispagestyle{firststyle} | |
\nomprenomformatte | |
\begin{tabular}{lll} | |
\specialitetabular | |
\end{tabular} | |
} | |
\endinput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exemple d'utilisation: https://gist.github.com/MayeulC/8dad97ff0ab19967c6f766eea8195795