Mathjax-math LaTex integration

Hi Agenda crew, awesome looking first version; really like the whole idea. Been looking for something like this for a long time. I am in science, and this more or less fits my journaling needs perfectly, with the exception that I write a lot of math, and having some form of integration for LaTex here would be so cool. Anyone considered this?

Keep up the good work!

17 Likes

I think we will begin with support for images. That may already allow you to embed formulas without the full support of latex, which — as I understand it — is about 300MB in size. Wouldn’t like to have to distribute that to everyone.

1 Like

You don’t have to support latex. Markdown can input math symbol. Then the next question is how to use markdown in Agenda?

Markdown is just using latex to do the formula layout, I’m afraid.

Just wanted to add: I second MathJax support!

Math support would be important for me, too. You don’t need to include a whole latex distribution, though; you could either use MathJax in a WebView, and there are other existing rendering solutions as well. Maybe you can use some rendering code from this project: GitHub - kostub/iosMath: Beautiful math equation rendering on iOS and MacOS

3 Likes

Sounds like a good option.

Question: Can MathJax already be used in a browser? If so, couldn’t you just use that, and when we add support for images, you could get the output from the browser? Would adding it in Agenda accomplish anything?

Just trying to understand what the best solution is here.

I guess you might use MathJax in a browser if you create a custom html file and ask Safari to load it. However, I figure that the vast majority of the people asking for equation typesetting already do have an entire Latex pipeline installed, so it’d be easier to just use that and take a screenshot.

There are some serious drawbacks to the image-based solution, though. There wouldn’t be support for inline equations, hence one couldn’t easily write something like „this is proportional to exp(-1/k_bT)“. The second big point is that images are not editable. If one makes a mistake, one would need to retype the entire formula. I once tried to set up a keynote presentation using the new Pages latex support (which pastes the formula as an image) and it was an incredible frustrating experience.

I feel like the ideal solution would be an inline as well as a display math mode, you might enter by wrapping your equation in $ respectively $$. When one leaves the editing mode, Agenda would render the formula, when reentering the code would be displayed again.

Maybe you guys come up with an easier and more intuitive solution, but, at least for me, image support wouldn’t be able to replace native math support.

3 Likes

Clear. Thanks!

We will concentrate first on supporting attachments and inline images, and once we have that in place, we can consider equations (which are really just special images).

Drew

Sure! Images are obviously more important.

Other people have already alluded these, but I would like to elaborate on a couple of things about MathJax.

  • To support MathJax, you don’t have to distribute the entire LaTeX suite with Agenda. MathJax renders LaTeX commands using a JavaScript engine and displys the rendered equations on your webpage. So the only thing you need to do to create an HTML page with beautifully rendered equations is to include the following line at the top of your HTML document (which I think can be done relatively easily by the Agenda developers):
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
  • The eqautions rendered by MathJax are not images. They are more like texts with math fonts. You can highlight the portion of a MathJax-rendered equation and copy it, which will be saved as text in the clipboard. Also, because they are not images, they don’t pixelated upon magnification: no matter how much you magnify your webpage, the MathJax-renderd equations in the page look still perfectly good, without any blurring due to pixelation. So, to support image embedment is not the way to support MathJax at all.

I sincerely ask the Agenda developers to take a closer look at the MathJax samples page here to clearly understand the above features. Hope this helps supporting MathJax in Agenda, which will be critical to many users in the STEM areas.

2 Likes

Thanks for that, we’ll have a look!

We’ll certainly look at this. Seems like it is indeed a good alternative to full on Latex.

One complication is that Agenda is not a web page, and doesn’t use HTML. But maybe once we have images, we can find some way around by converting or something like that.

Really looking forward to any advance in this regard. I’m also a science guy and would love to be able to write LaTeX inside a note in Agenda.

4 Likes

I would also absolutely love this as a physics PhD student, it would absolutely set the app apart from anything else for me. I’ve been searching for a note taking app that has LaTeX equation support for months, even toying with the idea of making my own

Please let this be the app!! It is otherwise perfect for me

3 Likes

Big thumbs up for math support.

MathJax is the most likely candidate for a solution. You can also look into KaTeX, an alternative to MathJax developed by Khan Academy. Tradeoffs: should be a whole lot faster to render, but less compatible / mature. However I haven’t followed the status of the two in a while, so might be worth checking up on.

1 Like

Oh, yes, pretty please! Support for formulas. I second that.
MathJax is cool because it doesn‘t produce images (as said already above) so the formulas can be scaled like vector graphics without pixelation. And LaTeX syntax is the standard in the science community, no doubt about that. So a solution in Agenda that doesn‘t use LaTeX syntax would be baaad. :wink:

2 Likes

I’m guessing MathJax is probably a HTML/JS/CSS solution, so it may well scale nicely in a web browser, but Agenda is not a web browser, and not using those technologies. So it is probably not that simple. But we will see what we can do.

1 Like

Thumbs up for math support! I would really love that feature (and I think lots of others too)!

2 Likes

+1 for equation support.

1 Like