Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Mar 02 14:40
    moh1434 commented #836
  • Mar 02 14:27
    moh1434 opened #845
  • Mar 01 12:47
    reach1dev closed #844
  • Mar 01 12:47
    reach1dev commented #844
  • Mar 01 10:09
    arnog labeled #844
  • Mar 01 10:09
    arnog commented #844
  • Mar 01 09:58
    reach1dev edited #844
  • Mar 01 09:57
    reach1dev edited #844
  • Mar 01 09:56
    reach1dev opened #844
  • Feb 28 21:29
    jambonmcyeah opened #843
  • Feb 27 15:37
    dependabot-preview[bot] edited #842
  • Feb 27 15:37
    dependabot-preview[bot] edited #841
  • Feb 27 15:27
    dependabot-preview[bot] edited #838
  • Feb 27 15:27
    dependabot-preview[bot] edited #839
  • Feb 27 15:20
    dependabot-preview[bot] closed #829
  • Feb 27 15:20
    dependabot-preview[bot] commented #829
  • Feb 27 15:20
    dependabot-preview[bot] labeled #842
  • Feb 27 15:20
    dependabot-preview[bot] opened #842
  • Feb 27 15:19
    dependabot-preview[bot] closed #827
  • Feb 27 15:19
    dependabot-preview[bot] commented #827
stefnotch
@stefnotch

It seems like skipBoundary is currently a bit buggy when something doesn't have any content.
e.g. 33+\ddot{}+44 (put your cursor at the beginning and keep tapping the right arrow key)

What should the correct behaviour be?

Arno Gourdol
@arnog
hmmm... indeed. It should be the same behavior as when pressing the left arrow key (but in reverse)
stefnotch
@stefnotch

Now, I don't want the issues that I'm taking a look at to balloon in scope, but after taking a look at the model-select, model-delete and related code, I've stumbled upon quite a few things. (some of them are quite subjective)

  • skipBoundary is buggy for things like \ddot{}
  • skipBoundary is buggy for nested 3+\ddot{\ddot{\ddot{3}}}+4, for example deleting it doesn't work as expected
  • 3\stackbin{4}{5}6 and tapping the left arrow key results in a slightly different order to tapping the right arrow key (the spot after the 4 gets skipped over)
  • 3\xrightarrow[]{}3 and tapping the left arrow key results in a bottom placeholder but not a top placeholder
  • \sqrt[3]{4} and tapping the left arrow key results in a, for me, slightly unexpected order. I expected it to first let me edit the 4 and then the 3.
  • 'overunder' atoms like \utilde{3333} cannot be deleted without deleting the content, because of the skipBoundary. Maybe that's fine.
  • Then there is xrightarrow, which really doesn't feel like an overunder atom. It feels more like a mop atom, just like the sum.

On whole, I'm not sure, maybe the code ties the latex representation too close to the editing part?

