
I'm interested in using Functional MetaPost on Mac OS X (or FreeBSD). I'm looking for a tutorial like: http://haskell.org/haskellwiki/Haskell_in_5_steps but for FMP. I can't even get a simple example to show up in a PDF file: ------------------- import FMP ... (see full code below) myPicture = text "Hello World" main = do print $ emit $ metaPost 1 myPicture params ---------- When run, this emits MetaPost, which, after running through my shell script, below, won't show up in my PDF... (this same TeX file will show an .eps figure I made with PyX, the Python equivalent of FMP, when I change includegraphics to use that file instead of test.1) What am I missing? If I can get this working I will gladly write the FMP 5 Step Tutorial. I like the idea of using FMP but I can't for the life of me understand why running a toy example is so non-trivial. (Not to mention undocumented... the manual and tutorials are very compelling but they don't mention how to get a viewable PDF out of any of the otherwise enticing examples.) Jared. Relevant almost working code: Test.hs: ------------------- import FMP params = Parameters { prolog = "verbatimtex\n\ \\\documentclass{article}\n\ \\\begin{document}\n\ \etex\n\n\ \input boxes\n\ \input FuncMP\n\n", epilog= "\n\n\\end", defaultDX= 3, defaultDY= 3, textDX= 2, textDY= 2, newmp= True, funcmpRTS= "IGNORE", --"+RTS -H40m -K3M -RTS", funcmpBin= "IGNORE", -- "~/FuncMP-1.2/FuncMP", mpBin= "IGNORE" -- "MPINPUTS=:~/FuncMP-1.2 TEX=latex mpost " } myPicture = text "blah" main = do print $ emit $ metaPost 1 myPicture params ---------- test.tex: ----------- \documentclass[12pt]{article} \usepackage[dvipdfm]{graphicx} \begin{document} \section*{Heading} \begin{figure} \begin{center} \includegraphics{test.1} \end{center} \end{figure} \end{document} --------------- shell script: ------ #!/bin/sh ghc --make Test.hs && \ ./Test > test.mp && \ mpost test.mp && \ latex test.tex && \ latex test.tex && \ dvipdfm test.dvi && \ open test.pdf # MacOS X runs my pdf in preview -----------

On Thu, 23 Oct 2008 22:13:10 -0700
"Jared Updike"
I can't even get a simple example to show up in a PDF file
I can't even get my simple example to show up anywhere, period. PDF,
DVI, PS - anything.
No matter which way I try, and I've tried lots, I always hit some kind
of PostScript or TeX error. My Haskell file is attached.
I asked about it on the tex-live mailing list, and I got this
response, advising me to speak to the author:
From: Taco Hoekwater
No, it was generated by MetaPost. Here are the sequence of commands I used:
FuncMP.mp is the culprit here. It alters MetaPost's output via explicit special command so that it is no longer acceptable to the mptopdf converter.
I suggest you rename the file to figure1.eps (and run epstopdf on it before inclusion in your latex document)
"epstopdf figure1.eps" outputs this error:
Error: /undefined in cmmi10
If the document was was 'plain' metapost input, it would actually have been possible to fix this in texlive 2008 by adding prologues:=3; at the top of the figure1.mp file. However, FuncMP.mp has redefined (via specials) the PostScript commands like /fshow etc,. so this won't work. Also, it seems to be altering the label typesetting so that it uses metafont bitmap (pk) fonts instead of type1. My advice is to look into the functional metapost documentation or ask its author for help and guidelines on how to use the result images in pdftex (as opposed to dvips/xdvi). Best wishes, Taco

Hi Robin,
[FuncMP problems with pdflatex]
I have no experience whatsoever with pdflatex, I'm sorry, Funcmp works just fine for me in normal LaTeX, though. That's not exactly what you need, but from the sound of it, it might be step forward anyway. First of all, try writing the MetaPost files with the following function, toMPFile, rather than the standard 'generate': toMPFile :: (IsPicture a) => a -> FilePath -> IO () toMPFile pic f = writeFile f (show $ toMetaPost pic) toMetaPost :: (IsPicture a) => a -> Doc toMetaPost a = emit $ metaPost 0 (toPicture a) params where params = Parameters { mpBin = undefined , funcmpBin = undefined , funcmpRTS = undefined , defaultDX = 3 , defaultDY = 3 , textDX = 2 , textDY = 2 , prolog = myprolog , epilog = "\\end" , newmp = False } myprolog = "verbatimtex\n" ++ "\\documentclass[11pt]{report}\n" ++ "\\begin{document}\n" ++ "etex\n\n" ++ "input boxes\n" ++ "input FuncMP\n" The resulting .mp file has to be run through mpost with the $MPINPUTS variable pointing to the directory that contains FuncMP.mp from. This will give you an EPS file, which in turn can be included in any LaTeX document with, say \epsfig{}. This whole process ought to work fine with texlive of tetex. I hope this helps, Peter
participants (3)
-
Jared Updike
-
Peter Simons
-
Robin Green