> For the complete documentation index, see [llms.txt](https://ayakaleaf-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://ayakaleaf-pro.ayaka.space/latex/zh-cn/yu-yan/12-korean.md).

# 韩语

## 简介

LaTeX 通过特殊宏包支持许多世界语言。本文介绍如何导入并使用宏包来排版包含韩文文本的文档。Overleaf 上可用的韩文字体列表可在 [这里](/latex/zh-cn/wen-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/38b98113470101333cb5b7065572c00a892c2685)

在上面的示例中，声明了四种不同的字体：

* `\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 Regular weight monospace: {\ttfamily 전체 문서에 대한 기본 정보를 소개 단락.}

\vspace*{10pt}

\noindent Bold weight monospace: {\ttfamily\bfseries 전체 문서에 대한 기본 정보를 소개 단락.}

\vspace*{10pt}

\noindent Sans serif: \textsf{ 전체 문서에 대한 기본 정보를 소개 단락.}

\vspace*{10pt}

\noindent Sans serif bold: \textsf{\bfseries 전체 문서에 대한 기본 정보를 소개 단락.}

\vspace*{10pt}

\noindent And of course, Latin characters are also allowed in \textbf{bold} or \textit{italics}.
\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/6cfd9a7e75890ddad9bdc68a1b2eaa25a72b3fe1)

## 使用加载到项目中的字体与 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/68876d47315149379cbc134745e551ed4c6904ad)

## 使用 pdfLaTeX 排版韩文文档

如果您的工作流程意味着您 *必须* 需要使用 pdfLaTeX，而不能使用 XeLaTeX，您可以使用 `CJKutf8` 宏包与 pdfLaTeX。以下是一个示例：

```latex
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{mj}
 用于介绍整个文档基本信息的介绍段落。

 \begin{verbatim}
 它按间距方法原样测试字体
 \end{verbatim}
\end{CJK}

也允许使用拉丁字符。
\end{document}
```

[打开此 `CJKuft8` 在 Overleaf 中的宏包示例](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/e0d80ef9caf446bc3b184692ac0347ccbbdcd831)

请注意，要输入韩文文本，您必须使用 `CJK` 环境：

`\begin{CJK}{UTF8}{mj}`将开始一个 `CJK` 环境，传递给环境声明的第一个参数是文本编码。只使用 `UTF8` 在 Overleaf 上，因为 Overleaf 上的所有文本文件都是 UTF8。第二个参数是要使用的字体族：使用 `mj` 用于韩文。

## 更多信息请参见：

更多信息请参见

* [Overleaf 上可用的韩文字体列表](/latex/zh-cn/wen-da/85-which-otf-or-ttf-fonts-are-supported-via-fontspec.md#korean)
* [在 XƎLaTeX 中支持现代字体](/latex/zh-cn/zi-ti/03-xelatex.md)
* [引号和引号符号的排版](/latex/zh-cn/yu-yan/04-typesetting-quotations.md)
* [国际语言支持](/latex/zh-cn/yu-yan/03-international-language-support.md)
* [中文](/latex/zh-cn/yu-yan/06-chinese.md)
* [法语](/latex/zh-cn/yu-yan/07-french.md)
* [德语](/latex/zh-cn/yu-yan/08-german.md)
* [希腊语](/latex/zh-cn/yu-yan/09-greek.md)
* [意大利语](/latex/zh-cn/yu-yan/10-italian.md)
* [日语](/latex/zh-cn/yu-yan/11-japanese.md)
* [阿拉伯语](/latex/zh-cn/yu-yan/05-arabic.md)
* [葡萄牙语](/latex/zh-cn/yu-yan/13-portuguese.md)
* [俄语](/latex/zh-cn/yu-yan/14-russian.md)
* [西班牙语](/latex/zh-cn/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://ayakaleaf-pro.ayaka.space/latex/zh-cn/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.
