-
I used the #block tag but it adjust to full line, how to have background-color only for a specific phrase? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
Use
|
Beta Was this translation helpful? Give feedback.
-
Tried: Too bad it's a box, it's not related to the text and does not stop at the text end. |
Beta Was this translation helpful? Give feedback.
-
Tried it now! The result is the expected but text changes all spacing. The better approximation was #[
#show regex(".*"): box.with(fill: red)
#show " ": box.with(fill: red, width: 2.7pt)
#lorem(30)
] |
Beta Was this translation helpful? Give feedback.
-
Just to note, found the point why the text changes so much, my For further tests use: set text(size: 12pt, hyphenate: true)
#[
#show regex(".*"): box.with(fill: red)
#show " ": box.with(fill: red, width: 2.7pt)
#lorem(30)
] |
Beta Was this translation helpful? Give feedback.
Oh, I see what you mean - you want background that adjusts to the text. Right now this isn't natively supported, but here's a rough hack:
(Places every word - or, otherwise, character - in an individually filled box, with a special case for space (a box with just a space and auto width is automatically collapsed))
This should get better in the future - please open a feature request issue for this.