"Font not found" when converting HTML to PDF via pandoc

Viewed 76

I want to convert html to pdf using pandoc, but when I use the cmd to convert, I always get an error.

For example, when I try pandoc C:\Users\Lenovo\Desktop\Pandoc_User's_Guide.html --pdf-engine=xelatex -V CJKmainfont='KaiTi' -o C:\Users\Lenovo\Desktop\Pandoc_User's_Guide.pdf, I get this error:

kpathsea:make_tex: Invalid fontname `'KaiTi'/OT', contains '''
kpathsea:make_tex: Invalid fontname `'KaiTi'/OT', contains '''
Error producing PDF.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "'KaiTi'" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.21     \setCJKmainfont[]{'KaiTi'}

Then I try to change the code, but I still can't get a pdf document. Could who give me some help? PS: I have install tex live 2017 and pandoc2.18 in my computer.

1 Answers

The value of the variable is taken verbatim from the string that follows the equal sign, so -V CJKmainfont='KaiTi' means that CJKmainfont is set to 'KaiTi'. Omit the quotes (-V CJKmainfont=KaiTi) to get the desired value.

Related