7

I saw some sites include LaTeX formulas in their sites. How they do that?
Is there any HTML tag or maybe a SSI command to include LaTeX formulas?
I prefer there be a server-side command, not a client-side. Some clients don't have LaTeX compiler.

Thanks in advance

Pro.Hessam
  • 819
  • 3
  • 11
  • 26
  • Does this answer your question? [What is the best way to embed LaTeX in a webpage?](https://stackoverflow.com/questions/116054/what-is-the-best-way-to-embed-latex-in-a-webpage) – MattAllegro Jan 02 '21 at 15:03
  • Very related: https://stackoverflow.com/questions/116054/what-is-the-best-way-to-embed-latex-in-a-webpage – MattAllegro Jan 02 '21 at 15:04

3 Answers3

8

MathJax is a possible solution. It is a client-side solution (Javascript) which is compatible with LaTeX syntax.

I think MathTran provides an online outsourcing of your LaTeX files, which you can later embed in your HTML code (much in the way of the Google Chart Tools)

Depending on your server configuration (ie assuming you can install what you want), if the LaTeX files don't change often you could easily schedule a (say) LaTeX -> PNG render (lots of info the web on how to do it) and link the resulting PNG.

Last resort (but the simplest) if you have server limitations (say a shared host), you can just render the LaTeX to an image offline and upload the result.

Rui Vieira
  • 5,253
  • 5
  • 42
  • 55
  • 1
    Thanks, I found [codecogs](http://www.codecogs.com/latex/htmlequations.php) a good option for online clients. It suits my needs. – Pro.Hessam Aug 10 '11 at 12:54
1

MathJax can do that job for you. Check out the website.

agf
  • 171,228
  • 44
  • 289
  • 238
  • 2
    Welcome to Stack Overflow. The point of your answer was already mentioned in the accepted answer quite some hours ago, so your answer is not bringing anything new. – Paŭlo Ebermann Aug 10 '11 at 21:35
0

While CodeCogs (updated hyperlink) can be used to separately generate images that you can add later to your webpage using the tag <img>, a valid (and faster loading) alternative to MathJax is given by KaTeX: I paste here a minimal example of implementation of this latter.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Katex</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
</head>

<body>
<p>Blah blah \(e^{i\pi}+1=0\) blah blah blah.</p>
\[e^{i\pi}+1=0\]
<p>Blah blah blah blah blah.</p>
</body>
</html>

All you need to do is to add one link and two script tags to your header, then you can write with LaTeX syntax inline math between the delimiters \( \) and displayed math between the delimiters \[ \].

MattAllegro
  • 6,455
  • 5
  • 45
  • 52