1

Hi I'm new to LateX and Tex4ht. So please bear with my inexperience.

I am required to convert LaTeX source files into HTML (I further require to compile them into .chm files; I have decided to first work on the HTML output and then worry about the chm part)

My source includes pictures and I have used the \caption command to provide the necessary captions. The MWE is:

\begin{figure}[htbp]
 \begin{center}
  \includegraphics[width=\linewidth,keepaspectratio]{figs/figure1.png}
 \end{center}
 \caption{Startup Screen}
\end{figure}

On running the pdflatex command from command prompt I get accurate .pdf files but when I run the htlatex command the caption is skewed to the left of the .html formed.

Any help would be great..! Thanks

0
2

You can configure appearance with css instructions in the custom config file.

Try this, name the file myconf.cfg:

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

Important line is \Css{div.caption ...} whis is css instruction to center the text, div.caption is element generated by tex4ht for \caption commands.

Now compile your file with

htlatex filename "myconf"

and captions should be centered

3
  • So I'm not allowed to vote up as yet! Worked like a charm thanks :)
    – AnirudhJ
    Dec 18 '13 at 7:21
  • Hi! I'm trying to do the same thing with Tables. I assumed that this same configuration file should work since I am again having trouble with aligning the Table Captions to the center; it does not seem to work for some reason. Any suggestions on how I can over this? thanks :)
    – AnirudhJ
    Jan 16 '14 at 10:55
  • @AnirudhJ it would be best if you could post it as new question with complete example, probably you will need to add more configurations for tables
    – michal.h21
    Jan 16 '14 at 11:04

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.