addFunction method

void addFunction(
  1. String tex,
  2. List<TeXArg> args
)

Add function to the current node.

Implementation

void addFunction(String tex, List<TeXArg> args) {
  currentNode.removeCursor();
  final func = TeXFunction(tex, currentNode, args);

  /// Adding a pow requires further action, that's why we handle it in it's
  /// own function.
  if (tex.startsWith('^')) {
    addPow(func);
  }
  // The same applies for fractions.
  else if (tex == r'\frac') {
    addFrac(func);
  } else {
    currentNode.addTeX(func);
    currentNode = func.argNodes.first;
  }
  currentNode.setCursor();
  notifyListeners();
}