Math equations on the web

前端 未结 16 1897
礼貌的吻别
礼貌的吻别 2020-12-04 09:19

How can I render Math equations on the web? I am already familiar with LaTeX\'s Math mode.

相关标签:
16条回答
  • 2020-12-04 10:01

    If you do use images, will a reader for a blind user be able to read the equation? Some may want to.

    0 讨论(0)
  • 2020-12-04 10:05

    I have the impression that MediaWiki will allow you to enter LaTeX markup (or something similar) and dynamically decide the best way to display it. Currently I think that uses HTML where possible for small expressions and images for more complicated expressions that cannot be represented otherwise; I suspect that one day it may take advantage of whatever other methods become state of the art, i.e., MathML if browsers start supporting it. So I think you might find that if you use MediaWiki as if it were your website engine you'll be forward-compatible with whatever comes in the future.

    0 讨论(0)
  • 2020-12-04 10:06

    Katex

    A couple of developers from the Khan Academy released a blazing quick library based off of Tex called Katex:

    • Fast
    • High-quality
    • Self-contained; and,
    • Can be rendered on the server

    Looks like a great modern option.

    Katex sample

    0 讨论(0)
  • 2020-12-04 10:06

    I do render LaTeX formulas "on demand" in my wiki. Basically, I extract the latex code from each wiki section and put it into a .tex file (whose filename is an md5sum of the latex, so if the same code is used again, the same tex and therefore the same image will be used). The tex file is then latex compiled by a cron task every minute, to produce first a .ps, then with the convert program a .png (named again with the original md5). The wiki entry replaces the latex text with an img tag referring to this png (with the original latex code as an alt, for text readers).

    If you want to go this way, be very careful to sanitize your latex as much as you can. there are commands in latex, like \input, that you definitely do not want to let go through, as anybody able to use them would be able to include any readable file in your server disk and include it in the resulting latex output.

    To solve this issue, Mediawiki (of wikipedia fame) has a special plugin which sanitizes the latex input, but I didn't want to use it for two reasons: first I did not use mediawiki, second it's written in OCaml and I didn't want to mess with a language I don't know.

    0 讨论(0)
  • 2020-12-04 10:06

    You can generate equation image on-the-fly via a LaTeX server.

    http://www.forkosh.com/mimetex.html

    If you are using WordPress, you can use LaTeX for WordPress (http://wordpress.org/extend/plugins/latex/) plugin.

    0 讨论(0)
  • 2020-12-04 10:07

    LaTeX and MathML are the only "right" ways to do this. However each has severe limitations. The other options are images (not really optimal if you need to edit the equations later) or complex HTML(requires some training but can be done).

    0 讨论(0)
提交回复
热议问题