본문으로 건너뛰기

TikZ 노드, 화살표, 다이어그램

상자마다 \node[draw] (name) {text};로 배치하고, 다음 상자들은 positioning 라이브러리(right=of name)로 위치를 정한 다음, \draw[->] (a) -- (b);로 이으세요.

노드

노드는 한 점에 놓인 텍스트로, 테두리를 둘 수도 있습니다. draw는 윤곽선을, fill은 배경을, circle이나 ellipse는 둥근 모양을 줍니다(기본값은 rectangle). 괄호 안에 이름을 쓰면 나중에 그 노드를 가리킬 수 있습니다.

모양, 채움, 크기가 다른 노드

LaTeX프리앰블: \usepackage{tikz}편집기에서 열기 (새 탭에서 열림)
\begin{tikzpicture}
  \node[draw] (a) at (0,0) {plain box};
  \node[draw, rounded corners, fill=blue!10] (b) at (3,0) {rounded};
  \node[draw, circle, fill=yellow!40] (c) at (5.5,0) {44};
  \node[draw, ellipse] (d) at (8,0) {ellipse};
  \node[draw, minimum width=2.5cm, minimum height=1cm] at (1,-1.6) {fixed size};
  \node[draw, text width=2.6cm, align=center] at (5,-1.6) {text that wraps onto two lines};
\end{tikzpicture}

노드 사이의 화살표

\draw[->] (a) -- (b);는 노드 a에서 노드 b로 화살표를 그립니다. 선은 노드의 중심이 아니라 테두리에서 시작하고 끝납니다. -|와 |-는 직각으로 꺾인 연결선을 그립니다.

positioning 라이브러리로 만든 작은 순서도

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\begin{document}
\begin{tikzpicture}[
    node distance=1.2cm and 1.6cm,
    box/.style={draw, rounded corners, fill=blue!8, minimum width=2.2cm, minimum height=0.8cm},
    >={Stealth},
  ]
  \node[box] (in) {Read data};
  \node[box, right=of in] (clean) {Clean};
  \node[box, right=of clean] (fit) {Fit model};
  \node[draw, circle, below=of clean] (ok) {OK?};
  \draw[->] (in) -- (clean);
  \draw[->] (clean) -- (fit);
  \draw[->] (fit) |- (ok);
  \draw[->] (ok) -| node[pos=0.75, left] {no} (in);
\end{tikzpicture}
\end{document}

right=of in은 노드를 in의 오른쪽에 node distance만큼 떨어뜨려 놓습니다. 다른 방향은 left, above, below와 above right 같은 대각선 방향입니다. right=2cm of in은 노드 하나에만 거리를 지정합니다.

화살표와 노드의 레이블

경로 중간에 쓴 node는 그 경로에 레이블을 붙입니다. above, below, left, right는 어느 쪽에 둘지를, midway, near start, near end, pos=0.3은 경로를 따라 어디에 둘지를 정합니다. label=below:text는 노드에 레이블을 붙입니다.

레이블이 붙은 곡선 간선의 상태 다이어그램

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\begin{document}
\begin{tikzpicture}[state/.style={draw, circle, minimum size=1cm}, >={Stealth}, node distance=2.4cm]
  \node[state, label=below:start] (s0) {$q_0$};
  \node[state, right=of s0] (s1) {$q_1$};
  \node[state, right=of s1, fill=green!15] (s2) {$q_2$};
  \draw[->] (s0) to[bend left] node[above] {$a$} (s1);
  \draw[->] (s1) to[bend left] node[below] {$b$} (s0);
  \draw[->] (s1) -- node[above] {$a$} (s2);
\end{tikzpicture}
\end{document}

앵커

모든 노드에는 테두리에 앵커가 있습니다. north, south, east, west와 north east 같은 모서리입니다. (box.north)는 box의 위쪽 가운데 점입니다.

노드의 앵커에서 나가는 화살표

LaTeX프리앰블: \usepackage{tikz}편집기에서 열기 (새 탭에서 열림)
\begin{tikzpicture}
  \node[draw, minimum width=3cm, minimum height=1cm] (box) {Server};
  \draw[->] (box.north) -- ++(0,0.7) node[above] {north};
  \draw[->] (box.east) -- ++(1,0) node[right] {east};
  \draw[->] (box.south west) -- ++(-0.6,-0.6) node[below left] {south west};
  \node[anchor=west] at (box.south east) {\small (anchor=west)};
