[pstricks] postscript problem

Herbert Voss Herbert.Voss at FU-Berlin.DE
Sun Nov 6 09:46:05 CET 2011

Am 06.11.2011 08:16, schrieb David Arnold:

> Then I get this error:
>
> ! LaTeX Error: Environment postscript undefined.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type  H<return>   for immediate help.
>   ...
>
> l.9 \begin{postscript}
>
> So I'm kinda stuck. Because of our system I'm winding up with both types of file in the same section of the text:
>
> \begin{equation*}
> {\color{red}2\rnode[t]{A}{x}^2y}\,({\color{red}\rnode[t]{B}{x}^2}+xy-3y^2)={\color{red}2\rnode[t]{C}{x}^4y}+2x^3y^2-6x^2y^3
> \end{equation*}
> \ncbar[linecolor=red,angle=90,arm=10pt,nodesep=3pt]{->}{A}{B}
> \ncbar[linecolor=red,angle=270,arm=10pt,nodesep=3pt]{->}{B}{C}
>
> \begin{postscript}
> \begin{align*}
> 5\rnode{A}{u2} -10\rnode{B}{uw} -8\rnode{C}{u} +16\rnode{D}{w}
> &=5u\,{\color{red}(u-2w)} -8\,{\color{red}(u-2w)}\\
> \intertext{Now we note that we can factor a $u-2w$ out of both of these terms.}
> &=(5u-8){\color{red}(u-2w)}
> \end{align*}
> \ncbar[linecolor=red,angle=270,arm=7pt,nodesep=3pt]{<->}{A}{B}
> \ncbar[linecolor=red,angle=270,arm=7pt,nodesep=3pt]{<->}{C}{D}
> \end{postscript}
>
> I'm wondering if there is some way of compiling the file with both these types in the file?

try it this way:

\usepackage{...}
\makeatletter
\ifx\endpostscript\@undefined\newenvironment{postscript}{}{}\fi
\makeatother
\begin{document}
...

Herbert