OthersKatexUtils(iOS) - Remove unwanted Asterisk from latex equation

Information and discussion about other tools not listed above.
Post Reply
mmd
Posts: 2
Joined: Fri Aug 20, 2021 4:21 pm

KatexUtils(iOS) - Remove unwanted Asterisk from latex equation

Post by mmd »

I have these latex equation and I'm using https://github.com/nks5117/KatexUtils to show latex equation

Code: Select all

Simplify $$\\frac{x^3-4x^5}{14x+21} \\div \\frac{x^2}. 
   {7}$$\n\nsdssdsdsds\n\n\nsdsdsds\n\n\n\n\n\n\n\n\n\n\nSdsdsds
By identifying line break using \n,replacing the \n with "\\*".

Code: Select all

func latex () -> String {
        var modifyString = self
        if modifyString.first == "$"{
            modifyString.removeFirst()
        }
        
        if modifyString.first == "$"{
            modifyString.removeFirst()
        }
        
        if modifyString.last == "$"{
            modifyString.removeLast()
        }
        
        if modifyString.last == "$"{
            modifyString.removeLast()
        }
        let mString = modifyString.replacingOccurrences(of: "$", with: "")
        
        let lString = mString.replacingOccurrences(of: " ", with: #"\ "#)
        if lString.contains("matrix") {
            let newString = lString.replacingOccurrences(of: "\n", with: #"\\"#)
            return newString
        }
        let newString = lString.replacingOccurrences(of: "\n", with: #"\\*"#)
        return newString
    }

By using force line break in latex equation it is showing asterisk in equation.

I need to remove these asterisks from equation.And bottom spacing
Attachments
Simulator Screen Shot - iPhone 11 - 2021-08-20 at 19.56.04.png
Simulator Screen Shot - iPhone 11 - 2021-08-20 at 19.56.04.png (104.42 KiB) Viewed 14481 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

KatexUtils(iOS) - Remove unwanted Asterisk from latex equation

Post by Ijon Tichy »

IMHO this question is off-topic, because Katex is not LaTeX. AFAIK it does not use TeX but JavaScript.

Maybe it does not support \\*, because web pages do not have page breaks, so \\* instead of \\ does not make sense. In LaTeX \\* usually is a new line without page break. So I would try to not use \\* but \\ only in the replacement.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
mmd
Posts: 2
Joined: Fri Aug 20, 2021 4:21 pm

KatexUtils(iOS) - Remove unwanted Asterisk from latex equation

Post by mmd »

But \\ is breaking the line but not identifying the vertical empty spaces.So when I put multiple \n\n\n only it breaks line one time not three times.
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

KatexUtils(iOS) - Remove unwanted Asterisk from latex equation

Post by Ijon Tichy »

Once again Katex is not LaTeX. So this is off-topic. So my answer will be for LaTeX not Katex.

In LaTeX neither \\* nor \\ is intended to use be used several times to add vertical space. Vertical space should be added using either the optional argument: \\[5\normalbaselineskip], or using \vspace{5\baselineskip}. Using several \\ or \\* is broken by design. In LaTeX, this is the same for \\ and \\*.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply