[texworks] Metapost graphic does not show up in Miktex 2.8 again

Paul A Norman paul.a.norman at gmail.com
Thu Sep 22 06:56:36 CEST 2011


Sorry I have not followed this thread completely,

... but if you are trying to use \write18

As in
\immediate\write18{mpost q106-433988DE-E310-11E0-B81F-AFF3C110DD5E}

Under MiKTeX on Windows

Have a look at  Heiko Oberdiek's notes even for the epstopdf package
Page 2 of ftp://ftp.tex.ac.uk/pub/tex/macros/latex2e/contrib/oberdiek/epstopdf.pdf
section 1.2 Requirements

" 1.2 Requirements
" The feature \write18 must be enabled. This allows the running of external
programs during TEX's compile run. Keep in mind that this is a security
risk. The feature is an addition to \TeX. MikTEX, teTEX, TEX Live support
it. In Web2C based TEX distributions (teTEX, TEX Live) it can be enabled
in the con
guration 
le texmf.cnf:
shell_escape = 1
Because of the security risk, it is better to do it on the command line only:
--shell-escape (teTEX, TEX Live)
--enable-write18 (MiKTEX)  "

>From a dos prompt from a full install of MiKTeX you can guarantee that
mthelp miktex will bring up the .chm for MiKTeX and you can read more
there. On a portable install you;ll need to use the command prompt
from right clicking the MiKTeX icon in your tool area at the bottom
right of your screen.

You can search inside the MiKTeX .chm for --enable-write18, and
perhgaps have a look at the sections under Contents / User Guide /
Using MiKTeX /Specialities / 2.10. "Running Programs From Within TeX"

>From my skim reading of the postings, it appears that one system is
probably using TeXLive and the other is using MiKTeX.

--shell-escape (teTEX, TEX Live)
--enable-write18 (MiKTEX)

Paul


On 22 September 2011 12:35, David-Arnold <david-arnold at redwoods.edu> wrote:
> 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