45

I would like to split a frame into 2 parts side by side by minipage. But it seems that the following code puts one on top of the other:

\begin{minipage}[t]{0.48\linewidth}
left part
\end{minipage}\hfill
\begin{minipage}[t]{0.48\linewidth}
right part
\end{minipage}

Could anyone tell me how to do that, and if it is correct to set 0.48\linewidth?

  • 6
    The fact that you say "frame" and have tagged this "beamer" makes me think that this is part of a presentation. Since many things are set up slightly differently for presentations than for ordinary articles, a minimum working example is really important here. Please add a full example including preamble. – Loop Space Aug 29 '11 at 10:04
  • could you add more context to your question? Like for example you wrote beamer but you never reference it in the details, could you explain how your question relates to beamer please? – Charlie Parker Nov 7 '16 at 18:12
68

A minipage or a parbox or a box in general need a \noindent to prevent the indention at the beginning of a paragraph.

\documentclass{article}
\begin{document}
\fboxsep=0pt
\noindent\fbox{%
\begin{minipage}[t]{0.48\linewidth}
left part
\end{minipage}}%
\hfill%
\fbox{%
\begin{minipage}[t]{0.48\linewidth}
right part
\end{minipage}
}

\end{document} 

I am sure that Raphink knows the answer but you don't provide a minimal example to show the problem.

I used the command \frame to demonstrate the left and right part.

enter image description here

EDIT: How Andrew Stacey commented here the solution with beamer. beamer provides additional features / environments like columns which is used in the minimal example. For more details have a look at the documentation.

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{columns}[T] % align columns
\begin{column}{.48\textwidth}
\color{red}\rule{\linewidth}{4pt}

Left Part
\end{column}%
\hfill%
\begin{column}{.48\textwidth}
\color{blue}\rule{\linewidth}{4pt}

Right Part
\end{column}%
\end{columns}
\end{frame}
\end{document}

enter image description here

  • 1
    Why does your example require the {.48\textwidth} after you the begin column command? – Charlie Parker Nov 7 '16 at 18:15
  • 1
    Random question, is it possible to insert a dividing line between the Left part and Right part? – Charlie Parker Nov 7 '16 at 19:54
8

You should add a \hfill between the two minipages.

Using 0.48\textwidth is indeed a correct way of splitting the page.

  • it still does not work... – SoftTimur Aug 29 '11 at 9:47
  • It works for me. Can you post a MWE? – ℝaphink Aug 29 '11 at 9:48
  • Note that editing your question to add \hfill makes my answer moot while it doesn't help as long as you don't provide a MWE demonstrating the problem. – ℝaphink Aug 29 '11 at 9:57
  • That is true... – SoftTimur Aug 29 '11 at 10:36

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.