# GPT ,generate math equation in latex format problem

**URL:** <https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791>\
**Category:** API\
**Tags:** gpt-4, api\
**Created:** [March 11, 2024, 4:55am UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791 "2024-03-11T04:55:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![padonougabin10](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/padonougabin10/32/194345_2.png) [@padonougabin10](https://community.openai.com/u/padonougabin10)\
**Post date:** [March 11, 2024, 4:55am UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791/1 "2024-03-11T04:55:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Diet](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/diet/32/562749_2.png) [@Diet](https://community.openai.com/u/Diet)\
**Post date:** [March 11, 2024, 5:04am UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791/2 "2024-03-11T05:04:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![padonougabin10](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/padonougabin10/32/194345_2.png) [@padonougabin10](https://community.openai.com/u/padonougabin10)\
**Post date:** [March 11, 2024, 2:23pm UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791/3 "2024-03-11T14:23:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [March 12, 2024, 5:00am UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791/4 "2024-03-12T05:00:54Z")

</div>

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

> [@Rendering latex equations from the api response](https://community.openai.com/t/rendering-latex-equations-from-the-api-response/567598/4):
>
> I went after making gpt-3.5-turbo-0125 reliable - the poorest AI yet. It is predisposed to dump backslashes for ChatGPT because these new models are useless for being anything other than ChatGPT. I want it to make formulas for forums. system: You are an expert AI assistant. // response rules Writing math formulas: You have a MathJax render environment. - Any LaTeX text between single dollar sign ($) will be rendered as a TeX formula; - Use $(tex\_formula)$ in-line delimiters to display equatio…

---

<div class="post-metadata">

**Author:** ![anjula](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/anjula/32/448497_2.png) [@anjula](https://community.openai.com/u/anjula)\
**Post date:** [March 13, 2024, 4:16am UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791/5 "2024-03-13T04:16:58Z")

</div>

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

gpt-4- turbo preview

gpt-4-0125-preview

gpt-4-0125-preview

gpt-4-0613

---

<div class="post-metadata">

**Author:** ![nicoloceneda](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/nicoloceneda/32/318612_2.png) [@nicoloceneda](https://community.openai.com/u/nicoloceneda)\
**Post date:** [March 13, 2024, 4:31am UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791/6 "2024-03-13T04:31:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Diet](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/diet/32/562749_2.png) [@Diet](https://community.openai.com/u/Diet)\
**Post date:** [March 13, 2024, 9:25pm UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791/7 "2024-03-13T21:25:13Z")

</div>

> [@anjula](#):
>
> gpt-4- turbo preview
> 
> gpt-4-0125-preview
> 
> gpt-4-0125-preview

these are all the same model lol

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

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [March 13, 2024, 9:35pm UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791/8 "2024-03-13T21:35:21Z")

</div>

> [@anjula](#):
>
> Which GPT model is more accurate & efficient for latex & other education purpose?

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`”]

---

<div class="post-metadata">

**Author:** ![anjula](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/anjula/32/448497_2.png) [@anjula](https://community.openai.com/u/anjula)\
**Post date:** [March 14, 2024, 7:35am UTC](https://community.openai.com/t/gpt-generate-math-equation-in-latex-format-problem/676791/9 "2024-03-14T07:35:55Z")

</div>

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