Port add-on to Thunderbird 140+ MailExtension#94
Conversation
|
@andrewboldi, you are a real hero! Thanks. I am looking forward to building the .xpi, install and use it again. |
|
You're welcome @sphh! (You can also thank Codex too :)) Just one thing. Note that if you've installed Thunderbird with a sandboxed environment (e.g. with Snap) (as I have), Thunderbird does not have access to Therefore, the preferred setup is to install a helper script as a user service with Alternatively (less preferred), you can start it with |
|
@andrewboldi: I just made and installed the xpi file and I do not get any LaTeX rendered in the message compose window. After switching on the debugging options, I get this error message:
Any idea how to solve it? BTW I use Betterbird instead of Thunderbird Original, if that makes any difference. |
|
@sphh Codex here, I just pushed a fix for this. Root cause: Could you pull the latest branch, rebuild ( |
|
With the commit 0e0aa37, Betterbird freezes when converting a LaTeX formula. I have to kill the whole Betterbird. |
|
ok sorry let me debug this further. just setup betterbird |
|
Ok I have tested this on both Thunderbird (via Snap) and Betterbird (via direct archive) and it's working. |
|
Hurray! The last commit works! 👏 There is just one ‘problem’: If you have switched on
when sending? |
|
Yes! By default it should be off now. (You can also disable this in the settings) |
|
Ok. But I am talking about the case, when it is switched on and you forget to delete the run report … |
|
I am Codex. I pushed commit 46fbdd8 to tb140-mailextension-port. Run reports are now removed from the compose body automatically in compose.onBeforeSend, so they are not sent even when logging is enabled. |
|
hi Andrew, thanks for the PR! @sphh do you have further comments on usability / feature parity with previous version / functionality? |
|
This is a huge PR. A few preliminary questions.
|
Beside the notes in #94 (comment), I can only say, that I am more than happy that @andrewboldi finally tackled the task to bring LaTexIt up to date! |
|
Thanks for the review. Answers to your questions:
I also addressed @sphh's latest dialog/options usability notes in fa663f1. |
|
Thanks @andrewboldi for considering my suggestions! Personally I have no more ideas (at the moment! 🤣) |
|
Haha yeah I'll try to use the extension a bit more over the next few days to think of more ideas. |
|
@protz: Is there anything which keeps you from merging this PR and push the add-on to Thunderbird? |
Extract per-expression depth from dvipng's --depth output in both the direct experiment API (using Subprocess.sys.mjs to capture stdout) and the Python helper service. Apply it as a dynamic vertical-align so that inline math sits on the text baseline correctly. Center display math ($$ / \[) instead of baseline-aligning it. Add inline width/height styles for compatibility with email clients that strip HTML attributes (e.g. Apple Mail). Add a `make install` target that deploys the xpi, syncs the helper, and (re)starts the systemd service. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three issues prevented the extension from working on current Thunderbird builds: 1. strict_max_version was pinned to 140.* — bump to 999.* so the extension is not blocked on any post-140 release. 2. browser.composeScripts.register() is deprecated in Thunderbird 140+. The compose script was never injected into compose windows, causing "could not access compose editor" errors. Fixed by declaring compose_scripts statically in manifest.json instead. 3. The HTTP helper fallback (tblatex_helper.py) was only activated when Thunderbird reported a sandboxed environment (Snap/Flatpak). On standard Windows installs, nsIProcess fails to spawn latex.exe from native TeX Live distributions. Removed the sandboxed guard so the helper is used whenever direct rendering fails. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…40-compat Fix compatibility with Thunderbird versions newer than 140
Now that compose_scripts is declared statically in manifest.json (via PR #1), the runtime registration is redundant and calls a deprecated API. Also removes the getRuntimeInfo() call that was only used for the sandbox-type log message. Co-Authored-By: MatthewBhattacharya <54419776+MatthewBhattacharya@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f960d65 to
fb85731
Compare
|
Hello, I used to use latexit until it stopped working a few years ago, and I just across these new commits. I git cloned /andrewbold/LatexIt.git and manually installed the xpi. But I ran into problems when I tried to run it:
I did check that my texlive is in /usr/bin/latex. How should I adjust my settings to make this work? Thanks! I use linux mint 22.3, running texlive 2023. |
|
Hi @fugata, thanks for trying it out! Both errors ("Could not access compose editor" and "Receiving end does not exist") have the same root cause: the compose script isn't being injected into the compose window. This extension requires Thunderbird 140 or newer. Could you check your version? (Help → About Thunderbird). Linux Mint 22.3 may ship an older Thunderbird (e.g. 128 ESR) that doesn't support the If your version is below 140:
If you're already on 140+, try these steps:
Let me know your TB version and I can help further! |
|
@andrewboldi: Thanks for your very prompt reply! thunderbird: 140.10.2esr (64 bit) I uninstalled the extension completely, restarted thunderbrid and then reinstalled the xpi. The errors reminded :-( I clicked the autodetect button for path; the button did not change color/do anything when I clicked it, but the path indicated there is correct (/usr/bin/latex and /usr/bin/dvipng). Tools -> Developers Tools -> Error Console does have many error messages mentioning "tblatex" or "compose". I've sent along the complete error log. Please let me know if you have any questions. Thanks for your work! |
Thunderbird 140 ESR does not support the compose_scripts manifest key (logs "An unexpected property was found in the WebExtension manifest"), so the compose script is never injected. Restore the runtime composeScripts.register() call as a fallback — it silently fails on newer TB versions where the manifest key works. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@fugata Thanks for the error log — that pinpointed the issue! Root cause: Thunderbird 140 ESR doesn't support the Fix pushed: I've restored the runtime To get the fix:
Let me know if it works! |
|
@andrewboldi: The new patch works --- finally I can use latexit again! I just notice a small issue: "\mathbb P" does not work, but "\mathbf P" does. Do I need to include extra packages and/or change the config file? Thanks SO MUCH! edit: Adding \usepackage{amssymb} brings back \mathbb P. Sorry about the false alarm. |
|
Glad it's working! 🎉 And yep, you nailed it — |
Common packages like \mathbb, \mathfrak, \implies, and align environments now work out of the box without manual template editing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I don't know if this is the right place for feature request, but it would be great if there is an option to choose between transparent background vs white-background-black-text. After I successfully installed the latest built by @andrewboldi I sent test messages to several people, but none of them could see the equations. Turns out they all used the gmail app on their phone with black theme so the png were not (or barely) visible. As soon as they changed to the light theme the equations were visible, of course, but to be on the safe side it might be useful to have the option for the sender to choose white-background-black-text. Of course it could look ugly, but ugly >>> not visible 😏 Thanks for your consideration. |
This is an old problem and has never been solved. Would using the \documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[auto]{contour}
\usepackage{xcolor}
\usepackage[active,displaymath,textmath]{preview} % DO NOT DELETE - this is required for baseline alignment
\pagestyle{empty}
\begin{document}
\contour{white}{%
__REPLACE_ME__ % this is where your LaTeX expression goes between $$
}
\end{document} |
I tried each of the followings (plus the rest of the preambles)
Thanks! |
…racket overtype
- Dark mode compatibility: auto-wraps equations with \contour{white}{} using
explicit \begin{preview} blocks to avoid multi-page conflicts with preview package
- Live preview tooltip in compose window: shows rendered LaTeX above cursor
while typing $...$ expressions, with 800ms debounce
- Error diagnostics: shows friendly error messages in compose window log panel
when rendering fails, even without debug logging enabled
- Bracket overtype: typing ) } ] in insert dialog skips over auto-inserted
closing brackets instead of duplicating them
- Auto-package retry: now reads LaTeX .log file for error extraction in both
direct renderer and helper, enabling auto-detection of missing packages
- Options: added autoRenderOnSend and darkModeCompat toggles with sanitization
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks @sphh for the The latest build now has dark mode compatibility built in as a toggleable option (Options → Formula Rendering → "Dark mode compatibility", enabled by default). It automatically wraps your equations with @fugata — the reason the manual approach failed is that |
|
@andrewboldi: Great! Just for reference, here is the original issue which requested transparent background: #70, and the PR introducing it: #71. |


Summary
$...$/$$...$$expressions into inline PNG images from the compose windowtblatex.*preference migration and executable autodetection supportValidation
node --check background.jsnode --check compose/compose-script.jsnode --check ui/options.jsnode --check ui/insert.jsnode --check api/TBLatex/implementation.jsmakeNotes
\$\\frac{2}{3}\$and\$\$\\boxed{\\frac{34}{31}}\$\$.0in the new experiment renderer.