1

I use to have old latex docs that included pstricks pictures. I had to define objects that I could reuse several times in the pictures and did this with a newcommand/def (and everything was fine). I recently had to compile these files and it's not working anymore: objects defined in the newcommand line isn't displayed.

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.

  • 1
    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
1

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

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.