use new_gram and modify Tex.h