> 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/latex-1/03-display-math-should-end-with.md).

# 표시 수식은 $$로 끝나야 합니다

## 소개

TeX 엔진에는 수학식을 조판하는 두 가지 방법이 있습니다:

* *인라인 수학 모드* 수학 내용이 단락 안에 포함되는 방식이며,
* *디스플레이 수학 모드* 수학 내용이 별도로 표시되며, 위아래에 추가 간격이 있는 방식입니다.

*전통적으로*, TeX 초기에는 조판할 의도의 수학식이 *인라인으로*, 보통 단락 내에서, 단일 `$` 문자로 둘러싸였습니다: `$ 인라인 수학 내용...$` 그리고 *디스플레이* 는 이중 `$` 문자로 둘러싸였습니다: `$$ 디스플레이 수학 내용...$$`.

## 오류의 원인: 디스플레이 수학은 $$로 끝나야 합니다

오류 메시지 `디스플레이 수학은 $$로 끝나야 합니다` 는 TeX 엔진이 어떤 디스플레이 수학 내용을 조판을 마무리하려 할 때 생성되는 오류이며, 잘못된 TeX 마크업 때문에 디스플레이 수학 모드에서 깔끔하게 빠져나올 수 없을 때 발생합니다. 오류 메시지가 나타내듯이, 디스플레이 수학으로 조판할 내용은 두 번째 `$$` 쌍.

### 예시: 단일 오류

이 오류는 다음 예시에서 설명됩니다:

```latex
\documentclass{article}
\usepackage[textwidth=8cm]{geometry}
\begin{document}
\noindent \verb|$$ E=mc^2$| 는 수식이
\texttt{\$\$}로 시작했지만 단일 \texttt{\$}로 끝났기 때문에 오류가 발생합니다:

$$ E=mc^2$

\noindent\verb|$$ E=mc^2$ $| 도 사이의 공백 때문에 오류가 발생
끝나는 \texttt{\$} 문자들 사이에 공백이 있기 때문입니다:

$$ E=mc^2$ $
\end{document}
```

[이 예제를 **오류를 발생시키는** Overleaf의 예](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Errors+in+display+math\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Btextwidth%3D8cm%5D%7Bgeometry%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnoindent+%5Cverb%7C%24%24+E%3Dmc%5E2%24%7C+generates+an+error+because+the+math+is+%0Astarted+by+%5Ctexttt%7B%5C%24%5C%24%7D+but+terminated+by+a+single+%5Ctexttt%7B%5C%24%7D%3A%0A%0A%24%24+E%3Dmc%5E2%24%0A%0A%5Cnoindent%5Cverb%7C%24%24+E%3Dmc%5E2%24+%24%7C+also+generates+an+error+because+of+the+space+between%0Athe+terminating+%5Ctexttt%7B%5C%24%7D+characters%3A%0A%0A%24%24+E%3Dmc%5E2%24+%24%0A%5Cend%7Bdocument%7D)

이 예시는 다음 출력물을 생성합니다(두 오류를 강조하기 위해 이미지를 편집함):

![OLdisplaymatherrors.png](/files/1964dfde372db9d9582196e5a2390034435bb021)

### 예시: 두 개의 오류

**참고**: 어떤 경우에는 *또한* 관련 오류를 볼 수도 있습니다 [누락된 $가 삽입되었습니다](/latex/ko/latex-1/25-missing-inserted.md), 다음 예시에서 다음을 작성함으로써 보여주듯이 `$$E=mc^2`, 이로써 두 개의 끝맺는 `$` 문자로 둘러싸였습니다:

```latex
\documentclass{article}
\usepackage[textwidth=8cm]{geometry}
\begin{document}
\noindent 다음 예시는 끝나는 \texttt{\$} 문자를 둘 다 생략하여 \texttt{Missing \$ inserted} 및 \texttt{Display math should end with \$\$.} 오류를 발생시킵니다

$$E=mc^2
\end{document}
```

[이 예제를 **오류를 발생시키는** Overleaf의 예](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Two+errors+in+display+math\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Btextwidth%3D8cm%5D%7Bgeometry%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnoindent+The+following+example+omits+both+terminating+%5Ctexttt%7B%5C%24%7D+characters%2C+triggering+the+errors+%5Ctexttt%7BMissing+%5C%24+inserted%7D+and+%5Ctexttt%7BDisplay+math+should+end+with+%5C%24%5C%24.%7D%0A%0A%24%24E%3Dmc%5E2%0A%5Cend%7Bdocument%7D)

이 예제는 다음 출력을 생성합니다:

![OLdisplaymathtwoerrors.png](/files/8880f9521dec2f3f9264efdfaa8cb4f24ad24ab7)

## 해결 방법

위에서 설명한 오류의 경우 수정은 간단합니다. 끝나는 `$$` 를 디스플레이 수학의 끝에 추가하면 됩니다:

```latex
\documentclass{article}
\begin{document}
\noindent 해결 방법은
\verb|$$E=mc^2$$|를 써서 디스플레이 수학을 올바르게 끝내는 것입니다:

$$E=mc^2$$
\end{document}
```

[이 예제를 **수정됨** Overleaf의 예](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Errors+in+display+math\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnoindent+The+solution+is+to+ensure+correct+termination+of+the+%0Adisplay+math+by+writing+%5Cverb%7C%24%24E%3Dmc%5E2%24%24%7C%3A%0A%0A%24%24E%3Dmc%5E2%24%24%0A%5Cend%7Bdocument%7D)

## 수학식을 조판할 때 $ 문자를 사용하지 마십시오

요즘 표준적인(권장되는) 모범 사례는 *피하는 것입니다* 명시적인 `$` 문자를 사용해 수학식을 조판하는 대신 LaTeX *구분 기호를* 대신 사용하는 것입니다. 특히 디스플레이 수학에서는:

* 에는 **디스플레이 수학**: 다음과 같이 쓰세요 `\[ 디스플레이 수학 내용 \]` 대신 `$$ *디스플레이* 수학 내용...$$`
* 에는 **인라인 수학**: 다음과 같이 쓰세요 `\( 인라인 수학 내용 \)` 대신 `$ *인라인* 수학 내용...$`

실제로 LaTeX 구분 기호 `\(`, `\)`, `\[` 및 `\]` 는 한 글자 *매크로* 단일 및 이중 `$` 문자 주위에 일종의 “절연 래퍼”를 제공합니다. 이러한 구분 기호(매크로)의 LaTeX 정의에는 실제로 `$` 문자가 포함되어 있지만, 몇 가지 테스트/검사를 실행하는 추가 코드가 함께 있습니다. 또한 LaTeX의 오류 메시지 `잘못된 수학 환경 구분 기호`. 이러한 구분 기호(매크로)를 사용하면 추가적인 장점이 있는데, 특별한 효과를 내기 위해 일시적으로 다시 정의할 수 있기 때문입니다.


---

# 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/latex-1/03-display-math-should-end-with.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.
