Class files

LaTeX supports many worldwide languages by means of some special packages. In this article is explained how to import and use those packages to create documents in Korean.

 Introduction

Korean language needs some special packages since the encoding and fonts are quite unique.

\documentclass{article}
\usepackage{xeCJK}

\begin{document}
\section{소개}
전체 문서에 대한 기본 정보를 소개 단락.

\begin{verbatim}
그것은 간격 방법을 참조 그대로 글꼴을 테스트
\end{verbatim}

Latin characters are also allowed.

\end{document}

This document uses the xeCJK package, which enables LaTeX to display hangul characters. The next sections will clearly explain this and other tools for Korean LaTeX typesetting.

 Korean documents with XeLaTeX

There are two ways of using the CJK package, wich is a LaTeX package intended to display properly Chinese, Japanese and Korean characters. The first manner is compiling the document with XƎLaTeX, this is quite flexible and allows to import external fonts.

\documentclass{article}

\usepackage{xeCJK}

\setCJKmainfont{UnGungseo.ttf}
\setCJKsansfont{UnGungseo.ttf}
\setCJKmonofont{gulim.ttf}

\begin{document}

\section{소개}
전체 문서에 대한 기본 정보를 소개 단락.

\begin{verbatim}
그것은 간격 방법을 참조 그대로 글꼴을 테스트
\end{verbatim}

Latin characters are also allowed.

\end{document}

In the previous example three different fonts are declared. Also, text with Latin characters can be added. Below you can see a description of each command.

\usepackage{xeCJK}
This command imports the xeCJK package. For this package to work the document must be compiled with XeLaTeX.
\setCJKmainfont{UnGungseo.ttf}
Sets the font UnGungseo to be used as the main font, you can either use one of the fonts already installed on your system or download one and place it in you current working directory.
\setCJKsansfont{UnGungseo.ttf}
Just as the previous command this declares a font, but in this case for elements that require the sans family.
\setCJKmonofont
Font to be used in elements that requiere a monospace font, for instance the verbatim environment.

 Korean documents with pdfLaTeX

If XeLaTeX is not available in your LaTeX distribution or if for some reason you have to generate your document with other compiler, you can import the CJKutf8 package.

\documentclass{article}

\usepackage{CJKutf8}

\begin{document}

\begin{CJK}{UTF8}{}
\CJKfamily{mj}
전체 문서에 대한 기본 정보를 소개 단락.

\begin{verbatim}
그것은 간격 방법을 참조 그대로 글꼴을 테스트
\end{verbatim}
\end{CJK}

Latin characters are also allowed.
\end{document}

The package CJKuft8 allows to typeset hangul characters with utf8 encoding, so Latin characters can be included too. Notice that in order to type Korean text you must use the CJK environment.

\begin{CJK}{UTF8}{}
This will start a CJK environment, the parameter passed to the environment declaration is the text encoding.
\CJKfamily{mj}
Font-family to be used.