> 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/ko/fonts/03-xelatex.md).

# XƎLaTeX로 현대적 글꼴 지원하기

## 소개

[XeTeX](https://tug.org/xetex/) 는 Donald Knuth의 원래 TeX 소프트웨어에서 파생된 조판 엔진입니다. 그러나 Knuth의 원래 프로그램과 달리 XeTeX는 UTF-8로 인코딩된 유니코드 텍스트를 기본적으로 읽고(입력하고), 내장된 [HarfBuzz](https://harfbuzz.github.io/) 조형 엔진의 도움을 받아 다음과 같은 현대적인 글꼴 형식을 지원합니다. [OpenType (OTF)](https://docs.microsoft.com/en-us/typography/opentype/) 및 [SIL의 Graphite 글꼴 기술](https://scripts.sil.org/cms/scripts/page.php?site_id=projects\&item_id=graphite_home). Overleaf에서 대응되는 LaTeX [컴파일러](/latex/ko/more-topics/08-choosing-a-latex-compiler.md) 는 `xelatex`. 서로 다른 TeX 엔진의 진화를 더 잘 이해하고 싶은 분들은 Overleaf 기사인 [이름에 담긴 의미: TeX의 여러 변형에 대한 가이드](/latex/ko/in-depth-articles/55-what-s-in-a-name-a-guide-to-the-many-flavours-of-tex.md).

## 기본: Times New Roman

Times New Roman은 널리 사용되는 글꼴이며, 여기에는 XeLaTeX 컴파일러를 통해 Overleaf에서 사용하는 예가 나와 있습니다. 이 예에서는 문서 글꼴이 다음을 사용해 설정됩니다. `\usemainfont{Times New Roman}`이며, 이 명령은 `\usemainfont{...}` 패키지에서 제공됩니다. `fontspec`.

```latex
\title{Overleaf에서 xr 패키지 사용하기}
\usepackage{fontspec}

\setmainfont{Times New Roman}
\title{샘플 글꼴 문서}
\author{Overleaf}
\date{\today}

\begin{document}
\maketitle

이것은 \textit{예시} 문서의 한 예로, 다음과 같이 컴파일되었습니다.
\textbf{XeLaTeX}로. LuaLaTeX도 역시 동작합니다.

\end{document}
```

[Overleaf에서 XeLaTeX로 연 Times New Roman 예제](https://www.overleaf.com/docs?engine=xelatex\&snip_name=Times+New+Roman+%28via+XeLaTeX%29\&snip=%5Cdocumentclass%5B12pt%5D%7Barticle%7D%0A%5Cusepackage%7Bfontspec%7D%0A+%0A%5Csetmainfont%7BTimes+New+Roman%7D%0A%5Ctitle%7BSample+font+document%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7B%5Ctoday%7D%0A+++%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A+++++%0AThis+is+an+%5Ctextit%7Bexample%7D+of+a+document+compiled+%0Awith+%5Ctextbf%7BXeLaTeX%7D.+LuaLaTeX+should+also+work+too.%0A%0A%5Cend%7Bdocument%7D)

이 예제는 다음과 같은 출력을 생성합니다:

![XeLaTeXOverleaf.png](/files/ea19e064242cad86944eabb75d2fe507a4eb6d09)

또한 [같은 코드를 LuaLaTeX로 실행할 수도 있습니다.](https://www.overleaf.com/docs?engine=lualatex\&snip_name=Times+New+Roman+%28via+LuaLaTeX%29\&snip=%5Cdocumentclass%5B12pt%5D%7Barticle%7D%0A%5Cusepackage%7Bfontspec%7D%0A+%0A%5Csetmainfont%7BTimes+New+Roman%7D%0A%5Ctitle%7BSample+font+document%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7B%5Ctoday%7D%0A+++%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A+++++%0AThis+is+an+%5Ctextit%7Bexample%7D+of+a+document+compiled+%0Awith+%5Ctextbf%7BLuaLaTeX%7D.%0A%0A%5Cend%7Bdocument%7D) .

## 서로 다른 LaTeX 요소에 글꼴 설정하기

LaTeX 문서의 서로 다른 요소는 서로 다른 글꼴로 서식이 지정됩니다. 예를 들어, `verbatim` 환경에서는 텍스트가 타자기 스타일로 표시됩니다. 각 문맥마다 서로 다른 글꼴 스타일을 설정할 수 있습니다:

```latex
\title{Overleaf에서 xr 패키지 사용하기}
\usepackage{fontspec}

%-----------------------------------------------------------------------
\setmainfont{Times New Roman}
\setsansfont{Arial}
\setmonofont[Color={0019D4}]{Courier New}
%-----------------------------------------------------------------------

\title{샘플 글꼴 문서}
\author{Overleaf}
\date{\today}
\begin{document}

\maketitle

이것은 다음과 함께 컴파일된 문서의 \textit{예시}입니다.
\textbf{XeLaTeX} 컴파일러. 코드를 작성해야 한다면
\texttt{verbatim} 환경을 사용할 수 있습니다:

    \begin{verbatim}
    보통 이 환경은 코드를 표시하는 데 사용되므로,
    간단한 C 프로그램을 보겠습니다.

    #include <stdio.h>
    #define NUMYAYS 10

    int main()
    {
        int i;
        for (i = 0; i <= NUMYAYS; i++)
        {
            printf("Yay! Overleaf is Awesome!\n");
        }
        return 0;
    }
    \end{verbatim}
    {\sffamily 이것은 \textbf{Sans Serif Font Typeface}의 샘플 텍스트입니다}

\end{document}
```

[결과를 보려면 Overleaf에서 이 XeLaTeX 예제를 여세요.](https://www.overleaf.com/docs?engine=xelatex\&snip_name=Document+formatted+with+different+fonts\&snip=%5Cdocumentclass%5B12pt%5D%7Barticle%7D%0A%5Cusepackage%7Bfontspec%7D%0A%0A%25-----------------------------------------------------------------------%0A%5Csetmainfont%7BTimes+New+Roman%7D%0A%5Csetsansfont%7BArial%7D%0A%5Csetmonofont%5BColor%3D%7B0019D4%7D%5D%7BCourier+New%7D%0A%25-----------------------------------------------------------------------%0A%0A%5Ctitle%7BSample+font+document%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7B%5Ctoday%7D%0A%5Cbegin%7Bdocument%7D%0A++++%0A%5Cmaketitle%0A+++++%0AThis+an+%5Ctextit%7Bexample%7D+of+document+compiled+with+the++%0A%5Ctextbf%7BXeLaTeX%7D+compiler.+If+you+have+to+write+some+code+you+can+%0Ause+the+%5Ctexttt%7Bverbatim%7D+environment%3A%0A%0A++++%5Cbegin%7Bverbatim%7D%0A++++Usually+this+environment+is+used+to+display+code%2C+%0A++++so+here%27s+a+simple+C+program.%0A%0A++++%23include+%3Cstdio.h%3E%0A++++%23define+NUMYAYS+10%0A++++++%0A++++int+main%28%29%0A++++%7B%0A++++++++int+i%3B+++%0A++++++++for+%28i+%3D+0%3B+i+%3C%3D+NUMYAYS%3B+i%2B%2B%29+%0A++++++++%7B%0A++++++++++++printf%28%22Yay%21+Overleaf+is+Awesome%21%5Cn%22%29%3B%0A++++++++%7D%0A++++++++return+0%3B%0A++++%7D%0A++++%5Cend%7Bverbatim%7D%0A++++%7B%5Csffamily+This+is+a+sample+text+in+%5Ctextbf%7BSans+Serif+Font+Typeface%7D%7D%0A+++++++%0A%5Cend%7Bdocument%7D)

이전 예제에서는 서로 다른 세 가지 글꼴이 사용되었으며, 다음 줄은 이 글꼴을 사용할 요소를 결정합니다:

**\setmainfont{Times New Roman}**

이것은 문서의 대부분에서 사용되는 일반 글꼴이며, 예제에서는 Times New Roman입니다.

**\setsansfont{Arial}**

예제에서 \ssfamily로 명시적으로 선언된 산세리프 글꼴이 필요한 요소는 Arial 글꼴로 조판됩니다.

**\setmonofont{Courier New}**

모노스페이스(타자기형) 글꼴로 서식이 지정될 모든 내용은 Courier New 글꼴을 사용합니다. 이 명령에는 중괄호 안에 추가적인 선택적 매개변수가 있습니다:

**Color={0019D4}**

이것은 HTML 16진수 형식의 Color= 값을 사용해 텍스트 색을 설정합니다. 발표 자료를 만들 때 텍스트 색을 선택적으로 신중하게 사용하면 유용할 수 있습니다.

## Overleaf의 글꼴

여러 [Overleaf에 설치된 수많은 글꼴이 있으며](/latex/ko/questions-and-answers/85-which-otf-or-ttf-fonts-are-supported-via-fontspec.md) 프로젝트에서 사용할 수 있습니다. 가장 쉽게는 `fontspec`을 통해 사용할 수 있습니다. 다음 예제는 Overleaf 서버에 포함된 Google Noto 같은 글꼴과, [Google Fonts](https://fonts.google.com/).

### Overleaf 서버에 설치된 글꼴: Google Noto 글꼴

왜냐하면 [TeX Live](https://www.tug.org/texlive/)—Overleaf에서 사용하는—에는 [Google Noto 글꼴](https://www.google.com/get/noto/) 이 포함되어 있습니다. XeLaTeX 또는 LuaLaTeX 컴파일러로 컴파일되는 Overleaf 프로젝트 안에서 `fontspec` 패키지를 통해 이를 사용할 수 있습니다. 여기에는 [`noto` 패키지](https://ctan.org/pkg/noto?lang=en) 를 사용하여 NotoSerif, NotoSans 및 NotoSansMono 글꼴 패밀리로 문서를 조판하도록 설정하는 샘플 프로젝트가 있습니다. 해당 `noto` 패키지 문서는 그 [CTAN의 readme 파일](http://mirrors.ctan.org/fonts/noto/README).

```latex
\documentclass{article}
\usepackage{xcolor}
\usepackage{noto}
\usepackage{hyperref}
\title{Google Noto 글꼴 사용하기}
\author{Overleaf}
\date{2021년 4월}

\begin{document}

\maketitle

\section{Introduction}
이 예제 프로젝트는 Google의 Noto 글꼴을 사용해 문서를 조판하기 위해 \href{https://ctan.org/pkg/noto?lang=en}{\color{blue}\texttt{noto}} 패키지를 사용합니다\footnote{\url{https://www.google.com/get/noto/}}:
\begin{itemize}
\item \verb|\textbf{bold}|는 \textbf{bold}를 생성합니다.
\item \verb|\textit{italic}|은 \textit{italic}을 생성합니다.
\item \verb|\textbf{\textit{bold italic}}|은 \textbf{\textit{bold italic}}을 생성합니다.
\item \verb|\emph{emphasis}|는 \emph{emphasis}를 생성합니다.
\item \verb|\textbf{\emph{bold italic}}|은 \textbf{\emph{bold italic}}을 생성합니다.
\end{itemize}

\subsection{모노스페이스 글꼴}
Noto의 모노스페이스 글꼴을 \texttt{regular} 및 \texttt{\textbf{bold}} 모노스페이스 텍스트에 사용할 수 있습니다.

\subsection{산세리프 글꼴}
여기에는 \textsf{text is typeset in a sans serif font}가 있으며, \textbf{\textsf{text typeset in bold sans serif}}와 함께 있습니다.

\section{추가 읽을거리}
\texttt{noto} 패키지에 대한 문서는 CTAN의 \href{http://mirrors.ctan.org/fonts/noto/README}{\color{blue}\texttt{readme} 파일}에서 찾을 수 있습니다.

\end{document}
```

[Noto 글꼴을 살펴보려면 Overleaf에서 이 XeLaTeX 예제를 여세요.](https://www.overleaf.com/docs?engine=xelatex\&snip_name=Using+Google+Noto+fonts\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bxcolor%7D%0A%5Cusepackage%7Bnoto%7D%0A%5Cusepackage%7Bhyperref%7D%0A%5Ctitle%7BUsing+Google+Noto+fonts%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7BApril+2021%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%0A%5Cmaketitle%0A%0A%5Csection%7BIntroduction%7D%0AThis+example+project+uses+the+%5Chref%7Bhttps%3A%2F%2Fctan.org%2Fpkg%2Fnoto%3Flang%3Den%7D%7B%5Ccolor%7Bblue%7D%5Ctexttt%7Bnoto%7D%7D+package+to+typeset+your+document+using+Google%27s+Noto+fonts%5Cfootnote%7B%5Curl%7Bhttps%3A%2F%2Fwww.google.com%2Fget%2Fnoto%2F%7D%7D%3A%0A%5Cbegin%7Bitemize%7D%0A%5Citem+%5Cverb%7C%5Ctextbf%7Bbold%7D%7C+produces+%5Ctextbf%7Bbold%7D%0A%5Citem+%5Cverb%7C%5Ctextit%7Bitalic%7D%7C+produces+%5Ctextit%7Bitalic%7D%0A%5Citem+%5Cverb%7C%5Ctextbf%7B%5Ctextit%7Bbold+italic%7D%7D%7C+produces+%5Ctextbf%7B%5Ctextit%7Bbold+italic%7D%7D%0A%5Citem+%5Cverb%7C%5Cemph%7Bemphasis%7D%7C+produces+%5Cemph%7Bemphasis%7D%0A%5Citem+%5Cverb%7C%5Ctextbf%7B%5Cemph%7Bbold+italic%7D%7D%7C+produces+%5Ctextbf%7B%5Cemph%7Bbold+italic%7D%7D%0A%5Cend%7Bitemize%7D%0A%0A%5Csubsection%7BMonospaced+fonts%7D%0AYou+can+use+Noto%27s+monospaced+fonts+for+%5Ctexttt%7Bregular%7D+and+%5Ctexttt%7B%5Ctextbf%7Bbold%7D%7D+monospaced+text.%0A%0A%5Csubsection%7BSans+serif+fonts%7D%0AHere+is+some+%5Ctextsf%7Btext+is+typeset+in+a+sans+serif+font%7D+together+with+%5Ctextbf%7B%5Ctextsf%7Btext+typeset+in+bold+sans+serif%7D%7D.%0A%0A%5Csection%7BFurther+reading%7D%0ADocumentation+for+the+%5Ctexttt%7Bnoto%7D+package+can+be+found+in+its+%5Chref%7Bhttp%3A%2F%2Fmirrors.ctan.org%2Ffonts%2Fnoto%2FREADME%7D%7B%5Ccolor%7Bblue%7D%5Ctexttt%7Breadme%7D+file+on+CTAN%7D.%0A%0A%5Cend%7Bdocument%7D)

![Google Noto 글꼴을 사용해 LaTeX 문서 조판하기](/files/8c25baf2441736ace95336168cb4ff52449aae94)

### Overleaf 서버에 설치되어 있지 않은 글꼴을 사용하는 Google Fonts 예제

Overleaf 서버에 설치되어 있지 않은 OpenType 글꼴을 사용하려면, 먼저 글꼴 파일을 Overleaf 프로젝트에 업로드해야 합니다. 단, 글꼴 라이선스가 이를 허용해야 합니다. OpenType 글꼴을 업로드한 후에는 프로젝트 컴파일러를 XƎLaTeX(또는 LuaLaTeX)로 설정하고 `fontspec` 를 사용하여 글꼴을 구성하세요.

아래에 설명된 예제 프로젝트는 폴더를 만들고, 글꼴을 업로드하고, `fontspec`로 구성하는 방법을 보여줍니다. 우리의 예에서는 [Google Fonts](https://fonts.google.com/):

* 세리프 글꼴: [Brygada1918](https://fonts.google.com/specimen/Brygada+1918)
* 산세리프 글꼴: [Asap](https://fonts.google.com/specimen/Asap)
* 모노스페이스 글꼴: [JetBrains Mono](https://fonts.google.com/specimen/JetBrains+Mono)

참고: 이 예제가 인쇄술적으로 조화로운 글꼴 스타일 조합을 제시한다고 말하는 것은 아닙니다. 단지 원하는 글꼴을 업로드하고, 설정하고, 사용하는 방법을 보여줄 뿐입니다.

각 글꼴 패밀리에 대해 Google Fonts에서 해당 글꼴 패밀리를 다운로드해야 합니다:

![GoogleDownload.png](/files/0e3dc9c96fa4573410da5719018f19ae70ce11e5)

참고: 일부 Google 글꼴은 "static" OpenType 글꼴과 이른바 "variable" OpenType 글꼴로 제공됩니다. 다운로드한 ZIP 파일에 "static" 폴더가 있다면 변수 글꼴 버전이 아니라 그 폴더 안의 글꼴을 업로드해야 합니다:

![OpenTypeStatic.png](/files/a98adff07160631c3daabb03c92f2a746a27afdb)

다음으로 글꼴 파일을 프로젝트에 업로드해야 합니다. 하지만 글꼴 패밀리에는 여러 글꼴 파일이 포함되어 있으므로, 글꼴 패밀리마다 하나의 폴더를 사용하는 식으로 개별 Overleaf 프로젝트 폴더를 만드는 것이 좋습니다. 아래 영상은 그 방법을 보여줍니다. 나중에는 XƎLaTeX에 프로젝트의 글꼴이 어디에 있는지 알려줘야 합니다. Overleaf 서버에 미리 설치되어 있지 않기 때문입니다.

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/4lQFkZ1Ni1FHFdHJUJSNH4/4aee7c5bafeb021a6f21b4637d0fe6ec/UploadingGoogleFonts.mp4>" %}

### fontspec을 구성하여 글꼴 사용하기

글꼴 패밀리 파일을 Overleaf 프로젝트 폴더에 업로드한 뒤에는 `fontspec`를 통해 사용할 수 있도록 구성할 수 있습니다. 다음 LaTeX 코드에서 `Path` 매개변수를 사용해 `fontspec` 글꼴 파일이 프로젝트 파일 시스템의 로컬 폴더에 있음을 알려준 방식을 주목하세요:

```latex
\setmainfont{Brygada1918}[
    Path=./BrygadaFontFiles/,
    Extension = .ttf,
    UprightFont=*-Regular,
    BoldFont=*-Bold,
    ItalicFont=*-Italic,
    BoldItalicFont=*-BoldItalic
    ]

\setsansfont{Asap}[
    Path=./AsapFontFiles/,
    Scale=0.9,
    Extension = .ttf,
    UprightFont=*-Regular,
    BoldFont=*-Bold,
    ItalicFont=*-Italic,
    BoldItalicFont=*-BoldItalic
    ]

\setmonofont{JetBrainsMono}[
    Path=./JetbrainsFontFiles/,
    Scale=0.85,
    Extension = .ttf,
    UprightFont=*-Regular,
    BoldFont=*-Bold,
    ItalicFont=*-Italic,
    BoldItalicFont=*-BoldItalic
    ]
```

![FontSpecPathUpdated.png](/files/8cdfab38d6adc2d7ed20c6a2c4b25ce461cede16)

[Overleaf에서 XeLaTeX 및 Google Fonts 데모 열기](https://www.overleaf.com/project/new/template/31226?id=835225587\&templateName=XeLaTeX+font+demo+with+Google+Fonts\&latexEngine=xelatex\&texImage=texlive-full%3A2022.1\&mainFile=)

이 [`fontspec` 패키지](https://ctan.org/pkg/fontspec?lang=en) LuaLaTeX 또는 XƎLaTeX와 함께 사용할 OpenType 글꼴을 구성하기 위한 다양한 옵션을 제공합니다. 그 [훌륭한 문서](http://mirrors.ctan.org/macros/unicodetex/latex/fontspec/fontspec.pdf) 에는 문서의 디자인과 조판을 미세 조정하기 위해 탐색할 수 있는 수많은 예제가 포함되어 있습니다.

## 추가 읽을거리

자세한 내용은 다음을 참고하세요:

* [굵게, 기울임꼴 및 밑줄](/latex/ko/latex/03-bold-italics-and-underlining.md)
* [글꼴 크기, 패밀리 및 스타일](/latex/ko/fonts/01-font-sizes-families-and-styles.md)
* [글꼴 서체](/latex/ko/fonts/02-font-typefaces.md)
* [문단 서식](/latex/ko/formatting/04-articles-how-to-change-paragraph-spacing-in-latex.md)
* [줄 바꿈과 빈칸](/latex/ko/formatting/05-line-breaks-and-blank-spaces.md)
* [텍스트 정렬](/latex/ko/formatting/06-text-alignment.md)
* [다단 구성](/latex/ko/formatting/09-multiple-columns.md)
* [대규모 프로젝트에서의 관리](/latex/ko/document-structure/07-management-in-a-large-project.md)
* [다중 파일 LaTeX 프로젝트](/latex/ko/document-structure/08-multi-file-latex-projects.md)
* [국제 언어 지원](/latex/ko/languages/03-international-language-support.md)
* [LaTeX 컴파일러 선택하기](/latex/ko/more-topics/08-choosing-a-latex-compiler.md)
* [Overleaf에 설치된 OTF 및 TTF 글꼴 목록](/latex/ko/questions-and-answers/85-which-otf-or-ttf-fonts-are-supported-via-fontspec.md)
* [Google의 글꼴 컬렉션](http://www.google.com/fonts/)
* [`fontspec` 패키지 매뉴얼](http://tug.ctan.org/tex-archive/macros/latex/contrib/fontspec/fontspec.pdf)


---

# 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/ko/fonts/03-xelatex.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.
