- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Pairs of numbers incorrectly concatenated with cdot = false #304
Comments
Interesting. To simplify the problem description a little: julia> @latexify 2x + 2*3 cdot=false
L"$2 x + 2 3$" should be "$2 x + 2 \cdot 3$" Since the current representation is incorrect, this is a bug. I don't think the solution has to be technically non-breaking. |
Why not use parenthesis? |
For one thing I think that's an even harder algorithm to implement. I'm toying with one idea where a step of julia> @latexify 2x+2*(3)+2*3^4+3^4*2+x^4*x cdot=false
L"$2 x + 2 \cdot 3 + 2 \cdot 3^{4} + 3^{4} \cdot 2 + x^{4} x$" This catches many of these things, but it's not perfect. For instance, I would expect |
It'll also be a battle of preference between users. Right now we have On tip of that, I'm (again idealistically) imagining users can specify which multiplication presentation to use for different contexts, e.g. between two numbers, between two symbols, between a number-then-symbol, or between a symbol-then-number (I haven't checked if And yes, such a change doesn't need to be API breaking, and my (again idealistic) mind might be motivated enough to come up with an algorithm for this, or at least a simpler improvement. I'll try out some things and give it a shot. Also a nice challenge yet introductory experience to more complicated contributions into the Julia ecosystem. That said someone else might have a better solution. Edit: My brain misprocessed the double-negative in your statement about breaking changes. I'll see what I can do with the current API and whether we'll need a breaking change or not - I imagine we will need to break things. |
I initially opened this issue in Symbolics.jl since I superficially noticed this issue occurs with
@variables
and notExpr
s orString
s fed tolatexify
.Basically the
@latexrecipes
defined inSymbolics.jl/src/latexify_recipes.jl
all setcdot --> false
, which avoids placing\cdots
everywhere.There isn't a simple solution to this, but I'm happy to look into the challenge of designing an algorithm and non-breaking (additive) API that places
\cdots
in some nicely disambiguating places.The text was updated successfully, but these errors were encountered: