Skip to content

remove_stray_braces: \{ should not be taken into account #225

@mz71

Description

@mz71

TexMobject("\{") gives an error, because the string "\\{" goes through the function remove_stray_braces which balances the unbalanced { to make a "\{}", which gives a Latex error.

The same thing applies to TexMobject("\}").

A quick fix would be to add those lines to the remove_stray_braces, although this should be consulted with more knowledgable person in Latex (or Python as a matter of fact):

num_lefts_bogus, num_rights_bogus = [
            tex.count(char)
            for char in ['\\{','\\}']
        ]
        num_lefts -= num_lefts_bogus
        num_rights -= num_rights_bogus

Metadata

Metadata

Assignees

No one assigned

    Labels

    pr:bugfixBug fix for use in PRs solving a specific issue:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions