2

Windows 10, MiKTeX 2.9 64-bit, WinEdt Build: 20150731 (v. 9.1) - 64-bit. I have updated the filename database and all format files in MiKTex 2.9.

I am using the gmp package that allows MetaPost files to be part of your latex document. In order to use the package it is necessary to put EnableWrite18=t in your pdflatex.ini file. Adding --enable-write18 or --shell-escape in WinEdt did not work (separate issue, possibly). However, once I click on the pdftexify button in WinEdt and the compilation encounters a MetaPost file generated by gmp, a panel pops up saying that Metapost has stopped working. Everything seems to load properly--the .mp and .mpx files are there, but MetaPost crashes. Does anyone know what might be the problem? Here is a MWE for those wishing to try it out.

    \documentclass[10pt]{article}
    \usepackage{amsmath}
    %% use option 'nowrite' if graphics are stable
    \usepackage[shellescape,latex]{gmp}
    \usempxclass{article}
    \usempxpackage{amsmath}
    \setlength{\unitlength}{1cm}
    \begin{document}

    \begin{mpost}[name=mwe]
    numeric u; u:=1.0cm;
    draw (0,0)*u--(1,0)*u;
    label(\btex "A" etex, (0,0)*u);
    label(\btex "B" etex, (1,0)*u);
    \end{mpost}

    \usempost[width=4.0in]{mwe}

    \end{document}
  • I've just tried with pdflatex annd it works fine . You can't can't use pdftexify as it is not a plain tex document, but mrobably pdflatexify. Unfortunately, there is no line concerning pdflatexify in WinEdt'sExecution modes. I suggest you use pdflatex first (with option --write18) and use the gmp option nowrite, with pdflatexify once the figures have all been made. – Bernard Aug 21 '15 at 0:31
  • Btw, welcome to TeX SX! – Bernard Aug 21 '15 at 0:32
5

As clearly stated in pdflatex.ini:

please do not edit this file

so revert your changes in that file and rebuild the format.

You should enable the --shell-escape feature when invoking your compiler.

To do that in WinEdt, if you wish to use the PDFTeXify compiler, go to Options -> Execution Modes, and add --tex-option=--shell-escape in the "Switches" field of this compiler, as in the image below.

enter image description here

If instead you want do that for PDFLaTeX, you can simply add --shell-escape in the corresponding field.

enter image description here

The --tex-option part is needed because PDFTeXify calls MiKTeX's texify.exe executable which requires that format.

Now your code should compile fine with this output:

enter image description here

  • I used a suggestion elsewhere to execute the command – W. Kehowski Aug 21 '15 at 10:10
  • I used a suggestion elsewhere to execute the command "initexmf --edit-config-file=miktex\config\pdflatex.ini" and then add "EnableWrite18=t". There was no line in the pdflatex.ini that said "Do not edit this file" so it must have been a local copy. I added the switches as you suggested and at least I have shell escape now. However, the problem still persists. Is there anything in Windows 10 security settings that might be a problem? I also apologize for using quotes instead of $ and label instead of label.bot, for example, in my MWE MetaPost example. – W. Kehowski Aug 21 '15 at 10:18
  • 1
    @W.Kehowski It is always better not to set --shell-escape permanently. In this way you can always go to Execution Modes and revert this. In regards of your MetaPost error, I don't know where it comes from. Try opening the file yourfile+mp0001.mp in WinEdt and running MetaPost on it to see what happens. – karlkoeller Aug 21 '15 at 14:44
  • It still crashes. Aargh! – W. Kehowski Aug 21 '15 at 16:05
  • @W.Kehowski Try removing the packages miktex-metapost-base and miktex-metapost-bin and then reinstall them. – karlkoeller Aug 21 '15 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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