I am trying to add a footnote to affiliation
in the YAML block, but got a mixed result:
I am just wondering how to display the footnote correctly?
Here is my full YAML block:
---
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:
name: \- ^[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
---
I can reproduce the issue on my end. The minimal YAML header to reproduce seems to be:
---
title: "How to add a footnote in the YAML block?"
subtitle: "A Question for Stackoverflow"
author: "Yang Hu ^[Retired]"
format: html
---
After changing the format to native
we can see that pandoc renders the author information and the footnote three times in the meta data, for author
, authors
and author-by
.
We can write a little pandoc filter in Lua that removes the first two notes and only accepts the third note and notes after that.
fix_meta_notes.lua
:
notes = 0
return {
{
Note = function (el)
notes = notes + 1
if notes >= 3 then
return el
else
return ""
end
end,
}
}
And this is what the YAML header with another note in the body would look like.
---
title: "How to add footnote in the YAML block?"
subtitle: "A Quesiton for Stackoverflow"
author: "Yang Hu ^[Retired]"
format:
html:
filters:
- fix_meta_notes.lua
---
Something ^[Another Note]