8000 GitHub - matiboux/astro-katex: Auto-render LaTeX in Element
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

matiboux/astro-katex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

astro-katex NPM version

astro-katex

Astro component to auto-render math in element, based on Katex

Math in astro markdown is not working with astro > 1.0.0-beta.31. #issue-3714

Install | Try it now | Blog Demo

$ npm install astro-katex katex

Usage

Before using astro-katex

Add a new integration

import katex from 'astro-katex';

export default defineConfig({
  integrations: [ katex() ],
});

Math in element

---
import AstroKatex from 'astro-katex/AstroKatex.astro'
---
<AstroKatex is:raw>
  Look again at \(\textbf{Figure A} \) and \(\textbf{Figure B}\). Notice that in both graphs, as  \(x\)  approaches \(7\), the output values approach \(8\). This means
  \[
    \lim_{x \to 7} f(x) = \lim_{x \to 7} g(x)
  \]
</AstroKatex>

Output:

Look again at $\textbf{Figure A}$ and $\textbf{Figure B}$. Notice that in both graphs, as $x$ approaches $7$, the output values approach $8$. This means $$\lim_{x \to 7} f(x) = \lim_{x \to 7} g(x)$$

Using just an Expression

---
import Expr from 'astro-katex/OnlyExpression.astro'
---

A simple mathematical expression:
<Expr>
    \sqrt{3x-1}+(1+x)^2
</Expr>

Output:

A simple mathematical expression: $\sqrt{3x-1}+(1+x)^2$

Options for Katex

A number of options are now supported. For a comprehensive list please visit: here

License

MIT

Note: Some $\LaTeX$ syntax may not be supported by KaTeX itself.

About

Auto-render LaTeX in Element

Resources

License

Stars

Watch 4180 ers

Forks

Releases

No releases published

Packages

No packages published
0