Refactored tern tex files.