mathnet/mathnet-symbolics

Multiplication signs being removed by Latex.formatvisual function

troelschristensen opened this issue · 4 comments

When making a latex string from latex.formatvisual the source code somehow changes,
what should output as '2*( 3 +3*x)' to '2(3+3x)'. It writes the latex codes (not shown here).
The point beeing that it is removing the multiplication signs.

I would like it to display the latex code that leeds to this output 2*(3+3x) or 2×(3+3x) or 2⋅(3+3x)

My users on my website can choose between these 3 types of multiplication signs ( *, × and ⋅).

Can this be done? Can I somehow maby define a symbol in the string, that the latex.formatvisual function skips?
I'm sadly not experinced enough to change the source code. Any workaround?

I'm programming in visual basic. I also understand C#, but not F#.

Here's my code:

Shared Function Reducer_latex(str As String)

        Dim strlatex As String = ""
        Dim parts As String() = str.Split(New Char() {"="c})
        Dim left = Infix.ParseVisual(parts(0))
        Dim right = Infix.ParseVisual(parts(1))

        If left.IsOk And right.IsOk Then
            strlatex = String.Format("{0}={1}", LaTeX.FormatVisual(left.ResultValue), LaTeX.FormatVisual(right.ResultValue))
        End If

      Return strlatex
End Function

Hope someone can help me on this.

Solved it by myself. Inserted this "#" in a string within a function. When calling another function, I replaced the "#" from the string with "123456". The latex command removed the "" from the string within the function. But now I can replace the "123456" with a multiplicationsign afterwards. I do not use that big numbers and the number allows the latex-command to function.
Udtryk_til_latex(udtryk.ToString.Replace("#", "123456").Replace("#", "123456")).ToString.Replace("123456", RegnetegnMultiplikationBrugBrøk)

image

So you'd want a multiplication sign between an integer and parenthesis (2⋅(x+y)), but not between an integer and a symbol (2x)? What would be the exact rules when the sign should be rendered for your needs?

Reopening, as there should be a better way than that workaround.

Yes. @cdrnet Could be great. If it just did not show it between 2x but everywhere else. Don’t know if this is good everywhere or not.🤷‍♂️ But sometimes 2(3 + 3x) would be good also. Depends on, who should do the math problems. Children should likely see the 2•(3 + 3x) and growups should see 2(3+3x). It depends. So I should be able to define, when to show and when not to show the multiplication signs.

Sent with GitHawk