Skip to content

Instantly share code, notes, and snippets.

@uwezi
Last active December 20, 2025 16:13
Show Gist options
  • Select an option

  • Save uwezi/357aa69864b3be7f63c597dc7fe97ca5 to your computer and use it in GitHub Desktop.

Select an option

Save uwezi/357aa69864b3be7f63c597dc7fe97ca5 to your computer and use it in GitHub Desktop.
[big expression] Finding and manipulating parts of a large LaTeX expression in LaTeX. #manim #mathtex #latex #indexlabels
from MF_Tools import ir
class bigeqn(Scene):
def construct(self):
eqn = MathTex(
r"""1+\sum_{i=1}^{2}\left\lfloor\left(
\frac{1}{\sum\limits_{j=1}^{i}\left\lfloor\left(\cos\left(\frac{(j-1)!\,+1}{j}\pi\right)^2\right)\right\rfloor}
\right)^\frac{1}{1}\right\rfloor"""
)
# uncomment for index labels
#self.add(eqn, index_labels(eqn[0]).set_color(RED))
self.play(Write(eqn))
self.wait()
for grp in [
[0],
ir(2,6),
[*ir(7,14),*ir(56,63)],
[*ir(15,19),*ir(48,52)],
[20],
[21],
ir(22,47)
]:
self.play(Indicate(VGroup(eqn[0][i] for i in grp)))
self.wait()
self.play(Create(SurroundingRectangle(eqn[0][22:48], buff=0.05)))
self.wait()

showing the index labels

image

and the final animation

bigeqn.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment