> 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/to-2/05-can-i-run-plain-tex-on-overleaf.md).

# Overleafでplain TeXを実行できますか？

はい。以下に説明する設定手順に従えば、プロジェクトをプレーン TeX でコンパイルするように設定できます。

1. Overleaf エディタで、次の **メニュー** ボタンをクリックし、次を設定します: **コンパイラ** のオプションを `LaTeX`—選択します `LaTeX` を、次の動画クリップに示すようにドロップダウン一覧から:

{% embed url="<https://www.filepicker.io/api/file/Iw9UYRbxRBy3Bk61YKqj>" %}

3. プロジェクトに空のファイルを追加し、次の名前で保存します: `latexmkrc`—拡張子は付けないでください（プロジェクトにすでに次の `latexmkrc` ファイルがある場合は、追加する必要はないかもしれません）。
4. 次の行を、あなたの `latexmkrc` ファイルに追加します:

```
$latex = 'tex %O %S';
```

#### この latexmkrc ファイルは実際に何をするのでしょうか？

詳細には立ち入りませんが、Overleaf のサーバーは次のプログラムを使用して [`latexmk`](https://mg.readthedocs.io/latexmk.html) TeX/LaTeX ベースの組版 `latexmk` を実行・制御しています。この `latexmkrc`設定ファイルを追加することで、Overleaf のユーザーは自分のプロジェクトの組版に影響を与えられます: `latexmkrc` の設定ファイルについて [次の `latexmk` Web サイト](https://mg.readthedocs.io/latexmk.html#configuration-files).

#### 例

この `latexmk` プログラムは次の言語で書かれています: [Perl プログラミング言語](https://www.perl.org/) これは、ハッシュ記号 (#) をコメント文字として使用します（TeX/LaTeX が通常 % 記号を使うのとよく似ています）。異なる TeX エンジンを使ってプレーン TeX を試したい場合は、次の `latexmkrc` ファイルを作成して、次のテキストをコピー/貼り付けします:

```
# $latex = 'tex %O %S'; # クヌースのオリジナル TeX エンジンを使うには
# $latex = 'pdftex %O %S'; # pdfTeX エンジンを使うには
# $latex = 'luatex %O %S'; # LuaTeX エンジンを使うには
# $latex = 'xetex %O %S';  # XeTeX エンジンを使うには
```

特定の TeX エンジンを使うには、使用したい TeX エンジンに対応する行のコメントアウトを解除します（先頭の '#' 文字を削除します）。たとえば XeTeX を実行するには、最後の行のコメントアウトを解除して、あなたの `latexmkrc` ファイルが次のようになるようにします—最後の行は '#' 文字で始まっていないため、その行が実行され、XeTeX を使ってプレーン TeX 文書が組版されます:

```
# $latex = 'tex %O %S'; # クヌースのオリジナル TeX エンジンを使うには
# $latex = 'pdftex %O %S'; # pdfTeX エンジンを使うには
# $latex = 'luatex %O %S'; # LuaTeX エンジンを使うには
$latex = 'xetex %O %S';  # XeTeX エンジンを使うには
```

次の短い動画では、上記の `latexmkrc` ファイルを選択的に編集して、XeTeX から始めて各 TeX エンジンを順番に実行する様子を示しています。この例で使用したプレーン TeX のソースコードは次から借用しました: [D. R. Wilkins による記事](https://www.ntg.nl/doc/wilkins/pllong.pdf).

{% embed url="<https://www.filepicker.io/api/file/9PVmkgTSSny7gjNliTdt>" %}

### さらに読む

Overleaf における次の利用についてよりよく理解したい方に役立つ、関連するヘルプ項目が 2 つあります: `latexmk` や `latexmkrc`:

* [Overleaf は私のプロジェクトをどのようにコンパイルしますか?](/latex/ja/narejjibsu/064-how-does-overleaf-compile-my-project.md)
* [Overleaf で latexmkrc を使う方法: 例とテクニック](/latex/ja/xiang-xi-ji-shi/28-how-to-use-latexmkrc-with-overleaf.md)


---

# 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/to-2/05-can-i-run-plain-tex-on-overleaf.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.
