[tex4ht] future support for multicols in htlatex?

Nasser M. Abbasi nma at 12000.org
Fri Jul 12 09:32:36 CEST 2013


Ok, here is my poor's man implementation of multiple columns
support in htlatex.

compile using

         htlatex foo.tex "my.cfg"

where my.cfg is

---------------------
\Preamble{ext=htm,pic-align}

\ConfigureEnv{newspaper}
{\HCode{<div class="newspaper">}}
{\HCode{</div>}}
{}{}
\begin{document}
\EndPreamble

\Css{.newspaper {
    -moz-column-count:2; /* Firefox */
    -webkit-column-count:2; /* Safari and Chrome */
    column-count:2;
    -moz-column-gap:10px; /* Firefox */
    -webkit-column-gap:10px; /* Safari and Chrome */
    column-gap:10px;
    -moz-column-rule:1px outset \#F8F8F8 ; /* Firefox */
    -webkit-column-rule:1px outset \#000000; /* Safari and Chrome */
    column-rule:1px outset \#000000;
}}
---------------------------

and foo.tex is

-------------------
\documentclass{article}%
\usepackage{lipsum}
\usepackage{multicol}
\setlength{\columnsep}{20pt}
\setlength{\columnseprule}{0.01pt}
\newenvironment{newspaper}{}{}
\begin{document}

\ifdefined\HCode
   \begin{newspaper}
\else
   \begin{multicols}{2}
\fi

     \lipsum[1-10]

\ifdefined\HCode
   \end{newspaper}
\else
   \end{multicols}
\fi

\end{document}
-----------------------

The div is hardcoded to 2 columns in HTML for now and the
other properties are hardcoded.

One can make newenv. for 3 columns, or pass the number of
columns as argument, but I am not good in Latex to do that
yet.

So, the above now generates HTML with 2 columns. I tried
it on firefox, chrome and IE and it all works. And pdflatex
works as before.

This is better for me than having to use tabular with 2 columns
to get the same effect in HTML.

--Nasser


More information about the tex4ht mailing list