Hi Chet,

I've found that the problem is caused by the Makefile always removing all
temporary files. TeX4ht needs several runs to get links right and store
some information in the temporary files.  So there are two possible fixes:

1. don't remove the temp files every time, only when necessary (using
explicit "make clean" rule)
2. execute Make:htlatex {} multiple times after index generation:

Make:htlatex {}
Make:xindex {}
Make:htlatex {}
Make:htlatex {}
Make:htlatex {}

This can make the compilation significantly slower, but it will always work
with the cleanup of temp files.

Best regards,
Michal

On Fri, Feb 28, 2025 at 2:22 AM Chet Murthy <[email protected]> wrote:

> Michal,
>
> The latest file doesn't change the outcome of the run.  At this point, we
> have 4 files: build.lua, config.cfg, index.4ht, listings.4ht.  And then, to
> keep track of the command, there's a Makefile, and the actual sample.tex.
>
> Do you think it would be useful if I created a little Github repo, and
> sent you pointers to branches in that repo, instead of sending attachments?
>
> For now, I'll continue to send attachments.  This time, I'm attaching a
> zipfile: hope that's OK.
>
> When I run the commands to build and then check:
>
> $ tex4ebook -c config.cfg -e build.lua sample.tex
> $ java -jar ../jcf*/tools/epubcheck/epubcheck-5.2.1.jar sample.epub
>
> I no longer get the "duplicate id" errors, but I still get the "fragment
> id not defined" errors:
> ====
> ERROR(RSC-012): sample.epub/OEBPS/sample.ncx(25,46): Fragment identifier
> is not defined.
> ERROR(RSC-012): sample.epub/OEBPS/sample.html(11,78): Fragment identifier
> is not defined.
> ERROR(RSC-012): sample.epub/OEBPS/sample.html(11,160): Fragment identifier
> is not defined.
> ERROR(RSC-012): sample.epub/OEBPS/sample.html(11,256): Fragment identifier
> is not defined.
> ERROR(RSC-012): sample.epub/OEBPS/samplech1.html(16,50): Fragment
> identifier is not defined.
> ====
>
> and looking at the unpacked EPUB, I can see that the fragment-id
> ("fn1x1"), referenced in file samplech1.html, exists in file sample3.html.
> So the problem was that the reference was of the form <a href='#fn1x1' --
> instead of including the filename.
>
> Your advice appreciated,
> --chet--
>
>

Reply via email to