From owner-freebsd-questions@FreeBSD.ORG Tue Jun 19 00:50:02 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD923106566C for ; Tue, 19 Jun 2012 00:50:02 +0000 (UTC) (envelope-from olivares14031@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6593F8FC12 for ; Tue, 19 Jun 2012 00:50:02 +0000 (UTC) Received: by yenl8 with SMTP id l8so5024428yen.13 for ; Mon, 18 Jun 2012 17:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Ko2DVosMJy0Y71A9E9cjjp01Vs95fIgwfmfgNzAlk74=; b=YJAk9SzlYwxmkCN2jonNDSqZBT/F7HYOiuByBXwX+Trei08J1I7l9MoTZJljZnD2pn 4poEnE2nzSoF4gBzJJMubsZV/QGadH7QkZgA2/MCNmCdyxWqY7UKhk0l8l8bCSxhgVGF /nar1nnowdOSccOH6q3xDFRINDLMP7CRDlTPnpdoNK8n50YDbSlXGTARNuE1XeyBJKJz EoGE00vfCRlBQ2SPUSJ1VnOnTwahDu9ghirbovZVoN+gpHWA70ascFTW+jS5BIn2OAwv ifMCVIxPHZj22ASPdrZnOTALAWwDmEuCfr/gXSnwkYK4WNj2hsEjvKJOXPPajl1NM8bp wh7Q== MIME-Version: 1.0 Received: by 10.50.213.71 with SMTP id nq7mr10091530igc.12.1340067001382; Mon, 18 Jun 2012 17:50:01 -0700 (PDT) Received: by 10.50.112.4 with HTTP; Mon, 18 Jun 2012 17:50:01 -0700 (PDT) Date: Mon, 18 Jun 2012 19:50:01 -0500 Message-ID: From: Antonio Olivares To: FreeBSD Questions Content-Type: text/plain; charset=ISO-8859-1 Subject: converting mpost(ed) files individually to eps X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 00:50:02 -0000 Dear folks, I am taking a plunge to learning a little bit of metapost. I have found examples page using google. http://www.tlhiv.org/MetaPost/examples/examples.html 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 #!/bin/sh MPOST=/usr/local/bin/kertex/mpost GS=/usr/local/bin/gs 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 $1.mp ] then # if it exists then metapost it,then convert with ghostscript, then remove all the unneeded files $MPOST $1.mp $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 ] then rm *.log fi else # otherwise give this output line with a list of available metapost files echo the file doesnt exist butthead! Choose one of these: ls *.mp fi =========================================================== 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 (http://www.kergis.com/en/kertex.html) ] at will as I also have texlive installed by FreeBSD TeXLive Ports by Roman Tartiere(https://code.google.com/p/freebsd-texlive/) , /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, Antonio