
아래쪽 파란색 직사각형 "H에서 E 업데이트"를 빨간색 다이아몬드 "완료"로 연결하는 화살표에는 두 개의 불연속성이 있습니다. 빈 노드에서 이 선을 연결하려면 아래 코드를 어떻게 수정해야 합니까?
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shadows}
\begin{document}
\begin{figure}
\begin{center}
\tikzstyle{greenrect} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text justified, draw=black, fill=green!60]
\tikzstyle{bluerect} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text justified, draw=black, fill=blue!50]
\tikzstyle{whiterect} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{reddiamond} = [diamond, minimum width=1cm, minimum height=1cm, text centered, draw=black, fill=red!80]
\tikzstyle{arrow} = [thick,->,>=stealth, line width=1.5pt]
\tikzstyle{line} = [thick,-,>=stealth, line width=1.5pt]
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
\node(Initialize) [greenrect] {
\begin{tabular}{c}Initialize Fields to Zero\\$\vec{E} = \vec{H} = 0$ \end{tabular}
};
\node (Done) [reddiamond, below of=Initialize] {Done};
\node(E2H) [bluerect, below of=Done, node distance=3cm] {
\begin{tabular}{c}Update H from E\\
$\displaystyle{\vec{H}\Bigr\lvert_{t+\triangle t/2} = \vec{H}\Bigr\lvert_{t-\triangle t/2} - \frac{\triangle t}{\mu} (\nabla \times \vec{E}\Bigr\lvert_{t})}$\\
\end{tabular}
};
\node (H2E) [bluerect, below of=E2H, node distance=2.5cm] {
\begin{tabular}{c} Update E from H \\
$\displaystyle{\vec{E}\Bigr\lvert_{t+\triangle t/2} = \vec{E}\Bigr\lvert_{t-\triangle t/2} - \frac{\triangle t}{\epsilon} (\nabla \times \vec{H}\Bigr\lvert_{t})}$\\
\end{tabular}
};
\node (Finished) [right of=Done, node distance=6cm] {
\begin{tabular}{c}
Finished\\
\end{tabular}
};
\node (Empty1) [below of=H2E, node distance=2cm] {};
\node (Empty2) [left of=Empty1, node distance=5cm] {};
\node (Empty3) [left of=Done, node distance=5cm] {};
\draw [arrow] (Initialize) -- (Done);
\draw [arrow] (Done) -- node[name=no] {No} (E2H);
\draw [arrow] (E2H) -- (H2E);
\draw [arrow] (Done) -- node[name=yes] {Yes} (Finished);
\draw [line] (H2E) -- (Empty1);
\draw [line] (Empty1) -| (Empty2);
\draw [line] (Empty2) |- (Empty3);
\draw [arrow] (Empty3) -- (Done);
\end{tikzpicture}
\end{center}
\caption{Block diagram describing a simple FDTD Algorithm}
\end{figure}
\end{document}
답변1
\coordinate
s 대신 s를 사용하세요 \node
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shadows,positioning}
\begin{document}
\begin{figure}
\begin{center}
\tikzstyle{greenrect} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text justified, draw=black, fill=green!60]
\tikzstyle{bluerect} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text justified, draw=black, fill=blue!50]
\tikzstyle{whiterect} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{reddiamond} = [diamond, minimum width=1cm, minimum height=1cm, text centered, draw=black, fill=red!80]
\tikzstyle{arrow} = [thick,->,>=stealth, line width=1.5pt]
\tikzstyle{line} = [thick,-,>=stealth, line width=1.5pt]
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
\node(Initialize) [greenrect] {
\begin{tabular}{c}Initialize Fields to Zero\\$\vec{E} = \vec{H} = 0$ \end{tabular}
};
\node (Done) [reddiamond, below of=Initialize] {Done};
\node(E2H) [bluerect, below of=Done, node distance=3cm] {
\begin{tabular}{c}Update H from E\\
$\displaystyle{\vec{H}\Bigr\lvert_{t+\triangle t/2} = \vec{H}\Bigr\lvert_{t-\triangle t/2} - \frac{\triangle t}{\mu} (\nabla \times \vec{E}\Bigr\lvert_{t})}$\\
\end{tabular}
};
\node (H2E) [bluerect, below of=E2H, node distance=2.5cm] {
\begin{tabular}{c} Update E from H \\
$\displaystyle{\vec{E}\Bigr\lvert_{t+\triangle t/2} = \vec{E}\Bigr\lvert_{t-\triangle t/2} - \frac{\triangle t}{\epsilon} (\nabla \times \vec{H}\Bigr\lvert_{t})}$\\
\end{tabular}
};
\node (Finished) [right of=Done, node distance=6cm] {
\begin{tabular}{c}
Finished\\
\end{tabular}
};
\coordinate[below = 2cm of H2E] (Empty1);
\coordinate[left=5cm of Empty1] (Empty2);
\coordinate[left = 5cm of Done] (Empty3);
\draw [arrow] (Initialize) -- (Done);
\draw [arrow] (Done) -- node[name=no] {No} (E2H);
\draw [arrow] (E2H) -- (H2E);
\draw [arrow] (Done) -- node[name=yes] {Yes} (Finished);
\draw [arrow]
(H2E) -- (Empty1) -- (Empty2) |- (Done);
\end{tikzpicture}
\end{center}
\caption{Block diagram describing a simple FDTD Algorithm}
\end{figure}
\end{document}
결과:
비고:
더 이상 사용되지 않는 이전
of=
구문 대신 위치 지정 라이브러리를 사용하십시오=of
(좌표를 찾는 데 사용한 코드의 예 참조).\tikzstyle
이전 사용 대신\tikzset
(패키지 설명서 참조)간단하게 화살표를 그릴 수 있습니다.
\draw [arrow] (H2E) -- (Empty1) -- (Empty2) |- (Done);