[pstricks] Listings in Combination with rput

Christian Häger christianhaeger at me.com
Wed Dec 14 13:39:18 CET 2011


Hello, 

I want to place a source code snippet at an arbitrary place in my pstricks figure. For displaying source code, I use the listings package. However, when I use the lstlisting command in combination with rput, I get the following error:  ! Missing \endcsname inserted.

Here is a minimal example: 

\documentclass[]{article}
\pagestyle{empty}	
\usepackage[]{pstricks}
\usepackage{listings}

\begin{document}

% this works
\begin{lstlisting}
	\pscircle[linestyle=dotted](0,0){2}
\end{lstlisting}

% this does not
\begin{pspicture}[](-4,-4)(4,4) 
	\pscircle[linestyle=dotted](0,0){2}
		\rput(0,0){
			\begin{lstlisting}
				\pscircle[linestyle=dotted](0,0){2}
			\end{lstlisting}
		}
\end{pspicture}
\end{document}

Why does this not compile? Are there any other options to accomplish this?

Best Regards
Christian


More information about the PSTricks mailing list