summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cahierprof/cahierprof.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/cahierprof/cahierprof.sty')
-rw-r--r--macros/latex/contrib/cahierprof/cahierprof.sty455
1 files changed, 455 insertions, 0 deletions
diff --git a/macros/latex/contrib/cahierprof/cahierprof.sty b/macros/latex/contrib/cahierprof/cahierprof.sty
new file mode 100644
index 0000000000..59850eef8f
--- /dev/null
+++ b/macros/latex/contrib/cahierprof/cahierprof.sty
@@ -0,0 +1,455 @@
+%% Informations générales
+%% Dernière modification le 2023-07-12 at 08:23
+\NeedsTeXFormat{LaTeX2e}[1999/01/01]
+\ProvidesPackage{cahierprof}
+ [2023-07-12 v0.91 Les commandes pour le cahier Professeur]
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Options du package commande
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Pas d'options
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Chargement des extensions
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage{geometry}
+\RequirePackage[table]{xcolor}
+\RequirePackage{tabularx}
+\RequirePackage{tikz}
+ \usetikzlibrary{math}
+ \usetikzlibrary{calc}
+\RequirePackage[babel=true,kerning=true]{microtype}
+\RequirePackage{lscape}
+\RequirePackage{ifthen}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Définitions des compteurs
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Compteurs day/month/year pour la date courante
+\newcounter{day}
+\newcounter{month}
+\newcounter{year}
+%
+% Compteurs pour les vacances scolaires
+% Toussaint
+\newcounter{dayToussaint}
+\newcounter{monthToussaint}
+\newcounter{dayToussaintFin}
+\newcounter{monthToussaintFin}
+% Noel
+\newcounter{dayNoel}
+\newcounter{monthNoel}
+\newcounter{dayNoelFin}
+\newcounter{monthNoelFin}
+% Hiver
+\newcounter{dayHiver}
+\newcounter{monthHiver}
+\newcounter{dayHiverFin}
+\newcounter{monthHiverFin}
+% Printemps
+\newcounter{dayPrintemps}
+\newcounter{monthPrintemps}
+\newcounter{dayPrintempsFin}
+\newcounter{monthPrintempsFin}
+% Jours Feriés
+\newcounter{dayPaques}
+\newcounter{monthPaques}
+\newcounter{dayAscension}
+\newcounter{dayAscensionPont}
+\newcounter{monthAscension}
+\newcounter{dayPentecote}
+\newcounter{monthPentecote}
+%
+% Définition de nouveaux compteurs pour Vendredi Jour/Mois/Année
+\newcounter{friday}
+\newcounter{frimonth}
+\newcounter{friyear}
+%
+% Gestion des années bissextiles.
+\newcounter{FinFevrier}%
+% Est-ce que l'année est bissextile?%
+\pgfmathparse{int(mod(\theyear,4))}%
+\ifthenelse{\pgfmathresult>0}%
+{%
+ % if (year is not divisible by 4) then (it is a common year)%
+ \setcounter{FinFevrier}{28}%
+}{%
+ % else if (year is not divisible by 100) then (it is a leap year)%
+ \pgfmathparse{int(mod(\theyear,100))}%
+ \ifthenelse{\pgfmathresult>0}%
+ {%
+ \setcounter{FinFevrier}{29}%
+ }{%
+ % else if (year is not divisible by 400) then (it is a common year)%
+ \pgfmathparse{int(mod(\theyear,400))}%
+ \ifthenelse{\pgfmathresult>0}%
+ {%
+ \setcounter{FinFevrier}{28}%
+ }{%
+ % else (it is a leap year)%
+ \setcounter{FinFevrier}{29}%
+ }%
+ }%
+}%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Nouvelles macros
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Liste des macros définies:
+% - \nextday : pour passer au jour d'après
+% - \weekend : pour passer les week-ends ou les vacances scolaires
+% - \getdate : afficher la date au format day/month/year
+% - \getWeek : afficher la semaine au format
+% Du lundi Day Month Year au Vendredi Day Month Year
+% - \Semaine : afficher la première ligne du tableau du cahier de texte (Lundi
+% day/month, Mardi day/month, etc)
+% - EmploiDuTemps[1] : afficher l'emploi du temps prof. #1 : l'emploi du temps,
+% au format tableau avec une colonne par jour.
+% - \sem[2] : Cours 1 semaine sur 2. Affiche le contenu de #2 si la semaine #1
+% est paire (0) ou impaire (1).
+% - \TableauClasse[2] : Afficher un tableau pour la classe. #1: le nom de la
+% classe. #2: la liste des élèves séparées par des virgules.
+% - \Classe[2] : Afficher 8 tableaux de classe. #1: le nom de la classe. #2: la
+% liste des élèves.
+% - \ListeEleves : créer un fichier ListeEleves.tex qui contient la liste des
+% élèves puis insère le fichier (compiler deux fois, comme \tableofcontents).
+%
+% Passer au jour d'après
+\newcommand{\nextday}%
+{%
+ % Les mois à 30 jours : Avril, Juin, Septembre, Novembre
+ % Les mois à 31 jours : Janvier, Mars, Mai, Juillet, Août, Octobre, Décembre
+ % Février à \theFinFevrier jours.
+ \ifthenelse{
+ \(\theday=30 \and \(\themonth=4 \or \themonth=6 \or \themonth=9 \or \themonth=11\)\)
+ \or \(\theday=31 \and \(\themonth=1 \or \themonth=3 \or \themonth=5 \or \themonth=7 \or
+ \themonth=8 \or \themonth=10 \or\themonth=12\)\)
+ \or \(\theday=\theFinFevrier \and \themonth=2\)}%
+ {
+ % Si on est en décembre, on change d'année et month=1, day=1
+ \ifthenelse{\themonth=12}%
+ {
+ \stepcounter{year}
+ \setcounter{month}{1}
+ \setcounter{day}{1}
+ }{
+ % Dans les autres cas, on change de mois et on recommence à day= 1
+ \stepcounter{month}%
+ \setcounter{day}{1}%
+ }%
+ }{
+ % Sinon, on augmente juste le compteur jour
+ \stepcounter{day}%
+ }%
+}%
+%
+% Gestions des vacances et week-end
+\newcommand{\weekend}{
+ % Vacances de Toussaint
+ \ifthenelse{ \theday=\thedayToussaint \and \themonth=\themonthToussaint}
+ {
+ \setcounter{day}{\thedayToussaintFin}
+ \setcounter{month}{\themonthToussaintFin}
+ Vacances de la Toussaint
+ }{
+ % Vacances de Noël
+ \ifthenelse{ \theday=\thedayNoel \and \themonth=\themonthNoel}
+ {
+ \setcounter{day}{\thedayNoelFin}
+ \setcounter{month}{\themonthNoelFin}
+ \stepcounter{year}
+ Vacances de Noël
+ }{
+ % Vacances d'Hiver
+ \ifthenelse{ \theday=\thedayHiver \and \themonth=\themonthHiver}
+ {
+ \setcounter{day}{\thedayHiverFin}
+ \setcounter{month}{\themonthHiverFin}
+ Vacances d'hiver
+ }{
+ % Vacances de Printemps
+ \ifthenelse{ \theday=\thedayPrintemps \and \themonth=\themonthPrintemps}
+ {
+ \setcounter{day}{\thedayPrintempsFin}
+ \setcounter{month}{\themonthPrintempsFin}
+ Vacances de printemps
+ }{
+ % sinon c'est juste un week-end
+ \nextday\nextday
+ }%
+ }%
+ }%
+ }%
+}
+%
+% Obtenir la date
+\newcommand{\getDate}{%
+ % On affiche la date
+ \theday/\themonth/\theyear%
+ % On affiche $\star$Ferié$\star$ si le jour est ferié.
+ \ifthenelse{%
+ % Jour de l'an, 1er janvier
+ \(\theday=1 \and \themonth=1\)%
+ % Lundi de Paques
+ \or\(\theday=\thedayPaques \and \themonth=\themonthPaques\)%
+ % Fête du travail, le 1er mai
+ \or\(\theday=1 \and \themonth=5\)%
+ % Victoire 1945, le 8 mai
+ \or\(\theday=8 \and \themonth=5\)%
+ % Jeudi de l'ascension
+ \or\(\theday=\thedayAscension \and \themonth=\themonthAscension\)%
+ % Pont du vendredi de l'ascension
+ \or\(\theday=\thedayAscensionPont \and \themonth=\themonthAscension\)%
+ % Lundi de Pentecote
+ \or\(\theday=\thedayPentecote \and \themonth=\themonthPentecote\)%
+ % Fête Nationale, le 14 juillet
+ \or\(\theday=14 \and \themonth=7\)%
+ % Assomption, le 15 août
+ \or\(\theday=15 \and \themonth=8\)%
+ % Toussaint, le 1er novembre
+ \or\(\theday=1 \and \themonth=11\)%
+ % Armistice 1914-1918, le 11 novembre
+ \or\(\theday=11 \and \themonth=11\)%
+ % Noël, le 25 décembre
+ \or\(\theday=25 \and \themonth=12\)%
+ }{
+ \hfil $\star$Ferié$\star$%
+ }{}%
+}%
+%
+% Affichage de la semaine.%
+\newcommand{\getWeek}{%
+ \setcounter{friday}{\theday}%
+ \setcounter{frimonth}{\themonth}%
+ \setcounter{friyear}{\theyear}%
+ % Si le mois a 31 jours.%
+ % Les mois à 31 jours : Janvier, Mars, Mai, Juillet, Août, Octobre, Décembre%
+ \ifthenelse{\themonth=1 \or \themonth=3 \or \themonth=5 \or \themonth=7 \or \themonth=8 \or \themonth=10 \or \themonth=12}%
+ {%
+ % Alors si on est avant le 28 du mois, on ajoute 4 jours%
+ \ifthenelse{\theday < 28}%
+ {%
+ \addtocounter{friday}{4}%
+ }{%
+ % Sinon, on change de mois %
+ \stepcounter{frimonth}%
+ % Changement d'année pour décembre%
+ \ifthenelse{\themonth=12}{\stepcounter{friyear}}{}%
+ % Lundi 31 - Mar 1, Mer 2, Jeu 3, Ven 4%
+ \ifthenelse{\theday=31}{\setcounter{friday}{4}}{}%
+ % Lundi 30 - Mar 31, Mer 1, Jeu 2, Ven 3%
+ \ifthenelse{\theday=30}{\setcounter{friday}{3}}{}%
+ % Lundi 29 - Mar 30, Mer 31, Jeu 1, Ven 2%
+ \ifthenelse{\theday=29}{\setcounter{friday}{3}}{}%
+ % Lundi 28 - Mar 29, Mer 30, Jeu 31, Ven 1%
+ \ifthenelse{\theday=28}{\setcounter{friday}{1}}{}%
+ }%
+ }{%
+ % Sinon, si on est au mois de février%
+ \ifthenelse{\themonth=2}%
+ {%
+ % Si le mois de février a 28 jours%
+ \ifthenelse{\theFinFevrier=28}%
+ {%
+ % Si on est avant le 25%
+ \ifthenelse{\theday < 25}%
+ {%
+ % Alors on ajoute 4 jours%
+ \addtocounter{friday}{4}%
+ }{%
+ % Sinon, on change de mois%
+ \stepcounter{frimonth}%
+ % Lundi 28 - Mar 1, Mer 2, Jeu 3, Ven 4%
+ \ifthenelse{\theday=28}{\setcounter{friday}{4}}{}%
+ % Lundi 27 - Mar 28, Mer 1, Jeu 2, Ven 3%
+ \ifthenelse{\theday=27}{\setcounter{friday}{3}}{}%
+ % Lundi 26 - Mar 27, Mer 28, Jeu 1, Ven 2%
+ \ifthenelse{\theday=26}{\setcounter{friday}{2}}{}%
+ % Lundi 25 - Mar 26, Mer 27, Jeu 28, Ven 1%
+ \ifthenelse{\theday=25}{\setcounter{friday}{1}}{}%
+ }%
+ }{%
+ % sinon le mois de février a 29 jours%
+ % si on est avant le 26%
+ \ifthenelse{\theday < 26}%
+ {%
+ % alors on ajoute 4 jours%
+ \addtocounter{friday}{4}%
+ }{%
+ % sinon, on change de mois%
+ \stepcounter{frimonth}%
+ % lundi 29 - mar 1, mer 2, jeu 3, ven 4%
+ \ifthenelse{\theday=29}{\setcounter{friday}{4}}{}%
+ % lundi 28 - mar 29, mer 1, jeu 2, ven 3%
+ \ifthenelse{\theday=28}{\setcounter{friday}{3}}{}%
+ % lundi 27 - mar 28, mer 29, jeu 1, ven 2%
+ \ifthenelse{\theday=27}{\setcounter{friday}{2}}{}%
+ % lundi 26 - mar 27, mer 28, jeu 29, ven 1%
+ \ifthenelse{\theday=26}{\setcounter{friday}{1}}{}%
+ }%
+ }%
+ }{%
+ % Sinon le mois a 30 jours%
+ % Les mois de 30 jours : Avril, Juin, Septembre, Novembre%
+ % Si on est avant le 27, on ajoute 4 jours%
+ \ifthenelse{\theday < 27}%
+ {%
+ \addtocounter{friday}{4}%
+ }{%
+ % Sinon, on change de mois%
+ \stepcounter{frimonth}%
+ % Lundi 30 - Mar 1, Mer 2, Jeu 3, Ven 4%
+ \ifthenelse{\theday=30}{\setcounter{friday}{4}}{}%
+ % Lundi 29 - Mar 30, Mer 1, Jeu 2, Ven 3%
+ \ifthenelse{\theday=29}{\setcounter{friday}{3}}{}%
+ % Lundi 28 - Mar 29, Mer 30, Jeu 1, Ven 2%
+ \ifthenelse{\theday=28}{\setcounter{friday}{2}}{}%
+ % Lundi 27 - Mar 28, Mer 29, Jeu 30, Ven 1%
+ \ifthenelse{\theday=27}{\setcounter{friday}{1}}{}%
+ }%
+ }%
+ }%
+ Du lundi \theday{}
+ \ifthenelse{\themonth=1}{janvier}{}%
+ \ifthenelse{\themonth=2}{février}{}%
+ \ifthenelse{\themonth=3}{mars}{}%
+ \ifthenelse{\themonth=4}{avril}{}%
+ \ifthenelse{\themonth=5}{mai}{}%
+ \ifthenelse{\themonth=6}{juin}{}%
+ \ifthenelse{\themonth=7}{juillet}{}%
+ \ifthenelse{\themonth=8}{août}{}%
+ \ifthenelse{\themonth=9}{septembre}{}%
+ \ifthenelse{\themonth=10}{octobre}{}%
+ \ifthenelse{\themonth=11}{novembre}{}%
+ \ifthenelse{\themonth=12}{décembre}{}
+ \theyear{}
+ au vendredi
+ \thefriday{}
+ \ifthenelse{\thefrimonth=1}{janvier}{}%
+ \ifthenelse{\thefrimonth=2}{février}{}%
+ \ifthenelse{\thefrimonth=3}{mars}{}%
+ \ifthenelse{\thefrimonth=4}{avril}{}%
+ \ifthenelse{\thefrimonth=5}{mai}{}%
+ \ifthenelse{\thefrimonth=6}{juin}{}%
+ \ifthenelse{\thefrimonth=7}{juillet}{}%
+ \ifthenelse{\thefrimonth=8}{août}{}%
+ \ifthenelse{\thefrimonth=9}{septembre}{}%
+ \ifthenelse{\thefrimonth=10}{octobre}{}%
+ \ifthenelse{\thefrimonth=11}{novembre}{}%
+ \ifthenelse{\thefrimonth=12}{décembre}{}
+ \thefriyear
+}%
+%
+% Affichage de la semaine
+\newcommand{\Semaine}
+{
+ & Lundi \getDate\nextday
+ & Mardi \getDate\nextday
+ & Mercredi \getDate\nextday
+ & Jeudi \getDate\nextday
+ & Vendredi \getDate\nextday
+}
+\newcommand{\EmploiDuTemps}[1]%
+{
+ \foreach \n in {1,...,37}
+ {
+ {\Large\textsc{Semaine \no\n{} --- \getWeek}}
+ \vfil
+ \begin{tabularx}{\linewidth}{|c||X|X|X|X|X|} \hline
+ \Semaine \\ \hline
+ #1
+ \end{tabularx}
+ \vfil
+ \hfil \weekend \hfil
+ \newpage
+ }%
+}%
+%
+% Cours 1 semaine sur 2
+% La commande \sem a deux arguments:
+% - #1 pour le cours en semaine impaire.
+% - #2 pour le cours en semaine paire.
+\newcommand{\sem}[2]%
+{
+ \pgfmathparse{int(mod(\n,2))}
+ \ifthenelse{\pgfmathresult=1}{#1}{#2}
+}%
+% Réaliser le tableau pour une classe
+% En argument:
+% - #1 : la classe.
+% - #2 la liste des élèves, séparée par des virgules (sauf le dernier).
+\newcommand{\TableauClasse}[2]
+{
+ \begin{tikzpicture}
+ % En tête et nom de la classe.
+ \tikzmath{\largeurLigne=18; \largeurNom=3.5;\largeurColonne=\largeurLigne-\largeurNom;}
+ \draw[fill=gray!50] (0,-.5) rectangle (\largeurLigne,.5);
+ \draw ({\largeurNom/2},0) node{\Large #1};
+ \draw[shift={(\largeurNom,-.5)}] (0,0) grid[xstep=\largeurColonne/20]
+ ++(\largeurColonne,1);
+ \foreach[count=\n] \NomPrenom in {#2}
+ {
+ % Griser une ligne sur 2 (les lignes paires)
+ \pgfmathparse{int(mod(\n,2))}
+ \ifnum0=\pgfmathresult\relax
+ \fill[gray!25] (0,{-.5*\n}) rectangle ++(\largeurLigne,-.5);
+ \fi
+ % Ecrire le numéro de l'élève et son nom
+ \draw (0,{-.5*\n}) node[text width=3.5cm,below right]
+ {\tiny \n. \NomPrenom} rectangle ++(\largeurNom,-.5);
+ \draw[shift={(\largeurNom,-.5*\n)}] (0,0) grid[xstep=14.5/20,ystep=.5]
+ (\largeurColonne,-.5);
+ }
+ \end{tikzpicture}
+}%
+%
+% Réaliser les tableaux de classe.
+% \TableauClasse a 3 arguments:
+% - #1 : la classe
+% - #2 : le nombre de fois qu'on voit la classe par semaine
+% - #3 : la liste des élèves
+%% Il y a 20 colonnes par tableaux. Il faut ~2 tableaux pour faire 37 semaines
+%% Le nombre de tableaux est donc deux fois le nombre de fois qu'on voit les
+%% élèves par semaine.
+%
+%
+\newcommand{\Classe}[3]
+{
+ \immediate\write\outputstream{#1}
+ \immediate\write\outputstream{\string \begin{enumerate}}
+ % Ecrire les noms des élèves dans le bon fichier
+ \foreach \i in {#3}
+ {
+ \immediate\write\outputstream{\string\item\space \i}
+ }
+ \immediate\write\outputstream{\string \end{enumerate}}
+ \begin{center}
+ \tikzmath{\NbTableaux=2*#2;}
+ \foreach \i in {1,...,\NbTableaux}
+ {
+ \TableauClasse{#1}{#3} \\[.50cm]
+ }
+ \end{center}
+}
+
+% Liste des élèves
+\newcommand{\ListeEleves}
+{
+ %insère le fichier ListeEleves.tex s'il existe
+ \IfFileExists{ListeEleves.tex}{
+ \input{ListeEleves.tex}
+ }{
+ % Else : do nothing.
+ }
+ % Stocker le nom des élèves dans un fichier externe.
+ \newwrite\outputstream
+ \immediate\openout\outputstream=ListeEleves.tex
+}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Divers
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Pas d'indentation des paragraphes
+\setlength{\parindent}{0pt}
+%
+% Fin du package.
+\endinput