> 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/ru/oshibki-latex/16-latex-error-missing-begin-document.md).

# Ошибка LaTeX: отсутствует \begin document

Эта ошибка появляется, когда вы забыли включить **`\begin{document}`** в ваш документ. Она также может появиться, если вы не написали **`\documentclass[...]{...}`** в начале вашего основного документа.

## Распространённые причины

**Забыли включить \begin{document}:**

Самая простая причина этой ошибки возникает, когда вы забыли написать **`\begin{document}`** после преамбулы в вашем основном документе. Если вы допустите эту ошибку, будет сгенерировано сообщение об ошибке, показанное ниже:

main.tex, строка 5

Ошибка LaTeX: отсутствует \begin{document}.

См. руководство по LaTeX или LaTeX Companion для объяснения. Введите H для немедленной помощи. ... У вас здесь проблемы. Попробуйте ввести что-нибудь, чтобы продолжить. Если это не сработает, введите X, чтобы выйти.

Чтобы исправить эту ошибку, просто убедитесь, что вы включили **`\begin{document}`** после преамбулы в вашем основном документе. См. [здесь](/latex/ru/osnovy-latex/01-learn-latex-in-30-minutes.md) чтобы узнать больше о том, как структурировать документы в LaTeX.

**\documentclass\[...]{...} не на своем месте:**

Еще одна распространенная причина этой ошибки — если **`\documentclass[...]{...}`** написано не в том месте. Это должно быть написано в начале основного документа. Если у вас есть отдельный файл для преамбулы, вы **не можете** включить **`\documentclass[...]{...}`** в тот файл. Это все равно должно находиться вверху основного файла проекта, иначе будет скомпилирован только файл преамбулы.

**Основной документ задан неверно:**

Эта ошибка также может появиться, если вы неверно задали основной документ в левом меню. Это может произойти, если **`\documentclass[...]{...}`** написано не в том месте, поэтому при необходимости сначала исправьте это. Чтобы изменить выбор основного документа, откройте левое меню:

![Lefthandmenu.PNG](/files/5c9580a7cd6279207e75e19d0a6699864b016d75)

и перейдите в *Основной документ* выпадающее меню:

![Maindocument.PNG](/files/b25b50dec12245a4d4ca4de7db36bbbc2f137f3c)


---

# 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/ru/oshibki-latex/16-latex-error-missing-begin-document.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.
