asciidocfx / AsciidocFX

Asciidoc Editor and Toolchain written with JavaFX 21 (Build PDF, Epub, Mobi and HTML books, documents and slides)
http://www.asciidocfx.com/
Apache License 2.0
1.91k stars 297 forks source link

Feature request: ASCII Math #286

Closed mlopezgva closed 7 years ago

mlopezgva commented 7 years ago

Hi!

I'm very surprised the a project name ASCIIDocFX doesn't support ASCIIMath!

MathJax already supports it, and it looks very "asciidoc/markdown" like. Could be a good feature, because it integrates better with AsciiDoc than LaTeX and alike. Using LaTeX for anything is always a PITA... that's why ASCIIDoc or MarkDown exist, in fact. :) so, mathematical expressions should also be easier to type. And looking around, from MathJax thanks to StackEdit, I found AsciiMath.

Just to make a point, see the difference between TeX-like and asciiMath with these examples:

captura de pantalla de 2016-07-14 17 01 13

captura de pantalla de 2016-07-14 17 18 59

captura de pantalla de 2016-07-14 17 18 33

Some more examples comparing the same formulas in Markdown Plus help:

1) image 2) image 3) image 4) image 5) image

Núm. LaTeX length ASCII Math length
1 \dfrac{ \tfrac{1}{2}[1-(\tfrac{1}{2})^n] }{ 1-\tfrac{1}{2} } = s_n 66 (1/2[1-(1/2)^n])/(1-(1/2))=8_n 30
2 \oint_C x^3\, dx + 4y^2\, dy 28 oint_Cx^3 dx+4y^2 dy 21
3 2 = \left( \frac{\left(3-x\right) \times 2}{3-x} \right) 57 2=(((3-x)xx2)/(3-x)) 20
4 \sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n} {3^m\left(m\,3^n+n\,3^m\right)} 80 sum_(m=1)^oosum_(n=1)^oo(m^2 n)/(3^m(m3^n+n3^m) 48

And the last one is so big (169 characters), I must put it as a code block...

phi_n(\kappa) =
 \frac{1}{4\pi^2\kappa^2} \int_0^\infty
 \frac{\sin(\kappa R)}{\kappa R}
 \frac{\partial}{\partial R}
 \left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR

And, ASCIImath version:

phi_n(kappa) = 1/(4pi^2 kappa^2)
 int_0^oo (sin(kappa R))/(kappa R)
 del/(del R)
[R^2 (del D_n (R))/(del R)] del R

Its not so long (112 characters, including spaces, I could've put it in a single line:

phi_n(kappa) = 1/(4pi^2 kappa^2) int_0^oo (sin(kappa R))/(kappa R) del/(del R) [R^2 (del D_n (R))/(del R)] del R

See the difference? And there's another one: I had only peeked at the docs to see the token of the oint. Everything else I was able to type it without help, it's "natural" (something LaTeX is definitely not ;)).

rahmanusta commented 7 years ago

Hello @mlopezgva thanks for the detailed explanation. AsciidocFX supports AsciiMath syntax. But the documentation wasn't updated :)

image

mlopezgva commented 7 years ago

Oh... OK. Thank you.

Feel free to use some of my examples to update the docs. :-D

rafa2000 commented 6 years ago

Yes but the display is too big compared with the sorrounding text. Any way to fix that? The same problem, of getting a too large display for math, happens when rendering LaTeX. If trying to fix it by using [svg] output, instead of [png], erases de output.

rahmanusta commented 6 years ago

You can play with width/ height.