Fix tex end patterns