Skip to content

React component using Khan Academy's Katex library

Notifications You must be signed in to change notification settings

MMedeirosB/React-Tex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status npm version dependencies Status

NPM NPM

React-Tex

Install

$ npm install --save react-tex

Using

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>
    )
  }
}

Output:tex

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>
    )
  }
}

Output:inlinetex

Available props for InlineTex are:

  • texContent: string. Latex string . (default: ``)
  • texSeperator: string. Latex string seperator using regex . (default: ${2})
  1. 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>

About

React component using Khan Academy's Katex library

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%