$ npm install --save react-tex
1.In your component
import {Tex} from 'react-tex';
class TexWrapper extends Component{
render(){
let latexString = "\int_{a}^{b} f(x)dx = F(b) - F(a)";
return(
<div>
<Tex texContent={latexString}/>
</div>
)
}
}
Available props for Tex are:
texContent
:string
. Latex string . (default: ``)
For Inline component wrap the latex string in between $$
import {InlineTex} from 'react-tex';
class InlineTexWrapper extends Component{
render(){
let latexString = "This is inline $$\int_{a}^{b} f(x)dx = F(b) - F(a)$$ latex string";
return(
<div>
<InlineTex texContent={latexString}/>
</div>
)
}
}
Available props for InlineTex are:
texContent
:string
. Latex string . (default: ``)texSeperator
:string
. Latex string seperator using regex . (default:${2}
)
- Include Katex CSS in your html
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css">
</head>
</html>