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.
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?pathnameli1.html
up topathnameli18.html
to understand where they come from in thedocument.tex
.epubcheck
. Could you please try to make a full example that I could compile and reproduce the issue?