# newcommand object not included in pstricks picture


I've tried to show a short, non-working, example:

\documentclass{article}
\usepackage{pdftricks}
\begin{psinputs}
\usepackage{pstricks}
\end{psinputs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\newcommand*{\example}{\qline(0,0)(1,1)}

\begin{pdfdisplay}
\begin{pspicture}(3,3)
\qline(0,0)(1,1) %this line displays correctly
\rput(1,0){\qline(0,0)(1,1)}  %this line displays correctly
\rput(2,0){\example}  %this line isn't displayed!
\end{pspicture}
\end{pdfdisplay}
\end{document}


In the above code, the first two lines are correctly drawn, but the third isn't. I've been fighting for hours with it and can't figure out what's wrong. The only piece of information I managed to understand is that the figure is wrapped in a tex file, then compiled in postscript, then transformed in pdf AND that the \example code isn't passed with it:

%%% This is the example-fig1.tex automatically generated file
\documentclass{article}
\input tmp.inputs
\pagestyle{empty}
\begin{document}
\begin{pspicture}(3,3)
\qline(0,0)(1,1) %this line displays correctly
\rput(1,0){\qline(0,0)(1,1)}  %this line displays correctly
\rput(2,0){\example}  %this line doesn't display!
\end{pspicture}

\end{document}


Help would be really appreciated! Thanks.

• Instead of editing the title to include [solved], you should mark the question as answered by clicking the tick mark next to the most helpful answer. – Jake May 14 '12 at 12:08

The following should work!

\documentclass{article}
\usepackage{pdftricks}
\begin{psinputs}
\usepackage{pstricks}
\newcommand*{\example}{\qline(0,0)(1,1)}
\end{psinputs}

\begin{document}
\begin{pdfdisplay}
\begin{pspicture}(3,3)
\qline(0,0)(1,1) %this line displays correctly
\rput(1,0){\qline(0,0)(1,1)}  %this line displays correctly
\rput(2,0){\example}  %this line ALSO displays correctly!
\end{pspicture}
\end{pdfdisplay}
\end{document}

• Sorry didn't know. – Emmanuel May 14 '12 at 12:18