2021-2022/tools/style/shortcuts.sty

313 lines
8.8 KiB
TeX
Executable File

\NeedsTeXFormat{LaTeX2e}
%%%%%%%%%%%%%%%%%
% Raccourcis %
%%%%%%%%%%%%%%%%%
% Displaystyle
\newcommand{\ds}{\displaystyle}
% Ensembles
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
%\newcommand{\D}{\mathbb{D}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
% intervalles ouvert ouvert
\newcommand{\intOO}[2]{\left]{#1}\,{;}\,{#2}\right[}
% intervalles ouvert fermé
\newcommand{\intOF}[2]{\left]{#1}\,{;}\,{#2}\right]}
% intervalles fermé ouvert
\newcommand{\intFO}[2]{\left[{#1}\,{;}\,{#2}\right[}
% intervalles fermé fermé
\newcommand{\intFF}[2]{\left[{#1}\,{;}\,{#2}\right]}
%% Vecteurs
% représentation d'un vecteur
\newcommand{\vect}[1]{\overrightarrow{#1}}
% Norme d'un vecteur
\newcommand{\norme}[1]{||\vect{#1}||}
% Produit scalaire
\newcommand{\scal}[2]{\vect{#1} \cdot \vect{#2}}
\newcommand{\vectCoord}[2]{%
{\renewcommand{\arraystretch}{1}%
\left(\begin{array}{c} #1 \\ #2 \end{array} \right)%
}%
}
% Les complexes
\def\Ouv{$\left(\text{O}~;~\vect{u},~\vect{v}\right)$}
\newcommand{\e}{\mathrm{\,e\,}}% le e de l'exponentielle
%\renewcommand{\i}{\mathrm{\,i\,}}% le i des complexes
%% Proba
\newcommand{\coefBino}[2]{\vectCoord{#1}{#2}}
%% Logique
\renewcommand{\equiv}{\Leftrightarrow}
%% Calculatrice
\usepackage{listings}
\newcommand{\calc}[1]{\Ovalbox{\lstinline|#1|}}
%\newcommand{\calc}[1]{\verb!#1!}
%% Autres
\newcommand{\TODO}[1]{\textcolor{red}{note(#1)}}
% Difficulté
\usepackage{fontawesome5}
\newcommand{\dure}{(\faBolt) }
\newcommand{\superDure}{(\faBioHazard) }
% Icones
\newcommand{\icon}[2][scale=0.4]{%
\includegraphics[#1]{icons/#2.png}%
}
% Icones des compétences
\newcommand{\iconScale}{0.3}
\newcommand{\Cher}[1][scale=\iconScale]{%
\icon[#1]{card-pick}
}
\newcommand{\Mod}[1][scale=\iconScale]{%
\icon[#1]{processor}
}
\newcommand{\Rep}[1][scale=\iconScale]{%
\icon[#1]{chart}
}
\newcommand{\Rai}[1][scale=\iconScale]{%
\icon[#1]{brain}
%\icon[#1]{gears}
}
\newcommand{\Cal}[1][scale=\iconScale]{%
\icon[#1]{computing}
}
\newcommand{\Com}[1][scale=\iconScale]{%
\icon[#1]{conversation}
}
\newcommand{\Con}[1][scale=\iconScale]{%
\icon[#1]{book-cover}
}
% Pour l'évaluation par compétence
\usepackage{tikzsymbols}
\usetikzlibrary{babel, shapes, snakes}
\RequirePackage{xstring}
\newcommand{\RepLevel}[1]{%
\IfEqCase{#1}{%
{.}{\Xey[2]}%
{0}{\Changey[2]{-1}}%
{1}{\Changey[2][black!20]{0}}%
{2}{\Changey[2][black!40]{1}}%
{3}{\Cooley[2][black!60]}%
}[\PackageError{Rep}{Undefinded type of answer: #1}{}]%
}
\newcommand{\RepT}{\Cooley[2][black!70]}
\newcommand{\RepD}{\Changey[2][black!40]{1}}
\newcommand{\RepU}{\Changey[2][black!10]{0}}
\newcommand{\RepZ}{\Changey[2]{-1}}
\newcommand{\NoRep}{\Xey[2]}
\newcommand{\EmptySignalBar}{%
\draw (0, 0) rectangle ++(0.8, 1);
\draw (1, 0) rectangle ++(0.8, 2);
\draw (2, 0) rectangle ++(0.8, 3);
\draw (3, 0) rectangle ++(0.8, 4);
}
\newcommand{\filledSignalBar}[1]{%
\IfEqCase{#1}{%
{}{%
}
{e}{%
\EmptySignalBar
}
{3}{%
\EmptySignalBar
\filldraw[fill=green] (0, 0) rectangle ++(0.8, 1);
\filldraw[fill=green] (1, 0) rectangle ++(0.8, 2);
\filldraw[fill=green] (2, 0) rectangle ++(0.8, 3);
\filldraw[fill=green] (3, 0) rectangle ++(0.8, 4);
}
{2}{%
\EmptySignalBar
\filldraw[fill=green] (0, 0) rectangle ++(0.8, 1);
\filldraw[fill=green] (1, 0) rectangle ++(0.8, 2);
\filldraw[fill=green] (2, 0) rectangle ++(0.8, 3);
}
{1}{%
\EmptySignalBar
\filldraw[fill=yellow] (0, 0) rectangle ++(0.8, 1);
\filldraw[fill=yellow] (1, 0) rectangle ++(0.8, 2);
}
{0}{%
\EmptySignalBar
\filldraw[fill=red] (0, 0) rectangle ++(0.8, 1);
}
}[\PackageError{Assesment}{Undefinded type of answer: #1}{}]%
}
\newcommand{\SignalBar}[1]{%
\begin{tikzpicture}[scale=0.15]
\filledSignalBar{#1}
\end{tikzpicture}
}
\newcommand{\Assesment}[1]{%
\SignalBar{#1}
\IfEqCase{#1}{%
{3}{%
Très bonne maîtrise%
}%
{2}{%
Maîtrise satisfaisante
}%
{1}{%
Maîtrise fragile%
}%
{0}{%
Maîtrise insufisante%
}%
}[\PackageError{Assesment}{Undefinded type of answer: #1}{}]%
}
\newcommand{\competencesStatement}{%
\begin{multicols}{3}
\noindent
Nom: \dotfill \\[0.5cm]
Prénom: \dotfill \\
\vfill\none
\columnbreak
\noindent
\Cher Chercher \hfill \SignalBar{e}\\
\Mod Modélser \hfill \SignalBar{e}\\
\Rep Représenter \hfill \SignalBar{e}\\
\vfill\none
\columnbreak
\noindent
\Rai Raisonner \hfill \SignalBar{e}\\
\Cal Calculer \hfill \SignalBar{e}\\
\Com Communiquer \hfill \SignalBar{e}\\
\end{multicols}
}
% ##########################
% Tikz shortcuts
% ##########################
% Les dessins
\RequirePackage{tikz}
%% le cercle trigo
\newcommand{\cercleTrigo}%
{%
\draw[->, very thick] (-1.1,0) -- (1.1, 0);
\draw[->, very thick] (0,-1.1) -- (0,1.1);
\draw[very thick] (0,0) circle (1);
\draw (0,0) node[below left] {$O$};
\draw (1,0) node[below right] {$I$};
\draw (0,1) node[above left] {$J$};
}
\newcommand{\cercleTrigoNoOIJ}%
{%
\draw[->, very thick] (-1.1,0) -- (1.1, 0);
\draw[->, very thick] (0,-1.1) -- (0,1.1);
\draw[very thick] (0,0) circle (1);
}
%% Le repère orthonormé avec la grille
%%% \repere{xmin}{xmax}{ymin}{ymax}
\newcommand{\repere}[4]%
{%
\draw[very thin, gray] (#1,#3) grid (#2,#4);
\draw[->, very thick] (#1,0) -- (#2,0);
\draw[->, very thick] (0,#3) -- (0,#4);
\draw (0,0) node[below left] {$O$};
\draw (1, 0) node [below left] {1};
\draw (0, 1) node [below left] {1};
% \draw [->] (0,0) -- (0,1) node[left] {$J$};
% \draw [->] (0,0) -- (1,0) node[below] {$I$};
% \draw (1,0) node[rotate=90] {-} node[below] {$I$};
}
\newcommand{\repereNoGrid}[4]%
{%
\draw[->, very thick] (#1,0) -- (#2,0);
\draw[->, very thick] (0,#3) -- (0,#4);
}
%% Diagramme boite
%%% \boxplot{Vertical Center}{min}{Q1}{Me}{Q3}{Max}
\newcommand{\boxplot}[6]%
{%
\filldraw[color=highlightbg, draw=text] (#3, {#1 - 0.5}) rectangle (#5, {#1 + 0.5});
\draw (#2, {#1 - 0.5}) -- (#2, {#1 + 0.5}) node[above] {$Min$};
\draw (#3, {#1 - 0.5}) -- (#3, {#1 + 0.5}) node[above] {$Q_1$};
\draw (#4, {#1 - 0.5}) -- (#4, {#1 + 0.5}) node[above] {$Me$};
\draw (#5, {#1 - 0.5}) -- (#5, {#1 + 0.5}) node[above] {$Q_3$};
\draw (#6, {#1 - 0.5}) -- (#6, {#1 + 0.5}) node[above] {$Max$};
\draw (#2, #1) -- (#3, #1);
\draw (#5, #1) -- (#6, #1);
%\draw ({(#2 +#3)/2}, #1) node[above] {25\%};
%\draw ({(#3 +#4)/2}, #1) node[above] {25\%};
%\draw ({(#4 +#5)/2}, #1) node[above] {25\%};
%\draw ({(#5 +#6)/2}, #1) node[above] {25\%};
}
\newcommand{\boxplotNoNames}[6]%
{%
\filldraw[color=highlightbg, draw=text] (#3, {#1 - 0.5}) rectangle (#5, {#1 + 0.5});
\draw (#2, {#1 - 0.5}) -- (#2, {#1 + 0.5});
\draw (#3, {#1 - 0.5}) -- (#3, {#1 + 0.5});
\draw (#4, {#1 - 0.5}) -- (#4, {#1 + 0.5});
\draw (#5, {#1 - 0.5}) -- (#5, {#1 + 0.5});
\draw (#6, {#1 - 0.5}) -- (#6, {#1 + 0.5});
\draw (#2, #1) -- (#3, #1);
\draw (#5, #1) -- (#6, #1);
}
\usetikzlibrary{quotes,arrows.meta}
\tikzset{
% drawing parallelepipoid
annotated cuboid/.pic={
\tikzset{%
every edge quotes/.append style={midway, auto},
/cuboid/.cd,
#1
}
\draw [every edge/.append style={pic actions, densely dashed, opacity=.5}, pic actions]
(0,0,0) coordinate (o) -- ++(-\cubescale*\cubex,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\cubex,0,0) coordinate (c) -- cycle
(o) -- ++(0,0,-\cubescale*\cubez) coordinate (d) -- ++(0,-\cubescale*\cubey,0) coordinate (e) edge (g) -- (c) -- cycle
(o) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (f) edge (g) -- (d) -- cycle;
\path [every edge/.append style={pic actions, |-|}]
(b) +(0,-5pt) coordinate (b1) edge ["\cubex \cubeunits"'] (b1 -| c)
(b) +(-5pt,0) coordinate (b2) edge ["\cubey \cubeunits"] (b2 |- a)
(c) +(3.5pt,-3.5pt) coordinate (c2) edge ["\cubez \cubeunits"'] ([xshift=3.5pt,yshift=-3.5pt]e)
;
},
/cuboid/.search also={/tikz},
/cuboid/.cd,
width/.store in=\cubex,
height/.store in=\cubey,
depth/.store in=\cubez,
units/.store in=\cubeunits,
scale/.store in=\cubescale,
width=10,
height=10,
depth=10,
units=cm,
scale=.1,
}