63

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?

3
  • 7
    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. Aug 29, 2011 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? Nov 7, 2016 at 18:12
  • I found your question useful. The {.48\textwidth} determines the width of each column and you can modify it to make one column wider than the other. Probably you already that, but it seemed to me that that was your question, many years ago.
    – Clara
    Jul 10, 2021 at 5:06

2 Answers 2

93

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

3
  • 1
    Why does your example require the {.48\textwidth} after you the begin column command? Nov 7, 2016 at 18:15
  • 1
    Random question, is it possible to insert a dividing line between the Left part and Right part? Nov 7, 2016 at 19:54
  • How can I make \fbox lines transparent?
    – RxT
    Nov 16, 2020 at 21:25
13

You should add a \hfill between the two minipages.

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

4
  • it still does not work...
    – SoftTimur
    Aug 29, 2011 at 9:47
  • It works for me. Can you post a MWE?
    – raphink
    Aug 29, 2011 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.
    – raphink
    Aug 29, 2011 at 9:57
  • That is true...
    – SoftTimur
    Aug 29, 2011 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.