new function write_latex_definitions closes #478

(cherry picked from commit f70ebea94c5ee863eb5e34b2d4d8da7deef0fa2b)