You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
here is the modified code. Note that there are two changes.
The first is "-V CJKmainfont=STSong", due to my system is windows. The second is "cmd = "pandoc "{}" -o "{}" --pdf-engine=xelatex -V CJKmainfont=STSong ".format(md_file, pdf_file)", change the '{}' to \"{}\" and delete the template order(because I don't care about the layout problem).
And I add a few debug code, neglect it. Also there are chinese annotations, I don't want to translate, neglect it again.
`from pathlib import Path
import os
work_dir = Path.cwd()
export_pdf_dir = work_dir / 'pdf'
if not export_pdf_dir.exists():
export_pdf_dir.mkdir()
for md_file in list(work_dir.glob('*.md')):
md_file_name = md_file.name
pdf_file_name = md_file_name.replace('.md', '.pdf')
pdf_file = export_pdf_dir / pdf_file_name
# STSong 或者 "STSong"是有效的,'STSong'是无效的,选择电脑内置的有效字体(通过命令fc-list :lang=zh查看)
cmd = "pandoc\ "{}\" -o\"{}\" --pdf-engine=xelatex -V CJKmainfont=STSong ".format(md_file, pdf_file)
result = os.system(cmd)
# 测试是否成功
if result != 0:
print(f"fail!!")
else:
print(f"success!!")`
No description provided.
The text was updated successfully, but these errors were encountered: