add ToLatex class, move machinery to General.v