[pstricks] Metapost-PSTricks conflict

David Arnold dwarnold45 at suddenlink.net
Tue Jan 13 18:34:17 CET 2009


All, We have reason to use both Metapost and PSTricks in our database  
of questions for our Optimath system. The following file will not  
compile. We believe it might have something to do with \jobname, but  
not sure. Can anyone tell us what we need to do to get the following  
to compile with pdflatex --shell-escape?

Thanks.

D.

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage[dvipsnames]{pstricks}
\usepackage{pstricks-add}
\usepackage{pst-pdf}
\PreviewEnvironment{psgraph}

\usepackage{emp,ifpdf}
\ifpdf
\DeclareGraphicsRule{*}{mps}{*}{}
\fi

\setlength{\unitlength}{1cm}

% statsmac and online macros for qdf files
\empTeX{}

\def\placegraph#1{
\rlap{\hspace*{\textwidth}\smash{\raise-4.5cm\llap{\empuse{#1}\hspace 
{2in}}}}
}

\begin{document}

Given the graph below, answer the question.
\begin{center}
\psset{unit=0.5cm}
\begin{pspicture}(-7,-7)(7,7)
	\psgrid[gridcolor=lightgray,gridlabels=0pt,subgriddiv=1](0,0)(-5,-5) 
(5,5)
	\psaxes[Dx=5,dx=5,Dy=5,dy=5,linewidth=1pt]{<->}(0,0)(-5.75,-5.75) 
(5.75,5.75)
	\uput[0](5.75,0){$x$}
	\uput[90](0,5.75){$y$}
\end{pspicture}
\end{center}

Given the graph below, answer the question.

\begin{empfile}

\begin{empdef}[vlt](4,4)

numeric u; 10u=2in;

for k=-5u step 1u until 5u:
	draw (-5u,k)--(5u,k) withcolor 0.85white;
	draw (k,-5u)--(k,5u) withcolor 0.85white;
endfor;

drawdblarrow (-5u,0)--(5u,0);
label.rt(btex $x$ etex, (5u,0));
label.bot(btex $5$ etex, (5u,0));
drawdblarrow (0,-5u)--(0,5u);
label.top(btex $y$ etex, (0,5u));
label.lft(btex $5$ etex, (0,5u));

\end{empdef}

\end{empfile}

\immediate\write18{mpost \jobname}

\placegraph{vlt}

\end{document}



More information about the PSTricks mailing list