[pstricks] Listings in Combination with rput
Christoph Bersch
usenet at bersch.net
Wed Dec 14 13:52:36 CET 2011
On 14.12.2011 13:39, Christian Häger wrote:
>
> 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.
Try:
\documentclass[]{article}
\pagestyle{empty}
\usepackage[]{pstricks}
\usepackage{listings}
\begin{document}
\newsavebox{\mybox}
\begin{lrbox}{\mybox}
\begin{lstlisting}
\pscircle[linestyle=dotted](0,0){2}
\end{lstlisting}
\end{lrbox}
\begin{pspicture}[](-4,-4)(4,4)
\pscircle[linestyle=dotted](0,0){2}
\rput(0,0){\usebox{\mybox}}
\end{pspicture}
\end{document}
I am not sure, if this is the best way, but it seems to work. For an
explanation see <http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbwithin>
Christoph
More information about the PSTricks
mailing list