LaTeX in NotebookLM

2025, Personal


NotebookLM is a powerful tool for organizing and reasoning about technical content, yet its lack of native LaTeX rendering limits its usefulness for math-heavy workflows. This project bridges that gap, making NotebookLM a more practical workspace for students, researchers, and engineers who frequently work with equations and symbolic expressions.

About This Update

This project builds on an existing NotebookLM LaTeX renderer. I contributed targeted improvements to make the renderer more reliable:

  • Previously, math split across multiple DOM nodes (e.g., with \forall or set-builder notation) was parsed in fragments, causing partial or failed renders. I fixed this by coalescing all contiguous text between math delimiters into a single string before rendering.
  • Additionally, in the original version, % inside math was treated as a comment start by KaTeX, truncating content. The fix here was to escape percent signs as \% inside math prior to parsing.
  • Previously, expressions spanning table cells or <br> seams were skipped because detection stopped at structural boundaries. To fix this, I normalize and flatten content across table and <br> boundaries so full expressions are detected and rendered.

Features

  • Supports both inline ($...$) and display ($$...$$) math
  • Lightweight, client-side transformation (no backend dependencies)
  • Safe HTML parsing and escaping to prevent injection vulnerabilities
  • Works seamlessly in existing notes—no migration required
  • Configurable math delimiters for custom syntax
  • Simple installation via userscript or browser extension
  • Fully open source on GitHub

Example Usage

Before

Before: LaTeX rendering in NotebookLM

After

After: Improved LaTeX rendering in NotebookLM
Inline: $e^{i\pi} + 1 = 0$
Block:
$$
\int_{-\infty}^{\infty} e^{-x^2} \; dx = \sqrt{\pi}
$$

Source Links