# Usage of \caption command in converting LaTeX files to HTML using tex4ht (For tables)

I am looking to convert TeX files into HTML using the htlatex command. I was previously having an issue with the formatting of my HTML file: the captions to my figures were skewed to the left of my page. I was able to correct this by including a configuration file (Thanks to @michal.h21)

Now I am facing a similar kind of problem with the formatting of tables included in my HTML. I've been told I would possibly need more configuration files for the tables.

The MWE to my problem is:

\begin{table}
\begin{center}
\begin{tabular}{c}
\includegraphics[width=\linewidth,keepaspectratio]{figs/tab1.png}
\end{tabular}
\caption{TestTable}
\end{center}
\end{table}


Any advice would be great! Thanks :)

• I don’t understand: what’s your exact problem, what’s your question? And why do you include a bitmap graphic inside your tabular? That looks like misuse very much. – Crissov Jan 17 '14 at 11:36
• @Crissov Well my question was this: I have a bunch of figures and Tables which I have acquired in the .png file format. The caption to these tables and figures were skewed to the extreme right of the webpage that I create using the \htlatex command. I need them to be centered below the figure/table. Also, I've used a image file inside because I have a bitmap which corresponds to a already created table which. It was a work around Ive used because I'm looking to move from a Word based to a LaTex based system. So in essence I already had a table created which I just want to reuse. – AnirudhJ Jan 17 '14 at 12:32
• @Crissov a short term solution till the time I get a grip on creating better tables :) – AnirudhJ Jan 17 '14 at 12:33

I don't know why you use table and center environments in this way, but anyway, try this configuration to catch both current use and more correct use in your first question:
\Preamble{xhtml}

• If the HTML source code generated by htlatex is any good, \Css{caption {margin-left: auto; margin-right: auto;}} should do. – Crissov Jan 17 '14 at 12:40
• @Crissov there is lot of css generated by htlatex by default, some of it set text-align of div.caption to left, so we need more complex selectors to override these default settings – michal.h21 Jan 17 '14 at 13:17