> 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/zh-tw/yu-yan/12-korean.md).

# 韓文

## 簡介

LaTeX 透過特殊套件支援許多全球語言。本文說明如何匯入並使用套件來排版包含韓文的文件。Overleaf 上可用的韓文字型清單可在 [這裡](/latex/zh-tw/wen-yu-da/85-which-otf-or-ttf-fonts-are-supported-via-fontspec.md#korean).

### 使用 Google Noto CJK 字型的範例

我們可以使用 `xeCJK` 套件，它需要 XeLaTeX 編譯器，來使用 [Noto CJK 字型](https://www.google.com/get/noto/help/cjk/) 排版一些韓文，這些字型已安裝於 Overleaf：

```latex
\documentclass{article}
\usepackage{xeCJK}
\setmainfont{Noto Serif}
\setCJKmainfont{Noto Serif CJK KR}
\setCJKsansfont{Noto Sans CJK KR}
\setCJKmonofont{Noto Sans Mono CJK KR}
\begin{document}
\section{簡介}
整份文件的基本資訊介紹段落。

\begin{verbatim}
它會依照間距方法，原樣測試字型
\end{verbatim}

也允許使用拉丁字元。
\end{document}
```

[在 Overleaf 中開啟這個韓文範例](https://www.overleaf.com/docs?engine=xelatex\&snip_name=Korean+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7BxeCJK%7D%0A%5Csetmainfont%7BNoto+Serif%7D%0A%5CsetCJKmainfont%7BNoto+Serif+CJK+KR%7D%0A%5CsetCJKsansfont%7BNoto+Sans+CJK+KR%7D%0A%5CsetCJKmonofont%7BNoto+Sans+Mono+CJK+KR%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7B%EC%86%8C%EA%B0%9C%7D%0A%EC%A0%84%EC%B2%B4+%EB%AC%B8%EC%84%9C%EC%97%90+%EB%8C%80%ED%95%9C+%EA%B8%B0%EB%B3%B8+%EC%A0%95%EB%B3%B4%EB%A5%BC+%EC%86%8C%EA%B0%9C+%EB%8B%A8%EB%9D%BD.%0A%0A%5Cbegin%7Bverbatim%7D%0A%EA%B7%B8%EA%B2%83%EC%9D%80+%EA%B0%84%EA%B2%A9+%EB%B0%A9%EB%B2%95%EC%9D%84+%EC%B0%B8%EC%A1%B0+%EA%B7%B8%EB%8C%80%EB%A1%9C+%EA%B8%80%EA%BC%B4%EC%9D%84+%ED%85%8C%EC%8A%A4%ED%8A%B8%0A%5Cend%7Bverbatim%7D%0A%0ALatin+characters+are+also+allowed.%0A%5Cend%7Bdocument%7D)

此範例會產生以下輸出：

![韓文排版的基本範例](/files/887040f7a5fdc90b9e009721f83640aa9f5f5bec)

在上述範例中，宣告了四種不同的字型：

* `\setmainfont{Noto Serif}`：使用 Noto Serif 字型來處理含拉丁字元的文字。
* `\setCJKmainfont{Noto Serif CJK KR}`：設定字型 `Noto Serif CJK KR` 作為主要字型。
* `\setCJKsansfont{Noto Sans CJK KR}`：與前一個指令相同，這會使用 `Noto Sans CJK KR` 來為需要無襯線字型的文件元素排版。
* `\setCJKmonofont{Noto Sans Mono CJK KR}`：使用 `Noto Sans Mono CJK KR` 字型來處理需要等寬字型的文件元素；例如，在 `verbatim` 環境中。

### 使用 Noto 字型與不同字重的範例

由於該 `xeCJK` 套件使用 `fontspec` 一般的 LaTeX 字型樣式、字族與字重選擇指令，例如 `\ttfamily`, `\bfseries` 和 `\textsf` 仍然可以運作，如下列範例所示：

```latex
\documentclass{article}
\usepackage{xeCJK}
\setmainfont{Noto Serif}
\setCJKmainfont{Noto Serif CJK KR}
\setCJKsansfont{Noto Sans CJK KR}
\setCJKmonofont{Noto Sans Mono CJK KR}
\begin{document}
\section{簡介}
整份文件的基本資訊介紹段落。

\vspace{10pt}

\noindent 一般字重等寬字型：{\ttfamily 整份文件的基本資訊介紹段落。}

\vspace*{10pt}

\noindent 粗體字重等寬字型：{\ttfamily\bfseries 整份文件的基本資訊介紹段落。}

\vspace*{10pt}

\noindent 無襯線字型：\textsf{ 整份文件的基本資訊介紹段落。}

\vspace*{10pt}

\noindent 無襯線粗體：\textsf{\bfseries 整份文件的基本資訊介紹段落。}

\vspace*{10pt}

\noindent 當然，拉丁字元也可以在 \textbf{粗體} 或 \textit{斜體} 中使用。
\end{document}
```

[在 Overleaf 中開啟這個第二個韓文範例](https://www.overleaf.com/docs?engine=xelatex\&snip_name=Korean+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7BxeCJK%7D%0A%5Csetmainfont%7BNoto+Serif%7D%0A%5CsetCJKmainfont%7BNoto+Serif+CJK+KR%7D%0A%5CsetCJKsansfont%7BNoto+Sans+CJK+KR%7D%0A%5CsetCJKmonofont%7BNoto+Sans+Mono+CJK+KR%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7B%EC%86%8C%EA%B0%9C%7D%0A%EC%A0%84%EC%B2%B4+%EB%AC%B8%EC%84%9C%EC%97%90+%EB%8C%80%ED%95%9C+%EA%B8%B0%EB%B3%B8+%EC%A0%95%EB%B3%B4%EB%A5%BC+%EC%86%8C%EA%B0%9C+%EB%8B%A8%EB%9D%BD.%0A%0A%5Cvspace%7B10pt%7D%0A%0A%5Cnoindent+Regular+weight+monospace%3A+%7B%5Cttfamily+%EC%A0%84%EC%B2%B4+%EB%AC%B8%EC%84%9C%EC%97%90+%EB%8C%80%ED%95%9C+%EA%B8%B0%EB%B3%B8+%EC%A0%95%EB%B3%B4%EB%A5%BC+%EC%86%8C%EA%B0%9C+%EB%8B%A8%EB%9D%BD.%7D%0A%0A%5Cvspace%2A%7B10pt%7D%0A%0A%5Cnoindent+Bold+weight+monospace%3A+%7B%5Cttfamily%5Cbfseries+%EC%A0%84%EC%B2%B4+%EB%AC%B8%EC%84%9C%EC%97%90+%EB%8C%80%ED%95%9C+%EA%B8%B0%EB%B3%B8+%EC%A0%95%EB%B3%B4%EB%A5%BC+%EC%86%8C%EA%B0%9C+%EB%8B%A8%EB%9D%BD.%7D+%0A%0A%5Cvspace%2A%7B10pt%7D%0A%0A%5Cnoindent+Sans+serif%3A+%5Ctextsf%7B+%EC%A0%84%EC%B2%B4+%EB%AC%B8%EC%84%9C%EC%97%90+%EB%8C%80%ED%95%9C+%EA%B8%B0%EB%B3%B8+%EC%A0%95%EB%B3%B4%EB%A5%BC+%EC%86%8C%EA%B0%9C+%EB%8B%A8%EB%9D%BD.%7D%0A%0A%5Cvspace%2A%7B10pt%7D%0A%0A%5Cnoindent+Sans+serif+bold%3A+%5Ctextsf%7B%5Cbfseries+%EC%A0%84%EC%B2%B4+%EB%AC%B8%EC%84%9C%EC%97%90+%EB%8C%80%ED%95%9C+%EA%B8%B0%EB%B3%B8+%EC%A0%95%EB%B3%B4%EB%A5%BC+%EC%86%8C%EA%B0%9C+%EB%8B%A8%EB%9D%BD.%7D%0A%0A%5Cvspace%2A%7B10pt%7D%0A%0A%5Cnoindent+And+of+course%2C+Latin+characters+are+also+allowed+in+%5Ctextbf%7Bbold%7D+or+%5Ctextit%7Bitalics%7D.%0A%5Cend%7Bdocument%7D)

此範例會產生以下輸出：

![不同樣式的韓文文本](/files/559513423ca5fcda58992f9e9acd3183adfd306c)

## 使用已載入到專案中的字型搭配 xeCJK 的範例

以下範例使用字型， `UnGungseo.ttf` 和 `gulim.ttf`，上傳到 Overleaf 專案中。

```latex
\documentclass{article}
\usepackage{xeCJK}

\setmainfont{Noto Serif}
\setCJKmainfont{UnGungseo.ttf}
\setCJKsansfont{UnGungseo.ttf}
\setCJKmonofont{gulim.ttf}

\begin{document}

\section{簡介}
整份文件的基本資訊介紹段落。

\begin{verbatim}
它會依照間距方法，原樣測試字型
\end{verbatim}

也允許使用拉丁字元。

\end{document}
```

[在 Overleaf 中開啟這個 XeLaTeX 和 xeCJK 範例](https://www.overleaf.com/project/new/template/21134?id=72864508\&templateName=Typesetting+Korean+with+uploaded+fonts\&latexEngine=xelatex\&texImage=texlive-full%3A2020.1\&mainFile=)

此範例會產生以下輸出：

![使用 pdfTeX 排版韓文](/files/2d11f22d31009687f4f3fedbe0bb663e3b3582a3)

## 使用 pdfLaTeX 排版韓文文件

如果你的工作流程表示你 *必須* 必須使用 pdfLaTeX 而無法使用 XeLaTeX，你可以使用 `CJKutf8` 套件與 pdfLaTeX。以下是一個範例：

```latex
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{mj}
 整份文件的基本資訊介紹段落。

 \begin{verbatim}
 它會依照間距方法，原樣測試字型
 \end{verbatim}
\end{CJK}

也允許使用拉丁字元。
\end{document}
```

[在 Overleaf 中開啟這個 `CJKuft8` 套件範例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Typesetting+Korean+with+pdfTeX\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7BCJKutf8%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7BCJK%7D%7BUTF8%7D%7Bmj%7D%0A+%EC%A0%84%EC%B2%B4+%EB%AC%B8%EC%84%9C%EC%97%90+%EB%8C%80%ED%95%9C+%EA%B8%B0%EB%B3%B8+%EC%A0%95%EB%B3%B4%EB%A5%BC+%EC%86%8C%EA%B0%9C+%EB%8B%A8%EB%9D%BD.%0A%0A+%5Cbegin%7Bverbatim%7D%0A+%EA%B7%B8%EA%B2%83%EC%9D%80+%EA%B0%84%EA%B2%A9+%EB%B0%A9%EB%B2%95%EC%9D%84+%EC%B0%B8%EC%A1%B0+%EA%B7%B8%EB%8C%80%EB%A1%9C+%EA%B8%80%EA%BC%B4%EC%9D%84+%ED%85%8C%EC%8A%A4%ED%8A%B8%0A+%5Cend%7Bverbatim%7D%0A%5Cend%7BCJK%7D%0A%0ALatin+characters+are+also+allowed.%0A%5Cend%7Bdocument%7D)

此範例會產生以下輸出：

![使用 CJKuft8 排版韓文](/files/8d4c54944c48d63fc2ce8c94544fdabd72b64355)

請注意，要輸入韓文文字，你必須使用 `CJK` 環境：

`\begin{CJK}{UTF8}{mj}`會開始一個 `CJK` 環境，傳遞給環境宣告的第一個參數是文字編碼。僅使用 `UTF8` 在 Overleaf 上，因為 Overleaf 中所有文字檔案都是 UTF8。第二個參數是要使用的字族：使用 `mj` 用於韓文。

## 延伸閱讀

更多資訊請參見

* [Overleaf 上可用的韓文字型清單](/latex/zh-tw/wen-yu-da/85-which-otf-or-ttf-fonts-are-supported-via-fontspec.md#korean)
* [使用 XƎLaTeX 支援現代字型](/latex/zh-tw/zi-xing/03-xelatex.md)
* [引號與引號符號的排版](/latex/zh-tw/yu-yan/04-typesetting-quotations.md)
* [國際語言支援](/latex/zh-tw/yu-yan/03-international-language-support.md)
* [中文](/latex/zh-tw/yu-yan/06-chinese.md)
* [法文](/latex/zh-tw/yu-yan/07-french.md)
* [德文](/latex/zh-tw/yu-yan/08-german.md)
* [希臘文](/latex/zh-tw/yu-yan/09-greek.md)
* [義大利文](/latex/zh-tw/yu-yan/10-italian.md)
* [日文](/latex/zh-tw/yu-yan/11-japanese.md)
* [阿拉伯文](/latex/zh-tw/yu-yan/05-arabic.md)
* [葡萄牙文](/latex/zh-tw/yu-yan/13-portuguese.md)
* [俄文](/latex/zh-tw/yu-yan/14-russian.md)
* [西班牙文](/latex/zh-tw/yu-yan/15-spanish.md)
* [LaTeX2ε 不那麼簡短的入門介紹](http://www.ctan.org/tex-archive/info/lshort/)
* [WikiBooks 上的 LaTeX/國際化](http://en.wikibooks.org/wiki/LaTeX/Internationalization)
* [WikiBooks 上的 LaTeX/特殊字元](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/zh-tw/yu-yan/12-korean.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.
