michal-h21 / tex4ebook

Converter from LaTeX to ebook formats (epub, mobi). Using tex4ht and texlua scripts.
311 stars 32 forks source link

Table of contents for book with faulty layout with epub3 #85

Closed FredericVivien closed 2 years ago

FredericVivien commented 2 years ago

Hi

First of all thanks for the work. I am working on a booklet and was impressed by the output of my first attempt at using tex4ebook. I noticed a couple of problems, here is one. In a book with chapters, and chapters in the appendix, the part of the table of contents related to the appendix has a faulty layout.

Toy example: \documentclass{book} \usepackage{tex4ebook} \begin{document} \tableofcontents \chapter{First chapter} Here is some text. \chapter{Second chapter} Here is some text. \appendix \chapter{First chapter in appendix} Here is some text. \chapter{Second chapter in appendix} Here is some text. \end{document}

When calling tex4ebook -f epub3 on the above example, the table of contents is:

Hence, the part of the table of contents related to the appendix appears to be nested inside the entry for the last chapter before the appendix (notice the location of ). Also, the chapters in the appendix do not appear to be processed the same way than the ones in the main part. The problem does not seem to appear with the epub target.

I have not tried to locate the origin of the problem.

Best.

michal-h21 commented 2 years ago

Hi Fredefic,

thanks for the report. You are right, appendix sections are broken in Epub 3. I've hopefully fixed that in the development version (2284bb1).

Best regards, Michal

FredericVivien commented 2 years ago

Hi Michal

Thanks for the fix. Indeed, the structure is now correct on my real-life example. However, I have found another problem I have not noticed earlier relative to all sections (apparently) in the table of contents for epub3 (but not for epub): textsuperscript characters appears as normal characters. For instance, when the source is: \chapter{2\textsuperscript{nd} chapter} In epub3 the output is: 2 2nd chapter when in epub it is: 2nd chapter

This problem is far less impacting than the previous one, obviously. Once again, than you for the fix.

Frédéric

michal-h21 commented 2 years ago

Hi Frédéric,

the superscript issue is strange, I cannot reproduce it when I just add a chapter with superscript to your previous example. It produces correct output for both Epub and Epub 3. Can you make a MWE that shows it?

Best, Michal

FredericVivien commented 2 years ago

Hi Michal

This is strange. Here is a MWE: \documentclass{book} \usepackage{tex4ebook} \begin{document} \tableofcontents \chapter{2\textsuperscript{nd} chapter} \end{document} It seems that the output is correct with epub (but the reader I first used could not process it properly). The output for epub3 is faulty because the corresponding line for the chapter in the table of content contains 1 2nd chapter'', and, hence, no modifiers fornd''. (There is a ``sup'' in the epub version.)

If you cannot reproduce the problem with that example, may it be due to different versions of tex4ht?

Best, Frédéric

michal-h21 commented 2 years ago

Hi Frédéric,

I see it now. tex4ebook removed all elements from TOC in Epub 3, because there were some validation issues. I've changed this method, and it should keep superscripts and other elements now.

Best, Michal

FredericVivien commented 2 years ago

Hi Michal

The epub3 looks fine now. I add noticed another problem but not yet found a MWE for it, but it looks like your fix also fixed that other indentation problem.

Thanks a lot.

Best, Frédéric

michal-h21 commented 2 years ago

Hi Frédéric,

that's good to hear! I hope to release a new tex4ebook version to CTAN soon, if you don't find other issues :)

Best, Michal