preambule_annotation.tex 1.30 KiB
% 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}; }