\end{tikzpicture}

노드에 anchor=west를 쓰면 노드의 west 앵커가 지정한 점에 오도록 배치됩니다.

화살촉

옵션화살촉Scissor LaTeX에서
->, <-, <->TikZ 기본 화살촉작동함
-stealth, -latex전통적인 stealth와 LaTeX 화살촉작동함
-{Stealth}, -{Latex}(arrows.meta)새로운 화살촉작동함
|-|양 끝의 막대작동함
그림에 쓴 >={Stealth}->가 쓰는 화살촉작동함
-{Stealth[length=3mm]} 같은 화살촉 옵션화살촉의 크기와 모양일부: 화살촉은 기본 크기로 그려짐

화살촉 크기는 TikZ와 비슷하지만 똑같지는 않습니다.

지원하지 않는 기능

다음 기능은 TeX 설치 환경에서는 컴파일되지만 여기서는 작동하지 않습니다. 대부분 문제 탭에 표시됩니다.

기능Scissor LaTeX에서 일어나는 일대신 쓸 것
\matrix(와 matrix of nodes)그림 전체가 메시지가 담긴 점선 상자가 됨at (x,y)나 positioning으로 노드 배치
\pic그림 전체가 메시지가 담긴 점선 상자가 됨shift를 준 scope 안에서 그림을 반복
장식(decorate, decoration=...)메시지를 남기고 무시하며, 경로는 장식 없이 그려짐일반 경로나 점선 경로
shapes.geometric의 노드 모양(diamond, trapezium ...)메시지와 함께 사각형으로 그려짐rectangle, circle, ellipse
double 선메시지를 남기고 무시노드나 경로 두 개
to[loop above](노드 하나에 붙는 고리)고리가 그려지지 않고 메시지도 없으며, 레이블은 노드 위에 놓임노드 테두리에서 시작하는 arc나 .. controls .. 곡선
pin=핀 텍스트는 보이지만 핀 선은 없음label=
-|나 |- 경로의 pos=레이블이 두 번째 구간에만 놓여 pos=0.25가 모서리 근처에 옴두 번째 구간에 pos=0.75로 레이블을 붙이거나 경로를 둘로 나누기
tikz-cd, circuitikz, forest메시지와 함께 그림이 빠짐간단한 TikZ나 이미지

\matrix는 자리 표시 상자가 됨

LaTeX프리앰블: \usepackage{tikz}편집기에서 열기 (새 탭에서 열림)
\begin{tikzpicture}
  \matrix[draw] {
    \node {a}; & \node {b}; \\
    \node {c}; & \node {d}; \\
  };
\end{tikzpicture}

문제 탭: \matrix in a picture is not supported yet

마름모 노드는 사각형으로 그려짐

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
  \node[draw, diamond] at (0,0) {Yes?};
  \node[draw, ellipse] at (2.5,0) {ellipse works};
\end{tikzpicture}
\end{document}

문제 탭: TikZ node option 'diamond' is not supported yet

TikZ 설명서(PGF 패키지에 포함)에 노드, positioning 라이브러리, 화살촉이 설명되어 있습니다: ctan.org/pkg/pgf. 도형과 경로는 TikZ로 그림 그리기를 보세요.

TikZ 기초, TikZ, 그림과 이미지도 함께 보세요.

질문과 답변

LaTeX에서 순서도는 어떻게 그리나요?

상자에는 draw를 준 TikZ 노드를, 배치에는 positioning 라이브러리(right=of a, below=of b)를, 화살표에는 \draw[->] (a) -- (b);를 쓰세요.

TikZ에서 화살표 위에 글자를 넣으려면 어떻게 하나요?

경로 중간에 노드를 쓰세요: \draw[->] (a) -- node[above] {text} (b);.

Scissor LaTeX에서 tikz-cd가 작동하나요?

아직은 아닙니다. tikzcd 다이어그램은 메시지와 함께 빠집니다. 간단한 다이어그램은 대신 노드와 화살표로 그리세요.

이 페이지의 모든 예제는 사이트를 빌드할 때 Scissor LaTeX로 조판됩니다. 마지막 업데이트: 2026-11-07