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

Multiplication signs being removed by Latex.formatvisual function #89

Open
troelschristensen opened this issue Dec 11, 2020 · 4 comments

Comments

@troelschristensen
Copy link

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.

@troelschristensen
Copy link
Author

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

@cdrnet
Copy link
Member

cdrnet commented Jan 10, 2021

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?

@cdrnet
Copy link
Member

cdrnet commented Jan 10, 2021

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

@cdrnet cdrnet reopened this Jan 10, 2021
@troelschristensen
Copy link
Author

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

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