Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

htlatex adds horizontal lines around figures floats. For instance, the HTML output for the following tex:

\begin{figure}
\begin{centering}
\includegraphics{photo.png}
\end{centering}
\end{figure}

is as follows:

<hr class="figure">
<div class="figure">
<p class="noindent">
<img src="photo.png" alt="PIC" class="graphics" width="250pt" height="250pt">
<br/>
</div><hr class="endfigure">

I want to prevent automatic insertion of <hr>s around my figure. Is there any way to do so?

share|improve this question
1  
You can use CSS to select hr.figure and hr.endfigure then to fix property display to none: hr.figure, hr.endfigure {display:none;} –  Paul Gaborit Jul 17 '12 at 14:26
add comment

1 Answer 1

up vote 3 down vote accepted

The way htlatex translates LaTeX environments and commands into HTML entities is configured by the file html4.4ht.

On my Windows 7 computer using MikTeX, this file resides in the %HOMEPATH%\AppData\Roaming\MiKTeX\2.9\tex\generic\tex4ht directory.

You can provide your own configuration file when invoking htlatex. The rules defined there overrule the standard configuration.

> htlatex myfile.tex "myfile.cfg,html"

The configuration file is a LaTeX file as described here, for example.

Based on html4.4ht, I used the following configuration file myfile.cfg

\Preamble{html}
\begin{document}

% Removing div element surrounding tables and figures.
\ConfigureEnv{tabular}
    {\HCode{}}{\HCode{}}{}{}
\ConfigureEnv{figure} 
    {\HCode{}}{\HCode{}}{}{}    
% Always ignore \hline commands. Tables will rather be styled using CSS.
\Configure{hline}{\HCode{}}
% This one removes the rulers. Taking a look at html4.4ht should make 
% clear what has been changed.
\Configure{float}
   {\ifOption{refcaption}{}{\csname par\endcsname\ShowPar \leavevmode}}
   {\HCode{}}
{\ifvmode \IgnorePar \fi\EndP \HCode{}\csname par\endcsname\ShowPar}
\EndPreamble

Note that in order to remove HTML code that would otherwise being added, you have to use the \HCode{} command to generate an empty HTML output rather than just leaving the brackets empty.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.