13

Suppose I have two images: one a solid blue square and another a yellow. What is the most appropriate way to divide and fill an entire beamer frame with these images? Horizontally (i.e., left half blue right half yellow)? Vertically? (i.e., top half blue bottom half yellow)

This post provides a method, but it involves low-level operations. Another post (can't find the link now) suggests using TikZ.

Is there a third that doesn't involve low-level operations or complicated external packages? I'm confused. I'd think this task wouldn't be all that difficult.

  • What do you mean by entire? Do you still wish to have the theme bars on the top/bottom? Margins? Place for the navigation buttons? Or do you want it to look just like someone took a page out of another pdf file and pasted it to your carefully-themed document? – Federico Poloni Nov 7 '11 at 22:34
  • 1
    \frame{\includegraphics[width=.5\textwidth}{image1}\includegraphics[width=.5\textwidth}{image2}}? Might not fill the full height, though. – Martin Scharrer Nov 7 '11 at 22:35
  • 1
    You can use \usebackgroundtemplate before the frame – Marco Nov 7 '11 at 22:39
  • For other examples see this or this or this – Marco Nov 7 '11 at 22:46
  • @FedericoPoloni I mean the latter, like someone took a page out of another pdf file. – lowndrul Nov 8 '11 at 0:26
7

You can use the standard \includegraphics command setting the proper values for the width and height in terms of \paperwidth and \paperheight; a box (in this case \makebox) will prevent an overfull box; using plain for the frames will remove the headline, footline:

\documentclass{beamer}
\usepackage{graphicx}

\begin{document}

\begin{frame}[plain]
\makebox[\linewidth]{%
  \includegraphics[width=0.5\paperwidth,height=\paperheight]{cat1}%
  \includegraphics[width=0.5\paperwidth,height=\paperheight]{cat2}}
\end{frame}

\begin{frame}[plain]
\makebox[\linewidth]{%
  \includegraphics[width=\paperwidth,height=0.5\paperheight]{cat1}}\\\nointerlineskip
\makebox[\linewidth]{%
  \includegraphics[width=\paperwidth,height=0.5\paperheight]{cat2}
}
\end{frame}

\end{document}
  • \paperwidth is hardly correct here because \paperwidth is larger than \linewidth. – Igor Kotelnikov Nov 8 '11 at 9:10
  • @Igor: you're wrong: since I used \makebox[\linewidth]{...}, LaTeX doesn't care if the contents of the box overflows the dimension. – Gonzalo Medina Nov 8 '11 at 12:44
  • @GonzaloMedina: First, there's still a thin white horizontal line in the second. I tried \setlength{\baselineskip}{0pt} and \setlength{\parskip}{0pt} locally and had no success. Secondly, how did that work? Could you explain? Is this a hack or an intended use of \makebox? What do you mean "will prevent an overfull box"? It looks like the graphics overfilled the box to fill the frame. Thx for the help! – lowndrul Nov 8 '11 at 15:12
  • @brianjd: you said "there's still a thin white horizontal line in the second". In the second what? Please explain in more detail what are you referring to with "in the second". On the other hand, the use of \makebox it's not a hack; it's an intended use. As I said in my previous reply, using \makebox[\linewidth]{...} makes LaTeX let the contents of the box overflow its dimension without producing an overfull box. – Gonzalo Medina Nov 8 '11 at 15:25
  • @GonzaloMedina: The top (almost) half is blue. The bottom (almost) half is yellow. And there's a thin white horizontal line separating the two. I'm guessing this is just the standard white-space that goes between two lines. – lowndrul Nov 8 '11 at 16:17
11

Here is a very simple solution via columns.

enter image description here enter image description here

\documentclass{beamer}
\usepackage{lmodern}
\begin{document}
\begin{frame}[plain]
  \begin{columns}
    \column{.5\paperwidth}
    \textcolor{blue}{\rule{.5\paperwidth}{\paperheight}}
    \column{.5\paperwidth}
    \textcolor{yellow}{\rule{.5\paperwidth}{\paperheight}}
  \end{columns}
\end{frame}
\begin{frame}[plain]
  \begin{columns}
    \column{\paperwidth}
    \textcolor{blue}{\rule{\paperwidth}{.5\paperheight}}\\\nointerlineskip
    \textcolor{yellow}{\rule{\paperwidth}{.5\paperheight}}
  \end{columns}
\end{frame}
\end{document}
  • This even worked on a decorated, non-plain frame with a custom theme. – ojdo Jan 29 '15 at 9:55
  • @ojdo Without plain option, the result seems correct... but material (here, \rules) is too long! – Paul Gaborit Jan 29 '15 at 10:13
  • I just used it with \includegraphics like the OP. The result looks fine for me. – ojdo Jan 29 '15 at 10:16

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.