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

@graffiticode/translatex

v0.24.0

Published

A library for translating LaTeX

Readme

TransLaTeX

A library for translating LaTeX

DESCRIPTION

This module implements a LaTeX translator using translation rules written in L120.

BUILD

$ make

This command will run ESLint linter and Jest tests.

INSTALLING

$ npm i './translatex'

where ./translatex refers to the directory that contains this repo.

CALLING

import {TransLaTeX} from '@graffiticode/translatex'
const str = TransLaTeX.translate(rules, '-1+2');
console.log(str);  // (negative (number one)) plus (number two)

where rules is a rules object created using L120. For example: https://gc.acx.ac/item?id=3LgCjBbX9u0

A rules object is the DATA JSON obtained by clicking the DATA link in the navigation bar at the top of the Graffiticode browser window. Here is a sample: https://gc.acx.ac/data?id=3LgCjBbX9u0

NUMBER FORMATTING

TransLaTeX supports Excel-like number formatting using the $fmt expander. This allows you to format numbers with different currency symbols, thousands separators, and decimal places.

Format String Syntax

The format string uses Excel-like patterns:

  • # - Optional digit
  • 0 - Required digit
  • , - Thousands separator (position determines separator type)
  • . - Decimal separator (position determines separator type)
  • Currency symbols: $, , ¥, £, , , ¢
  • _ prefix for suffix placement (e.g., _$ puts $ at the end)
Examples
// US Dollar format with comma thousands separator
const rules = {
  rules: { "?": ["$fmt{%1,$#,##0.00}"] }
};
TransLaTeX.translate(rules, "1234.56");  // "$1,234.56"

// European format with dot thousands, comma decimal
const rules = {
  rules: { "?": ["$fmt{%1,€#.##0,00}"] }
};
TransLaTeX.translate(rules, "1234.56");  // "€1.234,56"

// Japanese Yen (no decimals)
const rules = {
  rules: { "?": ["$fmt{%1,¥#,##0}"] }
};
TransLaTeX.translate(rules, "1234.56");  // "¥1,235"

// Currency suffix
const rules = {
  rules: { "?": ["$fmt{%1,#,##0.00_$}"] }
};
TransLaTeX.translate(rules, "1234.56");  // "1,234.56$"

// French format with space thousands separator
const rules = {
  rules: { "?": ["$fmt{%1,€# ##0,00}"] }
};
TransLaTeX.translate(rules, "1234567.89");  // "€1 234 567,89"

// International format with space separator
const rules = {
  rules: { "?": ["$fmt{%1,# ##0.00_$}"] }
};
TransLaTeX.translate(rules, "1234567.89");  // "1 234 567.89$"

// US Dollar with space separator (no decimals)
const rules = {
  rules: { "?": ["$fmt{%1,$# ##0}"] }
};
TransLaTeX.translate(rules, "12345.67");  // "$12 346"
Environment-Based Formatting

The $fmt expander can also get formatting instructions from the environment, which enables per-cell formatting in spreadsheet applications:

// Cell-based formatting (typical Graffiticode usage)
const formatRules = {
  rules: {
    "\\type{number}": ["$fmt"],
    "?": ["%1"]
  }
};

const options = {
  allowInterval: true,
  RHS: false,
  env: { format: "Currency" },  // Format from cell
  ...formatRules
};

TransLaTeX.translate(options, "1500.75", (err, val) => {
  console.log(val);  // "$1,500.75"
});

// Integration example (formatCellValue pattern)
const formatCellValue = ({ env, name }) => {
  const { val, format } = env.cells[name] || {};
  if (format && val.length > 0) {
    const options = {
      allowInterval: true,
      RHS: false,
      env: { format },
      ...formatRules
    };
    TransLaTeX.translate(options, val, (err, result) => {
      return result;  // Formatted value
    });
  }
  return val;  // Unformatted value
};
Supported Currency Symbols
  • $ - US Dollar
  • - Euro
  • ¥ - Japanese Yen
  • £ - British Pound
  • - Indian Rupee
  • - Russian Ruble
  • ¢ - Cent
Thousands Separators
  • Comma (,) - Used in US, UK: 1,234.56
  • Dot (.) - Used in Europe: 1.234,56
  • Space ( ) - Used in France, Germany, Russia, International: 1 234 567,89

The separator behavior is determined by the pattern:

  • #,##0.00 = comma thousands, dot decimal (US/UK)
  • #.##0,00 = dot thousands, comma decimal (European)
  • # ##0,00 = space thousands, comma decimal (French/International)
  • # ##0.00 = space thousands, dot decimal (Canadian/Scientific)
Countries Using Space Separators

Space as thousands separator is used in:

  • France - €1 234 567,89
  • Germany - 1 234 567,50 €
  • Russia - ₽1 234 567,89
  • Poland, Czech Republic, Slovakia - 1 234 567,89
  • Nordic countries (Sweden, Norway, Finland) - 1 234 567,89
  • Scientific/International documents - Following ISO 31-0 standard