_loop = function _loop() {
    var specialCharFound = false;
    escapeKeys.forEach(function (key, index) {
      if (specialCharFound) {
        return;
      }
      if (runningStr.length >= key.length && runningStr.slice(0, key.length) === key) {
        result += escapes[escapeKeys[index]];
        runningStr = runningStr.slice(key.length, runningStr.length);
        specialCharFound = true;
      }
    });
    if (!specialCharFound) {
      result += runningStr.slice(0, 1);
      runningStr = runningStr.slice(1, runningStr.length);
    }
  }
Escape a string to be used in LaTeX documents.
@param {string} str the string to be escaped.
@param {boolean} params.preserveFormatting whether formatting escapes should
 be performed (default: false).
@param {function} params.escapeMapFn the function to modify the escape maps.
@return {string} the escaped string, ready to be used in LaTeX.