astroidmail / astroid

A graphical threads-with-tags style, lightweight and fast, e-mail client for Notmuch
http://astroidmail.github.io
Other
613 stars 65 forks source link

Math/Latex Support #712

Open drdrjacobs opened 3 years ago

drdrjacobs commented 3 years ago

Would it be possible to add support for including latex formulas in emails?

There is currently no great option for including latex in emails, so this would be hugely helpful for those that work in math/science fields.

It seems like this maybe was a planned feature at some point:

https://github.com/astroidmail/astroid/issues/689#issuecomment-651297393

but it hasn't been mentioned since.

gauteh commented 3 years ago

This was actually an early feature, back in v0.2. Think I removed it because seldom use, and not renderable on receiver unless also using astroid. Or convert math to PNG. You can actually solve it by tweaking the theme and adding mathjax. Might have to allow js.

tir. 27. jul. 2021, 23:32 skrev Daniel Jacobson @.***>:

Would it be possible to add support for including latex formulas in emails?

There is currently no great option for including latex in emails, so this would be hugely helpful for those that work in math/science fields.

It seems like this maybe was a planned feature at some point:

689 (comment)

https://github.com/astroidmail/astroid/issues/689#issuecomment-651297393

but it hasn't been mentioned since.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/astroidmail/astroid/issues/712, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN367V5S3GSRRWEMMJ2V3TZ4QVHANCNFSM5BDCJ2LQ .

drdrjacobs commented 3 years ago

and not renderable on receiver unless also using astroid

I see. So the dream would be to get math working in a way that most receivers can see it, and then include some kind of fallback if not as discussed here:

https://superuser.com/a/892901

It's crazy that getting that working is so messy.

I guess an alternative that is probably pretty accessible would be to automatically attach a rendered pdf to the email if it contains math. Is this something that could be done as a plugin?

gauteh commented 3 years ago

ons. 28. jul. 2021, 00:42 skrev Daniel Jacobson @.***>:

and not renderable on receiver unless also using astroid

I see. So the dream would be to get math working in a way that most receivers can see it, and then include some kind of fallback if not as discussed here:

https://superuser.com/a/892901

It's crazy that getting that working is so messy.

Yes, using cid images is probably the best. But then we need a reliable plain-text fallback.

mreppen commented 3 years ago

But then we need a reliable plain-text fallback.

I might be in a bubble, but in my setting, the TeX code itself is a good fallback, as that is what my contacts write anyway.

gauteh commented 3 years ago

Yeah, fair enough. No point in overcomplicating it.

fre. 17. sep. 2021, 21:59 skrev mreppen @.***>:

But then we need a reliable plain-text fallback.

I might be in a bubble, but in my setting, the TeX code itself is a good fallback, as that is what my contacts write anyway.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/astroidmail/astroid/issues/712#issuecomment-922047206, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN367QIZMXWBWQMVEMPI3UCOM3DANCNFSM5BDCJ2LQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jorsn commented 2 years ago

You could just use the markdown feature and pandoc. From my config:

 "markdown_on": true,
 "markdown_processor": "/path/to/pandoc --mathml --self-contained -M pagetitle=Email --template=/path/to/template/template.html --resource-path=.:/home/johannes/Maildir/styles:",
My template.html, derived from the one supplied with pandoc: (click to expand) ~~~html $if(highlighting-css)$ $endif$ $for(css)$ $endfor$ $if(math)$ $math$ $endif$ $for(header-includes)$ $header-includes$ $endfor$ $for(include-before)$ $include-before$ $endfor$ $if(title)$

$title$

$if(subtitle)$

$subtitle$

$endif$ $for(author)$

$author$

$endfor$ $if(date)$

$date$

$endif$
$endif$ $if(toc)$ $endif$ $body$ $for(include-after)$ $include-after$ $endfor$ ~~~

Then, you can easily compose html mails, even styled ones by adding a YAML metadata block like

---
title: Hello World
css: fancy-style.css
---

to the top of your email, where fancy-style.css is in the directory /home/johannes/Maildir/styles.

If you want images instead of mathml for broader support, you can use GladTeX as described in the pandoc manual: First run pandoc to produce htex file, then run gladtex to produce html file, finally run pandoc with option --embed-resources to produce html with inlined images.