Discourse Math

artificial intelligence gives answers in latex format. I wrote a prompt to convert this latex format to mathjax format, but the prompt is not always implemented and responds in latex format. When I wrote my problem to the openai community, the following suggestion came.

"I decided it wasn’t even worth the effort of cluttering up a system prompt, when I could just do the following on my end with the results:

    translateLaTex = (val: string): string => {
        if (val.indexOf("\\") == -1) return val;

        return val.replaceAll("\\(", "$")//
            .replaceAll("\\)", "$")//
            .replaceAll("\\[", "$")//
            .replaceAll("\\]", "$");
    }

"
Can you apply this solution in the next update?

2 Likes