-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
I am encountering a weird error whereby there is extra space in summation symbols between the header and footers. As an example, here is an example of the LaTeX and its output:
$$
\begin{spreadlines}{0.5em}
\begin{align}
L(\sigma, \mu|\mathbf{y_i}) &= \prod^n_{i=1}\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2}\big(\frac{y_i - \mu}{\sigma}\big)^2}
\nonumber \\\\
&= \sigma^{-n}(2\pi)^{-\frac{n}{2}}e^{\Big(-\frac{1}{2\sigma^2}\sum_{i=1}
^n(y_i - \mu)^2\Big)}.
\label{eq:gauss-prod-s}
\end{align}
\end{spreadlines}
$$Here is my MathJax setup:
window.MathJax = {
section: {
n: -1,
useLetters: false,
letters: "AABCDEFGHIJKLMNOPQRSTUVWXYZ"
},
loader: {load: ['[tex]/tagformat', '[tex]/mathtools', 'output/chtml']},
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']], //allow inline math
displayMath: [['$$','$$']],
tagSide: 'right', //location of equation numbers
tags: 'all',
packages: {'[+]': ['tagformat', 'sections', 'autoload-all', 'mathtools']},
tagformat: {
number: (n) => {
const section = MathJax.config.section;
return (section.useLetters ? section.letters[section.n] : section.n) + '.' + n;
}
}},
chtml: {
mtextInheritFont: true, // font to use for mtext, if not inheriting (empty means use MathJax fonts)
displayOverflow: 'linebreak'
},
linebreaks: { // options for when overflow is linebreak
inline: true, // true for browser-based breaking of inline equations
width: '90%%', // a fixed size or a percentage of the container width
lineleading: 2, // the default lineleading in em units
LinebreakVisitor: null, // The LinebreakVisitor to use
},
startup: {
ready() {
const {CommonWrapper} = MathJax._.output.common.Wrapper;
const {LineBBox} = MathJax._.output.common.LineBBox;
const {ChtmlMtable} = MathJax._.output.chtml.Wrappers.mtable;
const Configuration = MathJax._.input.tex.Configuration.Configuration;
const CommandMap = MathJax._.input.tex.SymbolMap.CommandMap;
new CommandMap('sections', {
nextSection: 'NextSection',
setSection: 'SetSection',
}, {
NextSection(parser, name) {
MathJax.config.section.n++;
parser.tags.counter = parser.tags.allCounter = 0;
},
SetSection(parser, name) {
const section = MathJax.config.section;
const c = parser.GetArgument(name);
const n = section.letters.indexOf(c);
if (n >= 0) {
section.n = n;
section.useLetters = true;
} else {
section.n = parseInt(c);
section.useLetters = false;
}
},
});
Object.assign(ChtmlMtable.prototype, {
adjustWideTable() {
const attributes = this.node.attributes;
if (attributes.get('width') !== 'auto') return;
const [pad, align] = this.getPadAlignShift(attributes.get('side'));
const W = Math.max(this.containerWidth / 10, this.containerWidth - pad - (align === 'center' ? pad : 0));
this.naturalWidth() > W && this.adjustColumnWidths(W);
}
});
Configuration.create(
'sections', {handler: {macro: ['sections']}}
);
MathJax.startup.defaultReady();
}
}
};