[Tex/LaTex] Spurious [?] vertical space introduced by multicols

multicolspacing

In the example below, you'll notice, in the first box, a slight spurious vertical space before the text actually starts, and probably introduced by multicols. Do you know how to get rid of it?

\documentclass[10pt]{article}
\usepackage{xcolor}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{calc}
\setlength{\fboxsep}{3mm}\setlength{\fboxrule}{1pt}%
\begin{document}
\noindent\fcolorbox{red}{red!20}{%
\begin{minipage}[t]{\textwidth-2\fboxrule-2\fboxsep}%
\begin{multicols}{3}%
text text text text text text text text text text text text text 
text text text text text text text text text text text text text text 
text text text text text text text text text text text
\end{multicols}%
\end{minipage}}%

\noindent\fcolorbox{red}{red!20}{%
\begin{minipage}[t]{\textwidth-2\fboxrule-2\fboxsep}%
text text text text text text text text text text text text text 
text text text text text text
\end{minipage}}%
\end{document}

illustration

Best Answer

In order to have the first lines at the same height as in normal setting, multicol sets \splittopskip to \topskip. This means that TeX will add glue equal to \topskip-<height of first line> above each column, ensuring they will be at the same reciprocal height, unless it's bigger than \topskip (in this case zero glue would be inserted).

In your setting, the added glue above each column is 3.84921pt (10pt minus the height of a “t”, because the standard value of \topskip is 10pt, with the 10pt class option).

You can zero this added space by setting \topskip to a more sensible value, for instance the height of a capital letter.

\documentclass[10pt]{article}
\usepackage{xcolor}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{calc}

\setlength{\fboxsep}{3mm}
\setlength{\fboxrule}{1pt}

\begin{document}
\noindent\fcolorbox{red}{red!20}{%
\begin{minipage}[t]{\textwidth-2\fboxrule-2\fboxsep}
\setlength{\topskip}{\fontcharht\font`B }
\begin{multicols}{3}
text text text text text text text text text text text text text 
text text text text text text text text text text text text text 
text text text text text text text text text text text text
\end{multicols}
\end{minipage}}

\noindent\fcolorbox{red}{red!20}{%
\begin{minipage}[t]{\textwidth-2\fboxrule-2\fboxsep}
text text text text text text text text text text text text text 
text text text text text text
\end{minipage}}
\end{document}

enter image description here