I found this script on reddit that allows me to split footnotes and endnotes, but I was wondering how I could render all of my footnotes at the end of the document, instead of on the page?
Hi, original author of the reddit script here. Do I understand correctly that you basically want endnotes, but at the end of the document instead of at the end of every chapter? I’ve modified the script to allow showendnotes() to be called anywhere. If this is the functionality you want, you can add showendnotes() at the end of the document :)
(For completeness, the script is below)
#let allendotes = state("endnotes", ())
#let amt-of-endnotes = counter("amt-of-endnotes")
#let endnote(cnt) = {
amt-of-endnotes.step(level: 2)
context {
allendotes.update(x => x + (cnt + parbreak(),))
let currheading = counter(heading).get().first()
let idx = amt-of-endnotes.get().last()
let num = amt-of-endnotes.get().map(str).join(".") // pseudo-uuid
let in-document = query(selector(label(num))).len() >= 1
if not in-document {
return // showendnote() was not called before last endnotes
}
link(
label(num),
super[#idx]
)
}
}
#let showendnote(name: "Endnotes") = context {
if amt-of-endnotes.get().len() == 1 {
return
}
v(2em)
align(center, heading(level: 2)[#name])
let currheading = counter(heading).get().first()
let (level, amt) = amt-of-endnotes.get()
for idx in range(amt) {
let num = str(level) + "." + str(idx + 1)
super[#(idx + 1)] + [#allendotes.get().at(idx) #label(num)]
}
amt-of-endnotes.step()
allendotes.update(x => ())
}
Hi, no, not at the end of every chapter, as what I need this for is a regular paper that isn’t chaptered. I meant in the sense of making every footnote defined with #footnote() be rendered at the end of the document as if they were endnotes. The point is that I use endnotes/footnotes as a means to remind myself to fix certain wordings sometimes, or to give extra context for claims I’m making. Because of this, many of those footnotes run extra-long and they make reading through the paper complicated. (I’m obviously going to remove a lot of them and shorten them, but while I’m still drafting, I’d like to have a neat way to get them out of the way until I decide what to do with them).
In any case, this script is useful to me, so thank you! I’ve just replaced all instances of #footnote() in my document with #endnote().
But I also wanted to ask if it’s possible to change the color of these endnotes-as-links to something else? I’m also making use of links in my document (which enclose words #link(<link>)[like this]) and it would be nice to be able to differentiate them.
Yes, this is what I meant. Sorry for being unclear ![]()
Yes, if you only want to change the styling of the end(/foot)note links, you can add show/set rules inside the endnote function. That way it is scoped to only apply to endnotes, leaving the styling of links outside unchanged:
#let endnote(cnt) = {
amt-of-endnotes.step(level: 2)
context {
// stuff here
show link: set text(fill: red)
show link: emph
link(
label(num),
super[#idx]
)
}
}