From 0a104c9bc39e8155dc9250f572a4f0134fab8200 Mon Sep 17 00:00:00 2001 From: muli Date: Sun, 17 Sep 2017 05:27:51 +0000 Subject: [PATCH] change pdf font --- README.md | 27 +++++++++++++++++++++++++++ conf.py | 2 ++ 2 files changed, 29 insertions(+) diff --git a/README.md b/README.md index 58450d9..0d7ea43 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,30 @@ make html EVAL=0 ``` 但这样生成的html将不含有输出结果。 + +## 编译PDF版本 + +编译pdf版本需要xelatex,和思源字体。在Ubuntu可以这样安装 + +```bash +sudo apt-get install texlive-full +``` + +```bash +wget https://github.com/adobe-fonts/source-han-sans/raw/release/OTF/SourceHanSansHWSC.zip +wget https://github.com/adobe-fonts/source-han-serif/raw/release/OTF/SourceHanSerifSC_EL-M.zip +unzip SourceHanSansHWSC.zip +unzip SourceHanSerifSC_EL-M.zip +sudo mv SourceHanSansHWSC SourceHanSerifSC_EL-M /usr/share/fonts/opentype/ +sudo fc-cache -f -v +``` + +这时候可以通过 `fc-list :lang=zh` 来查看安装的中文字体。 + +然后可以编译了 + +```bash +make latex +cd _build/latex +xelatex -interaction nonstopmode gluon_tutorials_zh.tex +``` diff --git a/conf.py b/conf.py index 58f689e..35dcf1c 100644 --- a/conf.py +++ b/conf.py @@ -232,6 +232,8 @@ latex_elements = { 'babel' : r'''\usepackage[english]{babel}''', 'preamble' : r''' \usepackage{ctex} +\setCJKmainfont{Source Han Serif SC Medium} +\setCJKsansfont{Source Han Sans HW SC} ''', # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', -- GitLab