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

Ubuntu环境下Quarto/R Studio渲染PDF时hyphen-brazilian包安装失败的解决求助

解决Quarto渲染PDF时tlmgr找不到hyphen-brazilian的问题

首先,问题的核心原因是TeX Live的包仓库里并没有名为hyphen-brazilian的包——巴西葡萄牙语的断字规则其实包含在hyphen-portuguese这个包里面。加上你已经在Ubuntu系统安装了hyphen-pt-br,可以通过以下几种方案解决:

方案1:修改Quarto YAML配置,指定正确的断字规则

在你的pdf格式配置中,添加hyphenation: portuguese,让LaTeX使用正确的断字包,避免尝试安装不存在的hyphen-brazilian:

format:
  pdf:
    mainfont: Times New Roman
    toc: true
    toc-depth: 2
    toc-title: Sumário
    number-sections: true
    number-depth: 3
    lang: pt-br
    pdf-engine: lualatex
    fig-cap-location: bottom
    highlight-style: github
    hyphenation: portuguese  # 添加这一行

方案2:直接安装TeX Live的官方断字包

打开终端,执行以下命令安装包含巴西葡萄牙语断字规则的hyphen-portuguese包:

tlmgr install hyphen-portuguese

安装完成后,重新渲染你的Quarto文档即可。

方案3:让LaTeX使用Ubuntu系统已安装的断字文件

如果你不想额外安装TeX Live的包,可以让LuaLaTeX直接调用Ubuntu系统中hyphen-pt-br包提供的断字文件。在YAML中添加include-in-header配置,手动指定断字文件路径:

format:
  pdf:
    # 其他配置保持不变
    include-in-header:
      - text: |
          \usepackage{hyphsubst}
          \substitutelanguage{portuguese}{brazilian}
          \hyphenationfile{/usr/share/hyphen/hyph_pt_br.dic}

这个配置会告诉LaTeX使用系统自带的巴西葡萄牙语断字文件,跳过tlmgr的包安装流程。

测试下来,方案1和方案2是最简洁有效的,推荐优先尝试。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.27 12:37:42