GitbookIO / kramed

A markdown (kramdown compatible) parser and compiler. Built for speed. (Fork of marked)
MIT License
223 stars 47 forks source link

Mathematics - display should be allowed within paragraphs #3

Closed ErnWong closed 9 years ago

ErnWong commented 10 years ago

Yup. That sounds contradictory, but due to the fact that it is accepted to treat mathematics as part of sentences, it totally makes sense for mathematical equations, even display/block mathematics, to be inside a paragraph.

Have a look at the image in this page to get the idea: http://superuser.com/questions/601042/how-to-insert-display-equations-in-a-word-document-without-breaking-a-paragraph

Here's a small discussion about it in MathJax google groups: https://groups.google.com/forum/#!topic/mathjax-users/hnNmdpAm_4Q

From what I saw in kramed.js, it looks like you can only use double dollar signs $$ for maths delimiters: both display and inline, determined by whether it is separated from the paragraph or not. This could possibly be solved with/along with GitbookIO/plugin-mathjax#5.

Thanks!

jamesplease commented 10 years ago

:+1:

I can help make a PR for this if it's something y'all are interested in, GistbookIO team.

dunhamsteve commented 9 years ago

In my experience (MS in Math, interest in typography), almost all display math occurs within a paragraph. For a concrete example from a physics book, see The Feynman Lectures. (I link to a specific example of five displays in one paragraph, but you can look at any display equation in that document.)

Within the gitbook editor, kramed seems to do what I want (accepting both inline equations and display equations in a paragraph), if I tweak the inline math regular expression to expect a single $ (matching pandoc's markdown).

AaronO commented 9 years ago

@ErnWong kramed already accepts both inline and block math. I'm not sure what exactly isn't working as expected for you. Could you elaborate ?

AaronO commented 9 years ago

@ErnWong Closing this, to keep things clean. We switched to $$ to disambiguate with single dollar signs $, so inline math should work with $$.

Let me know if this is not the case.