-
-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Individual footnote formatting and omission of footnote reference #5630
Comments
Hi, I am guessing this is somewhat what you want? Though, you won't be able to style individual footnotes (well, not easily). Code: Override footnote behaviour#set page(height: 200pt)
#let determine-highlight(location, body) = context {
let footnote-counter = counter(footnote).at(location).first()
let fill = none
let transparency = none
let rem = calc.rem(footnote-counter, 5)
if rem == 1 {
fill = blue
transparency = 90%
} else if rem == 2 {
fill = green
transparency = 70%
} else if rem == 3 {
fill = yellow
transparency = 50%
} else {
fill = red
transparency = 30%
}
highlight(fill: fill.transparentize(transparency), extent: 2pt, body)
}
#show footnote: it => {
set text(weight: 900)
determine-highlight(it.location(), it.body)
}
#show footnote.entry: it => {
determine-highlight(it.note.location(), it.note.body)
}
#lorem(5)
#footnote[Highlight one]
#lorem(5)
#footnote[Highlight two]
#lorem(5)
#footnote[Highlight three]
#lorem(5)
#footnote[Highlight four] Which produces the following output: However, instead of hijacking the This makes it much easier to customize the styling for each individual highlight. I'm personally not entirely confident about the way I wrote the page highlights filtering code ( If this was indeed your question, maybe it'd be interesting to continue discussing this on the forum or in the Discord? Code: Custom highlight rendering#set page(height: 80pt)
#let highlight-item(fill: red, body) = [#highlight(fill: fill, extent: 2pt, body) <showcase-highlight>]
#set page(footer-descent: -4pt, footer: context {
let all-highlights = query(selector(<showcase-highlight>).before(here()))
let highlights-on-page = all-highlights.filter(it => it.location().page() == here().page())
set text(size: 0.8em) // Apply custom styling to the highlights in the 'footnote'
highlights-on-page
.map(it => link(it.location(), it)) // Additional example: link back to the highlight in the text
.join(h(1em))
})
#lorem(5)
#highlight-item(fill: blue.transparentize(90%))[Highlight one]
#lorem(5)
#highlight-item(fill: green.transparentize(70%))[Highlight two]
#lorem(5)
#highlight-item(fill: yellow.transparentize(50%))[Highlight three]
#lorem(5)
#highlight-item(fill: red.transparentize(30%))[Highlight four]
#lorem(5)
#highlight-item(fill: purple.transparentize(10%))[Highlight five] |
Description
I am wondering whether the following is possible with typst, whoever is smart and experienced with typst: help is very appreciated!
You may ask why I want that, and I admit it is a bit of a special case. I basically want to highlight particular sections of text with a background color on each page, and for each highlighted section, a footnote entry should be present with the same background color to visually match the main text. I then don't want and need the footnote numbering and therefore want to omit it.
Thank you!
Use Case
My 2 mentioned issues can be useful when having special requirements as outlined above.
The text was updated successfully, but these errors were encountered: