Giter Club home page Giter Club logo

plugin-katex's Introduction

Math typesetting using KaTex

Use it for your book, by adding to your book.json:

{
    "plugins": ["katex"]
}

then run gitbook install.

Usage

Inline math: $$\int_{-\infty}^\infty g(x) dx$$


Block math:

$$
\int_{-\infty}^\infty g(x) dx
$$

Or using the templating syntax:

{% math %}\int_{-\infty}^\infty g(x) dx{% endblock %}

Comparison with MathJax

  • Faster

plugin-katex's People

Contributors

aarono avatar samypesse avatar szarnyasg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plugin-katex's Issues

Cannot get inline math formula in webpage

Always get block version instead of inline version using the examples in the following, but it is rendered correctly in the gitbook editor.

Inline math: $$\int_{-\infty}^\infty g(x) dx$$

Block math:

$$
\int_{-\infty}^\infty g(x) dx
$$

Warnings during pdf generation

$ gitbook pdf . test.pdf
...
warn: "this.generator" property is deprecated, use "this.output.name" instead 
warn: "navigation" property is deprecated 
warn: "book" property is deprecated, use "this" directly instead 
warn: "options" property is deprecated, use config.get(key) instead 
...

`gitbook serve` crashes on error

Looking at Khan/KaTeX, there's an option throwOnError that could be set to false here. Otherwise the body of the process function should probably be wrapped in a try { … } catch (ex) { … }, if it's possible to tell Gitbook that an error occured

Does not work with GLOSSARY.md

Doesn't seem to render formulas in Glossary items. Not sure if this is a bug here, or in GitbookIO/gitbook.

Example:

README.md:

Difference equation

GLOSSARY.md:

# Difference equation
$$x_{n+1} = f(x_n)$$

Cannot insert literal ""$$"

In a case where I'd like to have a literal $$ (in my case in a `...`). Pretty much nothing seems to let me do this. I've tried using HTML entities, escaping. All sorts of weird stuff like `$\$` but nothing seems to work.

cannot parse \overrightarrow and \overleftarrow

ParseError: KaTeX parse error: Expected 'EOF', got '\overrightarrow' at position 1:
ParseError: KaTeX parse error: Expected 'EOF', got '\overleftarrow' at position 1: \̲o̲v̲e̲r̲l̲e̲f̲t̲a̲r̲r̲o̲w̲{k}

maybe other symbol cannot parse and render, such as a \brace b ?

Can not display number sets

I would like to display number of set using the \mathbb statement but it does not work:

KaTeX parse error: Expected 'EOF', got '\mathbb' at position 7: \mathbb̲{R}

The Gitbook editors renders it well but I can not build the ebook.

Block formulas

Thanks for the plugin, I was trying to switch from the mathjax plugin to this one and couldn't seem to get block formulas to render in the same way.

With mathjax if I put a formula on line by itself, e.g.:

Some text

$$ formula $$

More text

The formula will be rendered on a line by itself and centered. With this plugin I don't seem to get the centering and there's no bottom margin. Is this intentional or just due to this being in alpha?

Cannot present $$ inside code blocks

Problem:

$$a \ne 0$$ renders as {% math %}a \ne 0{% endmath %} inside code blocks.

Whilst it is possible to successfully escape "double-dollars" as \$\$ → $$ in plain text areas, inside code blocks \$\$a \ne 0\$\$ renders literally, as you would expect!

So, in other words, it's impossible to correctly document using the shortcut if you are using the plugin in your gitbooks!

katex=0.8.1 cannot be loaded with error "unexpected token import"

with katex=0.8.1, plugin load will fail, complain as below

debug: readme found at README.md
debug: summary file found at SUMMARY.md
debug: cleanup folder "C:\Users\zsli\AppData\Local\Temp\tmp-10564ld8oP2BXSmdZ"
info: 10 plugins are installed
info: 8 explicitly listed
info: loading plugin "katex"... ERROR

PluginError: Error with plugin "katex": Unexpected token import

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.