polylux icon indicating copy to clipboard operation
polylux copied to clipboard

Layout fails to converge when using `#show later` within bullet points

Open Azorlogh opened this issue 10 months ago • 10 comments

This file fails to converge:

#import "@preview/polylux:0.4.0": *

#slide[
  Hello world
]

#slide[
  - Foo
    #show: later
    - Bar
]

#slide[
  Goodbye
]

Azorlogh avatar Jun 26 '25 10:06 Azorlogh

Can reproduce. Note this only happens if the slide with #show: later is not the last slide in the document.

rmburg avatar Jun 26 '25 10:06 rmburg

Another thing: This goes away if the page following the pause is created with #page[] instead of #slide[]

rmburg avatar Jun 26 '25 10:06 rmburg

Does it go away when - Bar is not indented further than - Foo?

I think #show: later should come with a warning label: "It works when it works but sometimes not." 😅

andreasKroepelin avatar Jun 26 '25 10:06 andreasKroepelin

This also produces the warning (but doesn't hide Bar, as expected):

#slide[
  - Foo#show: later
  - Bar
]

This also produces the warning, if succeeded by another slide:

#slide[
  - Foo#show: later
]

rmburg avatar Jun 26 '25 10:06 rmburg

Note: this is not even specific to lists, as this also produces the warning if succeeded by another slide:

#slide[
  #box[Foo#show: later]
]

rmburg avatar Jun 26 '25 10:06 rmburg

Hmm... I suspect it has to do with #show: later not occurring at the top level of the node tree of a page/slide

andreasKroepelin avatar Jun 26 '25 12:06 andreasKroepelin

Interestingly, simply scoping with #[#show: later] does not cause any issue. Replace that with #box[#show: later] (or #box[#later[]]), and it breaks.

rmburg avatar Jun 26 '25 12:06 rmburg

I did some digging, and found that this block of counter updates

logical-slide.step()
subslide.update(1)
repetitions.update(1)
later-counter.update(0)

in the slide function are executed twice if we have #box[#later[]]. Consequently, the counters are slightly off: logical-slide is one too high, and repetitions is 1 when it should be 2. I'm not sure why this happens or if this is the root cause of this issue.

rmburg avatar Jun 26 '25 13:06 rmburg

Interestingly, simply scoping with #[#show: later] does not cause any issue. Replace that with #box[#show: later] (or #box[#later[]]), and it breaks.

Yeah I think scoping is not introducing a new node.

andreasKroepelin avatar Jun 26 '25 15:06 andreasKroepelin

I did some digging, and found that this block of counter updates

logical-slide.step()
subslide.update(1)
repetitions.update(1)
later-counter.update(0)

in the slide function are executed twice if we have #box[#later[]]. Consequently, the counters are slightly off: logical-slide is one too high, and repetitions is 1 when it should be 2. I'm not sure why this happens or if this is the root cause of this issue.

Huh, that's weird...

andreasKroepelin avatar Jun 26 '25 15:06 andreasKroepelin