How to make the list of listings to work properly in tex4ebook?

Commands \tableofcontents and \listoffigureswork correctly.

The pdf result


The epub result

enter image description here

I didn't found any suggestion to lstlistoflistings in tex4ebook in the internet.

A MWE follows


\renewcommand{\lstlistlistingname}{List of Algorithms}


\lstinputlisting[label = {alg:alg_01}, caption = {alg 01}]

\lstinputlisting[label = {alg:fc_alg_02}, caption = {fc alg 02}]
  • @michal.h21, I'm sorry calling you here and asking again for help, but I didn't find any hint to solve this problem. And as I also don't understand the syntax to create a config file as I've seen to solve other issues, I only have the option to ask someone I know might solve it. – FHZ Feb 7 '20 at 15:11
  • 1
    I've posted an answer. I am slowly trying to work on all tex4ht bug reports, there were too many of them in the past few months, so I was bit exhausted :( – michal.h21 Feb 13 '20 at 16:40

Try the following configuration:

\ConfigureToc{lol} {}{\empty}{}{\newline}

The commands that use the TOC mechanism needs a configuration. The \TableOfContents[list of types]. The \lstlistoflistings writes entries to the filename.lol file, so \TableOfContents[lol] will print these entries. It is also necessary to configure TOC type, using \ConfigureToc{lol}. I've used the configuration that tex4ht uses for all other types. It just prints the entries on separate lines.

This is the result:

enter image description here

  • It worked perfectly! I don't have words to express my gratitude. I only hope some day tex4ebook will be able to fully convert all LaTeX features to epub. The issue with equation/split/align I made a workaround. I can finally publish a epub version of my book. Once again thanks. – FHZ Feb 13 '20 at 19:07
  • @FHZ I hope to look at the split issue soon. the ideal would be if Epub readers supported MathML, as images are not ideal solution anyway. but the support is non-existent, so we will always get not good results – michal.h21 Feb 13 '20 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.