你好,我想给左边但位于其长度中心的箭头命名
这是我使用的代码
\draw [arrow] (dec2) -- +(-4,0) node[anchor=east]{Nie} |- (dec1);
可重现的例子
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\usepackage{geometry}
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30]
\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\newgeometry{left=1cm,top=3cm,right=1cm}
\begin{center}
\begin{tikzpicture}[node distance=2cm]
\node (start) [startstop] {Start};
\node (in1) [io, below of=start] {Pobierz wartośći końców przedziału $[a;c]$};
\node (pro1) [process, below of=in1] {Oblicz przedział dwusieczny $b =(a+c)/2$};
\node (dec1) [decision, below of=pro1, yshift=-1.5cm] {Jeżeli $f(a) * f(b) < 0$};
\node (pro2a) [process, below of=dec1, yshift=-1.5cm] {$c = b$};
\node (dec2) [decision, below of=pro2a, yshift=-1.5cm] {Jeżeli $|a-c| < eps$};
\node (pro2b) [process, right of=dec1, xshift=3cm] {$a = b$};
\node (out1) [io, below of=dec2, yshift=-1.5cm] {b jest rozwiązaniem};
\node (stop) [startstop, below of=out1] {Stop};
\draw [arrow] (start) -- (in1);
\draw [arrow] (in1) -- (pro1);
\draw [arrow] (pro1) -- (dec1);
\draw [arrow] (pro2a) -- (dec2);
\draw [arrow] (dec1) -- node[anchor=east] {Tak} (pro2a);
\draw [arrow] (dec1) -- node[anchor=south] {Nie} (pro2b);
\draw [arrow] (pro2b) |- (dec2);
\draw [arrow] (dec2) -- (out1);
\draw [arrow] (out1) -- (stop);
\draw [arrow] (dec2) -- +(-4,0) node[anchor=east]{Nie} |- (dec1);
\end{tikzpicture}
\end{center}
\restoregeometry
答案1
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\begin{document}
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30]
\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\newgeometry{left=1cm,top=3cm,right=1cm}
\begin{center}
\begin{tikzpicture}[node distance=2cm]
\node (start) [startstop] {Start};
\node (in1) [io, below of=start] {Pobierz wartośći końców przedziału $[a;c]$};
\node (pro1) [process, below of=in1] {Oblicz przedział dwusieczny $b =(a+c)/2$};
\node (dec1) [decision, below of=pro1, yshift=-1.5cm] {Jeżeli $f(a) * f(b) < 0$};
\node (pro2a) [process, below of=dec1, yshift=-1.5cm] {$c = b$};
\node (dec2) [decision, below of=pro2a, yshift=-1.5cm] {Jeżeli $|a-c| < eps$};
\node (pro2b) [process, right of=dec1, xshift=3cm] {$a = b$};
\node (out1) [io, below of=dec2, yshift=-1.5cm] {b jest rozwiązaniem};
\node (stop) [startstop, below of=out1] {Stop};
\draw [arrow] (start) -- (in1);
\draw [arrow] (in1) -- (pro1);
\draw [arrow] (pro1) -- (dec1);
\draw [arrow] (pro2a) -- (dec2);
\draw [arrow] (dec1) -- node[left, pos=0.5] {Tak} (pro2a);
\draw [arrow] (dec1) -- node[above, pos=0.5] {Nie} (pro2b);
\draw [arrow] (pro2b) |- (dec2);
\draw [arrow] (dec2) -- (out1);
\draw [arrow] (out1) -- (stop);
\draw [arrow] (dec2) -- +(-4,0) |- node[left, pos=0.25]{Nie}(dec1);
\end{tikzpicture}
\end{center}
\restoregeometry
\end{document}