Using several packages available in the LaTeX
world I managed to make some animation of algorithms. In case you want to do something like this yourself, I suggest that you install the following on your system:
- TeX, which you probably already have; if you do not have it yet, I am wondering whether for you this is the best point to start from.
- the following three packages:
- the lhs2TeX program
- the Glasgow Haskell Compiler or equivalent
In the attached file CodeTree.lhs
you can see a piece of Haskell code. When you process the file with
the file is loaded into the
, which ceeates an environment in which the
commands in your file can be evaluated. The text resulting from these calls is inserted in the CodeTree.tex
file that is generated by the call to
. In our example the call generates a series of numbered drawings, that can be stepped through because of the included beamer code.
lhs2TeX Codetree.lhs > CodeTree.tex
If you want to animate your own algorithm you will have to:
- make sure that you can reproduce the attached pdf file
- extend your data types with extra constructors to model the pending function calls on these data
- make your extended data types an instance of the class Rewite, in order to simulate the stepwise execution of your alogorithm
- make your data types an instance of the class Tikz, in order to map then onto a picture in the Tikz language.
If you are interested in aking animations in haskell you may also take a look at the Vital
- 03 Mar 2006