-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: LaTeX using MathJax #249
Comments
I'm sorry but I don't want to maintain such a feature 😅 MathJax with its "async loading" popups and flickers due to relayout is exactly one of the things I despise with passion. What I could do is exposing the M_MATH_RENDER_AS_CODE option to the Doxygen theme (which makes the math equations displayed as either inline or block fixed-width font), and possibly equip those with some additional CSS class. That you could then hook MathJax to on your end. Both the Doxygen theme and the Pelican theme have options for expanding the HTML But in any case I'd like to try to first solve the issue that made you consider MathJax in the first place -- what is the problem you're facing with dvisvgm on Mac? There used to be a brief window of time on Linux where it didn't work with Ghostscript 10 because version 10 wasn't yet whitelisted in dvisvgm's internal lookup routine, but that felt like it's gone now and that workaround isn't needed anymore. Similarly, all issues that were very common with broken latex installations on Ubuntu distros from 5 to 10 years ago are no longer a problem. Or are you facing a problem where you need several people to be able to build & view a website or Doxygen docs locally, and LaTeX is a pain point for many of them? That's a valid concern. I'm fine with adding Mac-specific hints or hardcoding common paths or whatever to make it more likely to "just work" on common setups -- tell me what's the common issue and how can I make that smoother. |
Understood. Your proposed solution with exposing I'll reply with a fuller explanation of the troubles I ran into on macOS when I have a bit more time. Stay tuned |
Ok, some details of the problems I ran into: I used m.css and doxgen to create this course website back in 2022. I was generally very happy with the process. I'm teaching the class again, so needed to create the 2024 edition. I haven't touched the code since then, and was surprised to see that things didn't "just work" anymore. First, I ran into the issue described in #241. To overcome this, I looked into how to downgrade doxygen to a lower version, but seemingly homebrew does not maintain multiple versions of doxygen, so the solution that worked was to Unfortunately, I still had build errors for the website. This time it was with an exception about % dvisvgm -V1
dvisvgm 3.2.2 (aarch64-apple-darwin20.6.0)
------------------------------------------
brotli: 1.1.0
clipper: 6.2.1
freetype: 2.13.2
kpathsea: 6.4.0
mutool: 1.23.11
potrace: 1.16
xxhash: 0.8.2
zlib: 1.3.1 Based on a suggestion on stackoverflow I downloaded and installed the Ghostscript and GhostscriptExtras packages from here. This did not seem to fix anything, even when passing in the location of the ghostscript library via What ended up working is installing macports, installing Ghostscript via macports, and pointing the
All of this was to bypass errors that stemmed from only a few LaTeX math equations I have on the site. The reason I'd like the option for using MathJax is that the whole experience of resurrecting 2-year old code made me feel that my workflow with m.css was more brittle than I would like. My hope was that reducing my need for additional components like |
You shouldn't install dvisvgm through Homebrew. It's part of your LaTeX installation. I prefer installing TeX Live (even though the TeX Live page points macOS users to MacTeX, it is easier to follow the generic Unix instructions, MacTeX comes with all sorts of editors and tools that seem quite useless to me). The only change I would make to the I just realized I'm still using TeX Live 2020, which must be for the Intel chips. I am installing the 2024 release for the Apple Silicon architecture, I'll report back if there are some problems running |
Hah yes, that pretty much sums up my experience with just about any software nowadays, Python and web-related especially. Even just adapting to new versions of python, matplotlib, graphviz, docutils etc. requires significant effort, to the point I often don't have energy left to add any new features, just barely keeping the project afloat. (With my C++ projects I ended up rewriting most dependencies including large part of STL myself, and the UX and general API stability improved significantly as a result. Sigh.)
Yeah sorry about that, I was building up the courage to touch Doxygen for way too long. I was working on this for the past week and today I have Doxygen 1.12 working for my projects with some patches locally. Now I "just" need to submit all the bugreports and fixes to them, and implement matching workarounds on my end. The progress is tracked in #215 and yes, it's a nightmare too.
It's possible that it just didn't see it if it dvisvgm was e.g. in @crisluengo here's a patch corresponding to what you suggested, does it work / does it make sense? @wkjarosz are there any other paths where libgs usually lives (from homebrew, from macports, etc etc), that I could add there? diff --git a/plugins/latex2svg.py b/plugins/latex2svg.py
index e4a5c520..86ca731c 100755
--- a/plugins/latex2svg.py
+++ b/plugins/latex2svg.py
@@ -52,9 +52,15 @@ libgs = find_library('gs')
if not hasattr(os.environ, 'LIBGS') and not libgs:
if sys.platform == 'darwin':
# Fallback to homebrew Ghostscript on macOS
- homebrew_libgs = '/usr/local/opt/ghostscript/lib/libgs.dylib'
- if os.path.exists(homebrew_libgs):
- default_params['libgs'] = homebrew_libgs
+ for homebrew_libgs in [
+ # Homebrew on ARM Macs
+ '/opt/homebrew/lib/libgs.dylib',
+ # Homebrew on Intel Macs
+ '/usr/local/opt/ghostscript/lib/libgs.dylib',
+ ]:
+ if os.path.exists(homebrew_libgs):
+ default_params['libgs'] = homebrew_libgs
+ break
if not default_params['libgs']:
print('Warning: libgs not found')
# dvisvgm < 3.0 only looks for ghostscript < 10 on its own, attempt to supply In any case, I'll look into exposing |
On older Macs, there will only be Of course, which version of On my machine, |
As of 7baa5a3 the Doxygen theme supports Additionally, since 4f413bc the math-as-code Let me know if the suggested addition to |
I realize one goal of this project is to be javascript-free, but it would be nice to have the option to output latex equations not as svg, but simply using MathJax. This option would also allow sidestepping the various hoops to get
dvisvgm
to work properly with libgs on recent version of macOS.The text was updated successfully, but these errors were encountered: