如何在Quarto文档的YAML块中正确添加脚注?
在Quarto YAML块中正确添加作者机构脚注的方法
你遇到的异常情况:
- 脚注显示与跳转功能正常,但底部脚注区域出现3条重复项
- 脚注编号从3而非1开始
问题原因
你当前写法中的\- ^[Retired]存在格式干扰:多余的\-会打乱Quarto对YAML内容的解析逻辑,导致脚注被重复渲染,同时破坏了脚注的编号序列。
解决方案
直接在机构名称中嵌入脚注标记即可,无需额外转义符号或列表标记,保持YAML结构简洁:
修正后的完整YAML块
--- title: "How to add footnote in the YAML block?" subtitle: "A Quesiton for Stackoverflow<br>" date: today published-title: "LAST UPDATED" affiliation-title: "TEAMS" author: - name: "Yang Hu" affiliation: "Retired^[Retired]" execute: freeze: auto toc: true toc-title: "Contents" toc-location: "left" toc-depth: 4 format: html: embed-resources: true self-contained: true smooth-scroll: true link-external-newwindow: true code-overflow: scroll code-fold: show code-line-numbers: true code-tools: true grid: sidebar-width: 268px body-width: 800px margin-width: 320px number-sections: false code-annotations: hover reference-location: document ---
扩展写法(若需区分机构名与脚注说明)
如果需要明确机构名称并附加脚注说明,可调整为:
author: - name: "Yang Hu" affiliation: "XX团队^[该成员已退休]"
补充说明
Quarto支持在YAML的author块中直接使用Markdown脚注语法,只要用引号包裹内容避免YAML解析错误,就不会出现重复渲染或编号异常的问题。
内容的提问来源于stack exchange,提问作者Grasshopper_NZ
相关产品推荐
相关产品推荐

