You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Paragraph justification sometimes doesn't use the full page width #5472
#setpage(margin: (left: 3cm, right: 1cm))
#settext(14pt)
#setpar(justify: true)
+ Методология и технология проектирования информационных систем: учебное пособие
\/ Ю. М. Казаков, А. А. Тищенко, А. А. Кузьменко [и др.]. --- Москва: ФЛИНТА,
\2018. --- 136 с. --- ISBN 978-5-9765-4013-2. --- Текст: электронный \//
Электронно-библиотечная система «Лань»: [сайт]. --- URL:
https://e.lanbook.com/book/113460
+ Ипатова, Э. Р. Методологии и технологии системного проектирования информационных
систем: учебное пособие / Э. Р. Ипатова. --- 2-е изд., стер. --- Москва: ФЛИНТА,
\2016. --- 256 с. --- ISBN 978-5-89349-978-0. --- Текст: электронный \//
Электронно-библиотечная система «Лань»: [сайт]. --- URL:
https://e.lanbook.com/book/84356
// + #lorem(24)#v(0cm)
+ https://geekbrains.ru/posts/development_methodology_msf --- Методология MSF
+ http://www.informicus.ru/default.aspx?SECTION=6&id=73&subdivisionid=7 --- Методология
RUP
As soon as I insert + #lorem(24) in the first list, they both become full-width:
I cannot explain why would this ever happen. I never noticed this before, but apparently this behavior is the same for previous versions too. I guess I rarely have 2 lists on the same page.
By definition, the justification stretches the content to the full-width of the page. My only hunch is something to do with non-Latin/Unicode stuff.
Reproduction URL
No response
Operating system
Linux
Typst version
I am using the latest version of Typst
Reacted by Philipp Niedermayer, Andrew Voynov, Matt Bryant, Savio Mak, Rdeisenroth and Sarah Schöttler
In principle they are just auto columns, separate lists are separate grids so they aren't in the same column. The underlying problem has the same cause as the centering equations in lists issue (#529).
However, what isn't clear is why justification isn't requesting the full width. Usually, the text would cause the list to resize to full width due to being too long.
In either case, the fix would be similar as the other issue. You can try to add #h(1fr) at the end of a line in the smaller list (or in both).
Nice! Adding #h(1fr) at the end of the 1st or 2nd item does the trick, thanks.
But now I have a small question: how to avoid the space before # (if it actually affects anything)? Because without it, the URL will have the id h(1fr) (which is an interesting edge case for URL + code mode).
I'm pretty sure the space there doesn't make much of a difference since what comes after it is also a space, but, if it's really necessary, you can write #[https://...]#h(1fr).
However, what isn't clear is why justification isn't requesting the full width. Usually, the text would cause the list to resize to full width due to being too long.
The width is determined as the maximum natural line width after line breaking. So it doesn't necessarily request the full width.
However, what isn't clear is why justification isn't requesting the full width. Usually, the text would cause the list to resize to full width due to being too long.
The width is determined as the maximum natural line width after line breaking. So it doesn't necessarily request the full width.
That's unfortunate, since it'll lead to situations like this, where the margin is uneven
Edit: As far as I can recall, this is not how justification works elsewhere
Just ran into the same issue with figure captions. Here's a reference to a solution that worked in my case if other people stumble upon this issue here the same way I did: #1498 (comment)
(The typo "afull" maximizes the effect, but it is present anyway)
Can confirm, a bit unintuitive since it depends on the way text wraps within the available space. Since, differently from list, I have control over the grid, explicitly setting both column sizes or placing the text inside a width: 100% box fixes it.
I too would not have expected the justify to change the column size, but I can see why it would happen
Ended up here trying to justify figure captions as explained in this post in the typst forum. This used to work in typst 0.12, but is broken since typst 0.13.
typst 0.12
typst 0.13
#setpage(width: 250pt, height: auto, margin: 10pt)
#letcaption= "This is an example caption which is veeeeeeeeeeery long"
Default, no justification:
#showfigure.caption: it=> {
setalign(left)
box(width: 230pt, fill: yellow, it) // see https://forum.typst.app/t//1714/4
}
#figure(none, caption: caption)
With justification in typst #sys.version:
#showfigure.caption: setpar(justify: true)
#figure(none, caption: caption)
EDIT: Interestingly, it can be worked around by replacing it (the caption) inside the box with the plain content context[#it.supplement #it.counter.display()#it.separator#it.body]
Activity
Enivex commentedon Nov 26, 2024
I suspect that this may be a duplicate of #5449 ? The issues seem very similar
Andrew15-5 commentedon Nov 26, 2024
It's not a regression, so I doubt that.
laurmaedje commentedon Nov 26, 2024
Probably the list (which is laid out as a grid) has shrink-to-fit semantics from the grid.
Andrew15-5 commentedon Nov 26, 2024
But I don't know any field that does that, which means there is no workaround? Without completely rewriting the list show rule in Typst.
https://typst.app/docs/reference/layout/grid/
PgBiel commentedon Nov 26, 2024
In principle they are just auto columns, separate lists are separate grids so they aren't in the same column. The underlying problem has the same cause as the centering equations in lists issue (#529).
However, what isn't clear is why justification isn't requesting the full width. Usually, the text would cause the list to resize to full width due to being too long.
In either case, the fix would be similar as the other issue. You can try to add
#h(1fr)at the end of a line in the smaller list (or in both).Andrew15-5 commentedon Nov 26, 2024
Nice! Adding
#h(1fr)at the end of the 1st or 2nd item does the trick, thanks.But now I have a small question: how to avoid the space before
#(if it actually affects anything)? Because without it, the URL will have the idh(1fr)(which is an interesting edge case for URL + code mode).PgBiel commentedon Nov 26, 2024
I'm pretty sure the space there doesn't make much of a difference since what comes after it is also a space, but, if it's really necessary, you can write
#[https://...]#h(1fr).laurmaedje commentedon Nov 27, 2024
The width is determined as the maximum natural line width after line breaking. So it doesn't necessarily request the full width.
Enivex commentedon Nov 27, 2024
That's unfortunate, since it'll lead to situations like this, where the margin is uneven
Edit: As far as I can recall, this is not how justification works elsewhere
laurmaedje commentedon Nov 27, 2024
It's only in blocks with shrink-to-fit behaviour.
Enivex commentedon Nov 27, 2024
How do I know if a given block has that kind of behavior?
See also #5479
laurmaedje commentedon Nov 27, 2024
All non-fixed-size blocks have that.
sonovice commentedon Jan 24, 2025
Just ran into the same issue with figure captions. Here's a reference to a solution that worked in my case if other people stumble upon this issue here the same way I did: #1498 (comment)
pollomarzo commentedon Feb 21, 2025
Ended up here while using a grid layout with an auto column:
grid( columns: (35%, auto), column-gutter: 5pt, { text("left side")}, {box(<text>, stroke:(right:black))} )(The typo "afull" maximizes the effect, but it is present anyway)
Can confirm, a bit unintuitive since it depends on the way text wraps within the available space. Since, differently from list, I have control over the grid, explicitly setting both column sizes or placing the text inside a
width: 100%box fixes it.I too would not have expected the
justifyto change the column size, but I can see why it would happenlaurmaedje commentedon Feb 21, 2025
For a grid specifically, it's best to not create a box or block at all and instead use
grid.cell:Gravitonic commentedon Mar 7, 2025
I ran into this issue with some long headings. A simple reproduction:
The increased margins make the effect clearer but it seems to be present even with default margins/a wider text area generally.
eltos commentedon Mar 17, 2025
Ended up here trying to justify figure captions as explained in this post in the typst forum. This used to work in typst 0.12, but is broken since typst 0.13.
EDIT: Interestingly, it can be worked around by replacing
it(the caption) inside the box with the plain contentcontext[#it.supplement #it.counter.display()#it.separator#it.body]Andrew15-5 commentedon Mar 17, 2025
I literally hit the same issue yesterday. And I wasn't able to make the caption stretch, even with
#h(1fr). I assume it's a different bug.autowidth does not take 100% width of the page when containing justified text #6545 as a duplicate of this issue