typst icon indicating copy to clipboard operation
typst copied to clipboard

Paragraph should be able to contain tight lists and block-level equations

Open Enivex opened this issue 1 year ago • 18 comments

Currently, a tight list attaches to the preceding paragraph when there is no whitespace, and a new paragraph is always created after the list.

image

In this case, this behavior is not desirable, because everything here is really part of the same paragraph.

For comparison, the behavior in LaTeX is that the next line is also part of the paragraph (new paragraphs are indented by default) image

unless whitespace is added image

Enivex avatar Jan 16 '24 12:01 Enivex

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.

corvulus-morti avatar Apr 29 '24 19:04 corvulus-morti

I modified the title to reflect that this is a wider issue

Enivex avatar Sep 17 '24 15:09 Enivex

Another example: Figures that are not top or bottom

Enivex avatar Sep 18 '24 14:09 Enivex

I'm not really convinced that a figure really makes sense as part of a paragraph.

laurmaedje avatar Sep 18 '24 15:09 laurmaedje

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.

corvulus-morti avatar Sep 18 '24 17:09 corvulus-morti

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.

laurmaedje avatar Sep 18 '24 18:09 laurmaedje

I'm sorry if I seemed rude in my previous comment. I in no way meant it antagonistically. My apologies!

corvulus-morti avatar Sep 18 '24 19:09 corvulus-morti