Mathjax -math LaTex integration

latex
textediting

#1

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!


LaTeX integration
Math Feature
#2

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.


#3

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


#4

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


#5

Just wanted to add: I second MathJax support!


#6

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: https://github.com/kostub/iosMath


#7

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.


#8

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.


#9

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


#10

Sure! Images are obviously more important.


#12

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.


#13

Thanks for that, we’ll have a look!


#14

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.


#17

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.


#18

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


#19

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.


#20

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:


#21

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.