An example of this failed rendering is here [1]. If I use Claude for all of my work, I come across issues like this or worse at least once a day. Instead, I find it easier just to ask any maths questions to ChatGPT which seems to have a much more robust system for outputting LaTeX.
I would love to merge my subscriptions though, so I'm here to ask whether anyone has a system prompt that has been effective in guiding Claude towards producing valid LaTeX. I've tried a few prompts myself but struggled to find anything that it consistently followed.
[1] https://imgur.com/yzlluOA
[1] https://docs.github.com/en/get-started/writing-on-github/wor...
[2] https://katex.org
[3] https://latex-sandbox.vercel.app
also: put it in your CLAUDE.md, not the system prompt. Claude reads that per-session and it sticks way better than hoping your prompt survives context compression. learned that the hard way after losing formmating mid-session one too many times.
https://gist.github.com/ontouchstart/bcffb186a753c5b75522fc8...