11

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

11

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

|improve this answer|||||
  • Cannot \topskip be set to 0pt? – karlkoeller Feb 23 '14 at 17:58
  • @karlkoeller No; the top lines wouldn't be necessarily vertically aligned to each other, because their distance from the top would depend only on the respective heights. – egreg Feb 23 '14 at 18:19
2

The problem doesn't come from multicol itself :

The minipage environment eat all space around multicol, and the fcolorbox add some spurious space :

\documentclass[10pt]{article}
\usepackage{xcolor}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{calc}
\setlength{\fboxsep}{3mm}\setlength{\fboxrule}{1pt}%
\setlength{\multicolsep}{20pt}

\begin{document}
\hrule
\begin{multicols}{2}%
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}

\hrule
\begin{minipage}[t]{\textwidth-2\fboxrule-2\fboxsep}%
\setlength{\multicolsep}{0pt}
\begin{multicols}{2}%
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}%
\setlength{\multicolsep}{0pt}
\begin{multicols}{2}%
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

|improve this answer|||||
  • 1
    It looks to me that there is a slightly bad interaction between multicols and fcolorbox. – pluton Feb 23 '14 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.