Centering fletcher diagram in an enum

I’m having some trouble getting my fletcher diagram to center when it’s inside of an enum:

#import "@preview/fletcher:0.5.8" as fletcher: diagram, node, edge

#let graph = diagram(
  node-shape: circle,
  node-stroke: black,
  $
    W_0 edge(->) &
    W_1 edge(->) &
    W_2 edge(->) &
    W_3
  $
)

// Outside enum works fine
#align(center, graph)

+
  // This doesn't work
  #align(center, graph)

When outside of the enum, the graph appears centered as expected, but when in the enum, the alignment seems to have no effect:

The thing to do is:

- #block(width: 100%, align(center, graph))

The reason is that enum items aren’t naturally full width. You see the same thing with block equations too.

For example:

- This is not full width.
- $ a^2 + b^2 $

This paragraph is longer than the enum items.

I’ve always thought this was strange behaviour of enum and list. Maybe someone else can comment on the reasoning behind it.

2 Likes

There is an open issue #529 about it. From quickly skimming the comments there, it seems like a proper fix is a bit more involved than simply setting the list/enum widths to 100%.

1 Like