Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
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 Answer 1

up vote 1 down vote accepted

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}
share|improve this answer
    
It does indeed. Many thanks! –  Emmanuel May 14 '12 at 11:59
    
Sorry didn't know. –  Emmanuel May 14 '12 at 12:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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