CHTML does not respect `adaptiveCSS: false` for some symbols
Created by: jasonchoimtt
Issue Summary
In MathJax 3 when using adaptiveCSS: false
, the CHTML stylesheet omits some symbols, e.g. \in
, and as a result those symbols will not show up.
Steps to Reproduce:
Script in Node.js:
const mathjax = require('mathjax-full/js/mathjax.js').mathjax;
const TeX = require('mathjax-full/js/input/tex.js').TeX;
const CHTML = require('mathjax-full/js/output/chtml.js').CHTML;
const liteAdaptor = require('mathjax-full/js/adaptors/liteAdaptor.js').liteAdaptor;
const RegisterHTMLHandler = require('mathjax-full/js/handlers/html.js').RegisterHTMLHandler;
const AllPackages = require('mathjax-full/js/input/tex/AllPackages.js').AllPackages;
const adaptor = liteAdaptor();
RegisterHTMLHandler(adaptor);
const tex = new TeX({packages: AllPackages});
const chtml = new CHTML({
fontURL: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.0.0/es5/output/chtml/fonts/woff-v2',
adaptiveCSS: false,
});
const html = mathjax.document('', {InputJax: tex, OutputJax: chtml});
function printCSS() {
const css = chtml.styleSheet(html).children[0].value;
console.log('CSS length', css.length, 'Contains 2208', css.indexOf('2208') !== -1);
}
printCSS(); // prints CSS length 596245 Contains 2208 false
// \in renders to U+2208 (Element Of)
html.convert('x\\in X');
printCSS(); // prints CSS length 596351 Contains 2208 true
Before the convert
, the HTML + CSS generated would not display the \in
symbol in a browser.
After convert
ing a tex expression containing \in
, the stylesheet will contain the necessary rule and the HTML + CSS would properly in a browser.
I expect that disabling adaptiveCSS
should result in all rules being included, but it is not the case, so this seems to be a bug.
Technical details:
- MathJax Version: 3.0.1 (mathjax-full on npm)
- Client OS: Mac OS X 10.8.4
- NodeJS: 12.12.0
Supporting information:
I think the cause is CHTMLFontData#addVariantChars
in which variant.chars[N].length === 4
did not consider the adaptiveCSS
option:
https://github.com/mathjax/MathJax-src/blob/master/ts/output/chtml/FontData.ts#L207
Thanks!