[tex4ht] [bug #625] Bad register code (65536) again on auto-generated Latex code
Nasser M. Abbasi
nma at 12000.org
Mon Apr 29 20:51:59 CEST 2024
Thanks for the info Michal;
Yes, I changed my texmf.cnf first thing when installing texlive
to increase the counters, else will not be able to compile
most of my files.
>cat texmf.cnf
buf_size=9000000
pool_size=9000000
main_memory=9000000
save_size=1000000
max_strings = 5000000
strings_free = 1000000
hash_extra=10000000
stack_size=500000
I've also just put the above file in the zip file:
<https://12000.org/tmp/bad_register_code_tex4ht.zip>
I think for now, I'll just delete these long equations and
not write them to the latex file as this seems simplest solution.
Since this is all done in code, I changed my code to check
for large Latex equations.
Computer algebra systems tend to generate huge Latex expressions.
Regards,
--Nasser
On 4/29/2024 5:32 AM, Michal Hoftich wrote:
> Follow-up Comment #2, bug #625 (project tex4ht):
>
> Hi Nasser, this is not limited to TeX4ht but to l3regex, which is used to
> clean the MathJax code. See this question, where they found the same issue:
> https://tex.stackexchange.com/q/654633/2891
>
> In theory, you could skip the regex cleaning using this configuration file:
>
> %%%%%%%%%%%%%%%%
> \Preamble{xhtml}
> \ExplSyntaxOn
> \cs_set_protected:Npn \alteqtoks #1
> {
> \HCode{\detokenize{#1}}
> }
> \ExplSyntaxOff
> \begin{document}
> \EndPreamble
> %%%%%%%%%%%%%%%%%%%%%
>
> The downside is that you can end with incorrect characters in your HTML, in
> particular <, > and &. These can cause MathJax fail.
>
> Also, to break your long strings, you can use this prefilter:
>
> %%%%%%%%%%%%%%%
> local max_len = 255
> for line in io.lines() do
> line = line:gsub("\r", "")
> local str_len = string.len(line)
> if str_len > max_len then
> -- if the line is longer than maxlen, we will break it to a shorter
> segments
> local curr_pos = max_len
> local prev_pos = 1
> while curr_pos < str_len do
> -- find next command preceded by spaces starting at the current
> position
> curr_pos, len = string.find(line, "%s+\\", curr_pos)
> print(curr_pos, str_len,string.sub(line, prev_pos, curr_pos))
> prev_pos = curr_pos
> -- we must move the current position
> curr_pos = curr_pos + max_len
> end
> -- print rest of the line
> print(string.sub(line, prev_pos, str_len))
> else
> print(line)
> end
> end
>
> %%%%%%%%%%%%
>
> Use it as:
>
> $ texlua format.lua < original.tex > formated.tex
>
> It will format your long lines into much shorter chunks, preventing the "!
> Unable to read an entire line---bufsize=200000" error I encountered. I suppose
> that you set the limit higher, but I didn't and couldn't compile your file
> originally.
>
> _______________________________________________________
>
> Reply to this item at:
>
> <http://puszcza.gnu.org.ua/bugs/?625>
>
> _______________________________________________
> Message sent via/by Puszcza
> http://puszcza.gnu.org.ua/
>
More information about the tex4ht
mailing list.