converting mpost(ed) files individually to eps

Antonio Olivares olivares14031 at
Tue Jun 19 00:50:02 UTC 2012

Dear folks,

I am taking a plunge to learning a little bit of metapost.  I have
found examples page using google.

I want to convert output files individually to eps.

I can only convert the first one output say file.1 to file.eps, but
when there are more files, ie, file.2, ..., file.10, all the files
between .2 and .10 do not get converted/saved to *.eps extension.

script called mpost-eps below:

$ cat mpost-eps


ERROR="Too few arguments : no file name specified"
[ $# -eq 0 ] && echo $ERROR && exit # no args? ... print error and exit

# check that the file exists
if [ -f $ ]
# if it exists then metapost it,then convert with ghostscript, then
remove all the unneeded files
$GS -dNOPAUSE -dBATCH -sDEVICE=epswrite -sOutputFile=$1.eps $1.1

# these lines can be appended to delete other files, such as *.out
if [ -f $1.log ]
	rm *.log
# otherwise give this output line with a list of available metapost files
echo the file doesnt exist butthead! Choose one of these:
ls *.mp

I run the script
$ ./mpost-eps file
without *.mp extension.  but only one gets converted.  I don't know
enough shell programming to do something like
for i in file.i do
$GS -dNOPAUSE -dBATCH -sDEVICE=epswrite -sOutputFile=$1.eps $1.i

but it does not work correctly.  I can change the mpost
executable[using kertex by T. Laronde
( ] at will as I also have
texlive installed by FreeBSD TeXLive Ports by Roman
Tartiere( ,
/usr/local/bin/mpost is the executable there, or same one but in
metapost executable by default teTeX.

Is there a magical incantanation I can use to output all the files to
eps and include them in documents either \TeX{}ed or \LaTeX{}ed?

Thanks in Advance,


More information about the freebsd-questions mailing list