If you directly implement with Chinese, it will throw error:
! Package inputenc Error: Unicode char \u8: not set up for use with LaTeX. Try running pandoc with –latex-engine=xelatex.Then you should put the following code in the head of the R markdown file:
title: Your File Title
author: Your Name
output:
pdf_document:
latex_engine: xelatex
- Though now it can be implemented, all Chinese disappear. So you should add a new latex file header to the R markdown file using the following code.
title: Your File Title
author: Your Name
outputs:
pdf_document:
includes:
in_header: header.tex
latex_engine: xelatex
- Now I will give you the content of header.tex file, which should be put in the same folder of your R markdown file.
\usepackage{xeCJK}
\setCJKmainfont{HanziPen SC} % Chinses Font
\setmainfont{Georgia}
\setromanfont{Georgia}
\setmonofont{Courier New}