You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub Actions中pandoc指定mainfont时报openBinaryFile不存在错误

问题原因

报错核心为YAML配置的参数解析异常:
你在args字段中使用单引号包裹带空格的字体名'Times New Roman'时,GitHub Actions解析YAML配置会自动移除外层的单引号,最终传入pandoc容器的参数会被空格拆分为多个独立字段:-V、mainfont=Times、New、Roman、report.md...
pandoc会把拆分出来的New识别为要转换的输入文件,因此抛出找不到New文件的错误。

解决方法

可选择以下任意一种方案修复:

  • 方案1:单引号包裹整个args字段,内部带空格参数用双引号标注
- uses: docker://pandoc/latex:2.14.1
  with:
    args: '--pdf-engine=xelatex -V mainfont="Times New Roman" report.md -o report.pdf'
  • 方案2:使用数组格式传参(更推荐,完全避免空格解析歧义)
- uses: docker://pandoc/latex:2.14.1
  with:
    args:
      - --pdf-engine=xelatex
      - -V
      - mainfont=Times New Roman
      - report.md
      - -o
      - report.pdf
  • 方案3:字体不存在的替代方案
    如果调整参数后仍报错,可确认pandoc/latex:2.14.1镜像是否预装Times New Roman字体,若未预装可替换为镜像默认带有的Liberation Serif字体,显示效果和Times New Roman基本一致。

内容的提问来源于stack exchange,提问作者jesmart

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.06 22:15:02