3

I'm struggling with this piece of LaTeX code:

\begin{minipage}{0.5\textwidth}
    \begin{tabu} to \textwidth {>{\itshape}r c}
        Foo:&\makebox[5cm]{}\\
        \cline{2-2}\\[-0.5em]
        & Foo
    \end{tabu}
\end{minipage}%
\begin{minipage}{0.5\textwidth}
    \begin{tabu} to \textwidth {>{\itshape}r c}
        Bar:&\makebox[5cm]{}\\
        \cline{2-2}\\[-0.5em]
        & Bar
    \end{tabu}
\end{minipage}

It has an overfull hbox of 17.62482pt too wide, just to the right of the minipages (see screenshot below). I can fix it by setting the width to 0.45\textwidth, but that's obviously not the right way.

Overfull hbox in black at the right hand side

How do I pin down what is causing this? Or is there some obvious error in my code that I am missing?

  • Are you using \noindent at the beginning? – Sigur Jan 15 '16 at 21:28
  • No. Would it be a good idea to do so? – lindhe Jan 15 '16 at 21:31
  • Just try it before the 1st minipage. – Sigur Jan 15 '16 at 21:31
  • 1
    @lindhe It happens because any paragraph starts with a \parindent. So you have to pull it back to the left margin. How would you know? With experience. Read and read and try. – Sigur Jan 15 '16 at 21:46
  • 1
    Another debugging aid is the showframe package (or showframe option of geometry). – John Kormylo Jan 15 '16 at 22:17
2

Sigur pointed out the answer in the comments:

Every paragrph is indented as default. Since the minipage begins a new paragraph it too will be indented. This behaviour can be prohibited by putting \noindent just before the new paragraph (the minipage environment), or by using \setlength{\parindent}{0cm} in the top matter.

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.