Use Korean font in pdf generated from rmarkdown on Windows

yaml

---
mainfont: NanumGothic
output:
  pdf_document: 
    latex_engine: xelatex
---

The mainfont is the LaTex option. The argument is a font family. The exact names of the font family can be found in the fonts folder. Expand the header of the fonts folder. NanumGothic is the exact name of the font family.

The font family should be Editable embedding type (https://docs.microsoft.com/en-us/typography/opentype/spec/os2#fstype).

The LaTex engine should be xelatex.

Let’s use another Korean font on pdf generated by rmarkdown.

You can use Roboto google font with

header-includes:
    - \usepackage[sfdefault]{roboto}
    - \usepackage[T1]{fontenc}
output: 
  pdf_document: 
    latex_engine: pdflatex
mainfont: roboto
Avatar
Jun Kang
Clinical Assistant Professor of Hospital Pathology

My research interests include pathology, oncology and statistics.

Related