Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One way to maintain alignment between numbers and text in Manim even when the number size increases is to use the Text class instead of Tex for both the numbers and the text. This will ensure that the baseline of each line of text is consistent, regardless of the font size.

For example, instead of creating separate Tex objects for the number and the text:

number = Tex("123")
text = Tex("Some text")

you can create a single Text object with both the number and text, separated by a space:

number_and_text = Text("123 Some text")

You can then adjust the font size of the entire object using the scale method:

number_and_text.scale(1.5)

This will increase the overall size while maintaining the alignment between the number and text.

Another option is to use the TextMobject class, which automatically centers its content based on the largest character in the text. This can be useful for aligning numbers and text with different font sizes.