[Haskell-cafe] Functional MetaPost in 5 Steps

Peter Simons simons at cryp.to
Tue Oct 28 19:11:07 EDT 2008


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


More information about the Haskell-Cafe mailing list