Skip to content

ManimCE 0.20.1: MathTex bounding box changes size when shifted #4643

Description

@uwezi

Description of bug / unexpected behavior

When shifting a MathTex() object which has an argument in the form of a list of substrings, the bounding box of the object grows, both vertically and horizontally.

As reported by TomBC on Discord https://discord.com/channels/1453870851807117363/1482938671190511748/1482938671190511748

Expected behavior

The bounding box should not change and just be the bounding box of the object.

How to reproduce the issue

Code for reproducing the problem
class TryMathTex(Scene):
    def construct(self):
        li = ['\\overrightarrow{', 'C', 'A', '}', '=', '\\bold{', 'm', '}']
        # str = r"\overrightarrow{BD}=\bold{m}"
        math_tex = MathTex(*li) 
        self.add(math_tex)
        bg1 = BackgroundRectangle(math_tex, color=GRAY, fill_opacity=0.5)
        self.play(Create(bg1))                    
        print(math_tex.width, math_tex.height) # 1.870 0.606 when I use li to MathTex
        self.play(math_tex.animate.shift(RIGHT+UP))
        print(math_tex.width, math_tex.height) # 1.935 1.303 when I use li to MathTex
        bg2 = BackgroundRectangle(math_tex, color=GRAY, fill_opacity=0.5)
        self.play(Create(bg2))

Additional media files

Images/GIFs Image

Logs

Terminal output

Bounding box before .shift()

1.8702728500000008 0.60589355

Bounding box after .shift()

1.9351364250000005 1.302946775000001

System specifications

System Details
  • OS: Windows 11 (my system) and Linux (Manimator)
  • Python version: 3.12.8
LaTeX details
  • LaTeX distribution: MikTex (my system) and TexLive (Manimator)

Additional comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions