# configuring minipage in htlatex

I want to use minipage in htlatex, because I want to have a minipage with a figure, close to a minipage with some text, and then I want some other text that must be on a new line and full-width.

I used the cfg template of answer:

Configuring minipage environment to incorporate width

and I use

\begin{figure}
\begin{minipage}{0.6\textwidth}
\makebox[0.4\columnwidth][l]{line1}
\par
\makebox[0.4\columnwidth][l]{line2}
\par
\makebox[0.4\columnwidth][l]{line3}
\end{minipage}
\begin{minipage}{0.375\textwidth}
\centering
\includegraphics{pic.jpg}
\end{minipage}
\end{figure}


but I have the following problem: the text after the minipage environment doesn't go to a new line, but stays on a third column. How can I force the text after the minipage environment to start a new line?

You haven't provided full mwe, so I expanded your sample to illustrate the problem:

\documentclass{article}
\begin{document}
\begin{figure}
\begin{minipage}{0.6\textwidth}
\makebox[0.4\columnwidth][l]{line1}
\par
\makebox[0.4\columnwidth][l]{line2}
\par
\makebox[0.4\columnwidth][l]{line3}
\end{minipage}
\begin{minipage}{0.375\textwidth}
\centering
%\includegraphics{pic.jpg}
image
\end{minipage}
\end{figure}

So what's the problem?

\end{document}


The problem is that two minipages which should be each next to the other are stacked down, and following text floats to the right column, reserved for the minípage. The first problem is with margins, which were provided by linked question's OP, which causes minipages to overflow. We can remove the margins and minipages will float correctly. The other problem is with figure environment, we need to provide css declaration to support enclosed floating objects. Corrected .cfg file:

\Preamble{xhtml}
\makeatletter
% to strip fraction from \textwidth
\def\striptextwidth#1\textwidth{#1}
% we must refer to minipage from the css file, because tags are beeing
% written before we know dimensions
\newcount\mini@count
% save original minipage
\let\oldiimini\@iiiminipage
% redefine minipage
\def\@iiiminipage#1#2[#3]#4{%
% calculate dimensions and save it to macro
\xdef\miniwidth{\strip@pt\dimexpr(\striptextwidth#4pt)*100\relax\%}
\oldiimini{#1}{#2}[#3]{#4}
}

\ConfigureEnv{minipage}{\advance\mini@count by 1\relax\ifvmode\IgnorePar\fi\EndP\HCode{<div class="minipage" align="center" id="minipage\the\mini@count" style="border:1px solid black;">}}
{\ifvmode\IgnorePar\fi\EndP\HCode{</div>\Hnewline}%
% we must write dimension here to the css file
\Css{\#minipage\the\mini@count{width:\miniwidth;}}%
}{}{}
\makeatother
\Css{div.minipage {
float: left;
}
}
\Css{div.minipage:last-child {
clear: none;
float: right;
}
}
\Css{div.figure{clear:both;overflow:auto;width:100\%;}}
\begin{document}
\EndPreamble


Notice that I changed changed Preamble to xhtml, removed HtmlPar configuration which is unnecessary and incorrect, removed margin declarations in .minipage css and added css for div,figure. The result is much better now:

• This is not working for me for some reason. With the same exact LaTeX and configuration, I see this output instead. Apr 2 '21 at 0:17