[ERROR] htlatex: ? 25 TeX capacity exceeded, sorry [main memory size=5000000].
I know it's a long shot, since I can't share my entire project, but any ideas on how to prevent this? Is it simply because your project is gigantic? I wonder if something is going on that will use up any amount of memory. Another user (Nasser) is processing documents that add up 200K pages (https://tug.org/pipermail/tex4ht/2025q1/003665.html), although I think he also had to increase the memory sizes. I've never tried it, but you might try setting the environment variables (I have no clue which kind of memory is getting exceeded): extra_mem_top=4000000 % extra high memory for chars, tokens, etc. extra_mem_bot=4000000 % extra low memory for boxes, glue, breakpoints, etc. (Yes, these are generically-named envvars. Sad but that's the reality.) If that doesn't help, it's possible to increase main_memory itself, up to 8000000, but then the .fmt has to be redumped, which is a pain. So easier to try the extra_mem_* variables first. Also, I wonder if dviluatex's limits are higher (dynamic), or can more easily be changed. You could try copying the htlatex script (it's tiny), replacing the "latex" invocations with "dviluatex" and see if anything changes. (I'll be rather surprised and pleased if it works at all. :) Good luck, Karl