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

@mkbabb/latex-paper

v0.2.1

Published

LaTeX in, navigable paper data out.

Readme

latex-paper

LaTeX in, navigable paper data out.

latex-paper parses .tex and .bib, resolves labels and citations, builds a typed section tree, and can expose the result as a Vite virtual module. The Vue entry point adds the rendering and windowing primitives used by the paper view in fourier-analysis.

See docs/virtual-paper.md for the end-to-end path.

Install

npm install @mkbabb/latex-paper

Entry points

| Export | Purpose | | --- | --- | | @mkbabb/latex-paper | Pure parser types and helpers | | @mkbabb/latex-paper/transform | AST → PaperSectionData[] transform | | @mkbabb/latex-paper/vite | Build-time virtual module for paper content | | @mkbabb/latex-paper/vue | Vue components and virtual-window composables | | @mkbabb/latex-paper/theme | Base paper styles |

Core path

  1. parseLatex() builds the AST.
  2. Transformer turns that AST into PaperSectionData[], interleaving prose, display math, theorems, and figures as content blocks.
  3. flattenPaperSections() derives a stable depth-first list with hierarchy metadata and height estimates.
  4. useVirtualSectionWindow() turns that flat list into a bounded render window with top and bottom spacers.
  5. latexPaperPlugin() emits paperSections, labelMap, pageMap, totalPages, and extractedMacros through virtual:paper-content.

The page map is ordered, not title-matched. It is built from LaTeX TOC artifacts, so math-heavy headings no longer fall back to page 1.

Quick start

import latexPaperPlugin from "@mkbabb/latex-paper/vite";

export default {
    plugins: [
        latexPaperPlugin({
            texPath: "paper/main.tex",
            bibPath: "paper/refs.bib",
        }),
    ],
};
import { paperSections, labelMap, pageMap, totalPages, extractedMacros } from "virtual:paper-content";

Vue primitives

ComponentsPaperSection, PaperSectionBlocks, PaperSectionContent, MathBlock, MathInline, Theorem, CodeBlock. These cover headings, section bodies, display/inline math, theorems, and code listings.

ComposablesusePaperReader, useVirtualSectionWindow, useSidebarFollow, useKatex, flattenPaperSections. Reader setup, virtual windowing, sidebar scroll tracking, KaTeX rendering, and tree flattening.

Tracking primitivesuseLazyLoader, useTreeIndex, useScrollTracker, useScrollTo, useClickDelegate. Generic scroll and intersection utilities used by the composables above.

ContextPAPER_CONTEXT and createRenderTitle for dependency injection across the component tree.

Output shape

interface PaperSectionData {
    id: string;
    number: string;
    title: string;
    sourceLevel?: number;
    starred?: boolean;
    content: ContentBlock[];
    theorems?: PaperTheoremData[];
    figures?: PaperFigureData[];
    codeBlocks?: PaperCodeBlockData[];
    proofs?: PaperProofData[];
    subsections?: PaperSectionData[];
    callout?: { text: string; link: string };
    summary?: string;
}

ContentBlock is one of:

  • paragraph HTML string
  • MathBlockData—display equation
  • TheoremBlock—theorem, definition, lemma, etc.
  • FigureBlock—figure with caption
  • CodeBlock—code listing
  • ProofBlock—proof body

Development

npm test
npm run build
npm pack

Notes

  • KaTeX is optional at the package level and used by the Vue entry point.