# Tex4ht (htlatex) html output in sans serif typeface and narrow textwidth

Using the htlatex myfile.tex command which invokes tex4ht, I learned that a rather nice text for web pages can be obtained by simply using the \sf command for an entire web article. Using the helvet package and enforcing the reencoding did nothing for the html output, but \sf does.

However, the font size in the html file is a little large, and I couldn't seem to reduce the font size by using e.g. \small \sf (using \sf \small would result in computer modern(cmr), since e.g. \small or \large resets the typeface to cmr).

Naturally, the math type is smaller, since it's not affected by \sf.

Thus, how can I nudge the font size of the text to be a little smaller?

Overall, it would be nice to be able to set the the text width and margins so that the result looks like an e.g. github wiki page, as the very wide default margins look terrible.

Here's how to generate a san serif html web page, with reduced text width that's centered on the page. It actually looks very nice.

In the .tex file, use for example

\begin{document}
\sf
\section{Introduction}


....

and when compiling use

htlatex myfile.tex "myconfig.cfg,html"


and inside the text file renamed myconfig.cfg, enter the following text:

\Preamble{html}
\Configure{Picture}{.svg}
% 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}
\Css {body {margin-top: 100px;
margin-right: 400px;
margin-bottom: 10px;
margin-left: 400px;
}
}
\begin{document}
\EndPreamble


Inside the myconfig.cfg file, the .svg command will force the equations to be saved to .svg image files, which will look better than the default .png files. The \Css command will change the left and right margins and make the textwidth appear about 8 inches wide and centered on the page. The other commands in the myconfig.cfg file remove the default rules (lines) which separate sections, subsections, tables, and figures from the text, which are actually quite ugly.