GitbookIO / plugin-mathjax

MathJAX plugin for GitBook
Apache License 2.0
88 stars 51 forks source link

Maths Plugin Improvement Suggestion #5

Open ErnWong opened 9 years ago

ErnWong commented 9 years ago

Right now, I think Mathematics is displayed like this:

What's happening now

(correct me if I'm wrong...)

Suggestion?

What do you guys, @SamyPesse and @AaronO, think?


Plugin options that are possibly great to have:

pkra commented 9 years ago

:+1: we're happy to help with any MathJax and MathJax-node questions.

renkun-ken commented 9 years ago

Since commit eafa018e7fe669b1b3776a71c3daa1aaa76807cb disabled inline math, I'm wondering how I can use inline math if there's a need? Now my inline formulas don't render any more...

ErnWong commented 9 years ago

I think right now double dollar signs e.g. $$ 1+1=2 $$ are parsed for inline... I'm not sure if that will change later on though.

Escaping the TeX notation still works though, although it's not parsed by kramed: e.g. \\( 1+1=2 \\) compiles to \( 1+1=2 \) which MathJax then reads.

However, that means that you will have to escape a lot of characters in your maths formulae, like ampersands, slashes, etc. and you could run into problems like #3

renkun-ken commented 9 years ago

Thanks @ErnWong, I reviewed the official documentation at http://docs.mathjax.org/en/latest/start.html#tex-and-latex-input, tried and it works only for inline math, and still found no way to render displayed math.

Commit eafa018e7fe669b1b3776a71c3daa1aaa76807cb removes the inlineMath config, so everything should go back to the default settings of mathjax, that is,

The default math delimiters are $$...$$ and \[...\] for displayed mathematics, and \(...\) for in-line mathematics.

Why $$...$$ (displayed math) is rendered as inline math instead?

renkun-ken commented 9 years ago

Find a way to use both inline math and displayed math:

Inline math:

This is an equation $$x^2+y^2=z^2$$ where $$x$$, $$y$$, and $$z$$ are some variables.

Displayed math:

This is an equation 
$$x^2+y^2=z^2$$ 
where $$x$$, $$y$$, and $$z$$ are some variables.

(just start a new line to write displayed math)

This works for me :)

ErnWong commented 9 years ago

Also, \\[ x=0 \\] works as well (at least last time I tried it).

But then that skips kramed preprocessing, meaning that markdown vs maths issues like #3 will creep back.

By the way, although the double dollar signs for both inline and display works, it sacrifices the ability to write display maths within paragraphs. I guess you don't need that though, and $$ does makes the code look clearer.

But then... GitbookIO/kramed#3

renkun-ken commented 9 years ago

Thanks @ErnWong for the references to the previous issues! It seems like the decision must be made really carefully to meet so many demands :) At the moment I'll change my content to adopt $$ in all places, hope it won't be broken some time later...

vasalx commented 9 years ago

Is it possible to add mhchem extension to MathJax. I really need it for the chemistry book. In mathjax configuration docs the recommendation is to "use this extension in your own configurations, add it to the extensions array in the TeX block: TeX: { extensions: ["mhchem.js"] }"

But if try to do it in book.json it just doesn't work.

hardywu commented 9 years ago

Let single dollar sign be supported as inline math delimiter? This could enable converting existing latex files into gitbooks.

cben commented 9 years ago

@vasalx It should also be possible to force the extension to load by putting \require{mhchem} in some equation. http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-extensions

davy39 commented 8 years ago

Thanks @ErnWong for this great summary of expected improvements, it 's very clearly exposed ! Does anybody currently working on it ? I'll be happy to help :)

Especially, I will be glad to be able to use another input notation (ASCIIMath). What about simply using config=TeX-MML-AM_HTMLorMML ?

Isn't it possible to enable a full configuration of mathjax by linking some MathJax.Hub.Config parameters to book.json "pluginsConfig" ?

dsoto commented 8 years ago

+1 for single dollar sign delimiter for maximum compatibility with existing latex

vkrishna143 commented 7 years ago

As @dsoto said it would be great to have compatibility with existing latex

xiaopow commented 7 years ago

for block math

$$ a + b $$

for inline math

$$a + b$$