> 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/uk/pomilki-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/uk/osnovi-latex/01-learn-latex-in-30-minutes.md) щоб дізнатися більше про те, як структурувати документи в LaTeX.

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

Ще однією поширеною причиною цієї помилки є те, що **`\documentclass[...]{...}`** це написано не в тому місці. Це має бути написано на початку основного документа. Якщо у вас є окремий файл для преамбули, ви **не можете** включати **`\documentclass[...]{...}`** у цьому файлі. Воно все одно має з’являтися на початку основного файла проєкту, інакше буде скомпільовано лише файл преамбули.

**Неправильно вибрано основний документ:**

Ця помилка також може з’явитися, якщо ви неправильно встановили основний документ у лівому меню. Це може статися, якщо **`\documentclass[...]{...}`** це написано не в тому місці, тому спочатку слід виправити це, якщо потрібно. Щоб змінити вибір основного документа, відкрийте ліве меню:

![Lefthandmenu.PNG](/files/d962f3004ce050bafa30c80fd71b5b1e4de6bee5)

і перейдіть до *Основний документ* випадаючого меню:

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


---

# 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/uk/pomilki-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.
