AsciiMath – An easy-to-write markup language for mathematics
asciimath.org
asciimath.org
The nice thing about Markdown is that it's quite legible in its source form, which makes it less distracting to edit. Same deal with AsciiMath and LaTeX: AsciiMath is more legible in its source form which means that it has lower overhead during editing.
One of these is more legible than the other:
(f'(x^2+y^2)^2)/(g'(x^2+y^2)^2)
\frac{f'\left(x^2+y^2\right)}{g'\left(x^2+y^2\right)^2}
In my experience, most people who learn LaTeX don't do so until sometime around the middle or end of their undergrad career (certainly in Physics--maybe mathematicians learn it sooner). Earlier than that, people struggle with junk like the Microsoft equation editor. No big deal?I think it does a pretty great job at being a WYSIWYG editor.
And yet, despite how much I like LyX, I keep using real LaTeX instead -- especially when there is complex maths. That's because the ability to create macros in maths eventually outweighs everything else readability-wise.
And I'm afraid the same logic applies to AsciiMath. Is there some equivalent to
\newcommand[1]{vr}{\mathbf{r_#1}}
Or am I just going to have to use somethng `bb"r"_1` for every instance? That's a lot less readable than `\vr1`.For example, a λ is just 'l'+tab.
Simarly, you can cycle through other symbols. For b: b->β->
Sadly, TeXmacs hasn't gotten as much love as it deserves: I find it way better than jupyter at producing notebooks/papers that involve math, interactive code, and prose.
Ouch, no Ubuntu package since Vivid? The screenshots look OK... is this worth building from source?
I mean you can always use evil-red-text. But then what is the point LyX?
I'd be curious to hear what you think about the equation editor in Desmos[1] (full disclosure, my employer).
We use an open source WYSIWYG typesetting library called MathQuill[2]. The keystrokes you use are very similar to AsciiMath, but the result is direct editing of the typeset math. E.g. you type '_' to move into a subscript, '^' to move into a superscript, '/' to create a fraction, 'sqrt' to create a radical, etc.
I believe that I can edit much faster with this interface than with Microsoft Equation Editor, and that it's approximately similar difficulty to learn. But I'm biased.
I think I remember MS being better in some edge cases. OTOH, I haven't used it in so long maybe that speaks for itself.
MS equation editor? It's got so much better! The version released when office 2007 came out allows a latex like syntax when writing equations. - still don't use it myself because that would require using ms office which was still broken in other ways when i last used it (2010).
https://image.slidesharecdn.com/latexseminar-130324215215-ph...
That output is from the ancient equation editor (MathType Lite, effectively). It used a user-defined font (usuallly Times New Roman), so had no idea about what and where to kern. Output from Word 2007 onwards is significantly better as since then math typesetting is native to Word instead of an OLE object from another application. Also they have their own font (which I find okay for math but ugly for body text), which uses an OpenType table to define math-relevant spacing and kerning factors.
The syntax is something between ASCIImath and LaTeX and IMHO quite readable and way more writable than the latter. The syntax is also described in a Unicode Technical Note (http://unicode.org/notes/tn28/), so there's no reason it couldn't be used elsewhere, either.
What has been typed in Word (mostly; as it included cursor movement to get out of inner expressions again; thus can't be pasted right now):
\iiint_G [u\nabla^2 v+(\nabla u,\nabla v)]\dd^3 V =\oiint_S (u \partial v/\partial n +v \partial u/\partial n)\dd^2 A
This results in this monstrosity when converted back to linear format (which can be pasted): ∭_G〖[u∇^2 v+(∇u,∇v)] ⅆ^3 V〗=∯_S〖(u ∂v/∂n+v ∂u/∂n) ⅆ^2 A〗
Although the following still works just as well (spacing can eliminate the explicit \begin and \end brackets): ∭_G[u∇^2 v+(∇u,∇v)] ⅆ^3 V =∯_S(u ∂v/∂n+v ∂u/∂n) ⅆ^2 A
It just seems to me that many people still decrying the old equation editor haven't used or seen Word in a decade. There was a time when publishers still enforced MathType since that's what their Word publishing toolchains were built around for math for over a decade, but I think that has passed by now as well.Lots of people make that mistake, making a nice listing with newlines in between but them it becomes an ugly single line.
BBcode from forums in the past worked better for comments.
That is a very specific thing for source code editors. But bad for comment boxes. So I don't understand the popularity of markdown for comment boxes.
IMHO markdown should have done the opposite, make listening to all your newlines the default, and if you want to make it ignore a newline, end the line with a backslash or something like that.
To me a math equation is just another plot. I love making quick plots but when it is my name on the document I want to be able to control every line and space.
I really like Scribble a Racket made document language is certainly the way to go but it will take a while to get broader usage. https://docs.racket-lang.org/scribble/
EDIT----
Math Library - http://docs.racket-lang.org/scribble-math/
What Scribble does really well is you write your document and it is a one line change to change the output. It can output to MathJax or LaTeX or Markdown or PDF etc....
But i was always a bit disappointed, because i had to try hard to keep my source readable. LATEX really clutters your enumerations, equations etc with way to much syntax. I always thought about writing a simple Markdown-with special math mode (similar to AsciiMath)-to-LATEX compiler.
From my cursory glance over the page, this isn't much simpler than LaTeX and it mostly just reduces a number of backslashes. It doesn't save me much time when typesetting equations. Nowadays, I mostly type LaTeX for MathJax or Jupyter notebook. Adding asciimath to Jupyter seems to be on the backlog[0], and it's dependent on CommonMark coming up with an extension system.
Similarly, "\left(" and "\right)" sometimes result in parentheses whose size don't reflect stress and emphasis. In those cases, it's good to have "\bigl(" and friends available.
LaTeX has several flaws. But it's also astonishingly good, making it extremely hard for a competitor to catch on. We're kind of locked in to LaTeX.
sum_(i=1)^n i^3=((n(n+1))/2)^2
To render this in LateX as it is shown would be
\sum_{i = 0}^n i^3 = \bigg( \frac{n(n+1)}{2} \bigg)^2
No fracts, just "/", no parenthesis enlarging with "\bigg", no slashes or brackets.
Looks pretty nice :-)
But all of these things distract from the main task.
And you also have to learn LaTeX, which many might not care for.
AsciiMath is perfect for users who do not know Latex (or code for that matter) but needs to use mathematical notation on a daily basis.
I applaud that AsciiMath has resurfaced. I've used it in combination with Katex a cuple of times with great results.
Knowledge of latex is assumed, and honestly I (and my colleagues) are able to parse thus natively.
http://junolab.org/ (scroll down)
Because Emacs does. Choose smart, choose Emacs.
(this comment is written half in jest)
P.s. emacs sounds like a great OS - are there any add ons that allow one to open its textareas in a decent editor? :p
At least on my keyboard, "x^2" is one keystroke more than "x²", and the latter is much more redable.
Recently I used Windows 10 quite a bit, and the number of AltGr combinations available on Linux has been the thing I missed the most!
It might work with a US keyboard as long as your computer was configured for an Italian keyboard, though. https://en.wikipedia.org/wiki/AltGr_key suggests that from the keyboard's perspective, AltGr and right Alt are the same thing. Really, no keyboard allows any character -- they just send key codes (and modifier codes), and it's on your software to interpret those. But typing ² is not part of the normal, expected functioning of a US keyboard.
Edit: it occurs to me that perhaps I should gloss "it's on your software to interpret those" as "it is the responsibility of your software to interpret those".
Just for testing, I installed a few new keyboards on my KDE desktop, and I can confirm that French, German, Spanish, and Greek keyboards have support for AltGr combinations to get superscripts/fractions/other characters.
I've never required that a keyboard could allow any character. However, this is indeed possible today, as Shift+Ctrl+u+HexNumber allows to quickly insert any Unicode character. (This works under Xfce and KDE, and probably other DEs.)
Nevertheless, I think that a 100-and-more-keys keyboard should support a subset of the most useful ones. I am a physicist and an Italian, so having quick keyboard combinations for exponents, fractions, and the euro sign € is extremely handy for my everyday activities.
The other abominations on those keyboards are the shorter left Shift key and the vertical Enter, both of which put two of the most used keys one position further away from home row.
The goal was also about being translated into MathML. LaTeX is not necessarily concerned with mathematical sense while MathML (sometimes) is. I think this was also a motivation.
And, quite frankly, replacing \frac{a}{b} with a/b is a huge win for ease of writing basic math.
If there's a demographic between those two groups, then I might simply have a blind spot, but... whose problem does this solve, and what is that problem? Because just saying "LaTeX is too much effort", the immediate counter-question is "for whom, exactly?" because it won't be people who already use LaTeX, or need reliable maths typesetting on a daily basis, and it probably isn't for people who need to use maths maybe a handful of times a year. So who's left, and what problem do they have where asciimath makes life easier?
If, however, the goal is to more easily edit LaTeX -- especially for folks who are less confident with LaTeX -- I suspect WYSIWYG is frequently a better option. MathQuill (mathquill.com), for example, is a fantastic open-source WISYWIG editor for LaTeX.
Disclosure: we use MathQuill heavily at desmos.com, where I work, and have contributed to its development.
intintint does the same as int int int, 3 integrals
del becomes a del symbol, delt becomes a del symbol plus a t, delta becomes a delta symbol
rhoint: will it become rh + oint (circular integral), or rho + int? It happens to become rho + int here, but does it specify that in its specification?
deltau: will it become del + tau, or delta + u? it happens to become delta + u here. Opposite of the rhoint case about where it chose to make both things a rendered symbol
So it's inconsistent parsing rules, simply requiring spaces between textual identifiers would make it more logical :)
Also, what is now => and lArr could make more sense as ==> and <==. Also sad that <- or <-- doesn't work for left arrow.
∀α,β ∈ ℝ², √ϕ=αβ, ...
∃ a⃗ + b⃗ ≥ ...
What I think is needed are generic 2d composition diacritics for unicode, to have text above/below/to the upper left/UR/LL/LR angle -- I mean, some more generic version to write things like Ψ̂⁹⁻¹=Ψ⁸, ρ₁₂ with composition characters instead of the dedicated numbers, or letters.
I don't like LaTeX because I want WYSIWYG, which is what unicode is for. Even in the body of an email. Even in a reply on YN.
- Keyboard shortcuts, like for diacritics on european keyboards.
- On screen keyboard, like for phones and tablets.
But entry is not the important part - rendering is.
If that was true, TeX already has us covered.
https://kasperpeulen.github.io/PressAndHold/Unicode/ was a novel attempt. [source: https://github.com/kasperpeulen/PressAndHold] The trick is you long-press any letter, e.g. press Shift+A and don't release => you get a popup offering 𝐴 ∀ 𝒜 𝔄 (use arrors & Enter to select) Long-pressing letters is amusingly unnatural, I have to make a conscious effor :-)
Apropos unicode notations, that demo was made for https://github.com/kasperpeulen/CoffeeTeX, a unicode AsciiMath-inspired notation.
It maybe 2017, but this doesn't quite work yet. Not to mention how it falls apart as soon as I want some _clever_ typesetting. Don't get me wrong: I think we can do better than TeX, and in a lot of cases common characters like e.g. Greek characters might be fine, but, uh, we aren't there yet.
I hope the combining diacritics will not be relegated too far off the BMP.
- No server-side rendering. I don't want to burden my reader's browser with Javascript. (With MathJax, you can do it server-side, I explained how here: https://a3nm.net/blog/selfhost_mathjax.html)
- The project looks dead: https://github.com/asciimath/asciimathml/pulse/monthly
https://en.wikipedia.org/wiki/Eqn
I've enjoyed the part of this interview with Linda Cherry, one of its creators, talking about it in comparison with Tex (incorrectly transcribed as "tech").
Instead of rolling my own or hacking into SymPy, I'll use asciimath.
As part of that work I implemented part of the DRACULAE formula layout analysis algorithm and improved on it to allow certain disambiguations when parsing the formula: the result encoding is not presentational like LaTeX but semantical like the ones used in Computer Algebra Systems. That makes thing much more complicated and I only implemented simple notations like super/subscripts and fractions. Still, it might give you an idea of how it can be done.You can play with it here: http://matracas.org/tacto/test.html
Speech synthesis using the HTML5 audio API (reads aloud the formula you write) worked in several browsers including Chrome at the time, but nowadays it seems to work only in Firefox.
You might combine the handwritten symbol recognition of detexify, mentioned in a sibling comment, with this layout analysis to have full handwritten recognition of formulas but it's not straightforward.
Some time ago there was a story in HN about someone else's PhD thesis that went much further ahead: "SESHAT: Handwritten math expression parser" https://news.ycombinator.com/item?id=12388407 This one is closer to what you want.
Hooked up the executable to an Automator service so I could highlight some AsciiMath text and replace it with LaTeX from the right-click menu. Much faster for writing math notes in LaTeX!
If anyone's interested, the project's at https://github.com/studouglas/AsciiMathToLatex. Haven't touched it since I made it, so don't judge too hard :p
Except, I guess it would be better if that could be compiled to LaTeX instead of rendering it directly. LaTeX is still de-facto standard, and surely there are situations when it would be more powerful. So this mid-layer still would be useful, I guess. But otherwise, I would gladly write everything I need in Markdown+AsciiMath instead of pure LaTeX.
This seem to tackle the issue that Latex equations are not very readable, which is great. A related problem is that tikz code for drawing commutative diagrams in latex is basically completely incomprehensible. Looks like this project is in a good position to start tackling that problem.
It's a work in progress (probably forever).
http://www.intmath.com/blog/mathematics/comparison-math-web-...
I wouldn't mind for an easier way to introduce mathematics, but just from the example given, I can see right away that the typography in AsciiMath is not good.
Just look at the space (or lack of it) around the inner parenthesis for instance.