add error.rb and Rakefile for template

edit these later
edit test for formula
fix bug and make some methods for tex