簡體   English   中英

MathJax配置用於Web,移動和輔助

[英]MathJax config for web, mobile, and assistive

輸入:

<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刪除嵌套的跨度。 我懷疑這種方法,因為雖然它可能適用於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;
}

PARTIAL ANSWER是將以下CSS放入其中。請注意,這是特定於我的iOS / droid離線方案。 對於那些有不同場景的人,可能不適用。 此外,有些事情非常糟糕。 我對此並不滿意。

[aria-hidden="true"] { display: none; }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM