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

Quarto生成PDF时机构信息重复问题及解决方法咨询

解决Quarto PDF作者机构重复显示问题

1. 调整YAML元数据,统一管理机构

把机构信息从作者条目里抽出来,放到顶层的affiliations字段中,让多个作者引用同一个机构ID,避免重复定义:

---
title: "Hey!"
# 顶层定义所有机构,每个机构配唯一ID
affiliations:
  - id: univ_birds
    name: University of Birds
author:
  - name: Birdy Bird
    affiliations: [univ_birds]  # 引用同一机构ID
  - name: None
    affiliations: [univ_birds]
format: 
  pdf:
    keep-tex: true
    template-partials: 
      - title.tex
    include-in-header:
      text: |
        \usepackage[noblocks]{authblk}
        \renewcommand*{\Authsep}{, }
        \renewcommand*{\Authand}{, }
        \renewcommand*{\Authands}{, }
        \renewcommand\Affilfont{\small}
---

2. 修改title.tex模板,确保机构仅输出一次

替换原模板内容为以下代码,先输出带机构上标的作者,再输出所有唯一机构:

$if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
$endif$

$if(subtitle)$
\subtitle{$subtitle$}
$endif$

$for(by-author)$
\author[$for(by-author.affiliations)$$it.number$$sep$,$endfor$]{$by-author.name.literal$}
$endfor$

$for(affiliations)$
\affil[$it.number$]{$it.name$}
$endfor$

$if(date)$
\date{$date$}
$else$
\date{}
$endif$

效果说明

  • 顶层定义的机构会被Quarto自动分配唯一数字编号,多个作者引用同一机构时,上标编号完全一致。
  • 模板仅遍历输出一次所有机构,彻底解决重复显示问题,最终两个作者名字带相同上标,机构只出现一次。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 07:52:48