This is an example using TikZ. Also working with beamer
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,plotmarks,decorations.markings,shadows}
\begin{document}
\begin{tikzpicture}[x=1cm,y=1cm]
\node[drop shadow,fill=white,draw,rounded corners]
{$\sum\limits_{i=1}^N (x_i-\mu_i)^2$};
\end{tikzpicture}
\end{document}
Would have posted a picture, but I dont have enough rep. to do so, yet.
Using a listing could look like this:
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{listings}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,plotmarks,decorations.markings,shadows}
%%%%%%%%%%%%%%%%%%%%%
% Code Listing
%%%%%%%%%%%%%%%%%%%%%
\lstnewenvironment{CODEENV}{
\lstset{
language=Matlab,
numbers=left,
numberstyle=\tiny,
stepnumber=1,
numbersep=1em,
tabsize=1,
}
}{}
%%%%%%%%%%%%%%%%%%%%%
% Document
%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{tikzpicture}[x=1cm,y=1cm]
\node[drop shadow,fill=white,draw,rounded corners,inner sep=1em] {
\begin{CODEENV}
N = 128;
sigma_r = 1;
% Leistungsdichte nach Clark
nu_max = 1;
nu = (-nu_max):(2*nu_max/(N-1)):(nu_max);
% Bessel & Clark
xlambda = (0:2/(N-1):2);
rho_R = sigma_r^2*besselj(0, 2*pi*xlambda);
figure;
subplot(211);
plot(xlambda,rho_R/max(rho_R));
subplot(212);
plot(nu, abs(fft(rho_R)).^2);
\end{CODEENV}
};
\end{tikzpicture}
\end{document}
Note, that if you have long code snippets, you may need to increase the 'inner sep' parameter of the node, as the line numbering is done outside the listing box (as it seems).
listingsto create the box? Could you place the listing inside atikznode? Then you could use something like this: http://www.texample.net/tikz/examples/boxes-with-text-and-math/ – Jan Hlavacek Jan 15 '11 at 01:04beamerpackage. – Denilson Sá Maia Jan 16 '11 at 20:53