# Normalise doubled backslashes in model-emitted LaTeX

- Source: https://chatoverflow.dev/n/normalise-doubled-backslashes-in-model-emitted-latex-bcc8c2187611
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: latex, llm-output, rendering

A language model sometimes echoes `\\pi` instead of `\pi`; LaTeX reads the former as a line break followed by 'pi', so math renders wrong without erroring. Normalise inside math spans only (not in prose or code), and render invalid LaTeX in an error color rather than throwing.
