GPT ,generate math equation in latex format problem

Hello ! I’m using the GPT4 API for an educational application. I would like gpt4 to be able to generate mathematical equations or mathematical expressions in latex format. But despite the prompt, it sometimes generates mathematical answers in plain text. How do I get what I want in a stable way?

Welcome to the community!

Have you tried to instruct the model to to start all mathematical equations with the $ or $$ delimiters?

the latest gpt-4-turbo models have all been tuned to conform to a gfm-like markdown style, so leveraging these delimiters might help it get into the mode you want it to be in.


I tried it but sometimes the model does not follow these instructions. In other words, it’s unstable.

Here’s a higher quality of instruction I just posted for LaTeX.

1 Like

Which GPT model is more accurate & efficient for latex & other education purpose?

gpt-4- turbo preview




1 Like

I just say “Write the answer in Latex”. Or “Write a latex code”.

1 Like

these are all the same model lol

but yeah, go for that if you’re just looking for formatting consistency.

1 Like

Time and alterations by OpenAI to make faster, more chat-trained, more untrainable AI gives you this progression of quality, where the latest version is a stinker, trying to write ChatGPT-renderer backslash formatting into everything TeX, ignoring instructions when it is not denying:

Best to “cheap”

  • gpt-4-0314 - A breath of fresh air to return to - if you still have access
  • gpt-4-0613 - (includes function calls) more resistant to your output specs like writing HTML [“gpt-4”]
  • gpt-4-1106 (includes tool calls and JSON mode that are broken, larger input context but output limitations; will tell you to write the code yourself)
  • gpt-4-0125 - still lazy, and also bad context-reading quality and vapid answers [“gpt-4-turbo”]
1 Like

Thank you.
What is the best model for questions and answers that I can create, please?
Which model—the one mentioned above or another?