Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Sanim (Slide ANIMation) is both a markup language for preparing presentations, and a parser for this language that produces the presentations. The transition between slides is animated using Manim.

Manim (Math ANIMation) is an animation engine for explanatory math videos made for the youtube channel 3Blue1Brown.

Sanim encapsulates Manim so that the user can prepare slides with a style similar to Manim but without needing to write Python code. Conceptually, a Sanim presentation can be thought of as a long "scroll" of paper. Lines appear one by one (by default), below the previous one. Once there is no more space, previous lines scroll up until they disappear. The presentation is displayed in a browser, and the user can move forward and backward using arrow keys.

Sanim is unfinished and I have no concrete plans to finish it. It is still buggy and has limited features. I made Sanim because I was planning to create some educational videos and I liked 3blue1brown a lot, but I wanted a tool that was easier to use. I will continue the development if/when I resume making the videos.


The following sanim source generates this animation Use the right arrow key to start displaying the slides. The right arrow goes back. (If the demo does not work, here is the raw video without the advance/go back features.)

TITLE Complexity Theory\textemdash  Lecture 1: Introduction

DEF "In a nutshell" how to classify \textit{\textbf{problems}} according to how \textit{\textbf{hard}} they are to solve by computer \textit{\textbf{programs}}.

DEF "In this lecture" define ``problem'', ``hard'', and ``program'' formally so that we can do mathematical proofs.

- What is a \textit{\textbf{problem}}?

\textbf{Problem} ; > vs ; > \textbf{Instance}
>Multiplication ; ; >$37\times 13$
>Sorting ; ; >$8,2,3,6,1$


- A \textit{\textbf{problem}} is a \textbf{function} mapping each instance to its solution.

>\textbf{Problem} ; ; > \textbf{Instance} ; ; > \textbf{Solution}
>Multiplication ; ; >$37\times 13$ ; >$\longrightarrow$ ; >$481$
>Sorting ; ; > $8,2,3,6,1$ ;  >$\longrightarrow$ ; > $1,2,3,6,8$
>Median ; ; > $8,2,3,6,1$ ;  >$\longrightarrow$ ; > $3$

- We focus on \textit{\textbf{decision problems}}: problems where the solution is YES$/$NO.


\textbf{Decision Problem} ; ; > \textbf{Instance} ; ; > \textbf{Solution}
>Prime testing ; ; >$9$ ; >$\longrightarrow$ ; > NO
;; >$11$; >$\longrightarrow$; >YES

DEF "In general" a decision problem asks ``does the instance have $X$ property?''

- We assume that the instance is just a (finite) \textbf{binary string}.

Mathematical object ; >vs ; >Binary representation


First, Manim must be installed; see this. Assuming that Manim is working, on the terminal, run

python Sanim -x sanim_file.txt

where sanim_file.txt is the Sanim source (add -l for fast render/lower quality).

This generates a file sanim_interactive_AUTOGENERATED.html in the same folder as the sanim source. It can be opened with a browser (I tested on chrome), and advanced with left/right arrow keys.

It is recommended that each sanim project is in its own folder in the presentations/ folder because the output/auxiliary files have generic names, so they are identified by the folder they are in.


Every non-empty line of the input file corresponds to an "item" of the presentation. Items can be of several types. The first word the line determines the type. By default, the rest of the input line is parsed as latex (it can include $ $, \textit{}, \textbf{}, and \underline{ }).

Item types:

  • TITLE: bigger font, underline
  • -: adds text with a bullet point
  • : adds plain text
  • DEF "X": Definition: bullet point with X highlighted, followed by ':' and the text

Special lines:

  • FLUSH X: removes all the lines before line X, shifts remaining lines to the top

Special symbols:

  • ";": To insert several items spaced evenly in the same line, separate them by ; (can be used to center a single item by surrounding it by ";")
  • ">": when it is the first char of an item, the line displays together with the previous line, without waiting for user input.

(The features listed here may be outdated)


  • add shortcuts for and \textbf \textit
  • smoother play backwards
  • modify the Manim tex template depending on the browser's width, so that it adds line breaks at the appropriate points
  • try different fonts and animations to distinguish the style from Manim
  • add command to color specific words (\color{}{} not working)
  • add labels for flushing instead of line numbers
  • Add an IMAGE item.
  • fix that DEF item shifts slightly to the right when flushing.
  • reduce width of title underline

Ideas for features

  • pin functionality for lines that don't get flushed (using symbol "^")
  • Automatic flush: once there is no more space, previous lines scroll up until they disappear (without cutting lines in half).
  • Integration with native Manim animations.


Sanim (Slide ANIMation) is an extension of manim focused on preparing slides







No releases published


No packages published