Create lib.tex (#37) and move matlab code