[tex4ht] [bug #561] tex4ht with xr-hyper does not work when splitting other document.

Nasser M. Abbasi nma at 12000.org
Sun May 15 01:25:53 CEST 2022


Just an update.

I was able to work around this xr-hyper issue limitation in texh4ht.

I removed this package and no longer use it, and was able to make
my own direct links to external documents using raw HTML code instead.

This worked, thanks to Michal changing the format of the generated HTML
files when splitting, so they now have a uniform file names.

<https://tex.stackexchange.com/questions/644059/how-to-control-the-name-of-the-html-files-that-tex4ht-uses-for-splitting-subsubs>

So my program now when in tex4ht mode, generates any needed link to external
chapters directly and it is now working.

I would have preferred to use xr-hyper, but it does not really work with tex4ht
as it only works with one external document, not multiple documents.

Now I can compile only changed chapters and this will make building the book
much faster.

Case closed.

Thanks
--Nasser


On 5/14/2022 3:13 AM, Nasser M. Abbasi wrote:
> On 5/13/2022 7:58 PM, Nasser M. Abbasi wrote:
> 
>> Not only that, it had the good side effect of making your eralier
>> changes in xrhyper-hooks.4ht now also work when splitting the external document!
> 
> I am sorry, but I was wrong.  I only checked one external document. But when
> I added a second one, I found it does not work. Links to the first one are lost.
> 
> But I spend more time looking at this and I found the cause of the bug
> in tex4ht which makes xr-hyper not work the same way with pdf.
> 
> This for me is a deal breaker. Without this working correctly, I can't
> compile each chapter separately, since I need the references to automatically
> work across documents. I could not add all references needed by hand.
> 
> I have this set up: main.tex in one folder, and ch1.tex and ch2.tex each
> in separate folders.  main.tex has a link to ch1.tex and to ch2.tex.
> 
> Here is the problem I found. When I do this in main.tex
> 
> --------------------------
> \documentclass{book}
> \usepackage{xr-hyper}
> \usepackage{hyperref}
> \externaldocument{CHAPTERS/chapter_1/ch1}
> \externaldocument{CHAPTERS/chapter_2/ch2}
> \begin{document}
> 
> See problem \hyperref[1]{1} in chapter 1
> 
> See problem \hyperref[2]{2} in chapter 2
> 
> \end{document}
> -------------
> 
> then ONLY the last \externaldocument is used.
> 
> The first one is ignored. So tex4ht implementation of \externaldocument
> seems faulty. It only accept one external document, and it  is the last one.
> 
> When I change the order, the links now go the last one listed.
> 
> In pdf, this is not the case. Both externaldocument are used.
> 
> Hopefully this finding will make it easier to locate where the problem is
> and fix it tex4ht? If not, I will just have to continue to build the whole
> document each time even if I make change in only one chapter.
> 
> I include a zip file which contains all the files and the tree.
> 
> The commands I used are
> 
> cd CHAPTERS/chapter_1
> make4ht  -ulm default  -a debug ch1.tex 'mathjax,htm,4,cut-fullname'
> cd ../chapter_2
> make4ht  -ulm default  -a debug ch2.tex 'mathjax,htm,4,cut-fullname'
> cd ../..
> make4ht  -ulm default  -a debug main.tex 'mathjax,htm,cut-fullname'
> 
> 
> I am using the new cut-fullname option thanks to Michal just added,
> which might not yet be in tex4ht but can be replaced by using this
> .cfg from
> 
> <https://tex.stackexchange.com/questions/644059/how-to-control-the-name-of-the-html-files-that-tex4ht-uses-for-splitting-subsubs>
> 
> --------------------------
> \Preamble{xhtml}
> \catcode`\:=11
> \def\fx:pt#1xxx!*?: {%
>      \expandafter\ifx \csname big:#1:\endcsname\relax
>            \expandafter\gHAssign\csname big:#1:\endcsname  0  \fi
>      \expandafter\gHAdvance\csname big:#1:\endcsname  1
>      \edef\big:fn{#1\csname big:#1:\endcsname}}
> \catcode`\:=12
> \begin{document}
> \EndPreamble
> --------------------------
> 
> the zip file is at
> 
> <https://12000.org/tmp/xrhyper_bug_tex4ht/trying_separate_chapters_bug.zip>
> 
> 
> Thanks
> --Nasser



More information about the tex4ht mailing list.