ลูกศรกับคณิตศาสตร์
Oct 26 2020
ตามรหัสต่อไปนี้
\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}
ฉันต้องการเพิ่มลูกศรเหมือนภาพด้านล่าง
เพื่อที่ฉันจะได้แสดงวิธีการหาผลรวมของจำนวนสองจำนวนที่มากขึ้น แต่ฉันไม่รู้ว่าจะรวมเข้าในโค้ดของฉันอย่างไร
ขอบคุณสำหรับคำแนะนำ
Gian Carlo
คำตอบ
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}