Open DL6ER opened 8 years ago
Update: The generated HTML source reads:
<span class="MathJax" id="MathJax-Element-9-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi><mo>,</mo><mi>n</mi><mo>&gt;</mo><mn>0</mn></math>" role="presentation" style="position: relative;">
<nobr aria-hidden="true"><span class="math" id="MathJax-Span-223" role="math" style="width: 4.071em; display: inline-block;"><span style="display: inline-block; position: relative; width: 3.835em; height: 0px; font-size: 106%;"><span style="position: absolute; clip: rect(1.359em 1003.78em 2.538em -999.997em); top: -2.179em; left: 0.003em;"><span class="mrow" id="MathJax-Span-224"><span class="mi" id="MathJax-Span-225" style="font-family: MathJax_Math; font-style: italic;">m</span><span class="mo" id="MathJax-Span-226" style="font-family: MathJax_Main;">,</span><span class="mi" id="MathJax-Span-227" style="font-family: MathJax_Math; font-style: italic; padding-left: 0.18em;">n</span><span class="mo" id="MathJax-Span-228" style="font-family: MathJax_Main; padding-left: 0.298em;">></span><span class="mn" id="MathJax-Span-229" style="font-family: MathJax_Main; padding-left: 0.298em;">0</span></span><span style="display: inline-block; width: 0px; height: 2.185em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.247em; border-left-width: 0px; border-left-style: solid; width: 0px; height: 1.066em;"></span></span></nobr>
<span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi><mo>,</mo><mi>n</mi><mo>></mo><mn>0</mn></math></span></span>
So, the MJX_Assistive_MathML is not hidden as it should be (and is within the presentation itself).
I am experiencing the same issue, except that the math is not even correctly rendered in my case.
@DL6ER Pointed it already out. Maybe not a nice solution. But it works.
The described procedure does not work for me. What does work is placing this code in the file plugin/math/math.js:
"AssistiveMML": {
disabled: true,
},
See also http://docs.mathjax.org/en/latest/options/extensions/assistive-mml.html
I just ran into this problem again; duplicate math text still seems to be present in speaker notes. As an update for anyone finding this from now on, it should be noted that @rschmehl's solution disabling AssistiveMML
should now be placed in plugin/math/plugin.js
.
Given that math config options can now be set within the Reveal.initialize
method, an even better solution would probably be just to set AssistiveMML : {disabled: true}
there. Perhaps a note about this should be added to the docs (with the caveat that by disabling "AssistiveMML" screen readers will no longer see the MML text)?
I was a bit curious about where this artifact orginated from, and it seems to be due to the fact that speaker notes written in an <aside class="notes">
block are captured using the innerHTML
property in the notes plugin:
/* plugin/notes/plugin.js */
// Look for notes defined in an aside element
if( notesElement ) {
messageData.notes = notesElement.innerHTML;
messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string';
}
It seems like this may be stripping the normal formatting that MathJax uses to hide the "AssistiveMML" text (suggested by this StackOverflow discussion). A workaround could be to reconfigure the notes
plugin to import the DOM elements straight from the original document, rather than just piping the HTML text into the speaker notes pop-up. (Unfortunately, it seems like the nodes themselves can't just be sent through the existing postMessage
method, due to restrictions on the structured clone algorithm... I'm no JS expert, so maybe there is an obvious fix for this.)
The following monkey patch has worked well for me. It injects css that hides the assistive text into the window for the speaker notes.
// Monkeypatch `open` to inject css that hides assistive mathml.
window._open = window.open;
window.open = (url, target, features) => {
let child = window._open(url, target, features);
setTimeout(() => {
let element = child.document.createElement("style");
element.textContent = "#speaker-controls .katex-html { display: none; }";
child.document.head.appendChild(element);
}, 500);
return child;
}
Whenever I try to use LaTeX on speaker notes, the output is different from what I expect: The "raw" input is always shown next to the (correctly) rendered math although it should be hidden.
Example 1 (single $):
Example 2 (double $):