If I run htlatex on



Bla bla bla bla

\begin{center} x \end{center} \end{document}

with the setting in this question I get the code below, but my browser (mozilla firefox) does not properly center "x". How can I redefine the way that center is handled to just use some simple html tag (which my browser does understand correctly)?

<?xml version="1.0" encoding="iso-8859-1" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   >  
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
 <meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" /> 
 <meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />  
<!-- -css,NoFonts,html,xhtml --> 
 <meta name="src" content="a.tex" /> 
 <meta name="date" content="2016-10-16 19:12:00" /> 
<body  > 
<p>Bla bla bla bla    </p>   
<div class="center"  > 
<p> </p> 
 <p>x</p>  </div> 
  • 1
    you are using code answering a question that explicitly asks that the css that produces the style is not generated, so in this case you need to provide the css for the .center class to centre the text. Or use the default setting and let tex4ht generate the css. Oct 16, 2016 at 23:27

1 Answer 1


The centering is done by CSS, so it can't work if you disable it's use in the document. <center> tag exists, which is deprecated in HTML 5, but you can try to use it, if you really don't want to use CSS.

Try the following .cfg file:




Options -css,NoFonts are included in the config file, so you don't have to specify them on the command line anymore. \FinishPar is helper macro to close paragraph tags at correct places. \ConfigureEnv can be used to configure environments. Because center environment is implemented using list, is is necessary to pass the custom tags in fourth and fifth arguments of \ConfigureEnv.

The other way would be to provide custom CSS file, hello.css:


and the .cfg file:


\Configure{@HEAD}{\HCode{<link rel="stylesheet" type="text/css" href="hello.css" />\Hnewline}}

This example just add link to the custom CSS file to the document.

The result looks the same for both possibilities:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .