Flèches avec maths
Oct 26 2020
Sur le code suivant
\begin{figure}[htbp!]
\begin{center}
\begin{tikzpicture}[>=stealth,baseline,anchor=base,inner sep=0pt]
\draw[thick,->] (-3.5,0) -- (4.5,0) node[anchor=north west] {$\mathbb{Z}$};
\foreach \x in {-3,-2,-1,0,1,2,3,4}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north] {$\x$};
\end{tikzpicture}
\caption{Somma algebrica} \label{fig:somma algebrica} %\label va messo qui
\end{center}
\end{figure}
Je voudrais ajouter des flèches comme l'image ci-dessous
Pour que je puisse montrer comment faire la somme de deux nombres ou plus, mais je ne sais pas comment l'intégrer dans mon code.
Merci pour vos conseils
Gian Carlo
Réponses
3 Zarko Oct 26 2020 at 14:42
\documentclass[tikz, margin=3.14159mm]{standalone}
\usetikzlibrary{arrows.meta,
positioning}
\usepackage{amssymb}
\begin{document}
\begin{tikzpicture}[
node distance = 6mm,
> = Straight Barb,
arr/.style = {very thick, gray, shorten <=1pt,
-{Triangle[length=3pt]}, looseness=3}
]
\draw[thick,->] (-3.5,0) -- (5,0) node[below left=2pt] {$\mathbb{Z}$};
\foreach \x in {-3,-2,-1,0,1,2,3,4}
\draw (\x,2pt) -- ++ (0,-4pt) node (n\x) [below] {$\x$};
\draw[arr] (n1) to [out=270, in=270] (n0);
\draw[arr] (n0) to [out=270, in=270] (n-1);
\end{tikzpicture}
\end{document}