7

输入:

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

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"]
  }
});

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>

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

如果我用 CSS 去掉辅助功能,我们确实只能看到一次输出。但随后 VoiceOver 用户什么也听不见。或者,我可以用 CSS 去掉嵌套的 span。我对这种方法持怀疑态度,因为虽然它可能适用于 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;
}
4

1 回答 1

1

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

[aria-hidden="true"] { display: none; }
于 2016-02-22T07:28:28.113 回答