All Projects → j13z → reveal.js-math-katex-plugin

j13z / reveal.js-math-katex-plugin

Licence: other
reveal.js plugin that renders mathematical formulas using KaTeX

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to reveal.js-math-katex-plugin

markdownreveal
A tool for creating presentations with simple Markdown notation.
Stars: ✭ 34 (-5.56%)
Mutual labels:  reveal-js
reveal-jekyll
Online presentation for GitHub Pages and Jekyll in Markdown using reveal.js with a Solarized Color Theme
Stars: ✭ 67 (+86.11%)
Mutual labels:  reveal-js
asciidoctor-katex
Asciidoctor extension for converting latexmath using KaTeX at build time
Stars: ✭ 16 (-55.56%)
Mutual labels:  katex
notes
Simple text editor for your Markdown and LaTeX notes.
Stars: ✭ 24 (-33.33%)
Mutual labels:  katex
ckeditor5-math
Math feature for CKEditor 5.
Stars: ✭ 51 (+41.67%)
Mutual labels:  katex
vscode-markdown-editor
A vscode extension to make your vscode become a full-featured WYSIWYG markdown editor
Stars: ✭ 249 (+591.67%)
Mutual labels:  katex
katex-rs
Rust bindings to KaTeX
Stars: ✭ 91 (+152.78%)
Mutual labels:  katex
cicero
🎤 Serving presentation slides written in Markdown.
Stars: ✭ 50 (+38.89%)
Mutual labels:  reveal-js
Draft
▪️Online markdown editor
Stars: ✭ 29 (-19.44%)
Mutual labels:  katex
showdown-katex
Math typesetting for showdown
Stars: ✭ 32 (-11.11%)
Mutual labels:  katex
marknotes
📝 You’re taking a lot of notes and need a solution to manage them i.e. put your knowledge base in one central place and being able to retrieve quickly information’s, display them nicely through the browser as a HTML page or a slideshow, export them in many file formats (docx, odt, pdf, txt, …). Sensitive information’s can be encrypted and notes …
Stars: ✭ 73 (+102.78%)
Mutual labels:  reveal-js
draft-js-katex-plugin
A Katex plugin for DraftJS.
Stars: ✭ 33 (-8.33%)
Mutual labels:  katex
augmath
Interactive Computer Algebra System. Augmenting how we *do* mathematics using computers
Stars: ✭ 41 (+13.89%)
Mutual labels:  katex
KaTeXView
KaTeX View for android
Stars: ✭ 43 (+19.44%)
Mutual labels:  katex
react-native-katex
React Native KaTeX
Stars: ✭ 28 (-22.22%)
Mutual labels:  katex
obsidian-advanced-slides
Create markdown-based reveal.js presentations in Obsidian
Stars: ✭ 407 (+1030.56%)
Mutual labels:  reveal-js
reveal-code-focus
A Reveal.js plugin that allows focusing on specific lines of code blocks.
Stars: ✭ 108 (+200%)
Mutual labels:  reveal-js
reveal.js
perennial location for Esri Reveal.js conference templates
Stars: ✭ 15 (-58.33%)
Mutual labels:  reveal-js
node-reveal
📦 [npm] Node CLI for reveal.js
Stars: ✭ 21 (-41.67%)
Mutual labels:  reveal-js
unveil-rs
Unveil Rs is a tool to create presentations from markdown inspired by reveal.js, mdbook and zola.
Stars: ✭ 39 (+8.33%)
Mutual labels:  reveal-js

math-katex Plugin

Build Status

A reveal.js plugin that renders mathematical formulas inside slides using KaTeX.

  • Lightweight rendering, thanks to KaTeX
  • Marks syntax errors on the slide
  • Renders all formulas when presentation loads (no re-rendering when slide changes)

Plugin setup

  1. Download the latest release (tar.gz or zip) and extract it into the plugin directory of your reveal.js presentation.

  2. Tell reveal.js to use the plugin:

    Reveal.initialize({
        // … other configuration …
    
        dependencies: [
            { src: 'plugin/math-katex/math-katex.js', async: true }
        ]
    });

A build of KaTeX is included with the plugin.

Usage

TL;DR: See the example.

There are two usage modes:

  1. TeX-style, wrapped in $…$ or $$…$$. Works in Markdown, too
  2. Wrapped in HTML elements with class formula or math. (Don’t also use dollar syntax when using a class.)

The rendered TeX-style formulas also get a class formula added so that you can style them. $…$ formulas in addition get class inline, $$…$$ class display.

TeX style (dollars)

  • Use $$…$$ for display-style (block) formulas: $$\frac{1}{1 + e^{-x}}$$

  • Use $…$ for in-line formulas: e.g. $P(A \mid B)$

Escape literal dollar characters with \$.

As an alternative: If you have many slides that use literal dollar characters, it may be easier to explicitly activate formula rendering per slide: Set math.enableGlobally to false and then activate formula replacements on each slide (<section>) by setting the data-math attribute (no value required).

Wrapped in an element

Wrap the formula in an element with class formula (or math):

<div class="formula display"> \frac{1}{1 + e^{-x}} </div>

Display mode is in-line by default, add class display if needed.

Exclude elements

You can exclude elements from formula rendering by:

  1. Adding the class math-ignored to an element or its (direct) parent
  2. Adding the element type to the math.ignoredElements array on the configuration object (default: pre, code)

Optional configuration

Reveal.initialize({
    // … presentation configuration …

    // `math-katex` plugin:

    // *Optional* configuration:
    math: {
        // Uncomment to disable syntax error notifications
        // notificationsEnabled: false   // default: true

        // Elements to ignore for math rendering (defaults shown):
        // ignoredElements: [ 'pre', 'code' ]

        // Set `enableGlobally` to `false` to avoid excessive
        // escaping of dollar characters. You will then need to
        // activate `$…$`-style replacements per slide with a
        // `data-math` attribute (formulas wrapped in elements
        // are still activated everywhere).
        //
        // enableGlobally: false

        // In case you need to load KaTeX from a different
        // location (relative or absolute URL):
        // katexScript:     'path/to/katex/katex.min.js',
        // katexStylesheet: 'path/to/katex/katex.min.css'
    },

    // Specify the plugin as a dependency:
    dependencies: [
        { src: 'plugin/math-katex/math-katex.js', async: true }
    ]
});

Example

To run the example in your browser, clone or download this repository and install reveal.js using npm (Node.js required):

From the repository root directory: $ npm install reveal.js

If you don't have Node.js installed: Download reveal.js and copy it into a new directory named node_modules.

Tests

Run tests (requires Node.js): $ npm install && npm test

Tests use Mocha + Chai via mocha-phantomjs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].