> 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/narejjibsu/029-code-check.md).

# コードチェック

Overleaf エディタには、入力しながら一般的なエラーをハイライトする構文チェック機能（「Code Check」として知られています）が含まれています。

Code Check が検出できるエラーは次のとおりです:

* 不一致の `\begin` や `\end` コマンド
* 不一致の LaTeX グループ区切り記号 `{ }`
* 不一致の `\left` や `\right` 区切り記号
* 不一致の数式モード区切り記号 `$..$` や `$$..$$`
* 数式モード外で使用された数式コマンド
* 数式モード内で使用されたテキストコマンド

Code Check はヒューリスティックを使用し、文書が標準コマンドのみを用いる典型的な LaTeX であると想定します。たとえば、すべての `\begin{}` には対応する `\end{}`.

## Code Check の制限事項

プロジェクトで独自の LaTeX または TeX マクロを使用している場合、あるいは標準の LaTeX の動作を変更するパッケージを使用している場合は、Code Check を無効にする必要があることがあります。これは、プロジェクト全体、1つのファイル、またはファイルの一部に対して行えます。

特に、標準の LaTeX 環境のショートカットとしてマクロを使用している場合（例: `\newcommand{\beq}{\begin{equation}}`）、これらは展開されないため、Code Check を無効にする必要があります。

## Code Check を全体で無効にする

Code Check をまったく使用したくない場合は、左側メニューでオフにできます。ファイル一覧パネルの上にある Overleaf メニューアイコンをクリックし、次に「Settings - Code Check」を探してください。

## 単一ファイルで Code Check を無効にする

単一ファイルで Code Check をオフにするには、コメント `%%novalidate` をファイルの先頭に置いてください。（注: 競合を避けるため、二重のコメント記号を使用しています）。

```latex
%%novalidate

% 複雑なマクロ定義または Tikz 図
% ...
```

## ファイルの一部で Code Check を無効にする

ファイルの一部についても Code Check をオフにできます

```latex
この部分は Code Check でチェックされます

%%begin novalidate
この部分はチェックされません
%%end novalidate

この部分も Code Check でチェックされます
```

## 既知の問題

* Url、verbatim、および、 `%` がリテラル文字であるような他のコマンドでは、コマンドと同じ行にその後の LaTeX コードがあると、誤ったエラーが出ることがあります。回避策としては、任意の `\url{}` またはリテラル `%` 文字を含む他のコマンドの後で改行を入れることです。
* マクロ名にアンダースコアを含む LaTeX3 構文を使用するコマンド。
* 分離するカスタムコマンド定義 `\begin{...}` からの `\end{...}` の記述


---

# 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/narejjibsu/029-code-check.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.
