1.1.1-beta.7 • Published 3 months ago

tiptex v1.1.1-beta.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

TipTex

TipTex is a simple JavaScript library that allows you to create interactive LaTeX equations using KaTeX with tooltips powered by Tippy.js. It's designed to make mathematical equations in web pages more interactive and informative.

Features

Simply render LaTeX equations with interactive tooltips.

Setup

Install TipTex via npm:

npm install tiptex

Or, if you prefer using Yarn:

yarn add tiptex

Usage

Note: v1.1+ introduces a new API that is more compatible with LaTeX.

Here's a quick example to get you started:

import {render} from 'tiptex';

const equation = render({
  latex: `\\group{outer}{\\id{e}{e} = \\group{rhs}{\\id{m}{m}\\id{csq}{c^2}}}`,
  interactiveElements: {
    e: { href: "https://en.wikipedia.org/wiki/Mass%E2%80%93energy_equivalence", },
    m: { label: 'mass'},
    csq: { label: 'speed of light (squared)'},
  },
  groups: {
    'outer': { label: 'Energy-mass equivalence'},
    'rhs': { label: 'Inherent energy content of mass'},
  },
  enableCopy: true,
})

document.getElementById('equationContainer').appendChild(equation);

This will render the equation e=mc^2 with tooltips for m and c^2, and make e a clickable link.

Open test.html to see the above in action.

API

The render function accepts multiple objects as arguments, each representing a part of the equation in sequential order. These objects can have the following properties:

  • value: The LaTeX string or plain text to be displayed.
  • plainText: Set to true if val is plain text. Defaults to false.
  • href: URL to open when the part is clicked (optional).
  • label: Tooltip text to display when hovering over the part (optional).
1.1.1-beta.7

3 months ago

1.1.0-beta.6

3 months ago

1.0.8-beta.5

3 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.8-beta.1

5 months ago

1.0.8-beta.0

5 months ago

1.0.8-beta.4

5 months ago

1.0.8-beta.3

5 months ago

1.0.8-beta.2

5 months ago

1.0.5-beta.4

5 months ago

1.0.5-beta.3

5 months ago

1.0.5-beta.2

5 months ago

1.0.5-beta.1

5 months ago

1.0.5-beta.0

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.0

5 months ago