Math style generated content is not getting consistent wrapped is $ or $$

Usually generated math or science type content is consistently wrapped in $ or $$ tokens - which is then easy to render to Latex using method of choice. Today though I’m seeing a lot of instances where the math content is instead getting wrapped in parentheses or square brackets. Example response with this behaviour:

However, these interpretations might not be directly compatible with the classic expression E_v = h(v+1/2) used for a quantum harmonic oscillator unless E_c and E_g are redefined or specified to fit this scenario. If this were the case in a hypothetical or extended conceptual framework where:

  • ( E_c ) could be defined as a base energy level (possibly of the ground state or zero-point energy).
  • ( E_g ) could be considered an incremental energy term analogous to the quantum mechanical derivation between successive states.

Then, one could attempt to express E_v in these terms, provided the following relational concepts:

  1. Redefined E_c could represent the “ground state energy” of the quantum system described by ( E_{v=0} ) which would be ( E_0 = h \times \frac{1}{2} ).
  2. Redefined E_g could represent the increase in energy per additional quantum number increment, which in the case of the quantum harmonic oscillator is ( h ).

Given this non-standard but conceptual framework, one could write:

[ E_v = E_c + v \times E_g ]

Where:

  • ( E_c = h \times \frac{1}{2} ) (reflects lowest possible energy state in this system)
  • ( E_g = h ) (reflects the energy increment per quantum number unit)

Hi! I had a similar problem for responses when feeding extracted LaTeX from PDFs. I find that if you prompt it enough, it will follow the instruction. It helps to use an eval framework like Ragas to debug how well your prompt is working as you go.

Oftentimes I repeat sentences multiple times such as “ALWAYS wrap equations in $$ tags only. DO NOT under any circumstances give parentheses or square brackets” etc.

Good luck!