Skip to content

Commit

Permalink
feat: Add latex support
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxence Drutel authored and MaxleDrut committed Apr 23, 2024
1 parent 47ce809 commit 6fd0159
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/javascripts/katex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
document$.subscribe(({ body }) => {
const macros = {
"\\dag": '\\dagger',
"\\dd": '\\mathrm{d}',
"\\dt": '\\mathrm{d}t',
"\\tr": "\\mathrm{Tr}\\left[#1\\right]",
"\\kett": "|#1\\rangle\\!\\rangle",
};

renderMathInElement(body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false },
{ left: "\\[", right: "\\]", display: true }
],
macros: macros,
})
});
8 changes: 8 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@ nav:
- About the Qiskit provider: about_api_providers/about_the_provider.md
- Changelog: about_api_providers/changelog.md
- Contact us: contact_us.md
markdown_extensions:
- pymdownx.arithmatex:
generic: true
extra_css:
- stylesheets/extra.css
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.css
extra_javascript:
- javascripts/katex.js
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.js
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/auto-render.min.js

0 comments on commit 6fd0159

Please sign in to comment.