Skip to content

Math font #717

Closed
Closed

Description

@lzhang1994

Thanks for this wonderful package. Is it possible to change the font for mathcal, mathfrak, sum symbol, integral symbol to be the default latex font (Computer Modern) while keep the font for the alphabet and number unchanged?

Activity

  1. cvanelteren commented on May 12, 2026

    @cvanelteren
    Collaborator

    What you’re asking for is partly possible today, but not fully exposed by Matplotlib in a way that UltraPlot can simply toggle with one setting. The easiest place to start is \mathcal, because that already maps through mathtext.cal, while \mathfrak, \sum, and \int appear to be handled deeper inside Matplotlib’s mathtext font machinery rather than through separate public rc parameters. If you’d like to explore this further, this could make a solid PR: a good starting point would be ultraplot/internals/rcsetup.py, where the current mathtext.* defaults are defined, and ultraplot/internals/fonts.py, where UltraPlot already applies a custom mathtext override. From there, a sensible first step would be to document and test the existing \mathcal path in ultraplot/tests/test_fonts.py, then see whether that same override mechanism can be extended safely to cover \mathfrak and possibly operator glyphs as well.

  2. cvanelteren commented on May 12, 2026

    @cvanelteren
    Collaborator

    Note that \mathfrak \sum and \int has no native control from within matplotlib. You can only adjust the family globally.

  3. cvanelteren commented on Jun 29, 2026

    @cvanelteren
    Collaborator
    Image 🥳
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions