-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
Can't use over-/underline() with any space symbol or h() #1716
Comments
My current workaround is: #let H(n) = {
for value in range(n) {
sym.space.hair
}
// I think I can write endless number of '0's, but the number must be more than '0.0'
h(0.000000000000000000000000000000001pt)
}
#box[some text #underline[#H(1000)]] // Add n spaces to fill the whole line I don't know why having P.S. I should try and use table, I think I can simplify this. |
Try using this: Text or no text #box(width: 1fr, stroke: (bottom: 0.5pt), none) or Text or no text #box(width: 1fr, line(length: 100%, stroke: 0.5pt))
|
// #set box(outset: (bottom: 1.29pt))
Text or no text #underline[test]#box(width: 1fr, stroke: (bottom: 0.5pt))
Text or no text #underline[test]#box(width: 1fr, line(length: 100%, stroke: 0.5pt)) This solution is much better than mine, but it still tries to mimic the "underline until EOL". Typst was created to be more intuitive than LaTeX, you can create documents faster. And the fact that Also, there can be default or custom settings for One more thing. The underline stroke thickness is determined by the font? W-why is that? In the example above, the fake stroke is a bit thicker than the real one: This is a different topic, but this makes it more difficult to use above workarounds. Sure, you can set underline thickness to |
I think this is a more universal version and all underlines (real/artificial) are on the same level (and have the same thickness). #let underline-thickness = 0.5pt
#let underline-offset = 1pt
#set underline(stroke: underline-thickness, offset: underline-offset)
// Underline box
#let ubox(..box_args) = box(
width: 1fr,
stroke: (bottom: underline-thickness),
outset: (bottom: underline-offset),
..box_args,
) You can (re)define any |
I forgot to mention that this is the one most heavily used thing in blanks/forms making. Whenever I need to make a form with/without filling in information/details, I have to import a whole bag of hacky underline functions that otherwise would be much simpler/slimmer if |
I have made a workaround helper today, hopefully useful for you: #let long-underline(left: 0, right: 0, stroke: black, fake-text: "a ", content, ..args) = {
let lspace(n) = {
set text(fill: rgb("00000000"))
underline(stroke: stroke, evade: false, fake-text * n, ..args)
}
if left > 0 {
lspace(left)
}
underline(..args, content)
if right > 0 {
lspace(right)
}
} Usage: |
Description
I need to extend underline to the end of the line like this:
But neither
#underline(h(100%))
(or1fr
) nor#underline(sym.space)
is working. I didn't find any of the settings that can replicate the same behavior, and#line()
ignores any text + it is drawn automatically on the next line (not inline).I consider this a bug, since it should work in theory, and it does work in LaTeX.
Reproduction URL
No response
Operating system
Linux
Typst version
The text was updated successfully, but these errors were encountered: