I am using #highlight[$qty("632.8", "nm")$]
to highlight the quantity. #highlight
works when it is only text, but fails with this one. Only nm
is highlighted. Any pointers to address this will be helpful.
Edit: Title changed.
I am using #highlight[$qty("632.8", "nm")$]
to highlight the quantity. #highlight
works when it is only text, but fails with this one. Only nm
is highlighted. Any pointers to address this will be helpful.
Edit: Title changed.
This is actually not specific to unify, #highlight[$632.8 "nm"$]
shows the same problem.
Could you update your post’s title to reflect that and to better describe your problem? Right now, someone reading your post’s title doesn’t know what the question is going to be about. Adding the math tag would be great, too. Be sure to follow the question guidelines:
Good titles are questions you would ask your friend about Typst.
We hope by adhering to this, we make the information in this forum easy to find in the future. Thanks!
Edited the title. Hope it helps convey the message better.
I’ve edited it some more. It’s now a question, says what the problem with highlighting is, and I added the math tag.
Hi @Anmys, I’m afraid this is a known issue.
And from that thread, a quick workaround:
#let hl(content) = box(
content,
inset: 0.2em,
fill: rgb("#fffe69"),
)
#hl([$632.8 "nm"$])
Edit: This also works with unify:qty
as I understand it was your initial query.
One can also use a show rule instead of a custom function for highlighting:
#show highlight: it => [
#box(
fill: it.fill,
stroke: it.stroke,
radius: it.radius,
outset: 2pt,
inset: 0.2em,
)[#it.body]
]
I recommend using the mannot package for annotating math and equations. The function that corresponds to highlight in particular is ‘markhl’.
Mannot is very good at what it does, and only works for math mode.
Thanks, it works fine.
This is also a nice solution. I do not have to replace highlight
with another function. Thanks.
Wow! Thanks for pointing out that package. It does things way beyond what I wanted currently. I might use some of the features elsewhere.