avoid invalid memory access in print_latex_string