Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying Math Equations from ChatGPT Responses #40

Open
tobitech opened this issue Aug 3, 2024 · 1 comment
Open

Displaying Math Equations from ChatGPT Responses #40

tobitech opened this issue Aug 3, 2024 · 1 comment

Comments

@tobitech
Copy link

tobitech commented Aug 3, 2024

Hello, I got a response from ChatGPT and tried to display it with LaTexSwiftUI but it didn't work:

Here is the response:

To solve the equation \(3x + 5 = 4\), follow these steps:
what format is this string of text:
1. Subtract 5 from both sides of the equation to isolate the term with \(x\):
   \[
   3x + 5 - 5 = 4 - 5
   \]
   Simplifying this, we get:
   \[
   3x = -1
   \]
2. Divide both sides by 3 to solve for \(x\):
   \[
   x = \frac{-1}{3}
   \]
So, the solution to the equation \(3x + 5 = 4\) is:
\[
x = -\frac{1}{3}
\]

When I tried it I get an error: Undefined control sequence \(
I don't know what I need to do to be able to display this type of response.

@RedPug
Copy link

RedPug commented Aug 5, 2024

if you're pasting it all into a string, you should double up the "" character. The backslash is an escape character and acts in a nasty way if you use it incorrectly.

so instead of "(3x + 5 = 4)" you would do "\(3x + 5 = 4\)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants