7

I have the following document, with several minipages of 12cm width. Each minipage contains a different number of minipages (with a sum of 12cm for all of them). So every subminipages should fit inside its main minipage, but the more minipages there are, the more they're oversized. I see no spaces between the minipages, so i don't understand why i have such a behaviour, especialy since the size is in cm and not in 0.X\linewidth.

Thank you for your lights on this.

Here is my code :

\documentclass[a4paper]{article}
\usepackage{xcolor}
\begin{document}

\fbox{\begin{minipage}[t]{12cm}
\hspace{-1mm}\colorbox{gray}{\begin{minipage}[t]{12cm}12\end{minipage}}%
\end{minipage}}

\fbox{\begin{minipage}[t]{12cm}
\hspace{-1mm}\colorbox{gray}{\begin{minipage}[t]{6cm}6\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{6cm}6\end{minipage}}%
\end{minipage}}

\fbox{\begin{minipage}[t]{12cm}
\hspace{-1mm}\colorbox{gray}{\begin{minipage}[t]{4cm}4\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{4cm}4\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{4cm}4\end{minipage}}%
\end{minipage}}

\fbox{\begin{minipage}[t]{12cm}
\hspace{-1mm}\colorbox{gray}{\begin{minipage}[t]{3cm}3\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{3cm}3\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{3cm}3\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{3cm}3\end{minipage}}%
\end{minipage}}

\fbox{\begin{minipage}[t]{12cm}
\hspace{-1mm}\colorbox{gray}{\begin{minipage}[t]{3cm}3\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{3cm}3\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\end{minipage}}

\fbox{\begin{minipage}[t]{12cm}
\hspace{-1mm}\colorbox{gray}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{3cm}3\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{3cm}3\end{minipage}}%
\end{minipage}}

\fbox{\begin{minipage}[t]{12cm}
\hspace{-1mm}\colorbox{gray}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{2cm}2\end{minipage}}%
\end{minipage}}

\fbox{\begin{minipage}[t]{12cm}%
\hspace{-1mm}\colorbox{gray}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{gray}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\colorbox{cyan}{\begin{minipage}[t]{1cm}1\end{minipage}}%
\end{minipage}}
\end{document}

And here is the result : myscreenshot

7

\colorbox internally uses \fbox. Thus there two additonal \fboxsep for the left and right side.

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.