3

What is the correct way to force tex4ht to put the caption under the table like it shows in pdf?

The caption always comes out shifted to the edge, while the table is centered OK in the middle of the web page.

Here is a MWE

\documentclass[11pt]{article}%
\usepackage{float}
\begin{document}

\begin{table}[H]
\centering
\begin{tabular}[c]{|c|c|}\hline
A & B \\\hline
853.075 (sec) & 43.711 (sec)\\\hline
14.218 (minutes) & 0.729 (minutes)\\\hline
\end{tabular}
\caption{Total real time used to solve all problems}
\end{table}

\end{document}

Compiled with lualatex foo.tex the output is as expected:

Mathematica graphics

Compiled with make4ht using make4ht -ulm default foo.tex "htm,mathjax" or just make4ht foo.tex "htm" gives

enter image description here

Using TL 2018, updated 2 months ago, on Linux Ubuntu under windows 10 subsystem

Nasser
  • 20,220

1 Answers1

4

You can style the appearance of the generated document to your liking using CSS. The caption is contained in <div class="caption">, you can center it using the text-align property. Try the following configuration file:

\Preamble{xhtml}
\Css{div.caption{text-align:center;}}
\begin{document}
\EndPreamble

The result:

enter image description here

michal.h21
  • 50,697