mathjax / MathJax-node

MathJax for Node
Apache License 2.0
615 stars 97 forks source link

[CommonHTML] TagSide: left not working #221

Closed pkra closed 8 years ago

pkra commented 8 years ago

Below a test which I think should succeed if TagSide was working and fails on develop.

However, in a more complex setup (looping through an XML document and fishing out some TeX fragments), I am using TagSide:left successfully. So I'm confused.

var tape = require('tape');
var mjAPI = require("..//lib/mj-single.js");
var jsdom = require('jsdom').jsdom;

tape('tagside:left', function(t) {
  t.plan(1);
  mjAPI.config({TeX: { TagSide: "left"}});
  mjAPI.start();
  var tex = '\\begin{equation} f(x) \\tag{1}\\end{equation}';
  var expected = "mjx-stack";

  mjAPI.typeset({
    math: tex,
    format: "TeX",
    html: true
  }, function(data) {
    var document = jsdom(data.html);
    console.log(data.html);
    var window = document.defaultView;
    var element = window.document.getElementsByClassName("mjx-mtable")[0].firstChild;
    var result = element.getAttribute('class');
    t.equal(result, expected);
  });
});
dpvc commented 8 years ago

The problem here is incorrect configuration. You need

  mjAPI.config({MathJax: {TeX: { TagSide: "left"}}});

in order to make configuration changes for MathJax itself (rather than mathjax-node). With that, I think your test should work.

pkra commented 8 years ago

D'oh.