Fixed bug (conversion of variable names in tex).

(cherry picked from commit 80218a1b65b9af0ccd6b598fe562819ea48bd0ec)