- 系统:macOs Sierra 10.12.6
安装
得到xelatex路径:
/Library/TeX/texbin/xelatex
常用命令
- markdown、html生成pdf
//test.md为你需要转换的markdown或html文件
$:pandoc test.md --latex-engine=/Library/TeX/texbin/xelatex -V CJKmainfont='STHeitiSC-Light' -o example13.pdf
- md->html
$pandoc -f markdown -t html -o demo.html demo.md
- 章节标题生成超文本书签(--toc)(带书签PDF)
$ pandoc -N -s --toc --smart --latex-engine=/Library/TeX/texbin/xelatex -V CJKmainfont='PingFang SC' -V mainfont='Monaco' -V geometry:margin=1in test.md -o output.pdf
//**注意事项,中文显示需要在命令中指定字体(CJKmainfont),使用字体的PostScript 名称**
PostScript查看方式:在mac 字体册 应用中查看,如下图:
生成的pdf预览:
参考https://www.zhihu.com/question/20849824
参考https://www.zhihu.com/question/22906637/answer/32816910