TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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). – yo' 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
up vote 29 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

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.