mgriebling/SwiftMath

Line breaks not supported

Lu-TheCoder opened this issue · 4 comments

Greetings

I'm working on a math app and SwiftMath has been very useful in my project and I Love it..

However, whenever I stumble upon an edge case where I'm dealing with long equations that simply can't fit into one line,
I can't seem to find a solution to create either manual line breaks or automatic line breaks within Latex in case of the text being longer than the screens width.

Will there ever be support for this feature in future?

You can manually force line breaks using math mode commands (e.g., \\ as in \text{Quadratic roots: }x = \\ \frac{-b \pm \sqrt{b^2-4ac}}{2a} to give

Screenshot 2023-02-23 at 8 00 59 AM

How do I enable math mode?

Here's a screenshot of my MathView configuration

Screenshot 2023-09-12 at 14 23 09

Here's a screenshot of the Quadratic roots sample you provided used in my API

Screenshot 2023-09-12 at 14 23 46

However the result does not create a new line as illustrated by your example..

Screenshot 2023-09-12 at 14 24 05

Unless I am missing something or doing something incorrectly...

I managed to figure it out... instead of double slashes \\ which only creates a space in between for whatever reason
we need to use 4 slashes \\\\ to get a new line break.

Here's a gif of it in action:

new line break

Math mode is always on. There's nothing to enable.

When in quotes, backslashes \ must be escaped so the "\\" should be "\\\\".
That's why all the commands appear to have double backslashes (in reality they're all being "escaped").