Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Issues
  • #2378
Closed
Open
Issue created Mar 23, 2020 by Administrator@rootContributor

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 converting 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!

Assignee
Assign to
Time tracking