Segment 1: The Formatting
Homer works as a LaTeX typesetter at the nuclear plant. After Mr. Burns demands perfectly aligned equations, Homer goes insane trying to format complex mathematical expressions, eventually snapping when his equations run off the page. In a parody of "The Shinning," Homer chases his family around with a mechanical keyboard while screaming "All work and no proper alignment makes Homer go crazy!"
Segment 2: Time and Compilation
In a nod to "Time and Punishment", Homer accidentally breaks his LaTeX compiler and tries to fix it, but ends up creating a time paradox where every document compiles differently in parallel universes. He desperately tries to find his way back to a reality where his equations render properly.
Segment 3: The Cursed Code
Bart discovers an ancient LaTeX document that contains forbidden mathematics. When he compiles it, it summons an eldrich horror made entirely of misaligned integrals and malformed matrices. Lisa must save Springfield by finding the one perfect alignment that will banish the mathematical monster back to its dimension.
The episode ends with a meta-joke about how even the credits won't compile properly.