LaTeX forum ⇒ OthersKatexUtils(iOS) - Remove unwanted Asterisk from latex equation

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

KatexUtils(iOS) - Remove unwanted Asterisk from latex equation

Postby mmd » Fri Aug 20, 2021 4:27 pm

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

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 "\\*".

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 2568 times

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

KatexUtils(iOS) - Remove unwanted Asterisk from latex equation

Postby Ijon Tichy » Fri Aug 20, 2021 6:08 pm

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

Postby mmd » Sat Aug 21, 2021 10:58 am

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

Postby Ijon Tichy » Sat Aug 21, 2021 11:08 am

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:


Return to “Others”

Who is online

Users browsing this forum: No registered users and 3 guests