MCPcopy Create free account
hub / github.com/TruthHun/BookStack / makeLeftRightDelim

Function makeLeftRightDelim

static/katex/katex.js:8692–8712  ·  view source on GitHub ↗
(delim, height, depth, options, mode, classes)

Source from the content-addressed store, hash-verified

8690
8691
8692var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) {
8693 // We always center \left/\right delimiters, so the axis is always shifted
8694 var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right
8695
8696 var delimiterFactor = 901;
8697 var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm;
8698 var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight);
8699 var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are
8700 // 65536 per pt, or 655360 per em. So, the division here truncates in
8701 // TeX but doesn't here, producing different results. If we wanted to
8702 // exactly match TeX's calculation, we could do
8703 // Math.floor(655360 * maxDistFromAxis / 500) *
8704 // delimiterFactor / 655360
8705 // (To see the difference, compare
8706 // x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
8707 // in TeX and KaTeX)
8708 maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total
8709 // height
8710
8711 return delimiter_makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);
8712};
8713
8714/* harmony default export */ var delimiter = ({
8715 sqrtImage: makeSqrtImage,

Callers

nothing calls this directly

Calls 2

fontMetricsMethod · 0.80

Tested by

no test coverage detected