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

# Błąd LaTeX: Brak \begin document

Ten błąd pojawia się, gdy zapomniałeś dodać **`\begin{document}`** w swoim dokumencie. Może też pojawić się, jeśli nie napisałeś **`\documentclass[...]{...}`** na początku głównego dokumentu.

## Najczęstsze przyczyny

**Zapomnienie o dodaniu \begin{document}:**

Najbardziej podstawowa przyczyna tego błędu występuje, gdy zapomnisz napisać **`\begin{document}`** po preambule w głównym dokumencie. Jeśli popełnisz ten błąd, wygenerujesz komunikat o błędzie pokazany poniżej:

main.tex, linia 5

Błąd LaTeX: Brak \begin{document}.

Zobacz podręcznik LaTeX-a lub LaTeX Companion, aby uzyskać wyjaśnienie. Wpisz H, aby uzyskać natychmiastową pomoc. ... Masz tu kłopot. Spróbuj wpisać, aby kontynuować. Jeśli to nie zadziała, wpisz X, aby zakończyć.

Aby rozwiązać ten błąd, po prostu upewnij się, że dodałeś **`\begin{document}`** po preambule w głównym dokumencie. Zobacz [tutaj](/latex/pl/podstawy-latex-a/01-learn-latex-in-30-minutes.md) aby dowiedzieć się więcej o tym, jak strukturyzować dokumenty w LaTeX-u.

**\documentclass\[...]{...} w niewłaściwym miejscu:**

Inną częstą przyczyną tego błędu jest to, że **`\documentclass[...]{...}`** jest zapisane w niewłaściwym miejscu. Musi być zapisane na początku głównego dokumentu. Jeśli masz osobny plik dla swojej preambuły, **nie możesz** dołączyć **`\documentclass[...]{...}`** w tym pliku. Nadal musi pojawić się na górze głównego pliku projektu, w przeciwnym razie zostanie skompilowany tylko plik z preambułą.

**Nieprawidłowo ustawiony główny dokument:**

Ten błąd może też pojawić się, jeśli nieprawidłowo ustawiłeś główny dokument w lewym menu. Może się tak zdarzyć, jeśli **`\documentclass[...]{...}`** jest zapisane w niewłaściwym miejscu, więc w razie potrzeby najpierw to popraw. Aby zmienić wybór głównego dokumentu, otwórz lewym menu:

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

i przejdź do *Dokument główny* menu rozwijanego:

![Maindocument.PNG](/files/2f4357894571993ff26c70a6d96bb383f70b0df3)


---

# 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/pl/bledy-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.
