27

This happens in the beamer class only. Does anyone know the reason behind this? I fix it by just setting both widths to 0.49\textwidth and this works but I'm still curious why this happens and if I maybe do something wrong.

MWE here:

% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode

\documentclass{beamer}
\usetheme{Warsaw}

\begin{document}
\begin{frame}

\begin{minipage}{0.50\textwidth}
asdfasdf
\end{minipage}
\begin{minipage}{0.50\textwidth}
asdfasdf
\end{minipage}

\end{frame}
\end{document}
4
  • I wrote that already :) But I'm more interested in why this happens and if there is a mistake on my end (misusing the minipage environment e.g.). Also I copy pasted a sligthly altered version of the MWE at first where one width was .5 and the other .49. I'm wondering why .5+0.5 doesn't give me two minipages next to eachother.
    – Philipp
    Commented May 2, 2012 at 14:31
  • Ah, sorry for not understanding this point right away. As far as I can tell, you're not making a mistake.
    – Mico
    Commented May 2, 2012 at 14:33
  • 4
    Beamer provides a columns environment that allows to place things next to each other. It might be a cleaner solution for you (see beamer documentation for details).
    – yo'
    Commented May 2, 2012 at 14:51
  • Didn't know about columns but they indeed are a better solution.
    – Philipp
    Commented May 3, 2012 at 7:26

1 Answer 1

40

There is a space between the two minipages so the total of the line is more than \textwidth. Add a % directly after the first \end{minipage}.

6
  • 1
    nice, thanks! What does the % do? I assume removing spaces but maybe you can give me an accurate answer? TeXshop also includes a % when inserting a table via menu.
    – Philipp
    Commented May 2, 2012 at 14:35
  • 2
    % is the standard TeX comment character. It gobbles up anything until the end of the line (including the line end which is normally turned into a space). If that is not known to you I suggest you read some intro document on LaTeX as then you are probably missing a lot useful information. Try lshort.pdf for example or any of its translation into some language. Commented May 2, 2012 at 14:39
  • by the way ... therefore never ever write something like "so 20% of xyz..." because then half of your sentence will be missing in the output. Commented May 2, 2012 at 14:42
  • 1
    it doesn't change the layout, it drops the line end character as part of the commenting so you have one space less and that was the offending one in your example. Commented May 2, 2012 at 14:44
  • 4
    @Philipp: Have a look at Why the end-of-line % in macro definitions? Commented May 2, 2012 at 15:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .