> 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/ja/latexer/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/ja/latexno/01-learn-latex-in-30-minutes.md) LaTeX で文書を構成する方法について詳しく学ぶには。

**\documentclass\[...]{...} の場所が不適切：**

このエラーの別のよくある原因は、次の書き込み場所が **`\documentclass[...]{...}`** 間違っていることです。これはメイン文書の先頭に書かなければなりません。前文を別ファイルにしている場合、あなたは **できません** 含める **`\documentclass[...]{...}`** そのファイルに。これも必ずメインのプロジェクトファイルの先頭に現れなければならず、そうでない場合は前文ファイルだけがコンパイルされます。

**メイン文書の設定が間違っている：**

このエラーは、左側のメニューでメイン文書を誤って設定している場合にも表示されることがあります。これは、次の場合に起こります **`\documentclass[...]{...}`** が間違った場所に書かれているので、必要ならまずこれを修正してください。メイン文書の選択を変更するには、左側のメニューを開きます：

![Lefthandmenu.PNG](/files/2f79d3a86b719c1c9c3288eef53c25fc81fb4797)

そして *メイン文書* ドロップダウンメニューへ：

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


---

# 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/ja/latexer/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.
