2

Here is the example that fails

\documentclass{standalone}
\usepackage{tikz}
\usepackage{float}
\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}
\usetikzlibrary{shapes,positioning}
\begin{document}
\centering
\resizebox{5.00in}{!}{
\begin{tikzpicture}
  \node[draw] (PersonLocation Graph) {
    \begin{minipage}{.85\linewidth}
\begin{lstlisting}[language=XML,escapechar=!]
  <collection name=PersonLocation BiMap>
  <edge> 
  <ref>//collection[name=Locations]/loc[name=XXYY]
  </ref>
  <ref>//collection[name=Persons]/person[id=4564]  
  </ref>

  </edge>
  ...
  ...
  ...

  </collection>
\end{lstlisting}
\end{minipage}

};
\end{tikzpicture}
}
\end{document}
6

listings is a verbatim-like environment and you can never use such environments in the argument of a command. The lrbox environment was introduced for exactly this:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{float}
\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}
\usetikzlibrary{shapes,positioning}
\begin{document}
\centering
\begin{lrbox}{0}%
\begin{tikzpicture}
  \node[draw] (PersonLocation Graph) {%
    \begin{minipage}{.85\linewidth}
\begin{lstlisting}[language=XML,escapechar=!]
  <collection name=PersonLocation BiMap>
  <edge> 
  <ref>//collection[name=Locations]/loc[name=XXYY]
  </ref>
  <ref>//collection[name=Persons]/person[id=4564]  
  </ref>

  </edge>
  ...
  ...
  ...

  </collection>
\end{lstlisting}%
\end{minipage}

};
\end{tikzpicture}\end{lrbox}
\resizebox{5.00in}{!}{\usebox0}
\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.