Arno Gourdol
@arnog
One issue is that the code to traverse the tree is messy. There are multiple code paths that should do the same thing (moving forward and moving backward) and almost do, but not quite...
A solution for that is to have a single, canonical, place that does the iteration, and have everywhere that needs to know what is "next" or "previous" use that same code
Luckily, I just checked-in something along those lines :) Well, a beginning of it anyway.
There is now a PositionIterator class in model-iterator.ts
It calculates in order all the possible "spots" where the cursor can be, and it is then possible to move forward and back from the current spot
I had to add this because of the new API to get access to the selection, i.e. mf.getValue(mf.selection)
That's the good news. The bad news is that there are still some places in the code that use the "old" method. In particular, I haven't touched to next() and previous(), but they are ripe for simplification and using PositionIterator instead of the code they currently have
Arno Gourdol
@arnog
This means that whatever changes for the ordering (like swapping the index and root of surds) could be done in one place, PositionIterator and it would work for both forward and backward movement.
stefnotch
@stefnotch
Great! That sounds like a major improvement. I'll have to take a look at it later :smile:
Arno Gourdol
@arnog
Hmm... actually I just noticed that IteratorPosition does not account for skipBoundary but it probably should, and with better logic than currently to account for things like \ddot{} (i.e. skipBoundary atoms with no children).
3\xrightarrow[]{}3 good point. I think the logic is that the optional argument is skipped, but then that means there's not easy way to edit it. If changing this logic, that means that it would apply for \sqrt{} as well (which would always have an the index editable). Maybe that's OK, although that could be surprising for some users too...
xrightarrow is an overunder atom because the overunder atom knows how to draw and stretch the body with SVG. The kind of atom doesn't really influence the editing, though, it's really just what rendering routine gets invoked.
Arno Gourdol
@arnog
In general, the way selection is represented internally (with "paths" and "extent) is pretty messed up. I don't know what I was thinking when I came up with this. It's code that's both convoluted and fragile. Using a simple pair of indexes (start, end) to represent the selection would be much simpler. Now that PositionIterator is here, I hope over time to rip out the path based code. One thing that might be needed is to add a parent property to Atom, otherwise without path there isn't an easy way to go "up" in the node tree.
Actually, the reason why I did it this way in the first place is that TeX doesn't have pointer to parent nodes either. It's fine for rendering (when you really only need to descend the tree), but for editing, you need the parent pointer.
stefnotch
@stefnotch

I suppose that being able to edit the index of a sqrt isn't too surprising, but opening an issue on GitHub (and hopefully getting feedback) is always an option.

Well, the type does make a difference right here (model-delete.ts)

if (/^(group|array|genfrac|surd|leftright|overlap|overunder|box|mathstyle|sizing)$/.test(model.sibling(1).type) ) {
  move(model, +1);
} else  { ...

Hooray, the mathlive code is going to become simpler! :tada: I'm looking forward to it.

Arno Gourdol
@arnog
oh, I see. Fair enough...
Hmmm... I'm wondering if the correct test here wouldn't be to check for skipBoundary rather than the type...
Arno Gourdol
@arnog
heads up: I'm rewriting the way the selection works in MathLive. I'm moving away from paths and using an index-based selection instead. I expect the rewritten code will be much easier to read and debug, and it will be easier to change some of the selection and keyboard navigation behaviors.
stefnotch
@stefnotch
That does sound really nice, I'm looking forward to it! :)
Juan S. Escobar
@escobar5
Hi everyone
Anybody has used MathLive on CKEditor? any plugins out there?
Arno Gourdol
@arnog
Don't know of one yet, but let us know if you find something!
stefnotch
@stefnotch
Out of curiosity, how's it going?
(I've stumbled upon another project where something like mathjson would be really useful and looked far and wide before deciding that I'll probably have to implement a dirty hack, because all the alternatives are meh and mathlive's mathjson is sadly not yet done.)
Arno Gourdol
@arnog
I have jumped into a rabbit hole. I've been investigating some of the open issues regarding editing behavior, selection, and matrix editing and I've come to the conclusion that the current implementation is not going to cut it. So I've been hard at work on reimplementing the way selection works. It's a big job, but I'm making progress and fixing bugs along the way. I just want to make sure I don't introduce regressions and there are a lot of test cases to consider. The good news is that once I'm done new things will be possible, for example applying styles to arbitrary portions of an expression, being able to search an expression (for example "find all the x to a power"), and, importantly, do things like "select a column in a matrix". In the meantime I've also extracted MathJSON. I'll publish it to a separate GitHub repo shortly.
stefnotch
@stefnotch
Haha, jumping into rabbit holes also constantly happens to me. Glad to hear that it's going quite fine!
(Searching an expression is going to be so powerful. It would make it quite possible to write a really neat expression rewriter. Like "find all a^3" and then the rewriter figures out how to combine/factor them.)
Arno Gourdol
@arnog
I have just pushed a pretty massive update to the main branch. This include several architectural changes, including a complete rewrite of how the selection works, and using sub-classes to isolate the behavior of the different kind of atoms (instead of having it spread out all across the codebase).
This is still a work in progress: the handling of arrays is busted right now, but that's coming next.
See the CHANGELOG for details.
Philipp Imhof
@PhilippImhof
Hello everyone and thanks very much for that great piece of software. I have a quick question: When defining an inlineShortcut, is it possible to make use of the preceding symbol, e.g. have a shortcut "vec" that will put an arrow over the last char? I can currently only define "\vec{#1}" leaving a placeholder, but then the user will have to "move out" of it, once they are done.
Arno Gourdol
@arnog
Thanks, Philipp. Yes, you can use #@: this will refer to the selection if there is one, or the 'mord' symbol before the insertion point.
Philipp Imhof
@PhilippImhof
Unbelievable... Thank you. I will dig into all of this and hope that I might -- one day -- contribute something to this package.
Arno Gourdol
@arnog
:thumbsup:
Mohammed Aslam
@mohammed-aslam
hi, there is an issue, the autocomplete pop-up (when we start typing "\somthing") the pop-up gets stuck and mispositioned. it only happens when using math-field tag or MathfieldElement constructor but no issue with makeMathField. i wanna use as tag, my question is there anyway that i can disable this feature in the options?
Arno Gourdol
@arnog
That's fixed in the main branch, if that's an option for you. Otherwise, you can define a CSS rule div.ML__popover.is-visible { display: none } which should prevent the popover from showing.
Zach Oliver
@ledgerTalk_gitlab
Hello. I was looking through the docs for MathLive and if I understand it right, the only input that MathLive accepts into MathFields is latex. It seems to be able to output into many different formats, but input is only latex. Is that accurate?
Arno Gourdol
@arnog
no, you can also input mathascii, and a variant of UnicodeMath (used by Word)
Zach Oliver
@ledgerTalk_gitlab
Gotcha. So MathML is not an input option?
Arno Gourdol
@arnog
unfortunately not
it's not impossible but the parsing of MathML is... non-trivial
Zach Oliver
@ledgerTalk_gitlab
Ok, that's what I thought, just wanted to confirm. Thanks.
Arno Gourdol
@arnog
you're welcome!
Arno Gourdol
@arnog
I've just updated the cortexjs.io website with documentation on MathJSON (http://cortexjs.io/guides/math-json/) and the Compute Engine (http://cortexjs.io/guides/compute-engine/). MathJSON is pretty stable, and the Compute Engine is a work in progress on which I'm actively working.
I'm looking for feedback on a foundation of the Compute Engine, its domains (i.e. the "types" of mathematical objects it handles). If you have a minute, have a look at http://cortexjs.io/guides/compute-engine-domains/ and let me know what I got wrong, what's missing, or what doesn't need to be there. Note that domains (like everything else in Compute Engine) can be extended, so this list doesn't have to be exhaustive, but it should be large enough to be useful for "common cases".
stefnotch
@stefnotch

This looks really good!

One type that I haven't seen in the list

Some other types that I haven't seen in that list would be (no idea how useful any of them would be)

  • Quaternions: Programmers like using those to represent rotations
  • Orthogonal matrix: Every rotation can also be represented with an orthogonal matrix
  • Congruence Classes: Things like "odd" + "even" = "odd", but more general
  • Recurrence relations: Basically functions that call themselves, like the Fibonacci function

I also feel tempted to point out that vectors are a very general concept and even polynomials can be treated as vectors (you can add them and you can multiply them by a scalar). Our mathematics professor very much liked those examples xD

Arno Gourdol
@arnog
Thanks! That's super useful. One thing I'm not clear on: how do you see finitary relations and Predicate (i.e. a function with any arguments but with a Boolean codomain?). Or is that the same thing with a different name?
stefnotch
@stefnotch
Woah, that's a good point. After thinking about it for a bit and checking other sources, I suppose a finitary relation is indeed simply a predicate
Arno Gourdol
@arnog
OK, great. BTW I have added Quaternion, and OrthogonalMatrix. I'm still on the fence about Odd and Even. The documentation has also been updated.