MathJax配置用于Web,移动和辅助

Wil*_*sch 7 uiwebview assistive-technology mathjax ios

输入:

<ins class="marked-for-jax">\[
1 + 2 + 3 + \ldots + n = \frac{n(n+1)}2.
\]</ins>
Run Code Online (Sandbox Code Playgroud)

MathJax配置:

MathJax.Hub.Config({
  jax: ["input/TeX", "output/HTML-CSS"],
  extensions: ["tex2jax.js"],
  messageStyle: "none",
  TeX: {
    extensions: ["AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js"]
  }
});
Run Code Online (Sandbox Code Playgroud)

为清晰起见,MathJax输出,缩短并格式化:

<p>
  <ins class="marked-for-jax">
    <span class="MathJax_Preview" style="color: inherit;"></span>
    <div class="MathJax_Display" style="text-align: center;">
      <span class="MathJax" id="MathJax-Element-2-Frame" tabindex="0" data-mathml="[mathML data here]" role="presentation" style="position: relative;">
        <nobr aria-hidden="true"><span class="math" id="MathJax-Span-12" role="math" style="width: 14.517em; display: inline-block;"><!--lots of nested spans here--></nobr>
        <span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><!--lots of mathML here--></span>
      </span>
    </div>
    <script <!--does not impact any output. Why is it even there at all?--> type="math/tex; mode=display" id="MathJax-Element-2">1 + 2 + 3 + \ldots + n = \frac{n(n+1)}2.</script>
  </ins>
</p>
Run Code Online (Sandbox Code Playgroud)

UIWebView上的外观.请注意,我们看到输出两次.第一个来自嵌套的跨度; 第二个来自辅助. 看到双倍

如果我用CSS删除辅助的那个,我们确实只看到输出一次.但是VoiceOver用户什么都听不见.或者,我可以用CSS删除嵌套的跨度.我怀疑这种方法,因为虽然它可能适用于iOS,但它可能无法在所有浏览器上运行.另外,根据我使用输出的确切方式,我可能希望能够阻止MathJax首先输出它当前正在做的部分.例如,在某些情况下,我将以一种我确定只会出现在iOS上的方式使用Html.在这种情况下,我用css剥离的任何Html,我宁愿不首先拥有.

如何让视力和辅助用户的输出有意义?

编辑:我在这里找到了一个相关的问题:MathJax正在重复我的方程式 - 为什么以及如何解决这个问题?

进一步编辑:我可以通过以下CSS解决"看到双重"问题,从这里得到:http://mathjax.readthedocs.org/en/latest/options/assistive-mml.html.但后来我遇到了一个新问题 - VoiceOver不会说任何数学.

span.MJX_Assistive_MathML {
    position:absolute!important;
    clip: rect(1px, 1px, 1px, 1px);
    padding: 1px 0 0 0!important;
    border: 0!important;
    height: 1px!important;
    width: 1px!important;
    overflow: hidden!important;
    display:block!important;
}
Run Code Online (Sandbox Code Playgroud)

Wil*_*sch 1

部分答案是放入以下 ​​CSS。请注意,这是特定于我的 iOS/droid 离线场景的。对于那些有不同场景的人来说,它可能不适用。此外,有些事情的结果非常糟糕。我对此不太满意。

[aria-hidden="true"] { display: none; }
Run Code Online (Sandbox Code Playgroud)