This question already has an answer here:
Math rendering library for iPhone OS

(1个答案)


已关闭8年。




我想知道是否有一种简单的方法可以将数学方程式呈现到iOS应用程序中。它不必是交互式的。它所要做的只是以传统方式显示方程式,因此当用户处理复杂方程式时,它更易于遵循。

前任。 2 ^(2/(6 ^(1/2)))得出:

Wolfram Alpha会与我见过的其他应用程序一起执行此操作。它也不必处理变量。

最佳答案

自iOS5起,UIWebView可以显示mathML。你的例子:

<math title="2^(2/(sqrt(6))" xmlns="http://www.w3.org/1998/Math/MathML">
  <mstyle mathcolor="blue" fontfamily="sanserif" displaystyle="true">
    <msup>
      <mn>2</mn>
      <mrow>
        <mfrac>
          <mn>2</mn>
          <mrow>
            <msqrt>
              <mrow>
                <mn>6</mn>
              </mrow>
            </msqrt>
          </mrow>
        </mfrac>
      </mrow>
    </msup>
  </mstyle>
</math>

这将在iOS的UIWebView中呈现。

有可以为您转换的javascript库-例如mathjax可以接受ASCIIMath输入,例如本例2 ^(2/(sqrt(6))

这里对这些问题进行了很好的讨论
Tradeoff between LaTex, MathML, and XHTMLMathML in an iOS app?

10-05 20:34
查看更多