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
Wrap text around image with an irregular paragraph shape #5181
feature requestNew feature or requestlayoutRelated to the layout category, which is about composing, positioning, etc.textRelated to the text category, which is all about text handling, shaping, etc.
Very important feature request for the future of typst, I think.
I think #553 was closed prematurely, as the discussion within expressed numerous ideas about a more flexible floating placement system, and what was implemented for 0.12, while great, didn't fully fulfill the needs expressed in the issue, even those precisely scoped by its title, like 3 column layouts with 2 column span floating elements, a very common layout in magazines, newsletters and such.
The more flexible text placement required by this issue would perhaps allow for an easier implementation of the ideas expressed in #553.
The FOSS page layout design software Scribus already does this kind of text placement and its source code could be an inspiration for a typst implementation.
Wrapping text around shapes is definitely planned.
Regarding #553: I think it was the right decision to close it because it was the canonical issue for two column figures and that's what most of the >150 people that upvoted it wanted.
Yes, there were more requests in that issue, but it was not actionable as one work item. These other things are better served with separate issues like this one here.
Reacted by buzzqw, Alex Todoran, Josh Pollock, glatavento, Marco Bulgarelli, Rolf Leggewie, domo-domino-desu, Matthias Kunnen, Ludwig Austermann, maya and 1 more
Reacted by Roger Herikstad, akoll, Quint Guvernator, Marcel, glatavento, Marco Bulgarelli and Alex ANDRÉ
Thought it was worth mentioning that this issue was briefly discussed on the Typst Sub-Reddit in which u/NeuralFantasy was trying to get an output found on this repository. (Image below)
I have also discussed similar functionality with insetting text on my own package. It was mentioned above.
Reacted by fredericjs, Sean Clayton, glatavento, tianyi-smile, Andrzej Wąsowski, Sam Maloney, Sergei Zharinov, Marco Bulgarelli, Tim DuBois, Andonome and 1 more
We're evaluating Typst to replace Apache FOP in our customer communications platform. While Typst dramatically outperforms FOP for standard layouts (<50ms vs 200ms), the current plugin-based text wrapping solutions work well but have a critical performance gap which will prevent us from using Typst:
Benchmark: Newsletter with masthead column
Apache FOP: ~200ms
Typst (no wrap): <50ms (FASTER)
Meander plugin: ~500ms (SLOWER)
Wrap-it plugin: ~1200ms (SLOWER)
Root Cause: Plugins operate in the script layer and repeatedly invoke Typst's layout engine for measurements. They can't access internal optimizations like comemo caching.
Proposed Solution
Implement native text flow using Typst's relayout-based architecture:
1. Region Cutout System
Extend regions to support rectangular exclusion zones that reduce available width at specific vertical positions:
@jrhaywardtdsc This topic is unfortunately not suitable for contribution by a new contributor. It's a very complex topic and could only be tackled by a team member or contributor that has built significant trust. The fact that the description is AI-written also doesn't inspire confidence in the proposal.
If your team would like to contribute, I would suggest working on something smaller first. If you're using Typst commercially, we also always appreciate monetary contributions.
Reacted by Orjan Ameye, F.X.P., Robert Thalheim, Vadim, TechnicJelle, Kevin Bonham, JL710, max397574, Andreas Ellwanger, maya and 7 more
Reacted by Kevin Bonham, esarver, Steffen Uhlig, Alexander DiCaprio and Jens Bannmann
I got another problem that might be worth considering for some eventual implementation.
For touying's fit-to-height, we now implemented some much too basic reflow to allow text that will get scaled down to still occupy the full width. The idea is you call fit-to-height(1fr)[#lorem(50)] and have some big stuff above on the slide, and the content given will shrink to fit the remaining height. For blocks its easy, but text is a whole different story, and i really don't want to go ahead and measure individual words to get near-perfect scaling factors while also allowing reflow and going through tens or hundreds of opt steps.
I am not familiar with what any solution to such a problem would look like if done right, but perhaps it's worth considering such use cases.
For what it's worth, meander and droplet are wonderful, but have nonzero issues from being usermode code, such that I just decide to avoid wrapping in Typst at all. (I feel a bit awkward giving this negative criticism, but it hasn't been brought up in the discussion chain yet---just wanted to provide the point!) Eagerly awaiting this feature ^^
feature requestNew feature or requestlayoutRelated to the layout category, which is about composing, positioning, etc.textRelated to the text category, which is all about text handling, shaping, etc.
Activity
DorianBourgeoisat commentedon Oct 23, 2024
Very important feature request for the future of typst, I think.
I think #553 was closed prematurely, as the discussion within expressed numerous ideas about a more flexible floating placement system, and what was implemented for 0.12, while great, didn't fully fulfill the needs expressed in the issue, even those precisely scoped by its title, like 3 column layouts with 2 column span floating elements, a very common layout in magazines, newsletters and such.
The more flexible text placement required by this issue would perhaps allow for an easier implementation of the ideas expressed in #553.
The FOSS page layout design software Scribus already does this kind of text placement and its source code could be an inspiration for a typst implementation.
laurmaedje commentedon Oct 23, 2024
Wrapping text around shapes is definitely planned.
Regarding #553: I think it was the right decision to close it because it was the canonical issue for two column figures and that's what most of the >150 people that upvoted it wanted.
Yes, there were more requests in that issue, but it was not actionable as one work item. These other things are better served with separate issues like this one here.
jdpieck commentedon Feb 16, 2025
Thought it was worth mentioning that this issue was briefly discussed on the Typst Sub-Reddit in which u/NeuralFantasy was trying to get an output found on this repository. (Image below)
This functionality was also discussed in this comment on the original issue #553 by @Andonome, but got lost in the thread. Below is the main image of interest.
I have also discussed similar functionality with insetting text on my own package. It was mentioned above.
Reproduce in part the (in)famous test case from #5181
Reproduce #5181 example 2
Reproduce talmudifier example
jrhaywardtdsc commentedon Jan 23, 2026
Proposal: Native Text Flow Implementation
Hi! I'd like to propose implementing native text-flow support in Typst to address this issue. We've done extensive research and are prepared to contribute the implementation. We believe our approach conforms to the ideas presented in @laurmaedje 's blog on layout models. https://laurmaedje.github.io/posts/layout-models/.
The Performance Problem
We're evaluating Typst to replace Apache FOP in our customer communications platform. While Typst dramatically outperforms FOP for standard layouts (<50ms vs 200ms), the current plugin-based text wrapping solutions work well but have a critical performance gap which will prevent us from using Typst:
Benchmark: Newsletter with masthead column
Root Cause: Plugins operate in the script layer and repeatedly invoke Typst's layout engine for measurements. They can't access internal optimizations like
comemocaching.Proposed Solution
Implement native text flow using Typst's relayout-based architecture:
1. Region Cutout System
Extend regions to support rectangular exclusion zones that reduce available width at specific vertical positions:
2. Variable-Width Line Breaking
Modify Knuth-Plass to accept a width function instead of fixed width:
This allows different line widths at different vertical positions while maintaining Knuth-Plass optimization.
3. User-Facing API
4. Relayout Integration
Uses existing
Stop::Relayoutmechanism - layout wrap content, create cutouts, trigger relayout for paragraphs to use cutouts. Converges in 2-3 iterations.Implementation Plan
Phased approach with independent PRs:
This Approach:
Research Done:
typst-layout,typst-library)comemointegrationSecurity Considerations
We're mindful of security implications including:
Implementation will follow Typst's existing security patterns and include comprehensive edge-case testing.
Feedback
Before implementing, would appreciate maintainer input on:
wrap/mastheadAPIs appropriate?We're committed to implementing this if the approach fits Typst's vision. The issue has 67 positive reactions showing strong community demand.
About us: Team behind INTOUCH, a CCM platform migrating from Apache FOP to Typst. Happy to contribute back!
Full technical specification available if helpful. Happy to discuss details, provide benchmarks, or clarify anything!
omentic commentedon Jan 23, 2026
I think this comment was written by generative AI.
laurmaedje commentedon Jan 23, 2026
@jrhaywardtdsc This topic is unfortunately not suitable for contribution by a new contributor. It's a very complex topic and could only be tackled by a team member or contributor that has built significant trust. The fact that the description is AI-written also doesn't inspire confidence in the proposal.
If your team would like to contribute, I would suggest working on something smaller first. If you're using Typst commercially, we also always appreciate monetary contributions.
oxidebits commentedon Mar 10, 2026
What's the status of this issue?
Jumped from here : https://www.reddit.com/r/typst/s/41s99MIh9u
torsteinnh commentedon Mar 10, 2026
I don't know about the implementation for this issue, but the meander package can work as a stopgap while waiting for a permanent solution: https://typst.app/universe/package/meander/
I hope we get something in the compiler eventually to avoid the need for hundreds of packages like in LaTeX, but it does the job quite well for now.
zral0kh commentedon Apr 3, 2026
I got another problem that might be worth considering for some eventual implementation.
For touying's
fit-to-height, we now implemented some much too basic reflow to allow text that will get scaled down to still occupy the full width. The idea is you callfit-to-height(1fr)[#lorem(50)]and have some big stuff above on the slide, and the content given will shrink to fit the remaining height. For blocks its easy, but text is a whole different story, and i really don't want to go ahead and measure individual words to get near-perfect scaling factors while also allowing reflow and going through tens or hundreds of opt steps.I am not familiar with what any solution to such a problem would look like if done right, but perhaps it's worth considering such use cases.
wade-cheng commentedon Jun 22, 2026
For what it's worth,
meanderanddropletare wonderful, but have nonzero issues from being usermode code, such that I just decide to avoid wrapping in Typst at all. (I feel a bit awkward giving this negative criticism, but it hasn't been brought up in the discussion chain yet---just wanted to provide the point!) Eagerly awaiting this feature ^^roopeshor commentedon Oct 7, 2026
Any plans to implement this? Would be highly useful if implemented in engine itself