Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
1  
Answers are here: tex.stackexchange.com/q/66977/9549 –  Calaf Feb 23 at 15:54
1  

2 Answers 2

up vote 10 down vote accepted

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

share|improve this answer
    
Cannot \topskip be set to 0pt? –  karlkoeller Feb 23 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 at 18:19

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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