如何在网页中显示数学公式与化学公式的方法

一、实现方法:http://asciimath.org/

1、asciimathml,mathjax

二、展示技巧:

    1. Use MathJax to render your formulas. MathJax is a full fledged open source JavaScript display engine for mathematics and works in all browsers.
    2. This is the recommended approach!

      Get started by loading the default AsciiMath configuration:

      <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML"></script>

      Text in you HTML enclosed in ` (backticks) will now get rendered as a math formula. The math delimiters can also be customized. Check out the MathJax website for more information!

    3. Load the AsciiMath javascript file (get it on GitHub) in either the head or the body tag of your website like this:

      <script src="ASCIIMathML.js"></script>

      This file contains JavaScript to convert AsciiMath notation and (some) LaTeX to Presentation MathML. The conversion is done while the HTML page loads.

      Attention: Currently this only works in Firefox 3+ and Safari 5.1

    4. Syntax

      Operation symbols
      Type See
      + +
      -
      *
      **
      *** ?
      // /
      \\ \
      xx ×
      -: ÷
      @ °
      o+
      ox
      o.
      sum
      prod
      ^^
      ^^^ ?
      vv
      vvv ?
      nn
      nnn ?
      uu
      uuu ?
      Miscellaneous symbols
      Type See
      int
      oint
      del
      grad
      +- ±
      O/
      oo
      aleph
      /_
      :.
      |...| |...|
      |cdots| |?|
      vdots ?
      ddots ?
      |\ | | |
      |quad| |  |
      diamond ?
      square
      |__
      __|
      |~
      ~|
      CC C
      NN N
      QQ Q
      RR R
      ZZ Z
      Relation symbols
      Type See
      = =
      !=
      < <
      > >
      <=
      >=
      -< ?
      >- ?
      in
      !in
      sub
      sup
      sube
      supe
      -=
      ~=
      ~~
      prop
      Greek Letters
      Type See Type See
      alpha α
      beta β
      chi χ
      delta δ Delta Δ
      epsilon ε
      varepsilon ?
      eta η
      gamma γ Gamma Γ
      iota ι
      kappa κ
      lambda λ Lambda Λ
      mu μ
      nu ν
      omega ω Omega Ω
      phi ? Phi Φ
      varphi φ
      pi π Pi Π
      psi ψ Psi Ψ
      rho ρ
      sigma σ Sigma Σ
      tau τ
      theta θ Theta Θ
      vartheta ϑ
      upsilon υ
      xi ξ Xi Ξ
      zeta ζ
      Logical symbols
      Type See
      and and
      or or
      not ¬
      =>
      if if
      iff
      AA
      EE
      _|_
      TT ?
      |-- ?
      |== ?
      Grouping brackets
      Type See
      ( (
      ) )
      [ [
      ] ]
      { {
      } }
      (: ?
      :) ?
      {:  
      :} :}
      Arrows
      Type See
      uarr
      darr
      rarr
      ->
      |-> ?
      larr
      harr
      rArr
      lArr
      hArr
      Accents
      Type See
      hat x
      bar x
      ul x x−
      vec x x→
      dot x x.
      ddot x x..
      Font commands
      Type See
      bb "AaBbCc" AaBbCc
      bbb "AaBbCc" AaBbCc
      cc "AaBbCc" AaBbCc
      tt "AaBbCc" AaBbCc
      fr "AaBbCc" AaBbCc
      sf "AaBbCc" AaBbCc

      Special Cases

      Matrices: [[a,b],[c,d]] yields to [acbd]

      Column vectors: ((a,b),(c,d)) yields to (acbd)

      Complex subscripts: lim_(x->oo) yields to limx→∞

      Subscripts must come before superscripts: int_0^1 f(x)dx yields to ∫10f(x)dx

      Attention: Always try to surround the > and < characters with spaces so that the html parser does not confuse it with an opening or closing tag!

      Standard Functions

      sin, cos, tan, csc, sec, cot, sinh, cosh, tanh, log, ln, det, dim, lim, mod, gcd, lcm, min, max

      The Grammar

      Here is a definition of the grammar used to parse AsciiMath expressions. In the Backus-Naur form given below, the letter on the left of the ::= represents a category of symbols that could be one of the possible sequences of symbols listed on the right. The vertical bar | separates the alternatives.

      c ::= [A-z] | numbers | greek letters | other constant symbols (see below)
      u ::= ‘sqrt‘ | ‘text‘ | ‘bb‘ |     other unary symbols for font commands
      b ::= ‘frac‘ | ‘root‘ | ‘stackrel‘ binary symbols
      l ::= ( | [ | { | (: | {:          left brackets
      r ::= ) | ] | } | :) | :}          right brackets
      S ::= c | lEr | uS | bSS | "any"   simple expression
      E ::= SE | S/S | S_S | S^S | S_S^S expression (fraction, sub-, super-, subsuperscript)
时间: 2024-08-24 11:20:30

如何在网页中显示数学公式与化学公式的方法的相关文章

网页上显示数学公式目前哪种方案最好? 来自知乎

作者:Hello World链接:http://www.zhihu.com/question/26798550/answer/34064562来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 应该是MathJax吧,至少算得上是使用最广泛的,很多知名的网站像arXiv, MathSciNet, Science Direct, APS Journals, MathOverflow, Physics StackExchange, Scholarpedia等都在用 优点是

在网页中写入数学公式

今天跟大家分享在网页中使用数学公式. 像这样的公式大家怎么写出来呢? 甚至还有更复杂的: 以前有一种很常见的做法,就是利用数学公式生成器生成一张图片,然后将图片嵌在网页里. 就是先用这个数学公式生成器生成公式的图片,然后在将该img的style属性改成  style="padding:0px;border: none;margin:0px;vertical-align: bottom;"   插入到网页中就可以了. 这种方法可以利用阮一峰的数学公式生成器.具体做法去他的博客看,我就不搬

如何在网页中显示pdf

用如下的html代码即可(例子见http://www.cnblogs.com/zhangzujin/p/3768592.html): <div class="postBody"> <div id="cnblogs_post_body"> <p><iframe src="您要展示的pdf的网址" width="680" height="680"></ifr

当在网页中显示文本过长该怎么办?

当在网页中显示文本过长该怎么办? 当我们在设计网页页面的时候,有时候肯定会遇到这种情况,我们要显示的文本超出了我们元素的宽度.这时候调宽元素的width固然是可以的,但是太宽了又不太美观了.我们可能会想能不能不改变元素的width,让超出的部分隐藏掉,然后鼠标移动到文本上的时候把全部的内容再显示出来.下面我们就来说说CSS中能够实现这种效果的方式... 代码如下,各个样式的注释已经在代码中 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Trans

如何在浏览器网页中显示word文件内容

如何在浏览器网页中显示word文件内容 把word文件读到byte[]中,再Response.OutputStream.Write(bytes)到客户端去 Page_Load事件中写: //FileStream   fs   =   new   FileStream("c:\\1.doc",   FileMode.Open,   FileAccess.Read);  FileStream fs = new FileStream(Server.MapPath("files\\1

非常好的在网页中显示pdf的方法

今天有一需求,要在网页中显示pdf,于是立马开始搜索解决方案,无意中发现一个非常好的解决方法,详见http://blogs.adobe.com/pdfdevjunkie/web_designers_guide. 其实就光看这个网站也足够了,http://www.pdfobject.com/. 记录一下主要代码: <script type="text/javascript" src="scripts/pdfobject/pdfobject.js"><

让tomcat 日志网页中显示

长话短说,将tomcat日志在网页上显示出来的办法有很多,通过用不同的软件就可以实现,但是最简单的还是在本地几条命令完事了. 同分区的话可以用硬链接实现 首先查看你的web根目录:vim tomcat/conf/server.xml 找到 <Context docBase="****这一行并进入其指定的根目录中,在根目录里执行  ln /usr/local/tomcat/logs/catalina.out . 这样会在你当前的目录里产生一个catalina.out链接文件,重启tomcat

网页中显示pdf

1.<embed width="800" height="600" src="test_pdf.pdf"> </embed> 通过的浏览器:360.Firefox.IE.Chrome 2.<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="800" height="600"

在网页中显示CHM (c# csharp .net asp.net winform)

CHM即“已编译的帮助文件”,主要由.hhc(目录文件)..hhk(索引文件)以及相应的帮助主题文件(.html,.htm)这些内容编译而成. 方法对比 在网页中显示CHM内容,大致有以下几种办法: 使用某些工具来反编译,把CHM文件还原成以上相关的文件,并通过hhc文件来列出目录,内容链接到相应的html文件 依然是反编译这些文件,把相关目录及html文件内容直接存到数据库中 直接解析chm文件 这些方法有优点也有缺点: 方法1的优点是方便快捷:缺点也很明显,分散的html不便于管理也不利于搜