Skip to content

Separate show rules for text and math #4137

Closed as not planned
Closed as not planned

Description

@sijow

Description

Sometimes the same element in text vs math is semantically different and it would be helpful to have a show rule apply in text but not in math, or the other way.

Use Case

For example I might want to treat ? as a normal character in math mode to avoid the extra spacing:

Point $P(1, ?)$   // ugly space after the `?`

image

(See #4133 for a discussion of this issue.)

I can fix the spacing with a show rule but that affects it everywhere:

a?b $(1, ?) "x?y"$

#show sym.quest: it => math.class("normal", it)

a?b $(1, ?) "x?y"$

image

(It's not obvious in the image but the position of the first ? in plain text is also subtly changed.)

Another use case was discussed in #2273: #show "L": math.cal, with the proposed workarounds having similar limitations.

Activity

  1. added
    feature request
    on May 15, 2024
  2. PgBiel commented on May 15, 2024

    @PgBiel
    Contributor

    The solution presented at #2273 (comment) would be the way to go, but fully fixing the pitfall at #2273 (reply in thread) would require solving #1125

  3. sijow commented on May 15, 2024

    @sijow
    ContributorAuthor

    In that example:

    #show math.equation: it =>{
      show "L" : math.cal
      it
    }
    
    $
    L "is the Lagrangian."
    $
    

    I don't think #1125 would solve it? As I understand, once #1125 is done the text part will use the normal text font, but it will still be in the scope of the equation so it would still be subject to the show rule.

    I guess it might go unnoticed if math.cal happens to work on normal text without any effect, but e.g. showing the Lagrangian symbol in red for example would also affect the text?

  4. PgBiel commented on May 15, 2024

    @PgBiel
    Contributor

    #1125 would solve it because you'd write show math.var instead of show math.equation

  5. sijow commented on May 15, 2024

    @sijow
    ContributorAuthor

    Ah I see. Would that also apply to the question mark?

  6. PgBiel commented on May 15, 2024

    @PgBiel
    Contributor

    Outside of "quotes", yes, likely.

  7. Enivex commented on May 17, 2024

    @Enivex
    Collaborator

    Duplicate of #254

  8. added
    duplicate
    on May 17, 2024
  9. added
    math
    on May 17, 2024
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

    duplicatefeature requestmath

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions