1

This MWE, thanks for solution from this post

%-----------------------------
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}

\begin{document}

\begin{enumerate}
\item A
\item B
\item C \includegraphics[width=2cm, valign= c]{example-image-a}
\item D
\item E
\end{enumerate}
\end{document} 
%-----------------------------

Produces correct alignment in pdf, but not in HTML after doing make4ht foo.tex

Here is a screen shot of HTML and PDF side by side so you can see the difference:

Mathematica graphics

Is this a known limitation? Probably a custom CSS configuration can work around this. But it would be better to avoid this if possible.

This is TL 2018.

4

You are right, small piece of CSS can fix that:

\Preamble{xhtml}

\Css{li img{vertical-align:middle;}}
\begin{document}
\EndPreamble

tex4ht doesn't try to match visual appearance of the PDF version in HTML, so it is necessary to style it according to your needs sometimes.

This is the result:

enter image description here

| improve this answer | |
  • you always supports anything about TeX4ht...much thanks to you... – MadyYuvi Dec 4 '18 at 14:08
  • Thank you Michal for the help. Your solution works well. But unfortunately it stops working when I added the package \usepackage{enumitem}. I needed enumitem to make \setlist[enumerate]{font=\scriptsize}. I will try to find another way to make the item list numbers smaller without using enumitem. It seems using enumitem changed what tex4ht uses for list items so the CSS fix no longer have an effect. – Nasser Dec 4 '18 at 20:41
  • @Nasser it is just necessary to find what tags are used and use it instead of <li>. – michal.h21 Dec 4 '18 at 20:42

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.