typst: Center alignment broken in lists

Not sure if this a bug or actually an expected behavior. It seems the width of a numbered list is not always 100% but instead restricted to the maximum width of its lines.

Therefore, if you don’t have a long (>=100%) line in a numbered list, your math blocks in that list will not be placed at the horizontal center of the page. These math blocks are instead centered relative to the the parent numbered list. This is some what conterintuitive (at least from a previous LaTeX user’s perspective).

With a long line: Without a long line: To reproduce:

= Question 1

+ #set enum(numbering: "(a)")
  + The constructed sequent is given as follows:
    $ q arrow p, r arrow not p, q and r tack.long ((p and q) arrow not r) or ((p and r) arrow not q) $
    //The constructed sequent has assumptions $X={A_1,A_2,A_3}$ and a conclusion $C$ where:
    Without the long line:
    $ A_1 &= q arrow p\
      A_2 &= r arrow not p\
      A_3 &= q and r\
      C space &= ((p and q) arrow not r) or ((p and r) arrow not q)
    $

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 8
  • Comments: 16 (10 by maintainers)

Most upvoted comments

Should we make enum and list’s width 100% by default?

Then you can’t have a list in an automatically sized block anymore.

That would break lists in automatically sized containers.

Can we use width as a parameter of list to meet the both?

The top one. Sorry I was on my phone and too lazy to quote.

Wrapping the list with box(width: 100%, ...) didn’t work for me, I had to wrap the equations in a box and set alignment to center:

#show math.equation.where(block: true): e => [
    #box(width: 100%, inset: 0em, [
        #set align(center)
        #e
    ])
]

I find that this will make the following content a new paragraph, maybe use #block to replace #box is better.

Wrapping the list with box(width: 100%, ...) didn’t work for me, I had to wrap the equations in a box and set alignment to center:

#show math.equation.where(block: true): e => [
    #box(width: 100%, inset: 0em, [
        #set align(center)
        #e
    ])
]