Skip to content

Instantly share code, notes, and snippets.

@supriya-gdptl
Last active February 15, 2018 11:53
Show Gist options
  • Save supriya-gdptl/4b0045add415637dfac93fd7e901f042 to your computer and use it in GitHub Desktop.
Save supriya-gdptl/4b0045add415637dfac93fd7e901f042 to your computer and use it in GitHub Desktop.
Adding latex code in HTML website

To add Latex code in HTML website, there are two ways,

  1. Simple way to add Latex code is using HTML image tag(for more info visit codecogs):

<img src="http://latex.codecogs.com/gif.latex?1+sin(x)" border="0"/>

  1. Using MathJax CDN:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>MathJax example</title>
  <script type="text/javascript" async
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head>
<body>
<p>
  When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
  $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
</p>
</body>
</html>

(code borrowed from JSBin)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment