stefnotch / quantum-sheet

QuantumSheet - A user friendly mathematics worksheet and solver
https://stefnotch.github.io/quantum-sheet/
GNU General Public License v3.0
55 stars 5 forks source link

Unknown function parsing #33

Open stefnotch opened 3 years ago

stefnotch commented 3 years ago

We have to wait for the next compute-engine version https://cortexjs.io/docs/compute-engine/#(ParseLatexOptions%3Atype)

Compute-engine: parser should recognize unknown functions (like silly()) so, basically

  1. check if its a known token
  2. if not, check if brackets come right after it x()
  3. if there are brackets, its a function
  4. otherwise, split the letters and treat them as individual stuff

From Gitter

@stefnotch you can provide a parse function for xrightarrow that would parse for valid functions in the "above" argument. Arno Gourdol @arnog 12:16 For recursive functions, you have two options I can think of: use the parseUnknownToken option in the LatexSyntax parser to recognize foo as a function token. The second option would be for the definition of the := operator to create a scope (using ce.pushScope()) with a custom definition for the foo symbol. This gives you more flexibility (such as defining a domain, an argument list, etc...) in defining the symbol.