Skip to content

Subsequent show x: set y rules do not override previous ones #351

Closed

Description

@ndtodoroff
#show math.equation: set text(blue)
#show math.equation: set text(red)

$1 + 1 = 2$

This yields a blue equation, not a red equation. set rules do override properly:

#set text(blue)
#set text(red)

$1 + 1 = 2$

This yields a red equation.

The "expanded" form doesn't work either, but the reason is more obvious:

#show math.equation: it => {
  set text(blue)
  it
}
#show math.equation: it => {
  set text(red)
  it
}

$1 + 1 = 2$

This yields a blue equation because this essentially transforms into

#{
  set text(red)
  {
    set text(blue)
    math.equation[1 + 1 = 2]
  }
}

I would expect this behavior but I would not expect the show-set rules to act like this. I also feel like there ought to be a way to override any subsequent show or set rules so that we can force certain stylings. For instance, the current behavior makes it impossible to build off of someone else's template without modifying the code itself if they use show rules.

Activity

  1. changed the title [-]Subsequent `show` rules do not override previous ones[/-] [+]Subsequent `show x: set y` rules do not override previous ones[/+] on Mar 27, 2023
  2. laurmaedje commented on Mar 27, 2023

    @laurmaedje
    Member

    Yeah, that's a somewhat hard-to-fix bug, that I will try to tackle soon.

  3. added
    bug
    styling
    on Apr 1, 2023
  4. Complex2-Liu commented on Oct 15, 2023

    @Complex2-Liu

    Could someone please explain the difference between the "normal" show x: set y rule and the "expanded" form

    #show math.equation: it => {
      set text(blue)
      it
    }
  5. laurmaedje commented on Oct 15, 2023

    @laurmaedje
    Member

    It's pretty much equivalent, which is precisely the problem here.

  6. Phantop commented on Dec 30, 2023

    @Phantop

    Is there any workaround to this besides having to scope things such that the first rule's scope ends before the second?

  7. Andrew15-5 commented on Dec 30, 2023

    @Andrew15-5
    Contributor

    I don't think so, but a hacky way can potentially always exist (meaning that sometime you can't make your way around the limitations even if you try very hard). Everyone is waiting for the v0.11.0 which should go public somewhere in the February 2024. After it a lot of limitations should disappear or they can be fixed very easily (after v0.11.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstyling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions