I'm reporting this bug against the first version of Calibre for Debian that hypothetically could have used the new "node-mathjax-full" package. It seems worthwhile to start using "node-mathjax-full" for trixie, because then our copy of Calibre would benefit from security fixes to it. Regards, Nicholas
Hello Nicholas, Debian MathJax 3 was once enabled before, but disabled again because Debian MathJax 3 pulls many big (> 100M bytes) packages. See also Debian bug 1068765. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1068765 Do you think it's worth to pay disk space? If you say "yes", I will revert Debian bug 1068765 fix.
Hello Yokota, yokota <yokota.hgml@gmail.com> writes: Thank you for referring me to that bug, because I hadn't realised that this complication existed. I suspect that this is a false dilemma: ((bundled) OR (hard *Depends* on node-mathjax-full)) 1. One alternative that Gregor Herrmann asked about in #1068765 is if Calibre can have a run-time *Recommends* on node-mathjax-full. Calibre may not yet be able to gracefully handle missing dependencies, so this would need to be tested (ie: output a warning and don't crash!). Ideal scenario for this approach would be that it profiles an "apt://node-mathjax-full" type URL and "sudo apt install node-mathjax-full" so that user can: a) Click to link so that GNOME Software or KDE Discover, or maybe even Synaptic will install the required package. b) Copy & paste the terminal command, enter sudo password, install, restart Calibre, and have working MathJax. 2. Another alternative is unbundling the upstream copy, and making node-mathjax-full a *Build-Depend*. If done correctly, Calibre's build system won't be able to tell the difference. Yes, this means that Calibre for Debian continues to install its own copy of MathJax3, but the solution means we can binNMU src:calibre to rebuild it against updated Debian MathJax3--if necessary (this has lower risk of breakage than backporting upstream changes, and the release team and security team prefer it to using upstream-bundled copies and fixes). 3. Yet another is file a bug against the source package for node-mathjax-full and explain how this packages doesn't meet the needs of Debian packages that previously depended on bin:mathjax. We only need 1.4M of MathJax3, and it's certain that this is the case for other Debian packages. Please consider the advantages and disadvantages of each of these options. If you like the approach of #3 then you'll need to file a bug (using reportbug, not just sending an email) asap, because the freeze has already begun. It may be that #3 is no longer possible for trixie. I'll try to answer any questions you have. Kind regards, Nicholas P.S. Please feel free to quote this email freely and if you'd like to CC me for any discussions that's OK too. P.P.S. Sorry for the length of this email; my hope is that the long-form of this one will be more useful than a burden, but please let me know if this isn't the case!
Hello Nicholas, I was checked your suggestion. Option 1: Calibre uses symlinks to link to system installed MathJax. This means it provides some dangling symlinks when not installs node-mathjax-full package. So this option is not so good one. Option 2: This option requires to rebuild Calibre when Debian MathJax was updated. But this option is easy to implement, and breakage is minimal. I think it's the best one. Option 3: Calibre just requires small subset of MathJax. If other packages also wants these subsets, this option is the best. But I don't know such packages other than Calibre. I was rebuild Calibre with option 2 and push to salsa/experimental. https://salsa.debian.org/yokota/calibre/-/tree/experimental And upload the experimental package to Debian. https://tracker.debian.org/pkg/calibre Please examine the package. If you seems good, I will upload it Debian unstable.
Hello Yokota,
Thank you for taking the time to work on this bug. Reply follows
in-line:
yokota <yokota.hgml@gmail.com> writes:
Are you sure that the use of symlinks is the only possible solution?
It is a nice balance between effort and effect.
:) No one remembers such things, because Debian has so much software!
If you wanted to investigate, here are two tools to check for packages
that would benefit:
1. apt-file search PATTERN # This searches files that are installed
# from .deb packages
2. https://codesearch.debian.net/ # This searches all source code
I will do better than that. Here you go:
https://manual.calibre-ebook.com/typesetting_math.html
If you don't have time to read/translate, look for the sample file, open
the sample file in Calibre, and check to see that it rendered correctly.
There is a PNG at this page that can be used to check for correct
equation rendering.
Regards,
Nicholas
Hello Nicholas, I was checked with "mathjax.epub" in your suggested page, it provides "Math input error" message. This error provably comes from: https://salsa.debian.org/js-team/node-mathjax-full/-/blob/debian/3.2.2+_cs4.2.1-4/ts/core/MathDocument.ts#L798 I think there is something wrong in Debian MathJax's TeX input module. I also checked Debian MathJax's MathML input module with other ePub files, it works well. And, MathJax's upstream tarball from https://github.com/mathjax/MathJax/releases/tag/3.2.2 works well both TeX input and MathML input. So, there are some problems to embed files from Debian node-mathjax-full to Debian Calibre. I think we needs some more work to resolve this issue. If you have any suggestions about this issue, please tell me. PS: MathML based ePub file can be provides from Pandoc output. https://tracker.debian.org/pkg/pandoc
Hello Yokota, yokota <yokota.hgml@gmail.com> writes: Does upstream's tarball bundle anything that looks TeX-related? Agreed, and thank you for your thoroughness; I appreciate it, and I'm confident other Debian contributors and users do (and will) too! You're right. I think it's worth `reportbug node-mathjax-full`, because you've succeeded with two upstream alternatives. You're working to "do the right thing" in a Debian context, but have evidence that says that our MathJax3 isn't working the way users of MathJax3 expect it to. So we open a bug (Please also X-Debbugs-Cc myself, as well as Yadd, whose email is available here: https://tracker.debian.org/pkg/node-mathjax-full). You may have found a functional bug (outside of a Node.js context), or it might be a documentation bug about how software needs to be adjusted to use MathJax3 for Debian. That's good to know, and wow, Pandoc really can do everything! What ideas do you have in mind? Regards, Nicholas
Hello Nicholas, No. Calibre dose not have any TeX-related files. But MathJax can accept TeX-style math notation. And convert it to HTML by there own TeXmath-to-HTML compiler that written in TypeScript. Thank you. I will report it later.
Hello Nicholas, I was checked Calibre code around MathJax. * Calibre uses MathJax unusual way * Calibre injects some Javascript code to MathJax while run time See also: of MathJax may vary on its build options. Debian package often uses different build options to improve code security, interoperability to other software, etc. And this makes different internal interfaces from upstream MathJax. I think it's difficult to use Debian's MathJax instead of embedded MathJax. PS: MathML will always works because MathML is displayed by Qt web engine's internal MathML code, not by MathJax. But TeX math requires exact version of MathJax with specific build options. -- YOKOTA Hiroshi