2

I'm doing a beamer presentation in LaTeX, and I want know if it's possible make something like this:

enter image description here

Werner
  • 603,163
  • Welcome to TeX.sx! Your post was migrated here from [so]. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Dec 16 '12 at 16:43

1 Answers1

4

A combination of tabularx and listings would suffice:

enter image description here

\documentclass{beamer}% http://ctan.org/pkg/beamer
\usepackage{tabularx,listings}% http://ctan.org/pkg/{tabularx,listings}
\lstset{
  language=C++,
  basicstyle=\small\ttfamily
}
\newsavebox{\codebox}% Used to store listings/code
\begin{document}
\begin{lrbox}{\codebox}
\begin{lstlisting}
public class <Name> {
  ....
  ...
  ..
  .
  ..
  ...
  ....
}
\end{lstlisting}
\end{lrbox}
\begin{frame}
  \begin{tabularx}{\linewidth}{X|X}
  \usebox{\codebox}
  &
  \usebox{\codebox}
  \end{tabularx}
\end{frame}
\end{document}

The fragile nature of beamer's frame environment can be avoided by storing the content in a box (\codebox) and use it later. Or, you could explicitly use the fragile option for each frame. See How to put C++ source code into beamer slides. For a flavour in terms of keyword colouring, see How to format C program code block nicely.

See the listings documentation for more information on possible settings.

Werner
  • 603,163