LaTeX supports many worldwide languages by means of special packages. This article explains how to import and use packages to typeset documents containing Korean text. A list of Korean typefaces available on Overleaf can be found here.
Example using Google Noto CJK fontsWe can use the xeCJK
package, which requires the XeLaTeX compiler, to typeset some Korean using the Noto CJK fonts installed on Overleaf:
\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} Latin characters are also allowed. \end{document}
Open this Korean example in Overleaf
This example produces the following output:
In the above example four different different fonts are declared:
\setmainfont{Noto Serif}
: Uses the Noto Serif font for text with Latin characters.\setCJKmainfont{Noto Serif CJK KR}
: Sets the font Noto Serif CJK KR
to be used as the main font.\setCJKsansfont{Noto Sans CJK KR}
: Just as the previous command, this uses Noto Sans CJK KR
for document elements to be typeset in a sans serif font.\setCJKmonofont{Noto Sans Mono CJK KR}
: Uses the Noto Sans Mono CJK KR
font for document elements that require a monospace font; for instance, within the verbatim
environment.Because the xeCJK
package uses fontspec
the usual LaTeX font style, family and weight selection commands, such as \ttfamily
, \bfseries
and \textsf
continue to work, as shown in the following example:
\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}
Open this second Korean example in Overleaf
This example produces the following output:
Example usingxeCJK
with fonts loaded into your project
The following example uses fonts, UnGungseo.ttf
and gulim.ttf
, uploaded into the Overleaf project.
\documentclass{article} \usepackage{xeCJK} \setmainfont{Noto Serif} \setCJKmainfont{UnGungseo.ttf} \setCJKsansfont{UnGungseo.ttf} \setCJKmonofont{gulim.ttf} \begin{document} \section{소개} 전체 문서에 대한 기본 정보를 소개 단락. \begin{verbatim} 그것은 간격 방법을 참조 그대로 글꼴을 테스트 \end{verbatim} Latin characters are also allowed. \end{document}
Open this XeLaTeX and xeCJK example in Overleaf
This example produces the following output:
Typesetting Korean documents with pdfLaTeXIf your workflow means you have to use pdfLaTeX, and cannot use XeLaTeX, you can use the CJKutf8
package with pdfLaTeX. Here is an example:
\documentclass{article} \usepackage{CJKutf8} \begin{document} \begin{CJK}{UTF8}{mj} 전체 문서에 대한 기본 정보를 소개 단락. \begin{verbatim} 그것은 간격 방법을 참조 그대로 글꼴을 테스트 \end{verbatim} \end{CJK} Latin characters are also allowed. \end{document}
Open this CJKuft8
package example in Overleaf
This example produces the following output:
Note that in order to type Korean text you must use the CJK
environment:
\begin{CJK}{UTF8}{mj}
will start a CJK
environment, the first parameter passed to the environment declaration is the text encoding. Use only UTF8
on Overleaf, since all text files on Overleaf are UTF8. The second parameter is the font family to be used: use mj
for Korean.
For more information see
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4