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

Nasser M. Abbasi puszcza-hackers at gnu.org.ua
Sat Apr 23 07:23:31 CEST 2022


URL:
  <http://puszcza.gnu.org.ua/bugs/?560>

                 Summary: problem using tex4ht with xr-hyper when other
documents are in separate folders
                 Project: tex4ht
            Submitted by: nma123
            Submitted on: Sat Apr 23 05:23:31 2022
                Category: None
                Priority: 5 - Normal
                Severity: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

reference and screen shots at

https://tex.stackexchange.com/questions/641726/problem-using-tex4ht-with-xr-hyper-when-other-documents-are-in-separate-folders

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

   main.tex
      |
      +------ 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

%main.tex
\documentclass{book}
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument{chapter_1/ch1} %notice folder name included
\externaldocument{chapter_2/ch2}
\begin{document}
See problem \hyperref[1]{1} below and problem \hyperref[2]{2}.
\end{document}

and ch1.tex which is inside folder chapter_1/

\documentclass{book}
\usepackage{xr-hyper}
\usepackage{hyperref}

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

and ch2.tex

\documentclass{book}
\usepackage{xr-hyper}
\usepackage{hyperref}        
\begin{document}

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

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

    ch1.htm#x1-30001.1.1 

instead of

     chapter_1/ch1.htm#x1-30001.1.1

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





    _______________________________________________________

Reply to this item at:

  <http://puszcza.gnu.org.ua/bugs/?560>

_______________________________________________
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



More information about the tex4ht mailing list.