> 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/cs/chyby-latexu/16-latex-error-missing-begin-document.md).

# Chyba LaTeXu: Chybí \begin document

Tato chyba se objeví, když jste zapomněli zahrnout **`\begin{document}`** ve svém dokumentu. Může se také objevit, pokud jste nenapsali **`\documentclass[...]{...}`** na začátku svého hlavního dokumentu.

## Časté příčiny

**Zapomenutí zahrnout \begin{document}:**

Nejběžnější příčina této chyby nastává, když jste zapomněli napsat **`\begin{document}`** po preambuli ve svém hlavním dokumentu. Pokud uděláte tuto chybu, zobrazí se vám chybová zpráva uvedená níže:

main.tex, řádek 5

Chyba LaTeXu: Chybí \begin{document}.

Podívejte se do příručky LaTeXu nebo do LaTeX Companion pro vysvětlení. Pro okamžitou pomoc napište H. ... Tady jste v potížích. Zkuste psát pro pokračování. Pokud to nefunguje, napište X pro ukončení.

Chcete-li tuto chybu vyřešit, jednoduše se ujistěte, že jste zahrnuli **`\begin{document}`** po preambuli ve svém hlavním dokumentu. Viz [zde](/latex/cs/zaklady-latexu/01-learn-latex-in-30-minutes.md) abyste se dozvěděli více o tom, jak strukturovat dokumenty v LaTeXu.

**\documentclass\[...]{...} na nesprávném místě:**

Další častou příčinou této chyby je, pokud **`\documentclass[...]{...}`** je napsáno na nesprávném místě. To musí být napsáno na začátku hlavního dokumentu. Pokud máte pro svou preambuli samostatný soubor, nemůžete **nemůžete** zahrnout **`\documentclass[...]{...}`** v tomto souboru. Stále se musí objevit v horní části hlavního souboru projektu, jinak se zkompiluje pouze soubor s preambulí.

**Hlavní dokument je nastaven nesprávně:**

Tato chyba se také může objevit, pokud jste v levém menu nastavili hlavní dokument nesprávně. To se může stát, pokud **`\documentclass[...]{...}`** je napsáno na nesprávném místě, takže byste to měli nejprve opravit, je-li to potřeba. Chcete-li změnit volbu hlavního dokumentu, otevřete levé menu:

![Lefthandmenu.PNG](/files/3b8bf27f7e1dea55f261baeb45076d4490587a30)

a přejděte do *Hlavní dokument* rozbalovací nabídky:

![Maindocument.PNG](/files/1dbd00028f1e63bb9dc3379e082e2d09023bb256)


---

# 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/cs/chyby-latexu/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.
