← All installation guides

React

LaTeX2JS for React

  1. 1. Install the library:

    npm install latex2react
  2. 2. Import the latex2js CSS file and the LaTeX React component:

    import 'latex2js/latex2js.css';
    import { LaTeX } from 'latex2react';
  3. 3. Load your TeX into the content property. Enjoy!

    const tex = String.raw`
    \begin{center}
    \begin{pspicture}(-2,-2)(2,2)
    \psframe(-2,-2)(2,2)
    \userline[linewidth=1.5 pt]{->}(0,0)(2,2)
    \end{pspicture}
    \end{center}
    `;
    
    export default function App() {
      return <LaTeX content={tex} />;
    }