2

Now I am trying to validate produced epub files with the programm epubcheck, which I installed correctly and already used successfully to other newly produced epub files with tex4ebook.

But now I got an error message (or 9 nearly identical ones) when validating a larger epub file (with toc and indexing).

The error message is in german an says:

filename.epub/pathnameli1.html(12,38): Validierungsfehler: Der Wert des Attributs "id" ist ungültig; es muss ein XML-Name ohne Doppelpunkte sein

Translated:

filename.epub/pathnameli1.html(12,38): validation error: the value of attribute "id" is not valid; it needs to be a XML-name without colon.

I got this for pathnameli3.html, pathnameli5.html,..., pathnameli17.html. As a whole "9 errors".

When I open pathnameli3.html I find the following line refering to "id":

...
 <h2 class='likechapterHead' id='1'><a id='x5-3000'></a></h2>
...

Concerning the filename.tex source it refers obviously to the first pages with toc. Up to now I could not reproduce the error in a MWE. Maybe someone can get some hints out of this. What might be wrong? How to validate the epub up to "0 error"?

Edit 1

I looked at the pathnameli1.html (which produces an error), pathnameli2.html (which does not produce an error).

I find that the odd numbers up to 17 produce 9 errors messages of the above kind. The even numbers (2, 4, 6, 8, 10, 12, 14, 16) are as follows:

2: <h2 class='likechapterHead' id='vorwort'><a id='x3-2000'></a>Vorwort</h2>

They even numbers represent the all the \chapter*{} commands of the document.tex

Then I looked at these chapter commands in the document.tex and found \cleartooddpage commands and thought that it has to do with the problem and changed it to \clearpage. But the errors remained.

I do not understand the odd numbers of the pathnameli1.html and so on. Where are they produced in the document.tex? But they do come eventually with tex4ebook?

The part of relevant document.tex is as follows:

\cleartooddpage
\chapter*{Vorwort}
\ifdefined\HCode
\else\phantomsection\addcontentsline{toc}{chapter}{Vorwort}
\fi
\pagenumbering{arabic}
\thispagestyle{empty}
\pagestyle{Vorwort}

Edit 2 - Full example

This is the full example:

\documentclass[11pt,a4paper]{report}
\usepackage{ebgaramond-maths}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{nextpage}
\usepackage{tex4ebook}
\providecommand\phantomsection{}
\ifdefined\HCode
\usepackage[xindy,noautomatic]{imakeidx}
\else
\usepackage[]{imakeidx}
\fi
\makeindex[intoc=false,columns=1,noautomatic,title=Alphabetisches Verzeichnis]
\ifdefined\HCode
\usepackage[hyperindex=true,
pdfauthor={Autor},
pdftitle={Titel},
pdfkeywords={Keyword}]{hyperref}
\else\fi
\fancypagestyle{Inhaltsverzeichnis}{\fancyhf{}%
    \fancyhead[RO,LE]{\small\rmfamily\thepage}
    \fancyhead[LO,RE]{\small\scshape Inhaltsverzeichnis}}   
\fancypagestyle{Vorwort}{\fancyhf{}%
    \fancyhead[RO,LE]{\small\rmfamily\thepage}
    \fancyhead[LO,RE]{\small\scshape Vorwort}}
\fancypagestyle{Something}{\fancyhf{}%
    \fancyhead[RO,LE]{\small\rmfamily\thepage}
    \fancyhead[LO,RE]{\small\scshape About Something}}
\fancypagestyle{AlphabetischesVerzeichnis}{\fancyhf{}%
    \fancyhead[RO,LE]{\small\rmfamily\thepage}
    \fancyhead[LO,RE]{\small\scshape Alphabetisches Verzeichnis}}   
\usepackage{titletoc}
\titlecontents{chapter}[2pc]%
{\addvspace{0.5pc}\normalsize\scshape}%
{\contentslabel{2pc}}%
{\contentslabel{2pc}}{, \thecontentspage}%
[]
\titlecontents{section}[2pc]%
{\addvspace{0.1pc}\small\rmfamily}%
{\contentslabel{2pc}}%
{\contentslabel{2pc}}{, \thecontentspage}%
[]
\usepackage[rm,sc,small,center]{titlesec}
\renewcommand{\thechapter}{}
\titleformat{\chapter}[display]%
{\Huge\scshape}%
{}%
{0pt}{\filcenter}%
[]
\renewcommand{\thesection}{\arabic{section}}
\titleformat{\section}[display]%
{\large\scshape}%
{\filcenter\normalsize\textbf{\thesection}}%
{0pt}{\filcenter}%
[]

\begin{document}
\pagenumbering{roman}
\pagestyle{empty}

\ifdefined\HCode
\phantomsection
\addcontentsline{toc}{chapter}{Cover}
\coverimage[natwidth=\paperwidth,natheight=\paperheight]{Cover_Someimage.jpg}
\fi
\clearpage
\normalsize
... Some pages with empty pagestyle ...

\cleartooddpage
\begingroup
\makeatletter
\ifdefined\HCode
\else
\phantomsection
\addcontentsline{toc}{chapter}{Inhaltsverzeichnis}
\let\ps@plain\ps@empty
\pagestyle{Inhaltsverzeichnis}
\tableofcontents
\fi
\clearpage
\endgroup

