I'm writing a book and I create a new environement dialog in my .cls as following :

\setlist[dialog]{label=---,left = 0pt}

When I try to generate an ebook with tex4ebook, there is no new line at the end of dialog lines (all the dialog lines are the same one). There is no message error.

If I try to make a simple list in my document within itemize environment everything is ok, so I think there is a problem with my dialog environment but I can't figure out what is it. I precise that the pdf created with xetex is ok.

  • could you please make a full MWE, that show the intended usage of your custom environment, and that could be directly compiled?
    – michal.h21
    Commented Sep 22, 2021 at 9:54

1 Answer 1


You haven't provided a MWE, so here is some small sample:

\setlist[dialog]{label=---,left = 0pt}
\item Hello World
\item Hello, hello

When you compile this example, this is the resulting HTML code you get:

— Hello World
— Hello, hello

As you can see, there are no HTML tags around your list, so it is rendered on one line in the browser. You need to provide a configuration for all custom lists, in order to insert suitable HTML elements.

As you use custom text for the label, you can use the <dl> element.

All lists are configured using \ConfigureList command. From the documentation:


   #1   type of list (e.g., itemize, description, enumerate,
                            list, trivlist)
   #2   before list
   #3   after  list
   #4   before label
   #5   after label

The configuration file can look like this:

{\ifvmode\IgnorePar\fi\EndP\HCode{<dl class="dialog">}\par\ShowPar
\Css{.dialog{display:grid;grid-template-columns: 1em 1fr;}}


It creates <dl class="dialog"> element. There is a lot of commands used. \ifvmode\IgnorePar\fi\EndP closes paragraphs before the list. We define the \enddialoglabel command to insert closing tags for the previous item. It is used at the beginning of each item, so it is empty at first, and then redefined to insert the closing tag. \AnchorLabel inserts link destinations for \label commands.

We use the CSS grid to display label and text on the same line, because they are on separate lines by default.

Compile using:

make4ht -c mycfg.cfg filename.tex

This is the resulting HTML:

   <dl class='dialog'> <dt>
— </dt><dd>
<a id='x1-2x'></a>
   <!-- l. 7 --><p class='noindent'>Hello World
— </dt><dd>
<a id='x1-3x'></a>
   <!-- l. 8 --><p class='noindent'>Hello, hello</p></dd></dl>

In the browser:

enter image description here

  • Thank you very much for the whole explanation. It works :)
    – Marianne
    Commented Sep 22, 2021 at 12:44

You must log in to answer this question.

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