In Manim I'm using MathTex to display equations. I would like to allow variables in the equation to be shapes that I have constructed with other Manim functions. And not just a Circle or Square but perhaps a composite shape made of multiple shapes using a VGroup. So then the equation appears but in the relevant place(s) in the equation I would see the shape(s).
I answered your question on Discord - just copying what I think it is you are asking for here as well:
class visualMath(Scene):
def construct(self):
math = MathTex(*r"\text{Red Circle} + \text{Green Square} = \text{Blue Square}".split(" "))
redCircle = Circle(color=RED).scale_to_fit_width(math[0].width).move_to(math[0].get_center())
greenSquare = Square(color=GREEN).scale_to_fit_width(math[2].width).move_to(math[2].get_center())
blueSquare = Square(color=BLUE).scale_to_fit_width(math[4].width).move_to(math[4].get_center())
vis = VGroup(redCircle,math[1].copy(),greenSquare,math[3].copy(),blueSquare)
self.play(Write(vis))
self.wait()
self.play(ReplacementTransform(vis,math))
self.wait()