I am trying to get a boxed text as part of a tikz node. I found an example here that I am trying to follow, but it is giving me an error: Argument of \@xverbatim has an extra }. I can't figure it out. Any help would be greatly appreciated. My code is below. One interesting thing is that if I change the documentclass to article, it works. However, I need this in a beamer environment.
\documentclass[table,xcolor=pdftex,dvipsnames]{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes}
\begin{document}
\begin{frame}
\frametitle{Testing verbatim}
\tikzstyle{mybox} = [draw=red, fill=blue!20, very thick,
rectangle, rounded corners, inner sep=2pt, inner ysep=2pt]
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.4\textwidth}
\tiny
\begin{verbatim}
<list title="MOVIES">
<film>
<title>The Shining</title>
<release_date>1980-05-23</release_date>
<director>Stanley Kubrick</director>
<actor>Jack Nicholson</actor>
</film>
<film>
<title>Spartacus</title>
<director>Stanley Kubrick</director>
</film>
<film>
<title>The Passenger</title>
<actor>Jack Nicholson</actor>
</film>
...
</list>
\end{verbatim}
\end{minipage}
};
\end{tikzpicture}
\end{frame}
\end{document}
Best Answer
You have to add
[fragile]
option to\begin{frame}
. I have also added the optionsfont=\tiny,text width=0.45\textwidth
to themybox
style.Code:
Here is another option with
tcolorbox
: