Skip to content

Nested math mode: \text{x\(_2\)} #431

Open

Description

@tmke8

It would result in two <mtext> that are split at the point where we switched to math mode.

Supporting only \(...\) as the delimiters seems much easier than supporting $...$.

Activity

  1. tmke8 commented on Nov 26, 2025

    @tmke8
    OwnerAuthor

    One possible approach: introduce new tokens for \( and \) (Token::MathOpen and Token::MathClose or something) and then once the text-mode parser encounters this, it calls parse_sequence() with Token::MathClose as the end token.

    I think this can work because the text-mode parser is non-recursive with its state in a stack, so it can be easily suspended and resumed.

  2. changed the title [-]Consider supporting nested math mode: `\text{x\(_2\)}`[/-] [+]Nested math mode: `\text{x\(_2\)}`[/+] on Jun 2, 2026
  3. added
    enhancement
    on Sep 2, 2026
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

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions