-
-
Notifications
You must be signed in to change notification settings - Fork 797
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
Improve layout of multi-line headings #2410
Comments
The stack solution doesn't work correctly at the moment because a horizontal stack, in contrast to a grid, doesn't correctly size its children to fit the width. This means that the body will overflow into the right margin. This should be fixed. |
Isn't this largely a matter of personal preference, and something that would vary from template to template? I'm honestly not a fan of having text aligned to a different vertical line than the margin. That being said, I would never choose titles this long in the first place. |
For now, you can use: #show heading: it => if it.numbering != none {
grid(columns: 2, gutter: 0.3em, counter(heading).display(it.numbering), it.body)
} else {
it.body
} Which is faithful to the default show rule. A similar thing can be done for |
It may be a matter of personal preference, or it may be a matter of (corporate/academic) style guidelines. So I agree that this should be configurable; I wasn't trying to imply that the way LaTeX or Word are doing it is the only correct one.
Not even in bullet lists? I think that aligning the text to the right of the bullets is by far the most common layout here. An outline (cf. #2411) seems pretty similar to a (nested) numbered list, and many authors are also applying that layout to the headings themselves.
This, too, would probably depend on the context. A very quick survey of some textbooks and technical documentation within my reach indicates that titles which exceed the length of a line aren't terribly uncommon. |
Hey! Big Typst fan here - thank you all for your tremendous work. I would love to help the project and contribute. After looking a bit around the codebase my first idea was to solve it using the same technique applied by the Thank you! |
Go ahead and implement it, I think it's a better default than the current solution. We don't lose any flexibility so this should be fine. It comes down to laurenz if it will be accepted. |
Solved by #3459 |
Example document:
Result (Typst 0.8):
It seems like this could be improved by aligning subsequent lines with the text of the first line, not with the number
This is how LaTeX renders the same thing:
And MS Word 2016:
See also #2411 (similar issue, but for the outline instead of the heading)
The text was updated successfully, but these errors were encountered: