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

Jupyter nbconvert转PDF报错:Undefined control sequence \HyPsd@expand@utfvii

解决Jupyter Notebook导出PDF时的\HyPsd@expand@utfvii未定义错误

这个错误是LaTeX的hyperref包处理UTF-8字符时的适配问题,在M1芯片Mac上比较常见,以下是实测有效的修复步骤:

  • 安装hyperref相关依赖包,执行命令:
    tlmgr install hyperref hyph-utf8 pdfx
    
  • 手动修改生成的LaTeX文件:
    1. 打开test.tex,在开头添加编码声明:
      \usepackage[utf8]{inputenc}
      \usepackage[T1]{fontenc}
      
    2. 确保hyperref包的加载参数包含unicode:
      \usepackage[unicode]{hyperref}
      
  • 换用xelatex作为PDF编译器,执行导出命令:
    jupyter nbconvert --to pdf --pdf-engine=xelatex test.ipynb
    
  • 如果以上步骤无效,重置TeX Live缓存:
    fmtutil-sys --all
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.06 01:25:18