\cleartooddpage
\chapter*{Vorwort}
\ifdefined\HCode
\else\phantomsection\addcontentsline{toc}{chapter}{Vorwort}
\fi
\pagenumbering{arabic}
\thispagestyle{empty}
\pagestyle{Vorwort}
... Some Foreword ...

\cleartooddpage
\chapter*{About Something}
\ifdefined\HCode
\else\phantomsection\addcontentsline{toc}{chapter}{About Something}
\fi
\thispagestyle{empty}
\pagestyle{Something}
\clearpage
\section{First}\index{First}
... Some first things...
\clearpage
\section{Second}\index{Second}
... Some second things....

\cleartooddpage
\begingroup
\makeatletter
\let\ps@plain\ps@empty
\pagestyle{AlphabetischesVerzeichnis}
\label{AlphabetischesVerzeichnis}
\small
\renewcommand{\indexname}{\Large Alphabetisches Verzeichnis}
\phantomsection\addcontentsline{toc}{chapter}{Alphabetisches Verzeichnis}
\printindex
\clearpage
\endgroup
\end{document}

It reproduces the error 3 times. And also with the odd numbers pathnameli1.html for 1, 3, 5.

5
  • One issue is that the id should not start with number. What is strange is that you don't have any text in the title. Maybe you produce this title with a custom macro that tries to fix something else?
    – michal.h21
    Mar 24, 2023 at 16:11
  • See Edit 1. I looked at the appropriate html files for the pathnameli1.html up to pathnameli18.html to understand where they come from in the document.tex.
    – Thomkrates
    Mar 24, 2023 at 20:22
  • When I combine this snippet, and preamble from your older questions, I don't get any error from epubcheck. Could you please try to make a full example that I could compile and reproduce the issue?
    – michal.h21
    Mar 24, 2023 at 21:16
  • See Edit 2 with full example. It reproduces the error 3 times when running epubcheck.
    – Thomkrates
    Mar 25, 2023 at 4:32
  • In another, more complex sourcename.tex file, with indexing, pagenotes and bibliography, I got with epubcheck 126 errors, with lots identical to these in this question here. Maybe there is a good solution for it. I am on my limits, I do not know how to solve this and make a valid epub out of it. Thanks for caring.
    – Thomkrates
    Mar 25, 2023 at 16:16

1 Answer 1

0

This seems to be caused by titlesec, it inserts spurious empty chapter, which produces extra page. This can be fixed using this file, titlesec-hooks.4ht:

% titlesec-hooks.4ht (2022-03-16-14:13), generated from tex4ht-4ht.tex
% Copyright 2022 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version 2022-03-16-14:13}

\let\ttl:@makechapterhead\@makechapterhead
\let\ttl:@makeschapterhead\@makeschapterhead
\let\ttl:chapter\chapter
\let\ttl:section\section
\let\ttl:subsection\subsection
\let\ttl:subsubsection\subsubsection
\let\ttl:paragraph\paragraph
\let\ttl:subparagraph\subparagraph
\:AtEndOfPackage{
  \let\chapter\ttl:chapter
  \let\section\ttl:section
  \let\subsection\ttl:subsection
  \let\subsubsection\ttl:subsubsection
  \let\paragraph\ttl:paragraph
  \let\subparagraph\ttl:subparagraph
  \let\@makechapterhead\ttl:@makechapterhead
  \let\@makeschapterhead\ttl:@makeschapterhead
  \def\ttl@format@si#1#2#3#4#5#6#7{}
  \def\ttl@format@ii#1[#2]#3#4#5#6{
    \@ifnextchar[{%
      \ttl@format@iii{#2}%
    }{%
      \ttl@format@iii{#2}[]}
  }
  \def\ttl@format@iii#1[#2]{}
}

\endinput

It cancels the redefinition of the \@makeschapterhead command, to prevent any stuff that titlesec does to it.

10
  • Again and again, thank you so much for your support. Where do I need to save this file? Somewhere in TeX Live? Or in the same folder as the .tex file to process? I do not yet understand quite the function of these .4ht files? Is there a central folder in the TeX Live installation for it? Or does is need lokal storage and usage of these files always?
    – Thomkrates
    Mar 27, 2023 at 14:14
  • @Thomkrates I've installed this in TeX4ht sources, so it should be in TeX Live 2023 soon. You can install your own .4ht files in ~/texmf/tex/generic/tex4ht/ directory
    – michal.h21
    Mar 27, 2023 at 20:10
  • Thank you. I looked at this folder and found that titelsec-hooks.4ht is still there. But in the above full example still 3 errors of the above kind appear (invalid "id"). I also changed the font to stix2 so to avoid the problem with ebgaramond on my system. But the errors while running epubcheck on the .epub remain. Is there something else to do that I might have missed?
    – Thomkrates
    Mar 27, 2023 at 20:47
  • @Thomkrates it will take few days before the update gets there. You can check the titlesec-hooks.4ht after you see tex4ht in the update log of tlmgr.
    – michal.h21
    Mar 27, 2023 at 21:10
  • Yes, I was curious to know and ran tlmgr update --list where tex4ht appeared. Then I ran tlmgr update tex4ht and waited for processing, which occured without problems. Then I ran tex4ebook on the above MWE (with another font) and got an .epubfile without an error. After that I ran epubcheck and: still got the 3 errors of above. Am I still too early for your update? Or is there another problem going on?
    – Thomkrates
    Mar 27, 2023 at 21:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .