# Verbatim inside tikz node [duplicate]

Possible Duplicate:
Problem with TikZ, beamer and verbatim

Is it possible to use verbatim-like environments inside a tikz node? This MWE gives an error:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\tikz{
\node{\begin{verbatim}a_b\end{verbatim}};
}
\end{document}
-

## marked as duplicate by JLDiaz, Harish Kumar, Marco Daniel, Thorsten, Martin SchröderDec 9 '12 at 13:12

I saw that, but the answer notes 'if another document class (article, for example) ...' -- so that looks beamer-specific, no? – Mohan Dec 9 '12 at 12:16
Do you really need \begin{verbatim}...\end{verbatim}? – hpesoj626 Dec 9 '12 at 12:38
I need an environment constructed for me in other answers that is like verbatim... – Mohan Dec 9 '12 at 12:41

This other command works for me:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\node[draw] at (0,0) {\verb+a_b+};
\end{tikzpicture}
\end{document}
-

I get missing item error with your MWE. However, it seems to work with listings package. If you would allow it, then try the code below.

\documentclass{article}
\usepackage{tikz}
\usepackage{listings}
\lstset{basicstyle=\ttfamily}
\begin{document}

\tikz
\node at (0,0) {
\begin{lstlisting}
a_b
\end{lstlisting}
};

\end{document}
-