-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add \lim
and customLetters
, fix \lbrack
and companions, parse \left\lfloor
and ceil, and parse lone ampersands properly
#284
base: main
Are you sure you want to change the base?
Conversation
It appears I forgot a null check, as many of the tests are failing due to it. Please allow a moment to fix it. |
I have added two more things which must be implemented internally, and cannot be added by external software. First, the Second, a lone ampersand is now first checked against the |
If you would like, I have a proper implementation of |
\lim
node, customLetters
option, and fix \lbrack
, etc. displays\lim
and customLetters
, fix \lbrack
and companions, parse \left\lfloor
and ceil, and parse lone ampersands properly
This is awesome -- thank you so much for sharing these contributions. We haven't yet taken outside contributions to our repo directly, so need to do a little work on our end to make sure our ducks are in a row. One thing to start: have you signed Mathquill's CLA by chance? https://cla-assistant.io/mathquill/mathquill. I bet we can piggy-back off of that (we might need to set up our own CLA). Will review the rest of this over the next week or so with the team and decide how we want to proceed. Again, so grateful! |
I have just signed that CLA. The code is all my own (some copied from the templates of other MathQuill nodes, but I assume that's perfectly fine), and I'm happy to let MathQuill and Desmos use it. Let me know if you all make one. Thanks for the positive response! |
A question: is there a way to force a node to reevaluate spacing around binary operators and unitalicized operator names? I'm trying to implement a sort of extendable node which can dynamically change how many blocks it has, but every time I change the block order, binary operators remove any space around them and words like |
Nevermind. I have found a solution. |
As part of the extendable nodes, I'm using the character |
Apologies if this is getting a bit large. I'm trying to merge anything I'm working on that would be difficult to implement externally. |
To make reviewing easier, I would greatly appreciate if this is split into a few separate PRs, since these seem to be generally unrelated changes. I'd suggest a split like this:
Some feedback for now, from a quick skim:
|
Sounds good. I'll also make a PR for the floor and ceil commands, which seem to work now.
In personal projects, I run
I'm not entirely sure how to write tests, but I'll try.
I didn't realize Prettier ran on accident, and will update the file to no longer be formatted using it. |
The testing framework looks wonderful to use. It shouldn't be hard to make it work. |
In advance, I apologize for the lack of modularity in this pull request. I have added three things (now five, see later comments) which I believe to be very useful, but I will understand if I should need to split this into three pull requests, or if only some of the items are added.
Limit
Node — New Node TypeAdded
Limit
node (which can be accessed via\lim
or\limit
). It is special-cased (likeSummationNotation
) to be ignored when creating fractions or binomials. Typing/
when a limit is before will exclude the limit from the numerator of the newly created fraction.Reasoning: I would like to have a
\lim
node in my own projects. Currently, I export all MathQuill output variables to a module, and I add things toLatexCmds
from there. However, the\lim
node needs special-casing so it isn't put in fraction numerators, so I propose it be added to MathQuill core. It would also be useful to be able to type limit notation into Desmos for rendering purposes, even if it doesn't have any proper functionality.The limit node aligns itself such that the word
lim
is on the baseline, as pictured below.customCharacters
option — Adds ExtensibilityAdded
customCharacters
option, to allow future special casing of characters other thanf
. When this option is passed, any characters it lists will have theirCharCmds
orLatexCmds
forms used instead of the default symbol for that character. For example, ifcustomCharacters: ['m']
is listed andCharCmds
orLatexCmds
has an entry for it, the characterm
will be displayed using that entry instead of as its default letter.This option defaults to
'f'
if not specified, so it is perfectly backwards compatible.Reasoning: I would like to have custom single-letter commands in my own projects, and I have been adding these via the methods specified in the section about the
Limit
node. However, these cannot be added byautoOperatorNames
, so there should be a mechanic created to allow characters to be automatically converted into custom commands.This also makes it possible to easily disable the special-casing of
'f'
(which, while already possible by using CSS overrides, is difficult and feels hacky).Here is an example of a special-cased
m
variable for mouse position and at
variable for time, but also properly converts to commands and operator names when near them. This would not be possible without adjusting MathQuill core.Fixes to
\lbrack
,\rbrack
,\slash
, and\vert
— Minor Bug FixCurrently, the
\lbrack
,\rbrack
,\slash
, and\vert
commands show text rendered in Symbola when they are included in a MathQuill field. This is almost certainly incorrect behavior. I assume that those commands are meant to render proper characters, such as in the below image (my fix is below).Reasoning: this is likely a bug and should be fixed.