Commit f0c10bc6 authored by Dorchies David's avatar Dorchies David
Browse files

Ajout des extensions utiles à déclarer dans le préambule

parent 281db2bf
No related merge requests found
Showing with 150 additions and 0 deletions
+150 -0
% Annotation sur une image
% http://blog.dorian-depriester.fr/latex/tikz/annoter-une-image-avec-tikz
\usepackage{tikz}
\newenvironment{annotation}[2][]{
\begin{tikzpicture}[]
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[#1]{#2}};
\begin{scope}[x={(image.south east)},y={(image.north west)},style={font=\vphantom{Ag}}]
}{
\end{scope}
\end{tikzpicture}
}
\def\AnnoSep{0.02} % Marge entre les annotations et l'image
\newcommand{\BckImg}[2][]{
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[#1]{#2}};
}
\newcommand{\annoLeft}[4][->]{
\draw[->,#1, line width=0.5mm,-latex] (0,#2)++(-\AnnoSep,0) node[anchor=east, align=right]{#3} -- (#4);
}
\newcommand{\annoRight}[4][->]{
\draw[->,#1, line width=0.5mm,-latex] (0,#2)++(+\AnnoSep+1,0) node[anchor=west]{#3} -- (#4);
}
\newcommand{\annoUp}[4][->]{
\draw[->,#1, line width=0.5mm,-latex] (#2,0)++(0,\AnnoSep+1) node[anchor=south, align=center]{#3} -- (#4);
}
\newcommand{\annoDown}[4][->]{
\draw[->,#1, line width=0.5mm,-latex] (#2,0)++(0,-\AnnoSep) node[anchor=north, align=center]{#3} -- (#4);
}
\newcommand{\help}[1][0.1]{
\draw[help lines,xstep=#1,ystep=#1] (0,0) grid (1,1);
\foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
\foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
}
\ No newline at end of file
\usepackage{tikz}
\usetikzlibrary{shapes, arrows,positioning}
\usetikzlibrary{svg.path}
% Dessine une vanne
\usepackage{ifthen}
\usepackage{tikz}
% Environnement vanne 3 arguments :
% 1 - Largeur du dessin en centimètres
% 2 - Largeur de la vanne (en mètres)
% 3 - Hauteur de la vanne (en mètres)
\newenvironment{vanne}[3][\textwidth]{
% Commande pour ajouter une pelle à la vanne
% Paramètre 1 - ouverture de la vanne
\newcommand{\pelle}[1]{
\fill [white!50!black] (0,##1) rectangle (#2,#3);
\ifthenelse{\equal{##1}{0.0} \OR \equal{##1}{0}}{}{ \draw [black, thick, latex-latex] (0.05,0)--(0.05,##1) node [midway,right] {ouverture ##1 m}};
}
% Commande pour ajouter un niveau d'eau amont
% Paramètre 1 - Tirant d'eau
\newcommand{\tirantamont}[3][0]{
\draw [orange!50!black, line width=1pt,dashed] (-0.4*#2,0)--(1.2*#2,0) (-0.4*#2,0) node [black, below, text width = 3cm] {cote du fond~: ##3 m};
\pgfmathparse{##2+##3}\let\x\pgfmathresult
\pgfmathroundto{\x} \let\cde\pgfmathresult
\ifthenelse{\equal{##1}{0}} {\draw [blue, line width=2pt] (-0.4*#2,##2)--(1.2*#2,##2) node [black,midway,above,text width = 3cm] {cote de l'eau~: \cde m}} {\draw [blue, line width=2pt] (-0.4*#2,##2)--(1.3*#2,##2) node [black,midway,below,text width = 3cm] {cote de l'eau~: \cde m}};
\ifthenelse{\equal{##2}{0.0} \OR \equal{##2}{0}}{}{ \draw [black, thick, latex-latex] (-0.35*#2,0)--(-0.35*#2,##2) node [midway,left] {tirant d'eau\\amont ##2 m}};
}
% Commande pour ajouter un niveau d'eau aval
% Paramètre 1 - Tirant d'eau
\newcommand{\tirantaval}[3][0]{
\draw [orange!50!black, line width=1pt,dashed] (-0.2*#2,0)--(1.4*#2,0) node [black, below, text width = 3cm] {cote du fond~: ##3 m};
\pgfmathparse{(ceil((##2+##3)*100)/100)}\let\x\pgfmathresult
\pgfmathroundto{\x} \let\cde\pgfmathresult
\ifthenelse{\equal{##1}{0}} {\draw [blue, line width=2pt] (-0.2*#2,##2)--(1.4*#2,##2) node [black,midway,above,text width = 3cm] {cote de l'eau~: \cde m}} {\draw [blue, line width=2pt] (-0.2*#2,##2)--(1.4*#2,##2) node [black,midway,below,text width = 3cm] {cote de l'eau~: \cde m}};
\ifthenelse{\equal{##2}{0.0} \OR \equal{##2}{0}}{}{ \draw [black, thick, latex-latex] (1.35*#2,0)--(1.35*#2,##2) node [midway,right] {tirant d'eau\\aval ##2 m}};
}
% Commande pour ajouter un seuil
\newcommand{\seuil}[1]{
\fill [black!25!white] (0,0) rectangle (#2,##1);
\draw [orange!50!black, line width=1pt, dashed] (0,0)--(1.4*#2,0);
\draw [black, line width=1pt, dashed] (-0.4*#2,##1)--(1.4*#2,##1);
\draw [black, thick, latex-latex] (1.35*#2,0)--(1.35*#2,##1) node [midway, right, text width = 3cm] {Seuil de ##1~m};
}
% Commande pour mettre un message en travers du dessin
\newcommand{\acompleter}{
\node at (#2/2,#3/2) [rotate=45,opacity=0.8,red!50!black,font=\Huge] {A compléter};
}
\begin{tikzpicture}[scale=#1/(#2*3cm),every node/.style={align=center}]
% Mur gauche
\fill [orange!50!black] (-0.1*#2,0) rectangle (0,#3);
% Mur droit
\fill [orange!50!black] (#2,0) rectangle (1.1*#2,#3);
% fond du canal
\fill [orange!50!black] (-0.1*#2,-0.1*#2) rectangle (1.1*#2,0);
% Largeur de la vanne
\draw [black, thick, latex-latex] (0,1.1*#3)--(#2,1.1*#3) node [midway,above] at (#2/2,1.1*#3) {largeur #2 m};
}{
\end{tikzpicture}
}
\newenvironment{vanne_buse}[5][\textwidth]{
% Environnement vanne 5 arguments :
% 1 - Largeur du dessin en centimètres (optionel)
% 2 - Diamètre vanne (en mètres)
% 3 - Largeur du canal (en mètres)
% 4 - Bas de la buse par rapport au fond du canal (en mètres)
% 5 - Haut du canal par rapport au fond (en mètres)
\newcommand{\tirantamont}[3][0]{
\draw [orange!50!black, line width=1pt,dashed] (-0.8*#2,-0.5*#2-#4)--(0.8*#2,-0.5*#2-#4) (-0.8*#2,-0.5*#2-#4) node [black, left, below, text width = 3cm] {cote du fond~: ##3 m};
% Calcul de la cote de l'eau à partir du tirant d'eau et de la cote du fond. Arrondi à deux décimal
\pgfmathparse{(round((##2+##3)*100)/100)}\let\x\pgfmathresult
\pgfmathroundto{\x} \let\cde\pgfmathresult
\ifthenelse{\equal{##1}{0}}
{
\draw [blue, line width=2pt] (-0.8*#2,0.5*##2-0.25*#2)--(0.8*#2,0.5*##2-0.25*#2) node [black,midway,above,text width = 3cm] {cote de l'eau~: \cde m}
}
{
\draw [blue, line width=2pt] (-0.8*#2,0.5*##2-0.25*#2)--(0.8*#2,0.5*##2-0.25*#2) node [black,midway,below,text width = 3cm] {cote de l'eau~: \cde m}
};
\draw [black, thick, latex-latex] (-0.75*#2,-0.5*#2-#4)--(-0.75*#2,0.5*##2-0.25*#2) node [midway,left] {tirant d'eau\\amont ##2 m\\};
}
% Commande pour ajouter un niveau d'eau aval
% Paramètre 1 - Tirant d'eau
\newcommand{\tirantaval}[3][0]{
\draw [orange!50!black, line width=1pt,dashed] (-0.8*#2,0.5*#2-#4)--(0.8*#2,0.5*#2-#4) (0.8*#2,0.5*#2-#4) node [black,right, text width = 3cm] {cote du fond~: ##3 m};
\pgfmathparse{(ceil((##2+##3)*100)/100)}\let\x\pgfmathresult
\pgfmathroundto{\x} \let\cde\pgfmathresult
\ifthenelse{\equal{##1}{0}} {\draw [blue, line width=2pt] (-0.8*#2,0.5*##2-0.25*#2)--(0.8*#2,0.5*##2-0.25*#2) node [black,midway,above,text width = 3cm] {cote de l'eau~: \cde m}} {\draw [blue, line width=2pt] (-0.4*#2,##2)--(1.3*#2,##2) node [black,midway,below,text width = 3cm] {cote de l'eau~: \cde m}};
\draw [black, thick, latex-latex] (0.75*#2,0.5*#2-#4)--(0.75*#2,0.5*##2-0.25*#2) node [midway,right] {tirant d'eau\\aval ##2 m};
}
\begin{tikzpicture}[scale=#1/(#2*3cm),every node/.style={align=center}]
% Fond
\fill [white!50!black] (-0.5*#3,-0.5*#2-#4) rectangle(0.5*#3,-0.5*#2+#5-#4);
% Diametre extérieur
\fill[orange!50!black] (0,0) circle (0.5*#2*1.2);
%\fill[gray] (0,0) circle (1cm);
% Diametre interieur
\fill[white] (0,0) circle (#2*0.5);
\draw [black, thick, latex-latex] (-0.5*#2,0.7*#2)--(0.5*#2,0.7*#2) node [midway,above] at (#2,0.7*#2) {largeur #2 m};
\draw [black, thick, latex-latex] (0,-0.5*#2-#4)--(0,-#2*0.5) node [midway,right] at (#2,0.7*#2) {hauteur du radier #4 m};
}{
\end{tikzpicture}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment