write_latex_definitions: use M_ as global
(cherry picked from commit ea888fe6464d073367adf6811adff03b17cecd40)