> 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/yan-yu/06-chinese.md).

# 中国語

## はじめに

この記事では、Overleaf で中国語文書を組版する方法を説明します。推奨される方法は XeLaTeX または LuaLaTeX のコンパイラを使うことです。これらは UTF-8 でエンコードされたテキストを直接サポートし、TrueType および OpenType フォントを利用できるからです。こちらを参照してください： [この記事](/latex/ja/narejjibsu/026-changing-compiler.md) を読めば、Overleaf でコンパイラを変更する方法が分かります。

まずは、XeLaTeX と `ctexart` 文書クラスを使う例から始めましょう：

```latex
\documentclass{ctexart}
\begin{document}
\tableofcontents

\begin{abstract}
これは序文と要約です。
\end{abstract}

\section{前言}

\section{数学の部分について}
数学、中国語、英語は混在させることができます。追加の環境を入れなくても、数式、中国語、英語（ラテン文字）を混ぜて記述できます。

これは繁体字中国語です。
\end{document}
```

[これを開く `XeLaTeX` Overleafでの例](https://www.overleaf.com/docs?engine=xelatex\&snip_name=Basic+example+of+the+ctexart+class\&snip=%5Cdocumentclass%7Bctexart%7D%0A%5Cbegin%7Bdocument%7D%0A%5Ctableofcontents%0A%0A%5Cbegin%7Babstract%7D%0A%E8%BF%99%E6%98%AF%E7%AE%80%E4%BB%8B%E5%8F%8A%E6%91%98%E8%A6%81%E3%80%82%0A%5Cend%7Babstract%7D%0A%0A%5Csection%7B%E5%89%8D%E8%A8%80%7D%0A%0A%5Csection%7B%E5%85%B3%E4%BA%8E%E6%95%B0%E5%AD%A6%E9%83%A8%E5%88%86%7D%0A%E6%95%B0%E5%AD%A6%E3%80%81%E4%B8%AD%E8%8B%B1%E6%96%87%E7%9A%86%E5%8F%AF%E4%BB%A5%E6%B7%B7%E6%8E%92%E3%80%82You+can+intersperse+math%2C+Chinese+and+English+%28Latin+script%29+without+adding+extra+environments.%0A%0A%E9%80%99%E6%98%AF%E7%B9%81%E9%AB%94%E4%B8%AD%E6%96%87%E3%80%82%0A%5Cend%7Bdocument%7D)

この例では、次の出力が生成されます:

![OL2Chinese1.png](/files/4d1a8d107526013f4bf48630ef7d2846964b81fd)

その `ctexart` 文書クラスは [`ctex` パッケージ・バンドルの一部です。](https://ctan.org/pkg/ctex?lang=en) これは一般的な中国語組版の慣例を実装しています。 `ctex` の各クラスについては以下でさらに詳しく説明します。

## ctex クラス

簡体字中国語の組版用文字を扱うためには、 `ctex` 文書クラスを使うことができます： `ctexart`, `ctexrep`, `ctexbook` と `ctexbeamer`。たとえば、 `ctexart` クラスを使うには、文書のプリアンブルに次の行を追加します：

```latex
\documentclass{ctexart}
```

その `ctexart` クラス（および他の `ctex` クラス）は、 `babel`と同様に、中国語ローカライズを提供します。中国語文字を組版できるだけでなく、“Abstract” や “Table of Contents” などの要素を定義して、それらを「摘要」と「目録」に翻訳できます。

外部フォントを文書に取り込むには、LaTeX ファイルと同じディレクトリにアップロードする方法と、システム全体のフォントを使う方法があります。たとえば、 `BabelStone Han` フォントがすでにシステムにインストールされていれば、文書内で次のように使えます：

```latex
\setCJKmainfont{BabelStone Han}
```

文書の一部に使う追加フォントも設定できます。サンセリフ体を使う要素に特定のフォントを設定するには `\setCJKsansfont{}` を使い、verbatim 環境のように等幅フォントで表示される要素には、次のコマンドを使います： `\setCJKmonofont{}`。Overleaf で利用できる中国語フォントの一覧も参照できます。 [こちら](/latex/ja/to-2/85-which-otf-or-ttf-fonts-are-supported-via-fontspec.md#chinese).

上の例の最後の行が、 [はじめに](#introduction) 実際には繁体字中国語の文字を使っていることに注意してください。これはそのフォントにそれらの文字が含まれているため、Fandol フォント（既定）で実現されています。したがって、適切なフォントを使えば、実際には簡体字と繁体字の両方で文書を組版できます。ただし、繁体字専用または簡体字専用のフォントを使うと、そのグリフが利用できない文字は出力 PDF に表示されません。

たとえば、 `memoir` のような文書クラスや、あるいは大学から提供される `.cls` 論文クラスを使う必要があるが、それでも `ctex` バンドルを使いたい場合は、次のように `ctex` パッケージを読み込めます：

```latex
\documentclass{UniThesis}
\usepackage{ctex}
```

## XeLaTeX での xeCJK

もし完全な `ctex` ローカライズ用クラスとパッケージが大げさに感じられ、単にいくつかの中国語文字を組版したいだけなら、 [`xeCJK` パッケージ](https://ctan.org/pkg/xecjk?lang=en)パッケージを使えます。これは XeLaTeX でコンパイルした場合にのみ動作します。

```latex
\documentclass{article}
\usepackage{xeCJK}
\begin{document}
\section{前言}
これはいくつかの文字です。

\section{数学の部分について}
数学、中国語、英語は混在させることができます。追加の環境を入れなくても、数式、中国語、英語（ラテン文字）を混ぜて記述できます。

これは繁体字中国語です。
\end{document}
```

[これを開く `xeCJK` Overleaf での（XeLaTeX）例](https://www.overleaf.com/docs?engine=xelatex\&snip_name=Basic+example+of+the+xeCJK+package\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7BxeCJK%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7B%E5%89%8D%E8%A8%80%7D%0A%E8%BF%99%E6%98%AF%E4%B8%80%E4%BA%9B%E6%96%87%E5%AD%97%E3%80%82%0A%0A%5Csection%7B%E5%85%B3%E4%BA%8E%E6%95%B0%E5%AD%A6%E9%83%A8%E5%88%86%7D%0A%E6%95%B0%E5%AD%A6%E3%80%81%E4%B8%AD%E8%8B%B1%E6%96%87%E7%9A%86%E5%8F%AF%E4%BB%A5%E6%B7%B7%E6%8E%92%E3%80%82You+can+intersperse+math%2C+Chinese+and+English+%28Latin+script%29+without+adding+extra+environments.%0A%0A%E9%80%99%E6%98%AF%E7%B9%81%E9%AB%94%E4%B8%AD%E6%96%87%E3%80%82%0A%5Cend%7Bdocument%7D)

この例では、次の出力が生成されます:

![OL2Chinese2.png](/files/bf4ac4f09fbb759befc042d8cd8af99e1fafce16)

## pdfLaTeX で CJKutf8 を使う

その `CJKutf8` パッケージは、pdfLaTeX で CJK 言語を組版するために使えます。中国語（および日本語・韓国語）のテキストは必ず `CJK` 環境の中に配置する必要があるため、これは通常、中国語の断片を含む主にラテン文字ベースの文書（例：英語）や、その逆の文書で便利です。

```latex
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK*}{UTF8}{gbsn}

\section{前言}

\section{数学の部分について}
数学、中国語、英語は混在させることができます。追加の環境を入れなくても、数式、中国語、英語（ラテン文字）を混ぜて記述できます。

\end{CJK*}

\bigskip  %% ただの空白

文書内にラテン文字のテキストを挿入することもできます

\bigskip  %% ただの空白

\begin{CJK*}{UTF8}{bsmi}
これは繁体字中国語です。
\end{CJK*}
\end{document}
```

[これを開く `CJKutf8` Overleaf でのパッケージ例（pdfLaTeX 使用）](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+of+the+CJKutf8+package\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7BCJKutf8%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7BCJK%2A%7D%7BUTF8%7D%7Bgbsn%7D%0A%0A%5Csection%7B%E5%89%8D%E8%A8%80%7D%0A%0A%5Csection%7B%E5%85%B3%E4%BA%8E%E6%95%B0%E5%AD%A6%E9%83%A8%E5%88%86%7D%0A%E6%95%B0%E5%AD%A6%E3%80%81%E4%B8%AD%E8%8B%B1%E6%96%87%E7%9A%86%E5%8F%AF%E4%BB%A5%E6%B7%B7%E6%8E%92%E3%80%82You+can+intersperse+math%2C+Chinese+and+English+%28Latin+script%29+without+adding+extra+environments.%0A%0A%5Cend%7BCJK%2A%7D%0A%0A%5Cbigskip++%25%25+Just+some+white+space%0A%0AYou+can+also+insert+Latin+text+in+your+document%0A%0A%5Cbigskip++%25%25+Just+some+white+space%0A%0A%5Cbegin%7BCJK%2A%7D%7BUTF8%7D%7Bbsmi%7D%0A%E9%80%99%E6%98%AF%E7%B9%81%E9%AB%94%E4%B8%AD%E6%96%87%E3%80%82%0A%5Cend%7BCJK%2A%7D%0A%5Cend%7Bdocument%7D)

この例では、次の出力が生成されます:

![OL2Chinese3.png](/files/044cea339a3398853abf182adb0c2e06ca7782e8)

この行 `\usepackage{CJKutf8}` を読み込むと、 `CJKutf8` パッケージが導入され、中国語・日本語・韓国語のフォントで使える UTF-8 エンコーディングが有効になります。中国語テキストの各ブロックは必ず `\begin{CJK*}{UTF8}{gbsn}` 環境の中に入力しなければなりません。この環境では `UTF8` がエンコーディングで、 `gbsn` が使用するフォントです。 `gbsn` または `gkai` フォントは簡体字に、 `bsmi` または `bkai` は繁体字に使えます。

## 参考文献

詳しくは次を参照してください。

* [XƎLaTeX で現代的なフォントをサポートする](/latex/ja/fonto/03-xelatex.md)
* [Overleaf で利用できる中国語フォント](/latex/ja/to-2/85-which-otf-or-ttf-fonts-are-supported-via-fontspec.md#chinese)
* [例：Overleaf で CTeX パッケージを使う](https://www.overleaf.com/read/gndvpvsmjcqx)
* [例：LaTeX で異なるスクリプトを使って多言語テキストを書く方法](https://www.overleaf.com/read/wfdxqhcyyjxz)
* [引用と引用符の組版](/latex/ja/yan-yu/04-typesetting-quotations.md)
* [国際言語サポート](/latex/ja/yan-yu/03-international-language-support.md)
* [アラビア語](/latex/ja/yan-yu/05-arabic.md)
* [フランス語](/latex/ja/yan-yu/07-french.md)
* [ドイツ語](/latex/ja/yan-yu/08-german.md)
* [ギリシャ語](/latex/ja/yan-yu/09-greek.md)
* [イタリア語](/latex/ja/yan-yu/10-italian.md)
* [日本語](/latex/ja/yan-yu/11-japanese.md)
* [韓国語](/latex/ja/yan-yu/12-korean.md)
* [ポルトガル語](/latex/ja/yan-yu/13-portuguese.md)
* [ロシア語](/latex/ja/yan-yu/14-russian.md)
* [スペイン語](/latex/ja/yan-yu/15-spanish.md)
* [Ctex パッケージのドキュメント](http://www.texdoc.net/pkg/ctex)
* [xeCJK パッケージのドキュメント](http://www.texdoc.net/pkg/xeCJK)
* [LaTeX2ε へのそれほど短くない入門](http://www.ctan.org/tex-archive/info/lshort/)
* [WikiBooks の LaTeX/Internationalization](http://en.wikibooks.org/wiki/LaTeX/Internationalization)
* [WikiBooks の LaTeX/Special\_Characters](http://en.wikibooks.org/wiki/LaTeX/Special_Characters)


---

# 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/yan-yu/06-chinese.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.
