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 should be able to contain tight lists and block-level equations #3206
change requestA proposal for changes to an existing featuremodelRelated to model category, which is all about structure and semantics.textRelated to the text category, which is all about text handling, shaping, etc.
This is related to how typst handles paragraphs. A list is a different element than a paragraph, so, no matter how many lines are placed between the list and the next piece of content, it will treat the next piece of content as its own paragraph.
A paragraph is only indented if it follows another paragraph (and has first-line-indent != 0 and some alignment stuff). Typst doesn't consider a list a paragraph. Hence, the content that comes after the list will be its own paragraph, and that paragraph will not be indented.
I've forked the repo, because I think the paragraph element is too limited as it is. I'm attempting to change that.
changed the title [-]Interaction between lists and paragraphs[/-][+]Interaction between paragraphs and block elements like lists and equations[/+]on Sep 17, 2024
I'm not really convinced that a figure really makes sense as part of a paragraph.
How sensical you or anyone else thinks it is doesn't matter.
This is a typesetting software.
Disallowing some sort of formatting because it doesn't make sense to someone would be limiting.
A figure is a block of content.
A paragraph is a string of connected ideas.
If one of those ideas is best given as an equation block, code block, figure block, etc., then discriminating between content blocks is limiting to the string of connected ideas used to form the paragraph.
Reacted by Zhewen Mo, aglobalphenomenon, Cierra-Runis, ericpashman, Fabian Löschner, Fabian Bosshard, Mango Feng, tigertang, Filip-FK-Kwiatkowski and Astra Arcane
We don't disallow putting arbitrary stuff in paragraphs, that's what the box function is for. (For what it's worth, HTML does disallow block-level elements in paragraphs.) The question here is how various elements interact when not explicitly boxed --- that's a question of language design and thus it definitely matters what me or anyone else thinks (you obviously believe that it matters what you think after all). If you want to be constructive, you are invited to make your point. But please stay friendly.
Reacted by Aaron Manning, Bastien Voirin, Savio Mak, Dimitri Tabatadze and bb010g
changed the title [-]Interaction between paragraphs and block elements like lists and equations[/-][+]Paragraph should be able to contain tight lists and block-level equations[/+]on Feb 6, 2025
For some people who need a workaround (or maybe it's the only right solution?) :
#setpage(width: 30em)
#setpar(first-line-indent: (amount: 2em, all: true))
#setmath.equation(numbering: "(1.1)")
#lorem(10), for example,
#box[$integral x + y = z $]
shows that the integral of $x + y$ is $z$.
#lorem(20)
Reacted by ARAKI Ryo, Guangxi Liu, Gabriel Dahia, Yoni Katzuv, HPCesia, Kevin Stephen, 34j and bb010g
I tried to use the #box function, but still need to use parbreak when set the justify to be true.
#setpar(justify: true, first-line-indent: (amount:2em, all:true))
#setmath.equation(numbering: "(1.1)")
This is a line
#box($ x_1 + x_2 = x_3 $)
This is a new line
#line(length:100%)
This is a line
\ #box($ x_1 + x_2 = x_3 $)
This is a new line
Reacted by OrangeX4, HPCesia and Dimitri Tabatadze
It still destroys the sematic features by breaking the paragraph before & after. So this does not really solve the problem - we still need a language-level feature for this. Anyhow thanks for the temporal solution <3
At least I think it makes sense to make an equation a part of a paragraph. Simply, I would suggest giving an option to make display equations distinct from block equations, where the former appears as an independent line but act as an inline box, not a block.
Although being a fan of Typst, I don't know that much of Typst's philosophy. So for community is it a good idea to be some sort of compiler options, bring a breaking change, or introduce a settable parameter of math.equation?
Just came across this, the current behavior of equations and lists is pretty bad. I guess manually inserting space is all that's possible at the moment. first-line-indent: (amount: 2em, all: true) actually makes the problem worse since this prevents (at least the visual) look that equations are within the same paragraph completely (without other show rule trickery, which I don't think is worth the hassle).
Block equations might as well be a different case from lists, I guess this is somewhat specific to chinese typesetting and might be considered part of the language support.
Here's an improved version of #3206 (comment) that also supports labeled equations. (Before $ x $ <eq> After has two [ ] after the equation.)
#setpar(first-line-indent: (all: true, amount: 2em))
// This show rule should be put after other show/set rules.#show: rest=> {
letimmediately-after= falseforitinrest.children {
// If this text is immediately after special elements (block equations etc.), compensate the first-line indent.ifimmediately-afterandit.func() ==text {
contexth(-par.first-line-indent.amount)
}
it// If it is a space, consider we are still immediately after.// Notes:// - A single `\n` becomes a spaces, and a space between an equation and a label is still a space.// - Two consecutive `\n` become a parbreak.ifit!= [ ] {
immediately-after=false
}
// Detect special elements.if (
(it.func() ==math.equationandit.block)
orit.func() ==list.itemorit.func() ==enum.item
) {
immediately-after=true
}
}
}
Known limitation: If the text immediately after a special element (a block equation or similar things) starts with strong, link, or anything that makes it.func() ≠ text, then it does not work. Please manually insert a #h(-2em) or #context h(-par.first-line-indent.amount).
It still destroys the sematic features by breaking the paragraph before & after
In addition, the vertical spaces around block equations should be par.leading, but this workaround uses par.spacing.
Block equations might as well be a different case from lists, I guess this is somewhat specific to chinese typesetting and might be considered part of the language support.
I don't understand why chinese typesetting is relevant here? The same problem is present regardless of language.
I don't understand why chinese typesetting is relevant here? The same problem is present regardless of language.
For block equations, I notice in some English materials, the paragraph immediately after a block equation isn't indented even if they are (semantically) a new paragraph, which matches the default behavior of first-line-indent, without all:true, and some English materials don't use first line indents at all.
So while in chinese it's common to distinguish whether the line after the block equations is a new paragraph (if a new paragraph, indent), I thought typesetting in other languages might not enforce such rules, and it won't be a problem if block equations cannot be put into the paragraph, perhaps?
I don't understand why chinese typesetting is relevant here? The same problem is present regardless of language.
For block equations, I notice in some English materials, the paragraph immediately after a block equation isn't indented even if they are (semantically) a new paragraph, which matches the default behavior of first-line-indent, without all:true, and some English materials don't use first line indents at all.
So while in chinese it's common to distinguish whether the line after the block equations is a new paragraph (if a new paragraph, indent), I thought typesetting in other languages might not enforce such rules, and it won't be a problem if block equations cannot be put into the paragraph, perhaps?
I don't think it is specific to Chinese typesetting. By semantics, block equations should be part of a paragraph, and I cannot understand why there would be special rule that the next paragraphs of block equations should not be indented. The most possible cause I guess is that the creators of that materials were unaware.
I randomly open an ACM publication and immediately found they properly distinguish two cases:
Reacted by Y.D.X., Kevin Stephen, Enivex, Dominik Gschwind, OrangeX4, tianyi-smile, Fabian Löschner, Yoni Katzuv, Fabian Bosshard, tigertang and 2 more
I'm not really convinced that a figure really makes sense as part of a paragraph.
You are correct, at least from a semantic point of view. In terms of structural PDF or HTML tagging, it makes no sense to have figures inside of paragraph tags.
The parize package now gives an experimental solution, offering more flexible control over block-level elements and exploring how this paragraph model affects Typst typesetting.
Performance improvements and bug fixes in version 0.2.1
Example One:
Code:
#import"@preview/parize:0.2.1": *#setpage(margin: 1cm, height: auto, width: 25cm)
#setpar(justify: true)
#table(
columns: (1fr, 1fr),
[
#import"@preview/zebraw:0.6.3": *#show: zebraw```typst #import "@preview/parize:0.2.1": * #set par(first-line-indent: (amount: 2em, all: true)) #show strong: set text(fill: red, size: 1.2em) // debug #set block(stroke: red) // debug #show: par-indent.with( include-elem: (heading, math.equation, list, enum, terms, ), // Enable paragraph indentation control for heading, math.equation, list, enum and terms use-par-leading: true, // Enable paragraph spacing control for list, enum and terms ) #set heading(numbering: "1.") = Heading *Indented* #lorem(10) _Equation Test_. #lorem(8) $ a^2 + b^2 = c^2 $ *Unindented* #lorem(10) // This paragraph remains unindented (no parbreak before equation) #lorem(2) $ a^2 + b^2 = c^2 $ *Indented* #lorem(10) _Tight Lists Test_. #lorem(10) + #lorem(2) + #lorem(2) *Unindented and par-leading* #lorem(8) // Unindented with paragraph-leading spacing = Heading *Unindented* #lorem(10) + #lorem(2) + #lorem(2) *Indented* #lorem(10) _Non-tight Lists Test_. #lorem(2) - #lorem(2) - #lorem(2) *Unindented* #lorem(2) // Paragraph following lists without empty line ```
],
[
#showstrong: settext(fill: red, size: 1.2em) // debug#setblock(stroke: red) // debug#setpar(first-line-indent: (amount: 2em, all: true))
#show: par-indent.with(
include-elem: (heading, math.equation, list, enum, terms), // Enable paragraph indentation control for heading, math.equation, list, enum and termsuse-par-leading: true, // Enable paragraph spacing control for list, enum and terms
)
#setheading(numbering: "1.")
= Heading*Indented*#lorem(10)
_Equation Test_. #lorem(8)
$
a^2 + b^2 = c^2
$*Unindented*#lorem(10) // This paragraph remains unindented (no parbreak before equation)#lorem(2)
$
a^2 + b^2 = c^2
$*Indented*#lorem(10)
_Tight Lists Test_. #lorem(10)
+ #lorem(2)
+ #lorem(2)
*Unindented and par-leading*#lorem(8) // Unindented with paragraph-leading spacing = Heading*Unindented*#lorem(10)
+ #lorem(2)
+ #lorem(2)
*Indented*#lorem(10)
_Non-tight Lists Test_. #lorem(2)
- #lorem(2)
- #lorem(2)
*Unindented*#lorem(2) // Paragraph following lists without empty line
],
)
I'm not really convinced that a figure really makes sense as part of a paragraph.
You are correct, at least from a semantic point of view. In terms of structural PDF or HTML tagging, it makes no sense to have figures inside of paragraph tags.
I'm not sure what definition of semantics are being used here, but I agree with the given opinions that figures and math can be part of a paragraph. It's like how you can have a sentence that starts out as regular text and ends as a block level equation---that's still seen as a sentence, in mathy works. In the same vein, a paragraph is "just," "semantically," a bunch of stuff with the same idea (is how I see it). So, figures and math can definitely be part of an idea, just as how they can be part of a sentence.
Reacted by Fabian Löschner, Jakub Nowak, Yoni Katzuv, Kevin Stephen and janq0
I'm not really convinced that a figure really makes sense as part of a paragraph.
You are correct, at least from a semantic point of view. In terms of structural PDF or HTML tagging, it makes no sense to have figures inside of paragraph tags.
I'm not sure what definition of semantics are being used here, but I agree with the given opinions that figures and math can be part of a paragraph. It's like how you can have a sentence that starts out as regular text and ends as a block level equation---that's still seen as a sentence, in mathy works. In the same vein, a paragraph is "just," "semantically," a bunch of stuff with the same idea (is how I see it). So, figures and math can definitely be part of an idea, just as how they can be part of a sentence.
I agree on the math part, since an equation can be a part of a sentence and a paragraph is a collection of sentences in natural language. But I would not include figures into sentences. References to figures do make sense as a part of a sentence.
Having lists and display equation within a single paragraph is extremely common in academic papers and lecture notes. The fact that Typst doesn't natively support this is actually unusual, so let's stop debating whether this feature is necessary and focus on how to implement it.
Currently, a display math block forces the subsequent text into a new paragraph. This happens because Typst treats math blocks and paragraphs differently; inserting a math block essentially splits what should be a single, continuous paragraph. Writing a separate package just to patch the indentation issue feels like a hack. As a typesetting tool, Typst should address this at the language level for better usability—just like LaTeX, where a blank line creates a new paragraph and no blank line keeps the text in the same one. The block itself shouldn't implicitly insert a #parbreak; paragraph breaking should be handled during compilation.
Reacted by Yoni Katzuv, Jakub Nowak, Kevin Stephen, Johannes van den Berg, Cierra-Runis, Dominik Gschwind, Jacob Horak and Satvik Saha
change requestA proposal for changes to an existing featuremodelRelated to model category, which is all about structure and semantics.textRelated to the text category, which is all about text handling, shaping, etc.
Activity
corvulus-morti commentedon Apr 29, 2024
This is related to how typst handles paragraphs. A list is a different element than a paragraph, so, no matter how many lines are placed between the list and the next piece of content, it will treat the next piece of content as its own paragraph.
A paragraph is only indented if it follows another paragraph (and has first-line-indent != 0 and some alignment stuff). Typst doesn't consider a list a paragraph. Hence, the content that comes after the list will be its own paragraph, and that paragraph will not be indented.
I've forked the repo, because I think the paragraph element is too limited as it is. I'm attempting to change that.
[-]Interaction between lists and paragraphs[/-][+]Interaction between paragraphs and block elements like lists and equations[/+]Enivex commentedon Sep 17, 2024
I modified the title to reflect that this is a wider issue
Enivex commentedon Sep 18, 2024
Another example: Figures that are not
toporbottomlaurmaedje commentedon Sep 18, 2024
I'm not really convinced that a figure really makes sense as part of a paragraph.
corvulus-morti commentedon Sep 18, 2024
How sensical you or anyone else thinks it is doesn't matter.
This is a typesetting software.
Disallowing some sort of formatting because it doesn't make sense to someone would be limiting.
A figure is a block of content.
A paragraph is a string of connected ideas.
If one of those ideas is best given as an equation block, code block, figure block, etc., then discriminating between content blocks is limiting to the string of connected ideas used to form the paragraph.
laurmaedje commentedon Sep 18, 2024
We don't disallow putting arbitrary stuff in paragraphs, that's what the
boxfunction is for. (For what it's worth, HTML does disallow block-level elements in paragraphs.) The question here is how various elements interact when not explicitly boxed --- that's a question of language design and thus it definitely matters what me or anyone else thinks (you obviously believe that it matters what you think after all). If you want to be constructive, you are invited to make your point. But please stay friendly.corvulus-morti commentedon Sep 18, 2024
I'm sorry if I seemed rude in my previous comment. I in no way meant it antagonistically. My apologies!
first-line-indentshouldn't apply to all "block" elements #5825 as a duplicate of this issue[-]Interaction between paragraphs and block elements like lists and equations[/-][+]Paragraph should be able to contain tight lists and block-level equations[/+]OrangeX4 commentedon Feb 20, 2025
For some people who need a workaround (or maybe it's the only right solution?) :
Enivex commentedon Feb 22, 2025
Yes, that is probably more or less how "block" equations should've worked in the first place.
Yangchengran commentedon Mar 6, 2025
I tried to use the #box function, but still need to use parbreak when set the justify to be true.
13 remaining items
TheColdPot commentedon Dec 13, 2025
It still destroys the sematic features by breaking the paragraph before & after. So this does not really solve the problem - we still need a language-level feature for this. Anyhow thanks for the temporal solution <3
At least I think it makes sense to make an equation a part of a paragraph. Simply, I would suggest giving an option to make display equations distinct from block equations, where the former appears as an independent line but act as an inline box, not a block.
Although being a fan of Typst, I don't know that much of Typst's philosophy. So for community is it a good idea to be some sort of compiler options, bring a breaking change, or introduce a settable parameter of
math.equation?math.equationstickyness based on new lines #7589 as a duplicate of this issueN3xed commentedon Jan 23, 2026
Just came across this, the current behavior of equations and lists is pretty bad. I guess manually inserting space is all that's possible at the moment.
first-line-indent: (amount: 2em, all: true)actually makes the problem worse since this prevents (at least the visual) look that equations are within the same paragraph completely (without other show rule trickery, which I don't think is worth the hassle).first-line-indentwith block math #7815 as a duplicate of this issuereveperdu commentedon Feb 7, 2026
Block equations might as well be a different case from lists, I guess this is somewhat specific to chinese typesetting and might be considered part of the language support.
YDX-2147483647 commentedon Feb 8, 2026
Here's an improved version of #3206 (comment) that also supports labeled equations. (
Before $ x $ <eq> Afterhas two[ ]after the equation.)Known limitation: If the text immediately after a special element (a block equation or similar things) starts with
strong,link, or anything that makesit.func() ≠ text, then it does not work. Please manually insert a#h(-2em)or#context h(-par.first-line-indent.amount).In addition, the vertical spaces around block equations should be
par.leading, but this workaround usespar.spacing.I agree. See https://gap.zhtyp.top/#indent-after-block.
Enivex commentedon Feb 8, 2026
I don't understand why chinese typesetting is relevant here? The same problem is present regardless of language.
reveperdu commentedon Feb 8, 2026
For block equations, I notice in some English materials, the paragraph immediately after a block equation isn't indented even if they are (semantically) a new paragraph, which matches the default behavior of
first-line-indent, withoutall:true, and some English materials don't use first line indents at all.So while in chinese it's common to distinguish whether the line after the block equations is a new paragraph (if a new paragraph, indent), I thought typesetting in other languages might not enforce such rules, and it won't be a problem if block equations cannot be put into the paragraph, perhaps?
Shuenhoy commentedon Feb 9, 2026
I don't think it is specific to Chinese typesetting. By semantics, block equations should be part of a paragraph, and I cannot understand why there would be special rule that the next paragraphs of block equations should not be indented. The most possible cause I guess is that the creators of that materials were unaware.
I randomly open an ACM publication and immediately found they properly distinguish two cases:

SeSodesa commentedon Feb 18, 2026
You are correct, at least from a semantic point of view. In terms of structural PDF or HTML tagging, it makes no sense to have figures inside of paragraph tags.
tianyi-smile commentedon Apr 30, 2026
The
parizepackage now gives an experimental solution, offering more flexible control over block-level elements and exploring how this paragraph model affects Typst typesetting.Performance improvements and bug fixes in version 0.2.1
Example One:
Code:
Example Two:
Code:
See https://typst.app/universe/package/parize for more configurations.
See ex-in-elems-test.typ for details on using
par-indentwith therectelement when Paragraph Indentation or Paragraph Spacing is enabled.See also inlinable-block.pdf (source) for details on using
par-indentwith custom block-level containers that can be treated as part of a paragraph.wade-cheng commentedon May 16, 2026
I'm not sure what definition of semantics are being used here, but I agree with the given opinions that figures and math can be part of a paragraph. It's like how you can have a sentence that starts out as regular text and ends as a block level equation---that's still seen as a sentence, in mathy works. In the same vein, a paragraph is "just," "semantically," a bunch of stuff with the same idea (is how I see it). So, figures and math can definitely be part of an idea, just as how they can be part of a sentence.
SeSodesa commentedon May 27, 2026
I agree on the math part, since an equation can be a part of a sentence and a paragraph is a collection of sentences in natural language. But I would not include figures into sentences. References to figures do make sense as a part of a sentence.
Keep paragraph continuations after display math unindented
AstraArcane commentedon Aug 27, 2026
Having lists and display equation within a single paragraph is extremely common in academic papers and lecture notes. The fact that Typst doesn't natively support this is actually unusual, so let's stop debating whether this feature is necessary and focus on how to implement it.
Currently, a display math block forces the subsequent text into a new paragraph. This happens because Typst treats math blocks and paragraphs differently; inserting a math block essentially splits what should be a single, continuous paragraph. Writing a separate package just to patch the indentation issue feels like a hack. As a typesetting tool, Typst should address this at the language level for better usability—just like LaTeX, where a blank line creates a new paragraph and no blank line keeps the text in the same one. The block itself shouldn't implicitly insert a
#parbreak; paragraph breaking should be handled during compilation.