TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

enter image description here

share|improve this question

migrated from stackoverflow.com Dec 16 '12 at 16:41

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your post was migrated here from Stack Overflow. 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
up vote 4 down vote accepted

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}
\newsavebox{\codebox}% Used to store listings/code
public class <Name> {

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.