> 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/13-latex-error-can-be-used-only-in-preamble.md).

# LaTeX 오류: 서문에서만 사용할 수 있습니다

이 오류는 패키지나 클래스를 프리앰블이 아니라 문서의 본문에 포함했을 때 나타납니다. 문서의 프리앰블은 다음 전에 작성된 모든 내용으로 구성됩니다 **`\begin{document}`**. 프리앰블에서는 작성 중인 문서의 종류, 언어 및 기타 여러 요소를 정의합니다. 예를 들어, 일반적인 문서 프리앰블은 다음과 같습니다:

```latex
\documentclass[12pt, letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\title{첫 번째 문서}
\author{Hubert Farnsworth \thanks{ShareLaTeX 팀의 후원을 받음}}
\date{2014년 2월}
```

다음과 같이 작성하면 **`\usepackage{...}`** 문서의 본문에(다음 이후에 **`\begin{document}`**) 프리앰블이 아니라면 아래와 같은 오류 메시지가 표시됩니다.

main.tex, 7번째 줄

LaTeX 오류: 프리앰블에서만 사용할 수 있습니다.

설명은 LaTeX 매뉴얼 또는 LaTeX Companion을 참조하세요. 즉시 도움말을 보려면 H를 입력하세요. ... l.4 \usepackage {amsmath} 해당 명령은 무시되었습니다. 다른 명령으로 바꾸려면 I를 입력하거나, 그것 없이 계속하려면 입력하세요. \[1

이 오류를 수정하려면, 모든 **`\usepackage{...}`** 명령은 물론 **`\documentclass[...]{...}`**, 역시 다음 전에 작성되었는지 확인하세요 **`\begin{document}`**. LaTeX에서 문서를 구성하는 방법을 더 알아보려면, 우리의 [설명서](/latex/ko/latex/01-learn-latex-in-30-minutes.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/latex-1/13-latex-error-can-be-used-only-in-preamble.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.
