Ways to display Latex / Tex / Mathematical Notation in Glide

Hello friends,

I’m building a student helper app that uses OCR to scan math questions and solves them using GPT.

The OCR automation outputs a Latex styled string to represent the formula

EX:
\int\left(x^{5}-6 x+3\right) d x=

I’m able to pass off the initial question to a third party service that would render the formula as an image i can use.

The problem I run into, however, is when GPT starts using formulas in its own answer. GPT also uses Tex / LaTex (specifically, this service: https://www.katex.org/) formatting, and so its response contains a mix of normal english, and these Tex strings.

EX:

Sure! Using the power rule of integration, we can integrate each term separately:

\begin{align*}
\int\left(x^{5}-6 x+3\right) dx &= \int x^5 dx - \int 6x dx + \int 3 dx \\
&= \frac{x^6}{6} - 3x + 3C,
\end{align*}

where $C$ is the constant of integration.

Any ideas on how this problem should be approached? What can I do to properly output this text on glide?

This one is really bothersome fellas, and I’d appreciate any input you can provide on the matter :slight_smile:

Small bump to this - maybe the legends @Darren_Murphy or @ThinhDinh can advise :slight_smile:

Happy to provide more screenshots / images as needed.

Could you not instruct Chat-GPT to provide a response in plain English?

Thanks for the follow-up Darren! I could, but GPT wouldn’t necessarily honor the request all the time.

Furthermore, formulas are super-useful to have in terms of a user experience. The app would lose a lot of its utility if we remove such notation from the solution steps.

Okay, then I’m not clear on what you are trying to get? :man_shrugging:

Basically I’m trying to output GPT answers with Tex formatting within Glide. Here’s an example of Tex output in Glide compared to how it looks from within GPT itself.

Glide

GPT

My question: Is there no way for me to be able to output formulas the same way GPT does in its native chat interface?

I see. So basically you want the output rendered in the same way as Katex would present it, yes?

It might be possible to load Katex and do it with a JavaScript column, or alternatively you could probably set up your own hosted instance and embed that in a webview.

Correct! As far as I’m aware, JS columns would not be able to import js libraries but it seems that I’m mistaken.

Maybe I should give that a shot, and if all else fails - an embedded web view may be a path forward assuming I can steal a kind developer from the team to set up a hosted instance.

Let me give both of these a shot and report back on my findings :saluting_face:

Much appreciated sir :raised_hands:

P.S. I’ve used multiple guides of yours in the past. Specifically, the working day calculator + CSV file output guides were eye-openers; so thanks for all the help you’ve already provided :slight_smile:

The below thread may provide some inspiration:

1 Like

Can you tell me how you get Glide to display the formula in Latex form at the top? (just above the “Tutor” part).

I think it’s an image…

1 Like

Did you ever get this working?

Try using notalk;justgo at the end of the prompt

3 Likes