[tex4ht] Is it possible to fix tex4ht links so so it ends at top of page?

Nasser M. Abbasi nma at 12000.org
Fri Sep 20 04:07:20 CEST 2024


I thought I should also make MWE.

The problem really happens when the set up is like this:

There is table of content. Each link in the TOC opens
a new separate web page because split is 2. (In this example).

So given a book with 2 chapters. There is one TOC on the
main page and two separate pages. One for each chapter.

If the chapter has too much text to fit on monitor screen,
you will see the shift. i.e. when clicking on the link in
the TOC, the new page will open shifted little lower, so the
navigation bars do not show. (one has to move the vertical
slider bar up to see them and remove the shift manually).

This MWE shows this problem. So the links that needs to be fixed
are really the ones generated when making the TOC.

Normal direct links generarted using href are no problem.

--------------
\documentclass[12pt]{book}%

\usepackage{lipsum}
	
\begin{document}
\ifdefined\HCode
\Configure{tableofcontents*}{chapter}
\else
\setcounter{tocdepth}{0} %for toc
\tableofcontents
\fi
\tableofcontents	

\chapter{chapter 1}
\lipsum[2-4]

\lipsum[2-4]

\lipsum[2-4]
\chapter{chapter 2}
more important text
  	
\end{document}
----------------------

Compiled using

make4ht -ulm default -a debug A.tex 'mathjax,htm,2'

This zip file also contains everything.
<https://12000.org/tmp/example_page_shift.zip>


--Nasser


On 9/19/2024 7:21 PM, Nasser M. Abbasi wrote:
> Ive asked about this years ago. I do not remember or can find
> the link now.
> 
> This problem has been in tex4ht for ever it seems. I am wondering
> if it is possible to correct it or how hard it is to fix?
> 
> I will explain in words first what the problem is and then give
> link for an example from one of my own pages converted by tex4ht.
> 
> When I am at a top page, say index.htm and then when I click on
> link to another page on same site also produced by tex4ht
> such as
> 
>       indexpart2.htm
> 
> The new page opens not at the very top showing the navigation
> bars that tex4ht adds automatically, but opens the new page at
> little lower level, now showing the navigation bars, ending up
> at something like
> 
>             indexpart2.htm#x4829-4828000II
> 
> So I always have to manually delete those extra #x4829-4828000II from
> the new opened URL manually in order to see the top page and
> the navigation bars. Also if I want to send the link to someone
> I have to delete that extra #stuff.
> 
> Here is an example of one of my pages
> 
> <https://12000.org/my_notes/solving_ODE/current_version/index.htm>
> 
> At the bottom of the page (below the book images), you will see
> two links. Clicking on the second one called "Text books solutions"
> then it opens this page
> 
> <https://12000.org/my_notes/solving_ODE/current_version/indexpart2.htm#x4829-4828000II>
> 
> Instead, I want it to open
> 
> <https://12000.org/my_notes/solving_ODE/current_version/indexpart2.htm>
> 
> It seems tex4ht jumps to top of the table of content of the new opened
> page, which causes this problem. The problem is that when the links are
> generated, they have these #x4829-4828000II hardcoded in them.
> 
> Why does tex4ht do that? And is it possible to fix the links to remove
> this extra #x4829-4828000II stuff added to the link so the new
> page open at very top showing the navigation bars?
> 
> tex4ht on TL 2024.
> 
> Thank you,
> --Nasser
> 
> 
> 
> 
> 
>        



More information about the tex4ht mailing list.