[Tex/LaTex] text dimension in beamer

beamercolumnsminipagewidth

I can't understand how to dimension minipages or columns in a beamer frame.

Creating a single column with width \textwidth or \linewidth (or 2 columns with width 0.5 \textwidth or 0.5\linewidth) causes horizontal overful as you can see in the picture where frame boundaries have been highlighted

enter image description here

MWE:

\documentclass{beamer}
\usepackage{showframe}
\usepackage{lipsum}  
\usepackage{ragged2e}

\begin{document}

\begin{frame}
\justifying
\lipsum[75]

\fbox{
\begin{minipage}[t]{1\textwidth}
mp1
\end{minipage}} 
\fbox{
\begin{minipage}[t]{1\linewidth}
mp2
\end{minipage}} 

\begin{columns}
\fbox{
\begin{column}{1\textwidth}
c1
\end{column}}
\end{columns}

\begin{columns}
\fbox{
\begin{column}{0.5\textwidth}
c1
\end{column}}
\fbox{
\begin{column}{0.5\textwidth}
c2
\end{column}}
\end{columns}


\fbox{
\begin{minipage}[t]{0.5\textwidth}
mp1
\end{minipage}} 
\fbox{
\begin{minipage}[t]{0.5\linewidth}
mp2
\end{minipage}}


\end{frame} % 

\end{document}

Best Answer

The good news is: it seems, as if you did set up your columns and your minipages correct.

The bad new is: you didn't take care of suppressing unwanted white spaces and you forgot that the fbox always adds a small gap between the box and its frame.

To prevent the unwanted white spaces, you should use the comment character (%) frequently (at the important places, especially line ends!).

To prevent the gap between the box and its frame, just set the dimen \fboxsepto be 0pt. This works rather well, but in case, you put a fbox next to another fbox, you'll have to take the linewidth of the frames into account. I added an example at the end of my MWE, to show the effect and how to prevent it.

In case of the columns: Placing the \fbox at the correct place in the code seems to be important. You have to frame the column-environment, not a single columns.

Here is my enhanced MWE of yours:

\documentclass{beamer}
\usepackage{showframe}
\usepackage{lipsum}  


%% Set the gap between the box and its frame to be exactly 0pt
\setlength{\fboxsep}{0pt}

\begin{document}

\begin{frame}
\lipsum[75]

\fbox{% <--- There was a blank space inserted between the surrounding
      % box and the minipage.  See next example
  \begin{minipage}[t]{1\textwidth}
    mp1
  \end{minipage}} 
\fbox{
\begin{minipage}[t]{1\linewidth}
mp2 with leading blank space
\end{minipage}} 

%% Next test: Beamer-Columns  It seems, as if the location of the
%% \fbox is important  This example works
\fbox{\begin{columns}%
  \begin{column}{1\textwidth}
    \centering c1 (everthing fine!)
  \end{column}%
\end{columns}}
\begin{columns}%
  \fbox{\begin{column}{1\textwidth}
    \centering c2 (incorrect!)
  \end{column}}%
\end{columns}

%% Same problem with two columns.
\fbox{\begin{columns}%
    \begin{column}{0.5\textwidth}
      \centering c3.1 (fine!) 
    \end{column}%
    \begin{column}{0.5\textwidth}
      \centering c3.2 (also fine!)
    \end{column}%
  \end{columns}}
\begin{columns}%
    \fbox{\begin{column}{0.5\textwidth}
      \centering c4.1 (not fine!) 
    \end{column}}%
    \fbox{\begin{column}{0.5\textwidth}
      \centering c4.2 (neither fine!)
    \end{column}}%
  \end{columns}


%% This box is too full, because of four thin vertical lines.
\fbox{%
\begin{minipage}[t]{0.5\textwidth}
mp1
\end{minipage}}% <--- blank space!
\fbox{%
\begin{minipage}[t]{0.5\linewidth}
mp2
\end{minipage}}

%% Same again, this time adjustet by the line thickness.  Define a new
%% length, set it to half the textwidth and add "- 2 rulewidth" to it
%% (that is, removing them from the length)
\newlength{\halfline}
\setlength{\halfline}{0.5\textwidth}
\addtolength{\halfline}{-2\fboxrule}
\fbox{%
  \begin{minipage}{\halfline}
    New MP2
  \end{minipage}}%
\fbox{%
  \begin{minipage}{\halfline}
    New MP2
  \end{minipage}}%
\end{frame} 
\end{document}

This is the result:

enter image description here