Closed SinclaM closed 2 years ago
It looks like Desmos restricts the amount of recognized symbols while initializing LatexCmds
in the minified calculator_desktop-[hash].js
. I'd guess this is to discourage users from enabling too many shortcuts in order to prevent conflicts. For example, even among the few autoCommands
supported in the calculator, psi
conflicts with epsilon
, upsilon
, and Upsilon
.
A possible workaround might involve modifying calculator_desktop-[hash].js
before allowing it to load. But that is likely to conflict with DesModder, which does its own blocking and modifications.
Locally overriding a target function in calculator_desktop-[hash].js
with the corresponding function from build/mathquill.js
, from the MathQuill source code, and replacing instances of mq-
with dcg-mq-
is confirmed to add (probably?) all LaTeX symbols to the calculator. For example:
Since this modifies the internals of the calculator, it is a somewhat fragile approach, and will almost certainly conflict with DesModder if done naively.
A possible way to make the override during any point in runtime:
calculator_desktop-[hash].js
script, having changed the target function but otherwise leaving all the modules the samerequire(['toplevel/calculator_desktop', 'testbridge', 'jquery'], function (calcPromise, TestBridge, $) {
calcPromise.then(function(calc) {
$('.dcg-loading-div-container').hide();
window.Calc = calc;
TestBridge.ready();
});
});
'.dcg-wrapper'
element from '.graph-container'
. It's actually probably more sensible to do this removal before the previous step.A couple thoughts:
calculator_desktop-[hash].js
are made on top of the module overrides done by DesModder (this may be harder than anticipated).Success! e4291734d55fa17b6e4f524669b5a0b5f7011427 gives a very crude implementation of extending MathQuill, but it works. It employs the same module override method used by DesModder to override the mathquill_src
module. The code is an absolute mess, and DesModder compatibility hasn't been tested yet, but this is a good step forward.
The extension uses the
autoCommands
MathQuill configuration option, which in theory can support any LaTeX command. However, the Desmos graphing calculator heavily limits the amount of recognized symbols. So, although MathQuill can handle shortcuts likenabla
,partial
, andaleph
without issue, they are not recognized by the calculator.If possible, the extension should try to unlock the rest of the
autoCommands
and provide a way to enable them through the UI.