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.

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}
share|improve this question
    
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 May 2 '12 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 May 2 '12 at 14:33
3  
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). –  tohecz May 2 '12 at 14:51
    
Didn't know about columns but they indeed are a better solution. –  Philipp May 3 '12 at 7:26

2 Answers 2

up vote 22 down vote accepted

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}.

share|improve this answer
    
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 May 2 '12 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. –  Frank Mittelbach May 2 '12 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. –  Frank Mittelbach May 2 '12 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. –  Frank Mittelbach May 2 '12 at 14:44
3  
@Philipp: Have a look at Why the end-of-line % in macro definitions? –  Martin Scharrer May 2 '12 at 15:20

Here is a modified MWE with Mittelbach answer implemented

%% !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}
share|improve this answer
3  
so? ... by the way you don't need all those % only the one between the minipages. The frame environment drops spaces at the beginning and end only the one in the middle is not dropped because it is part of a paragraph. just think of the two minipages as two words in a paragraph. –  Frank Mittelbach May 2 '12 at 14:47
    
I really don't understand the purpose of this answer, especially since it was posted after the questioner clarified that the first answer had solved the problem, and as you state yourself, it does not add anything more than making the first answer a MWE. –  tohecz May 2 '12 at 16:49

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.