Quarto生成PDF无法正常显示中文的问题
今天在尝试使用Quarto写文档,发现当有中文时,无法正常显示:
---
title: "中文PDF文档"
author: "作者姓名"
format: pdf
documentclass: article
---
## 中文内容测试这里是中文内容## QuartoQuarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.render之后效果如下,缺失了中文内容

完全没有显示中文
解决方案
方案1
- 将文档类型修改为html--- title: "中文PDF文档" author: "作者姓名" format: html ---
- rendor后即可正常输出,之后可以使用html转换为pdf
  
方案2
- 
请教了deepseek并测试了几种方法,发现可以修改yaml文件如下(我另外加入了控制边距的geometry声明) --- title: "中文PDF文档" author: "作者姓名" format: pdf documentclass: article header-includes:- \usepackage[UTF8]{ctex} pdf-engine: xelatex geometry:- left=2.5cm- right=2.5cm- top=2.5cm- bottom=2.5cm ---
- 
即可正常显示中文,效果如下 
  
写在后边的tips
- 
可以在yaml文件中声明使用visual mode, 个人觉得这样更方便预览效果 editor: visual
- 
在空白处键入 /即可插入cell
  
