TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When htlatex converts a document, emphasis and bold-face are converted to spans of a certain style which is defined in the accompanying CSS file.



  Normal text

  \em{Emphasized text}

  \textbf{Bold-faced text}

Output (header and footer stripped):

<!--l. 4--><p class="noindent" >Normal text
<!--l. 6--><p class="indent" >  <span 
class="cmti-10x-x-109">Emphasized text</span>
<!--l. 8--><p class="indent" >  <span 
class="cmbxti-10x-x-109">Bold-faced text </span> 

Is it possible to generate "plain" HTML that does not use an external CSS file? Something along these lines:

<!--l. 4--><p class="noindent" >Normal text
<!--l. 6--><p class="indent" >  <em>Emphasized text</em>
<!--l. 8--><p class="indent" >  <b>Bold-faced text </b>

This is for pasting references into another website that already has a CSS.

share|improve this question
You can also include the css-code inside the html file. Would that be acceptable too? – canaaerus Sep 4 '12 at 10:09
up vote 15 down vote accepted

You have to do two things:

you can disable generation of css and ugly elements like

class="cmti-10x-x-109">Emphasized text</span>

with some command line options:

htlatex filename "xhtml, NoFonts, -css" 

You will then have to provide configurations for em and textit, as they are by default dealed only by css.

This should be done with custom config file, like myfonts.cfg


Now your htlatex call will be

htlatex filename "myfonts, -css, NoFonts"

Resulting html

<!--l. 4--><p class="noindent" >Normal text
</p><!--l. 6--><p class="indent" >  <em>Emphasized text</em>
</p><!--l. 8--><p class="indent" >  <b>Bold-faced text</b> </p> 

All command line options of tex4ht are described in this article. There are also other interesting articles about configuring of this system.

For getting rid of <p class="indent">, you can put following to the config file:

share|improve this answer
Works for me. But I have two questions: 1. Where did you find the documentation on the -css option? 2. Is there a way to get rid of the class="indent"? – krlmlr Sep 4 '12 at 12:37
@user946850 see edit – michal.h21 Sep 4 '12 at 12:59
The described code works for me too. But how to get rid off class="likesectionHead" and <a id="x1-1000"></a> from the < h3> tag (similarly from the < h4> tag), of the resulting html: <h3 class="likesectionHead"><a id="x1-1000"></a>2013</h3> <p> </p> <h4 class="likesubsectionHead"><a id="x1-2000"></a>Journal papers</h4> <p> </p> – rasha Jan 1 '13 at 20:08

Your Answer


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.