Improvements to tex handling.