Why maths formatting is often wrong

Hi! I have one issue that I found, and I wanted if anybody could find an explanation or a solution for. It might help me understand why maths rendering is such a pain in pickaxe.

One of the advantages of having html/latex rendered on the user input, is that it allows us devs to test what gets formatted when the bot outputs an answer.

Through this I found the following about the renderer:

\[x +1]\ by itself generates a good answer

\(x+1)\ by itself generates a good answer

\(x+1\), \(x+1\) by itself generates a good answer

but if you combine \(x+1\), \[ x+1 \] you consistently get this error:

image

I figured since this is a repeatable bug, you at pickaxe could use it to investigate the issue and try to allow maths rendering through \[ \] notation for the bots.


PS: Typing this:

\(x+1\)

\[x+1\]

Also always generate this other error

Hi @forward_ai_team ,

Try adding this to your prompt:
Render math equations with LaTex, enclose $$ for block $ for inline

Dear @stephenasuncion , thanks, I know.

I’ve with pickaxe for a while and we use it for Higher Education, so I’ve been prompting my bots to format proper maths for over a year.

This is a higher-level problem: There is a reason somewhere why \[…\] \(…\) formatting doesn’t work, and that’s why im digging.

Finding it out would make it a lot easier for ALL bots to use maths, even unprompted, since many were trained in material with \[…\] \(…\) notation.

So my question still stands: Do you or anyone happen to know why we gotta prompt them to use $$, and where do the Parse Errors in KaTeX come from?

What about this

The fix would be at the KaTeX configuration level:

javascript

// This needs to be set wherever KaTeX is initialized
delimiters: [
  {left: "$$", right: "$$", display: true},
  {left: "\\[", right: "\\]", display: true},  // Enable this
  {left: "$", right: "$", display: false},
  {left: "\\(", right: "\\)", display: false}  // Enable this
]
1 Like

That’s my intuition too.

@stephenasuncion ?