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:
\Preamble{xhtml}
% Configure the abtract environment to produce the <section> element
\ConfigureEnv{abstract}
{\ifvmode\IgnorePar\fi\EndP\HCode{<section role="doc-abstract" class="abstract">\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\HCode{</section>}}{}{}
% 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
\renewcommand{\absnamepos}{dummyabstracttitle}
% get rid of all extra <span> elements introduced by smaller font size
\renewcommand{\abstracttextfont}{\normalfont}
\renewcommand{\abstractnamefont}{\normalfont}
% style the abstract
\Css{.abstract{margin:1em;font-size:0.9rem;}}
\Css{.abstracttitle{text-align:center;margin-bottom:1em;}}
\begin{document}
\EndPreamble
I will describe it a bit:
\ConfigureEnv{abstract}
{\ifvmode\IgnorePar\fi\EndP\HCode{<section role="doc-abstract" class="abstract">\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\HCode{</section>}}{}{}
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:
\renewcommand{\abstracttextfont}{\normalfont}
\renewcommand{\abstractnamefont}{\normalfont}
The final document looks like this:

pdflatex
it seems that the\tituloestrangeiro{An apologist}
must be used. With this change, I can compile document without errors with bothpdflatex
andmake4ht
. It doesn't fix the abstract issue, it is another problem :)