> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/ko/in-depth-articles/26-how-to-draw-vector-graphics-using-tikz-in-latex.md).

# LaTeX에서 TikZ를 사용해 벡터 그래픽을 그리는 방법

**저자: Cody Herring (2013년 5월)**

### LaTeX의 절차적 그래픽: 기초

전통적으로 그래픽은 비트맵으로 표현되며, 1비트(흑백)부터 24비트(트루 컬러)까지 다양합니다. 이렇게 하면 전통적인(직사각형) 컴퓨터 화면에서 그래픽을 간단히 표시할 수 있습니다. 그러나 문서나 종이에 표시해야 할 내용을 정확히 나타내는 비트맵을 생성하는 것은 어렵고 번거로울 수 있습니다.

절차적 그래픽은 확장 가능한 벡터 그래픽(SVG)처럼 더 잘 정의되고 이해하기 쉬운 시스템을 사용할 수 있게 해 주어 이를 돕습니다. 개별 픽셀보다 벡터, 선, 도형을 정의함으로써 다양한 크기, 종횡비, 픽셀 밀도, 인쇄 품질 등에 맞는 이미지를 쉽게 생성할 수 있습니다. 이 튜토리얼에서는 Portable Graphics Format과 TikZ를 사용한 절차적 그래픽을 간단히 소개합니다:

* **포터블 그래픽 포맷** (PGF)는 간단한 그래픽과 도형을 생성할 수 있게 해 주는 기본 도구 모음입니다;
* **TikZ** 는 PGF의 확장으로, 다양한 미리 만들어진 도형을 사용할 수 있게 해 줍니다.

TikZ와 PGF에 대한 자세한 문서는 다음에서 찾을 수 있습니다: [PGF 매뉴얼](http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf).

### PGF와 TikZ 사용하기

TikZ 패키지를 사용하려면 이를 불러와야 합니다:

```latex
\usepackage{tikz}
```

그림을 그리려면 `tikzpicture` 환경을 사용해야 합니다:

```latex
\begin{tikzpicture}
명령은 여기에 들어갑니다
\end{tikzpicture}
```

### 기본 그리기

TikZ는 다양한 모양과 경로를 그릴 수 있게 해 줍니다. 여기서는 몇 가지 기본적인 그리기 기법을 보여줍니다. 이러한 기법들은 결합하여 더 복잡한 그림을 만들 수 있습니다.

#### 직선 경로

한 점에서 다른 점으로 가는 직선 경로는 `\draw` 명령을 사용해 X/Y(수평/수직) 좌표계에 따라 다음과 같이 그릴 수 있습니다:

```latex
\begin{tikzpicture}
\draw (5,0) -- (-5, 0);
\end{tikzpicture}
```

여러 `\draw` 호출도 이어서 사용할 수 있습니다. 이는 X 방향으로 -5에서 +5까지, Y 방향으로 -2에서 +2까지의 축 집합을 그립니다.

```latex
\begin{tikzpicture}
\draw   (5,0) -- (-5, 0)
        (0,2) -- (0,-2);
\end{tikzpicture}
```

![TikZFigure 1.png](/files/f6d71d3ee5bc74fc1699bb22124736aecab27944)

추가 매개변수를 넣어 이러한 선에 스타일을 적용할 수 있습니다. 아래는 같은 도형이지만, 초록색의 점선 매우 굵은 선을 15도 반시계 방향으로 회전시킨 예입니다:

```latex
\begin{tikzpicture}
\draw[green, dotted, ultra thick, rotate=15]
        (5,0) -- (-5, 0)
        (0,2) -- (0,-2);
\end{tikzpicture}
```

![TiKZFigure 2.png](/files/a9ebcd73412d36d4d8f344663840d5eaee78c7a7)

#### 도형의 크기 변경하기

때로는 도형의 기본 크기가 너무 크거나 너무 작을 수 있습니다. `scale` 매개변수를 `tikzpicture` 환경을 선언할 때 사용하면 같은 비율을 유지하면서 다른 크기를 사용할 수 있습니다:

```latex
\begin{tikzpicture}[scale=0.3]
\draw   (5,0) -- (-5, 0)
        (0,2) -- (0,-2);
\end{tikzpicture}
```

다음 이미지는 `[scale=0.3]`:

![TiKZFigure 3.png](/files/cb1453d8e499920f43836782d03205319ea27a21)

#### 화살촉 추가하기

화살표는 그래프와 도표에 유용할 수 있으며, TikZ 그림에 간단히 포함할 수 있습니다. 앞서 보여준 스타일뿐 아니라 여러 가지 다른 화살촉도 사용할 수 있습니다.

```latex
\begin{tikzpicture}
\draw[->](0,0) -- (5,0);
\end{tikzpicture}

\begin{tikzpicture}
\draw[<<->>](0,0) -- (5,0);
\end{tikzpicture}

\begin{tikzpicture}
\draw[<<->>, ultra thick, blue](0,0) -- (5,0);
\end{tikzpicture}

\begin{tikzpicture}
\draw[|->>, thick, red](0,0) -- (5,0);
\end{tikzpicture}
```

![TiKZFigure 4.png](/files/239f81d912cef15635b3280fc275f23629dbfcc2)

### 곡선 그리기

TikZ로 곡선을 그리는 가장 간단한 방법은 시작점과 끝점을 지정하고, 시작점에서 나가는 각도와 끝점에 도달하는 각도를 지정하는 것입니다.

```latex
\begin{tikzpicture}
\draw[ultra thick]
(0,0) to [out=75,in=135](3,4);
\end{tikzpicture}
```

![TiKZFigure 5.png](/files/c4f739355a9cedc4627f1235bfe7f70b6c9e748f)

연결된 호출을 사용하여 훨씬 더 복잡한 도형도 만들 수 있습니다. PGF는 지정된 방향을 사용해 가능한 한 가장 부드러운 선을 그리려고 시도합니다.

```latex
\begin{tikzpicture}
\draw[ultra thick]
(0,0)
to [out=90,in=180] (2,2)
to [out=270,in=0](0,0)
to [out=0,in=90](2,-2)
to [out=180,in=270](0,0)
to [out=270,in=0](-2,-2)
to [out=90,in=180](0,0)
to [out=180,in=270](-2,2)
to [out=0,in=90](0,0);
\end{tikzpicture}
```

![TIkZFigure 6.png](/files/c7875503aa679615c6b3d1c1215f54d8e1f02da0)

### 결론

벡터 그래픽으로 그릴 수 있는 것에는 끝이 없으며, 확장 가능하고 쉽게 편집할 수 있는 도형과 그림을 만들 수 있다는 점은 그래픽을 사용하기 쉬운 방법을 찾는 LaTeX 사용자들에게 큰 장점입니다. 이 글은 가능한 것의 표면만 살짝 훑고 있지만, 벡터 그래픽과 TikZ/PGF 환경의 기능을 소개하는 데는 충분할 것입니다.

추가 자료:

* [TikZ에 대한 최소한의 소개](http://cremeronline.com/LaTeX/minimaltikz.pdf);
* [TikZ 및 PGF에 대한 CTAN 문서](http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf);
* [Overleaf의 학습 위키 페이지](/latex/ko/figures-and-tables/05-tikz-package.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/ko/in-depth-articles/26-how-to-draw-vector-graphics-using-tikz-in-latex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
