npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-latex-js

v1.0.0

Published

A React Native component for rendering LaTeX content using LaTeX.js and WebView - fully offline, no CDN required

Readme

react-native-latex-js

A React Native component for rendering LaTeX content using LaTeX.js and WebView.

Features

  • ✅ Render LaTeX formulas and documents in React Native
  • ✅ Uses LaTeX.js for accurate LaTeX rendering
  • No CDN dependency - LaTeX.js is bundled inline
  • ✅ Works offline
  • ✅ Supports custom styling (colors, font size, custom CSS)
  • ✅ TypeScript support
  • ✅ Cross-platform (iOS & Android)
  • ✅ Easy to use
  • ✅ Callback support for load and error events

Installation

First, install the package:

npm install react-native-latex-js

Then install the required peer dependency:

npm install react-native-webview

For iOS, run:

cd ios && pod install

Note: The package automatically bundles LaTeX.js during installation, so no internet connection is required at runtime.

Usage

Basic Example

import React from 'react';
import { View, StyleSheet } from 'react-native';
import LatexView from 'react-native-latex-js';

export default function App() {
  return (
    <View style={styles.container}>
      <LatexView 
        latex="E = mc^2" 
        fontSize={18}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 20,
  },
});

Advanced Example

import React from 'react';
import { View, StyleSheet, ScrollView } from 'react-native';
import LatexView from 'react-native-latex-js';

export default function App() {
  const complexLatex = `
\\documentclass{article}
\\begin{document}

\\section{Introduction}
This is a LaTeX document rendered in React Native.

\\subsection{Math Examples}

Einstein's famous equation:
\\[ E = mc^2 \\]

Quadratic formula:
\\[ x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a} \\]

\\subsection{Lists}
\\begin{itemize}
  \\item First item
  \\item Second item
  \\item Third item
\\end{itemize}

\\end{document}
  `;

  return (
    <ScrollView style={styles.container}>
      <LatexView 
        latex={complexLatex}
        fontSize={16}
        backgroundColor="#f5f5f5"
        textColor="#333333"
        onLoad={() => console.log('LaTeX rendered successfully')}
        onError={(error) => console.error('LaTeX error:', error)}
        customCSS={`
          .section-title {
            color: blue;
          }
        `}
      />
    </ScrollView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
});

Inline Math Example

import React from 'react';
import { View, StyleSheet } from 'react-native';
import LatexView from 'react-native-latex-js';

export default function MathFormulas() {
  return (
    <View style={styles.container}>
      <LatexView 
        latex="The integral $\\int_0^\\infty e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}$" 
        fontSize={20}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 20,
  },
});

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | latex | string | required | LaTeX content to render | | customCSS | string | '' | Custom CSS styles to apply | | backgroundColor | string | '#ffffff' | Background color for the WebView | | textColor | string | '#000000' | Text color | | fontSize | number | 16 | Font size in pixels | | onLoad | () => void | undefined | Callback when rendering is complete | | onError | (error: string) => void | undefined | Callback when an error occurs | | webViewProps | object | {} | Additional props to pass to WebView |

How It Works

This component:

  1. Takes LaTeX content as input
  2. Bundles LaTeX.js library inline (no CDN, works offline)
  3. Creates an HTML page with embedded LaTeX.js code
  4. Renders the HTML in a WebView
  5. LaTeX.js parses and converts LaTeX to HTML/CSS
  6. The result is displayed in your React Native app

Note: LaTeX.js is bundled directly into the package at build time, ensuring offline functionality and no external dependencies.

LaTeX Support

This component supports most LaTeX features provided by LaTeX.js, including:

  • Math formulas (inline and display)
  • Document structure (sections, subsections)
  • Lists (itemize, enumerate)
  • Tables
  • Text formatting (bold, italic, underline)
  • And more...

For full LaTeX support details, see the LaTeX.js documentation.

Limitations

  • Performance may vary with very large LaTeX documents
  • Some advanced LaTeX features may not be supported by LaTeX.js
  • Bundle size includes LaTeX.js library (~600KB total)

TypeScript

This package is written in TypeScript and includes type definitions.

import LatexView, { LatexViewProps } from 'react-native-latex-js';

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Credits

Author

Omer Ulusoy