feat: add rendered math support with mathjax
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
title: "Render Math With Mathjax"
|
||||||
|
date: 2022-12-09T19:53:33+05:30
|
||||||
|
draft: false
|
||||||
|
author: "Gurusabarish"
|
||||||
|
tags:
|
||||||
|
- Markdown syntax
|
||||||
|
- Mathjax
|
||||||
|
- example
|
||||||
|
image: /images/mathjax.png
|
||||||
|
description: ""
|
||||||
|
toc:
|
||||||
|
mathjax: true
|
||||||
|
---
|
||||||
|
|
||||||
|
Math equations can be rendered using [Mathjax](https://www.mathjax.org) syntax with AMS symbol support.
|
||||||
|
|
||||||
|
Optionally enable this on a per-page basis by adding `mathjax: true` to your frontmatter.
|
||||||
|
|
||||||
|
Then, use `$$ ... $$` on a line by itself to render a block equation:
|
||||||
|
|
||||||
|
$$ | Pr_{x \leftarrow P_{1}} [A(x) = 1] - Pr_{x \leftarrow P_{2}} [A(x) = 1] | < \text{negligible} $$
|
||||||
|
|
||||||
|
The raw version is:
|
||||||
|
|
||||||
|
```
|
||||||
|
$$ | Pr_{x \leftarrow P_{1}} [A(x) = 1] - Pr_{x \leftarrow P_{2}} [A(x) = 1] | < \text{negligible} $$
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Write in-line equations with `\\( ... \\)` , like \\( x^n / y \\) . It's easy!
|
||||||
|
|
||||||
|
```
|
||||||
|
Write in-line equations with `\\( ... \\)` , like \\( x^n / y \\) . It's easy!
|
||||||
|
```
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
@@ -66,3 +66,24 @@
|
|||||||
{{ if not (.Site.Params.navbar.disableSearch | default false) }}
|
{{ if not (.Site.Params.navbar.disableSearch | default false) }}
|
||||||
<script src="/js/search.js"></script>
|
<script src="/js/search.js"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if (.Params.mathjax | default false) }}
|
||||||
|
|
||||||
|
{{ "<!-- MathJax -->" | safeHTML }}
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.min.js" integrity="sha384-M5jmNxKC9EVnuqeMwRHvFuYUE8Hhp0TgBruj/GZRkYtiMrCRgH7yvv5KY+Owi7TW" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
<script type="text/x-mathjax-config">
|
||||||
|
MathJax.Hub.Config({
|
||||||
|
tex2jax: {
|
||||||
|
inlineMath: [['\\(','\\)']],
|
||||||
|
displayMath: [['$$','$$'], ['\[','\]']],
|
||||||
|
processEscapes: true,
|
||||||
|
processEnvironments: true,
|
||||||
|
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
|
||||||
|
TeX: { equationNumbers: { autoNumber: "AMS" },
|
||||||
|
extensions: ["AMSmath.js", "AMSsymbols.js"] }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
|||||||
Reference in New Issue
Block a user