When creating HTML using make4ht for a document using the class abnTEX2, the generated document has a new paragraph for each diacritical marks in the abstract (only).

An example file follows:

\title{Um apólogo}
\author{Machado de Assis}
Machado de Assis, um homem do século XIX, escreveu o conto
\textit{Um apólogo} abaixo transcrito.

Era uma vez uma agulha, que disse a um novelo de linha:

-- Por que está você com esse ar, toda cheia de si, toda
enrolada, para fingir que vale alguma coisa neste mundo?

-- Deixe-me, senhora.

-- Que a deixe? Que a deixe, por quê? Porque lhe digo que
está com um ar insuportável? Repito que sim, e falarei sempre
que me der na cabeça.

When compiled with make4ht -u example I get some errors in \maketitle (without maketitle there is no error)

[ERROR]   htlatex: Compilation errors in the htlatex run
[ERROR]   htlatex: Filename Line    Message
[ERROR]   htlatex: ./example.tex    7    Undefined control sequence.

and the result is

document using abnTEX2 generated by make4ht

What's happening in abstract? How to fix it?

  • I get an error also with pdflatex it seems that the \tituloestrangeiro{An apologist} must be used. With this change, I can compile document without errors with both pdflatex and make4ht. It doesn't fix the abstract issue, it is another problem :)
    – michal.h21
    Jan 21, 2021 at 21:47

1 Answer 1


There is one small issue with your example. I get an error unless I provide the \tituloestrangeiro command. I don't know if it is required by abntex2, but from reading of it's sources it seems that it is required when you use the article document class option. So I've added the following command after \title and it fixed this issue:

\tituloestrangeiro{An apologist}

Now regarding the lines broken on accented characters. This is in fact introduced by make4hth. It makes paragraph for every inline element that is placed directly in the <body> element, so it is outside paragraph or other block element. It does it in order to produce valid HTML. Now TeX4ht produces extra ` element for every accented character in your abstract, but they are not placed inside paragraph, so this mechanism makes one for each one.

To fix this, we must configure abstract environment to produce better output. This can be done using the following .cfg file:

% Configure the abtract environment to produce the <section> element
{\ifvmode\IgnorePar\fi\EndP\HCode{<section role="doc-abstract" class="abstract">\Hnewline}} 
% we want to get rid of the center environment used around the abstract title
% we also introduce a <h3> element for the title
\newenvironment{dummyabstracttitle}{\ifvmode\IgnorePar\fi\EndP\HCode{<h3 class="abstracttitle">}}{\HCode{</h3>}\par\noindent}
% use our dummy environment to insert tags around the abstract title
% get rid of all extra <span> elements introduced by smaller font size
% style the abstract

I will describe it a bit:

{\ifvmode\IgnorePar\fi\EndP\HCode{<section role="doc-abstract" class="abstract">\Hnewline}} 

This configures the abstract environment to use the <section> element around it's contents.

The abstract title inserted by the class inserts lot of formatting commands to the HTML code, which is really unnecessary. As abntex2 is based on Memoir, we can provide a custom environment to format the title. We do lot of stuff in this environment:

\newenvironment{dummyabstracttitle}{\ifvmode\IgnorePar\fi\EndP\HCode{<h3 class="abstracttitle">}}{\HCode{</h3>}\par\noindent}

The \ifvmode\IgnorePar\fi\EndP commands close potentials opened paragraphs before we insert the <h3> tag. \par\noindent after the end starts a new paragraph, to ensure that the abstract text is inside it.

To get rid most of the <span> elements, which are requested by the fact that a smaller font is used for the abstract contents, we just redefine the commands that choose the abstract font to use the normal font:


The final document looks like this:

enter image description here

You must log in to answer this question.

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