How can I restyle the footnotes so that it runs together like the main text instead of each footnote being on a separate line?
here is the current display. However, I want something like
1 footnote1 | footnote 2 | … |footnote n
How can I restyle the footnotes so that it runs together like the main text instead of each footnote being on a separate line?
here is the current display. However, I want something like
1 footnote1 | footnote 2 | … |footnote n
The preview is sadly cached wrongly.
See here:
I am not sure if this is the optimal solution and maybe there is a way easier way to do this.
Code
#set page(
height: auto,
width: 15cm,
margin: auto,
footer: context {
let loc = here()
let notes = query(footnote).filter(n => n.location().page() == loc.page())
if notes.len() > 0 {
set align(left)
set text(size: 8pt)
block(
stroke: (top: 0.5pt + black),
inset: (top: 0.5em),
width: 100%,
notes
.map(n => {
let num = counter(footnote).at(n.location()).first()
super(str(num)) + h(1pt) + n.body
})
.join(" | "),
)
}
},
)
#show footnote.entry: none
#set footnote.entry(
separator: none,
clearance: 0pt,
gap: 0pt,
indent: 0pt,
)
= Page 1
This is some text with a footnote.#footnote[First footnote content.]
Here is another one.#footnote[Second footnote, which might be a bit longer.]
#pagebreak()
= Page 2
New page, new footnotes.#footnote[Third footnote.]
And one more.#footnote[Fourth footnote.]
@Vito0912 beat me to it, and with a better solution too. Here’s another approach using a state to collect all the footnotes and a function that displays them. I copied the idea of using a block to contain the footnotes.
#set footnote.entry(separator: none, gap: 0pt)
#let collected-footnotes = state("collected-footnotes", ())
#let display-footnotes() = {
let footnotes = collected-footnotes.get()
block(
stroke: (top: 0.5pt + black),
inset: (top: 0.5em),
width: 100%,
stack(
dir: ltr,
..footnotes
)
)
collected-footnotes.update(existing => ())
}
#set page(footer: context display-footnotes())
#show footnote.entry: it => {
collected-footnotes.update(existing => existing + (it,))
}
A red fruit#footnote[Apple] is not the same as a yellow fruit#footnote[Lemon].
#pagebreak()
Blue fruits#footnote[Blueberries] are not orange fruits#footnote[Oranges]
Hi, I want to say a very big thanks to you for the swift response.
This seems is very good option, however, there are two problems with this.
@Vito0912 and @gezepi kindly look into this.
Thanks a lot for your time and response once again
Do you have any attempts so far? Any specific questions or problems you’ve run into?
If the answer is
No, I haven’t made an attempt yet
Then these might be good places to begin your search for the solution you seek:
line() function offers more functionality than having a stroke on the block. So add a line before the block, adjust it to your liking, then remove the stroke from the blockfooter parameter of page. It will be some combination of the formatted footnotes and the page number.Good luck and let us know how things go!
I have been able to fix the line issue but not the page numbering.
Any help will be appreciated. Here is the code (modified from @Vito0912 's response
footer: context {
let loc = here()
let notes = query(footnote).filter(n => n.location().page() == loc.page())
if notes.len() > 0 {
set align(left)
set text(size: 7pt)
line(length: 40% + 0pt, stroke: 0.3pt)
block(
// stroke: (top: 0.5pt + black),
inset: (top: 0.5em),
width:100%,
notes
.map(n => {
let num = counter(footnote).at(n.location()).first()
super(str(num)) + h(1pt) + n.body
})
.join(" | ") ,
)
}
},
Nice.
For including the page number, the first thing I thought of was to use a grid. That way the footnotes stay near the bottom of the page.
Speaking of vertical spacing, I removed the inset from the block and added v(0.5em) so that the space is between the content on the page and the line instead of between the line and the footnotes.
Just the ‘footer’ parameter:
grid(
columns: (1fr, auto),
align: (left, right),
//Running footnotes
block(
width:100%,
notes
.map(n => {
let num = counter(footnote).at(n.location()).first()
super(str(num)) + h(1pt) + n.body
})
.join(" | "),
),
//Page number
str(here().page())
)
#set page(
height: auto,
width: 15cm,
margin: auto,
footer: context {
let loc = here()
let notes = query(footnote).filter(n => n.location().page() == loc.page())
if notes.len() > 0 {
set align(left)
set text(size: 7pt)
v(0.5em)
line(length: 40% + 0pt, stroke: 0.3pt)
grid(
columns: (1fr, auto),
align: (left, right),
//Running footnotes
block(
width:100%,
notes
.map(n => {
let num = counter(footnote).at(n.location()).first()
super(str(num)) + h(1pt) + n.body
})
.join(" | "),
),
//Page number
str(here().page())
)
}
},
)
Grid is also the first thing that would come to my mind.
That was also line breaks are handled.
One warning: A grid could mess with readers. So the PDF probably is not fully accessible (but that is also the case for my initial solution)
@gezepi I will update my shared snippet with your solution (might change one or two things). Ofc you will be credited