[HN Gopher] Mathup: Easy MathML authoring tool with a quick to w...
       ___________________________________________________________________
        
       Mathup: Easy MathML authoring tool with a quick to write syntax
        
       Author : runarberg
       Score  : 74 points
       Date   : 2025-03-21 17:02 UTC (5 hours ago)
        
 (HTM) web link (mathup.xyz)
 (TXT) w3m dump (mathup.xyz)
        
       | almostgotcaught wrote:
       | you know what we need even less than another json alternative?
       | another math-language alternative. more so than any other
       | formal(ish) language, a representation (for math) benefits from
       | network effects (because math is both older and broader than
       | any/every other such language).
        
         | runarberg wrote:
         | This is for authoring math expressions which compiles to
         | MathML. MathML has the explicit design goal of being hard to
         | write, and is much more meant to be a compiler target rather
         | than for humans to write.
         | 
         | This space is pretty dominated by LaTeX whom almost all
         | professionals use, but is pretty verbose and not exactly easy
         | to use for beginners (or even non-frequent users). Other than
         | LaTeX we have Office Math, which is a GUI, and AsciiMath. This
         | tool is a dialect of AsciiMath[1] and builds on top of that. If
         | you know AsciiMath, you know this. There is also
         | UnicodeMathML[2], but that has another goal than this or
         | AsciiMath, where the focus is on readability of authored
         | expressions, rather than writability here.
         | 
         | 1: https://asciimath.org/
         | 
         | 2: https://github.com/doersino/UnicodeMathML
        
           | zamadatix wrote:
           | Casual users probably just want the GUI options with less
           | care of what syntax that may eventually involve on the
           | backend. People deep enough to care about writing everything
           | in raw syntax probably want to stick with LaTeX and can have
           | a program transform that to MathML or SVG whatever else they
           | need for display. The "here's a special syntax which is
           | neither all of A or B" is just a hard sell.
           | 
           | On specific tools I've also liked
           | https://www.imatheq.com/imatheq/com/imatheq/math-equation-
           | ed... for quick casual use since it's just a webpage but
           | still a decent GUI editor.
        
             | almostgotcaught wrote:
             | offline the best tool for this is LyX
             | 
             | https://www.lyx.org/
        
           | Diti wrote:
           | > MathML has the explicit design goal of being hard to write
           | 
           | Wait, really? Do you have good primary sources to back up
           | that claim?
        
             | runarberg wrote:
             | I worded this badly. I probably should have said that human
             | authoring was not a concern while designing the language.
             | MDN has a specific page for authoring MathML[1] where they
             | suggest you probably don't want to write them by hand and
             | suggest you should use tools that generate MathML instead.
             | 
             | This is really no different from SVG. The design of the SVG
             | markup language did not take considerations of people
             | writing SVG images by hand, instead they designed the
             | language to be a handy compiler target. Which it is, you
             | can draw nice SVG images from a GUI like inkscape as well
             | as nice graphs from a javascript library like d3.
             | 
             | 1: https://developer.mozilla.org/en-
             | US/docs/Web/MathML/Guides/A...
        
       | BenFranklin100 wrote:
       | I like this. It addresses a need for quickly writing math
       | expressions with an intuitive syntax. I don't have to write math
       | expressions often enough to remember the more complex formatting
       | from more powerful packages; and when I do use mathematical
       | expressions, they are usually fairly simple. This will fill that
       | niche.
        
         | runarberg wrote:
         | Thank you. That is exactly why I wrote this. I wanted users to
         | be able to write math in a markdown document, but did not
         | expect any of them to know LaTeX.
        
       | jpavel2 wrote:
       | I absolutely love this project - for years I'd been using a
       | homegrown s-exp to MathML translator, but your project is both
       | more intuitive and capable.
       | 
       | mathup's tiny, clean API makes it easy to integrate the project
       | in all sorts of processing workflows, both in-browser and
       | scripting.
        
         | runarberg wrote:
         | Thank you. I'm glad you like it.
        
       | spankalee wrote:
       | I love that this publishes the <math-up> web component.
       | 
       | It's a great way to take content that's actually pretty humanly
       | readable in the HTML, and translate it to an even better rendered
       | format in the UI. It's good for progressive enhancement and
       | framework support at the same time.
        
         | runarberg wrote:
         | Another nice thing about web components is that you can sniff
         | the custom element registry (and even await a promised
         | registration) for custom elements. I was writing a couple of
         | markdown-it plugins yesterday[1][2] to render $dollar delimited
         | math$ and simply places its content in either a <math-up> or a
         | <la-tex>[3] element depending on what is already in the custom
         | element registry. Meaning if you want to write LaTeX rather
         | than AsciiMath all you have to do is import the webcomponent
         | before you call the markdown-it render.
         | 
         | 1: https://github.com/runarberg/markdown-it-mathblock
         | 
         | 2: https://github.com/runarberg/markdown-it-mathspan
         | 
         | 3: https://github.com/runarberg/temml-custom-element
        
       | oofbey wrote:
       | Could pick a better homepage example. The demo code doesn't
       | render very well in MathML. Kerning on the exponents is off. In
       | "beta^alpha" the alpha character touches the beta. Looks better
       | switching to MathJax.
        
         | runarberg wrote:
         | You are right. I hadn't taken a close look at that expression
         | in chromium (it looks fine on Firefox). I think this may be a
         | Chrome rendering issue. I know Temml does a lot more than me to
         | make sure the expressions look right (my primary concern is
         | that the MathML markup is correct) and even Temml has the same
         | problem[1].
         | 
         | Aside, I love this expression that you landed on. The Gamma
         | distribution is one of the reason I started writing this
         | library 10 years ago. The way the original AsciiMath can't have
         | arbitrary identifiers (only texts) was a deal breaker for me.
         | The Gamma distribution is a very nice showcase for capabilities
         | of an authoring tool like this because the name is usually
         | written using latin letters `Gamma` while its density function
         | also includes the gamma function which is usually written with
         | a greek capital gamma (G). In the original AsciiMath writing
         | Gamma just gives you the greek letter. The gamma distribution
         | is also just a very cool distribution, or rather it contains
         | some very cool distributions (in particular the Chi-squared
         | distribution).
         | 
         | 1: https://temml.org/#%5Cbeta%5E%5Calpha
        
       | Garlef wrote:
       | Hmm... The mobile experience of that page is not very convincing
       | on first contact
        
         | gnulinux wrote:
         | I don't see any issues in Android Firefox, works pretty much
         | the same as my OSX Chrome or Firefox. What is the problem
         | you're having I wonder?
        
           | runarberg wrote:
           | Author here. I will admit that the labeling of the playground
           | is a bit sloppy. The input comes before the output on desktop
           | (as it should) but is flipped in mobile (for ... reasons),
           | but I never wrote an addEventListiner on the matchMedia to
           | change the labels to reflect the swapped order. As a front
           | end engineer for 10 years this is pretty embarrassing.
           | 
           | Another missing feature which quite alot mobile users expect
           | is jump to top. I personally never use it, but many mobile
           | users do.
           | 
           | Code blocks also have kind of excessive margins, and I should
           | probably shrink the font-size so that more users could read
           | the entire thing without horizontal scrolling, though I think
           | this is fairly minor.
           | 
           | Finally, what I can think of, is the content it self. I made
           | the choice when writing the docs, to teach the reader a
           | little about MathML as I demonstrate the project. I think
           | this was a solid choice but it puts the simplest most
           | unimpressive expressions at the top. On desktop this is fine
           | because you can see more impressive expressions further down,
           | but on mobile these are hidden in a horizontal scroll, so the
           | user might be left unimpressed.
        
       ___________________________________________________________________
       (page generated 2025-03-21 23:00 UTC)