[Tex/LaTex] How to force vertical space in tex4ht? \bigskip and \vspace have no effect

spacingtex4ht

I am generating lots of tables one after the other, and noticed the tables in HTML generated by tex4ht are touching each others, and wanted to have some vertical white space between them to separate them a little.

In PDF, I can use \bigskip or \vspace{\baselineskip} and these work with no problem, but they have no effect in the HTML page produces by tex4ht.

Is there a trick to tell tex4ht to please add some extra vertical space? MWE:

\documentclass[12pt]{scrbook}% 
\usepackage{longtable}
\begin{document}       

\begin{longtable}{|p{.5\textwidth}|}\hline
test
\\\hline
\end{longtable}
\bigskip
\begin{longtable}{|p{.5\textwidth}|}\hline
test
\\\hline
\end{longtable}

\end{document}

The pdf is

Mathematica graphics

And the HTML is make4ht foo.tex

Mathematica graphics

I probably can fix this using .cfg and add some CSS commands or such, but first I wanted to see if it is possible to do in all in LaTeX.

Looking the HTML generated, shows that the \bigskip is just ignored in HTML and has no effect.

TL 2015

Best Answer

It is possible to redefine \bigskip to produce empty paragraph with some height. The problem is that \bigskip etc. is used internally in some LaTeX commands and environments, so it could break quite a lot of configurations. It is best to suppress it by default. I would use custom spacing commands instead.

% myspaces.sty 
\newcommand\mybigskip{\bigskip}
\newcommand\mymedskip{\medskip}
\newcommand\mysmallskip{\smallskip}

tex4ht configuration

% myspaces.4ht
\newcommand\:myskip[1]{\ifvmode\HCode{<span class="#1">}\:nbsp\HCode{</span>}\fi}
\renewcommand\mybigskip{\:myskip{bigskip}}
\renewcommand\mymedskip{\:myskip{medskip}}
\renewcommand\mysmallskip{\:myskip{smallskip}}
\Css{span.bigskip{height:2em;margin:0;}}
\Css{span.medskip{height:1em;margin:0;}}
\Css{span.smallskip{height:0.5em;margin:0;}}

modified TeX file:

\documentclass[12pt]{scrbook}% 
\usepackage{longtable}
\usepackage{myspaces}
\begin{document}       

\begin{longtable}{|p{.5\textwidth}|}\hline
test
\\\hline
\end{longtable}
\mybigskip
\begin{longtable}{|p{.5\textwidth}|}\hline
test
\\\hline
\end{longtable}
\mymedskip
hello

\mysmallskip
world
\end{document}

and the result:

enter image description here

Related Question