[texworks] Metapost graphic does not show up in Miktex 2.8 again
David-Arnold
david-arnold at Redwoods.edu
Thu Sep 22 02:35:18 CEST 2011
All,
Looks like my attachment was not included in the email to the list, so here it is again.
All,
I'd like to thank folks for their suggestions on --shell-escape.
On my IMac (running Snow Leopard and Mactex), I added --shell-escape to Texwork prefrences, Typesetting, pdflatex command line. On my IMac, the attached file compiles and shows the graphic.
On my colleague's Windows laptop, running Miktex 2.8, we also added --shell-escape to Texwork preferences, but the graphic does not show up. We are stuck as to what to do next.
Can someone on this list compile this in windows using miktex and see if they get the graphic to show up, and if so, share any configurations they made to Texworks?
Thanks,
David
\documentclass[12pt]{article}
% version 1.5
\usepackage{amsmath,amssymb}
\usepackage{polynom}
\usepackage{graphicx}
%\usepackage{xcolor}
\usepackage{infwarerr}
\usepackage{ltxcmds}
%% for metapost graphics
\usepackage{emp,ifpdf}
\ifpdf
\DeclareGraphicsRule{*}{mps}{*}{}
\fi
\setlength{\unitlength}{1cm}
%% statsmac and online macros for qdf files
\empaddtoprelude{input mp-tool}
\empTeX{}
\begin{document}
Given the graph of $f$ shown below, what is the value of $f(3)$?
\setlength{\unitlength}{1cm}
\begin{empfile}[q106-433988DE-E310-11E0-B81F-AFF3C110DD5E]
\begin{empdef}[evalf](4,4)
%grid color
def mygridcolor=0.65white enddef;
% inititialize numerator and denominator of the slope
numeric a, b;
a=-2;
b=-2;
% initialize the given point
numeric c, d;
c=3;
d=-3;
% initialize function label abcissa
numeric flabel;
flabel=1;
% define linear function
vardef f(expr x)=
d+((a*(x-c))/b)
enddef;
% draw line with given point and slope
path L;
L:=(-5,f(-5));
for x=-5 step 1 until 5:
L:=L--(x,f(x));
endfor;
% initialize scale
numeric u; 10u=w;
% the line
L:=L scaled 1u;
draw L withcolor blue;
% clipping path
path cpath;
cpath:=(-5,-5)--(5,-5)--(5,5)--(-5,5)--cycle;
cpath:=cpath scaled 1u;
% clip and save current picture
picture pic;
clip currentpicture to cpath;
pic:=currentpicture;
% erase currentpicture
currentpicture:=nullpicture;
% draw grid
for k=-5u step 1u until 5u:
draw (-5u,k)--(5u,k) withcolor mygridcolor;
draw (k,-5u)--(k,5u) withcolor mygridcolor;
endfor;
% draw axes
drawarrow (-5u,0)--(5u,0);
drawarrow (0,-5u)--(0,5u);
% label axes
label.rt(btex $x$ etex, (5.2u,0));
label.top(btex $y$ etex, (0,5.2.u));
label.bot(btex $5$ etex, (5u,0));
label.lft(btex $5$ etex, (0,5u));
% redraw line
draw pic;
% label the function f
pair D;
D:=(1,f(1)) scaled u;
label.bot(btex $f$ etex,D);
\end{empdef}
\end{empfile}
\immediate\write18{mpost q106-433988DE-E310-11E0-B81F-AFF3C110DD5E}
\begin{center}
\empuse{evalf}
\end{center}
\end{document}
----- configuration info -----
TeXworks version : 0.4.3r858 (personal)
Install location : /Applications/TeXworks.app
Library path : /Users/david-arnold/Library/TeXworks/
pdfTeX location : /usr/local/texlive/2011/bin/x86_64-darwin/pdftex
Operating system : Mac OS X 10.6.8 (Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386)
Qt4 version : 4.7.3 (build) / 4.7.3 (runtime)
------------------------------
More information about the texworks
mailing list