Compiling (Tex Live 2016 under Windows 10) the following LaTeX MWE (mwe1.tex
)
\documentclass{book}
\usepackage{graphicx}
\begin{document}
Look at picture
\begin{figure}
\includegraphics[width=5cm]{myimage.png}
\end{figure}
Nice, isn't it?
\end{document}
with (an image named myimage.png
must be provided)
htlatex "mwe1.tex" "xhtml,charset=utf-8,fn-in" " -cunihtf -utf8"
tex4ht
generates
...
<body
>
<!--l. 7--><p class="noindent" >Look at picture
</p>
<hr class="figure" /><div class="figure"
>
<!--l. 10--><p class="noindent" ><img
src="myimage.png" alt="PIC"
/>
</p>
</div><hr class="endfigure" />
<!--l. 13--><p class="indent" > Nice, isn’t it?
</p>
</body>
...
I'd like to customize this HTML output by getting rid of the unneeded <p>
tag wrapping <img...>
and, if possible, by giving some meaningful value to the alt
attribute.
I know that image is enclosed in a paragraph in LaTeX source, but I don't need it in HTML source (especially if it is placed around <img>
instead of around <div class="figure">...</div>
).
This answer deals with the subject but I wasn't able to find a solution by modifying it.
Can I achieve this result by a custom configuration file or by some other means?
Thanks in advance.
mwe
? This might depend on surrounding code.