[tex4ht] What would it take to fix tex4ht limitation of 65536 DVI pages?
Nasser M. Abbasi
nma at 12000.org
Sun Feb 9 12:33:14 CET 2025
On 2/9/2025 5:16 AM, Michal Hoftich wrote:
> Hi Nasser,
>
> On Sun, Feb 9, 2025 at 6:33 AM Nasser M. Abbasi <nma at 12000.org> wrote:
>
>>
>> At this day of 100's of GB memory and multi terabytes of disk storage,
>> I was wondering how hard it is to finally fix this limitation
>> of DVI with tex4ht so it can handle much larger DVI pages?
>>
>> It seems 65536 pages limit is something in the 1980's might
>> be required, but still in 2025? And why is there a limit
>> in the first place? Can not DVI file just grow in size as needed?
>>
>
> The number of pages is saved as two bytes in the DVI file header. This
> means that there is this limit of 65536 pages that cannot be changed
> without breaking of backwards compatibility, so it is unlikely to happen.
>
Could not the default remain 65536 pages, but have some user configuration
parameter they can change? This way there is no backwards compatibility
issues. right?
> Is it just a matter of changing some hardcoded number
>> in tex4ht source code somewhere? I will be happy to help in anyway
>> myself, but I have to idea how tex4ht works from the inside.
>>
>
> This is the limit of TeX, we cannot change it from the inside of TeX4ht.
> But you can use larger page sizes to work around this issue. Like paper
> height of 575 cm:
>
> \usepackage[paperwidth=100cm, paperheight=575cm]{geometry}
>
> This is the maximal size before I get dimension too large error.
>
Do you mean this something I need to do just when
compiling to HTML? or will also be applied to PDF generation?
i.e. can I wrap the above inside \ifdefined\HCode? If so,
then I will definitely try it.
But I can't have my PDF file be that size. I have to keep it
letter size. But if only for tex4ht, I can try it.
Not sure if this is what you meant.
> I hope this workaround doesn' cause other issues,
>
> Best,
> Michal
>
Thanks. It will be better if tex4ht can support large web pages one day.
After all, the web is supposed to be the future :)
When I asked about this about 2 years ago, Karl said
https://tug.org/pipermail/tex4ht/2023q4/003515.html
"it should be possible to remove the 2^16 page limit in tex4ht.
Sure, most likely it is possible. And if you want to rearrange the logic
in tex4ht-c.tex / tex4ht.c so it doesn't use the stated postamble value,
patches are welcome :). As I said, it's just not something I think is
crucial enough to spend time on."
I looked at tex4ht-c.tex but it is over my head what needs to change.
--Nasser
More information about the tex4ht
mailing list.