I'm playing with simple files in order to learn metafun. The following small example produces an undefined figure. It illustrates either a context problem or, more likely, a confusion on my part. ================= cut here =========================================== \runMPgraphicstrue \starttext \startreusableMPgraphic{a} fill fullcircle scaled 2cm; \stopreusableMPgraphic \placefigure[here,none]{}{\reuseMPgraphic{a}} \input tufte \stoptext ================= cut here =========================================== The figure is a square saying 'undefined'. Taking away the \runMPgraphicstrue line produces the expected filled circle. I use a web2c distribution (linux) with context version 2006.08.08 21:51, TeXExec | version 6.2.0 - 1997-2006 - PRAGMA ADE/POD It passes the write18 test given in the metafun-s.pdf manual (p.214 of the PDF file). -Sanjoy `A society of sheep must in time beget a government of wolves.' - Bertrand de Jouvenal
On Tue, 12 Sep 2006, Sanjoy Mahajan wrote:
I'm playing with simple files in order to learn metafun. The following small example produces an undefined figure. It illustrates either a context problem or, more likely, a confusion on my part.
================= cut here =========================================== \runMPgraphicstrue \starttext
\startreusableMPgraphic{a} fill fullcircle scaled 2cm; \stopreusableMPgraphic
\placefigure[here,none]{}{\reuseMPgraphic{a}} \input tufte \stoptext ================= cut here ===========================================
The figure is a square saying 'undefined'. Taking away the \runMPgraphicstrue line produces the expected filled circle.
I use a web2c distribution (linux) with
context version 2006.08.08 21:51, TeXExec | version 6.2.0 - 1997-2006 - PRAGMA ADE/POD
Strange... It works fine here with ConTeXt ver: 2006.09.10 13:33 MK II fmt: 2006.9.10 int: english/english Normally, runMPgraphics is set to true in one of the files, so you do not need to set it to true. I have no idea why you should be getting 'undefined'. Check your log file for systems : system commands are enabled and system(mpost -progname=metafun -mem=metafun mptest-mpgraph)...executed. Aditya
Check your log file for
systems : system commands are enabled
Thanks, that was the problem. It was saying 'disabled' instead. The fix was to change /etc/texmf/texmf.cnf to enable write18. The shell_escape line has to be set to 't' rather than 'f', i.e.: shell_escape = t Actually, on my system (Ubuntu, a Debian derivative), changing the texmf.cnf file directly is not a good idea. Instead one should change the same line in /etc/texmf/texmf.d/95NonPath.cnf and then run 'update-texmf' as root to generate the texmf.cnf file. Warning: If you've enabled 'shell_escape', then don't run *TeX on untrusted files, in case they do anything malicious like 'rm -fr /'. Also now I see how I got fooled into thinking that write18 was already enabled. The one-line tex file from metafun-s.pdf contains \immediate\write18{echo It works}. When run it produces an "It works" whether or not write18 is enabled. If disabled: (./3.tex echo It works ) which made me think that all was okay. If enabled you get this: \write18 enabled. (./3.texIt works ) -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
Sanjoy Mahajan wrote:
Actually, on my system (Ubuntu, a Debian derivative), changing the texmf.cnf file directly is not a good idea. Instead one should change the same line in /etc/texmf/texmf.d/95NonPath.cnf and then run 'update-texmf' as root to generate the texmf.cnf file.
incredible (probably a copy of texmf.cnf in your local tree also works ok; in that case: clean up the file a bit and things run faster too)
Warning: If you've enabled 'shell_escape', then don't run *TeX on untrusted files, in case they do anything malicious like 'rm -fr /'.
well, opening files and overwriting them can be done anyway Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hans Hagen wrote:
Sanjoy Mahajan wrote:
Actually, on my system (Ubuntu, a Debian derivative), changing the texmf.cnf file directly is not a good idea. Instead one should change the same line in /etc/texmf/texmf.d/95NonPath.cnf and then run 'update-texmf' as root to generate the texmf.cnf file.
incredible (probably a copy of texmf.cnf in your local tree also works ok; in that case: clean up the file a bit and things run faster too)
Yeah, it's a pain but it does have one justificaiton. This texmf.cnf system is easy for computers to update, although not for people. The idea is that new tex-related packages add options by placing the options in a file in /etc/texmf/texmf.d/ and then running update-texmf to combine the configlets into the One File to rule them all. The diversity of configuration systems and options across different tex installations is a big pain, makes it hard to create cross-platform software. -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
Hans Hagen wrote:
well, opening files and overwriting them can be done anyway
That's true. Though the default teTeX setup seems to be (from texmf.cnf): % Allow TeX \openin, \openout, or \input on filenames starting with `.' % (e.g., .rhosts) or outside the current tree (e.g., /etc/passwd)? % a (any) : any file can be opened. % r (restricted) : disallow opening "dotfiles". % p (paranoid) : as 'r' and disallow going to parent directories, and % restrict absolute paths to be under $TEXMFOUTPUT. openout_any = p openin_any = a So you can read any file but you cannot write any file. Seems sensible. -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
participants (3)
-
Aditya Mahajan
-
Hans Hagen
-
Sanjoy Mahajan