bugtex4ht - Bugs: bug #560, problem using tex4ht with xr-hyper...

Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #560: problem using tex4ht with xr-hyper when other documents are in separate folders

Submitted by:  Nasser M. Abbasi <nma123>
Submitted on:  Sat Apr 23 05:23:31 2022  
Category: NonePriority: 5 - Normal
Severity: 5 - NormalStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Tue Apr 26 08:21:28 2022, comment #2:

I've also fixed it for the Xr package. I think we can fix this now.

Michal Hoftich <michal_h21>
Project Member
Mon Apr 25 13:32:32 2022, comment #1:

Hi Nasser, thanks for the report. I've fixed this issue in the TeX4ht sources and posted answer on TeX.sx.

Michal Hoftich <michal_h21>
Project Member
Sat Apr 23 05:23:31 2022, original submission:

reference and screen shots at


I am splitting my large document into smaller separate documents, where now each chapter will be compiled separately, as separate PDF file (not using \include or input, but as a separate document with its own title and \begin{document})

But I still need to have reference from a main document to the other documents to build tables and references.

So I am using xr-hyper. Which worked well. I have this MWE tree to show my current set

+------ chapter_1/ch1.tex
+------ chapter_2/ch2.tex

I put each chapter in separate folder to reduce clutter. This is what my main.tex, ch1.tex and ch2.tex look like

\externaldocument{chapter_1/ch1} %notice folder name included
See problem \hyperref[1]{1} below and problem \hyperref[2]{2}.

and ch1.tex which is inside folder chapter_1/


\chapter{chapter 1 in document ch1.tex}
\section{some section name}
\subsection{problem 1 from some book}
This is problem 1

and ch2.tex


\chapter{chapter 2 in document ch2.tex}
\section{some section name}
\subsection{problem 2 from some book}
This is problem 2

Next, compiled ch1.tex,ch2.tex and finally main.tex in this order using lualatex. Now I opened main.pdf and the links there correct and work.

Next, I did the same for tex4ht. Compiled ch1.tex,ch2.tex then main.tex in this order, all using the commands

make4ht ch1.tex 'mathjax,htm'
make4ht ch2.tex 'mathjax,htm'
make4ht main.tex 'mathjax,htm'

Then opened main.htm and it shows correct output

Now here is the problem, when I click on the link, it drops the folder name from the link. The link for 1 says


instead of


So the link did not work.

By manually editing the link and adding the folder name chapter_1/ to it, then it works and opens chapter 1 page correctly.

I can fix all of this by having all separate documents (main.tex, ch1.tex and ch2.tex) in same top level folder.

But to reduce clutter, and since I have many chapters that I want to make now completely separate PDF files for each chapter (but still have cross references from main document to them), it will be much better to have each in separate folder to make it easier to manage and reduce clutter in same folder, since I need to compile each one separately now.

This looks like a bug in tex4ht, in that it drops the folder name from the reference. Or Am I doing something wrong?

TL 2021

Nasser M. Abbasi <nma123>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by michal_h21 (Posted a comment)
  • -unavailable- added by nma123 (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    2 latest changes follow.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue Apr 26 08:21:28 2022michal_h21StatusNone=>Fixed
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup+gray