-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmps2eps
executable file
·57 lines (46 loc) · 1.4 KB
/
mps2eps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Copyright 2013 Wenjun Deng <wdeng@wdeng.info>
# This file is part of Omega Tools.
# Omega Tools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Omega Tools is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Omega Tools. If not, see <http://www.gnu.org/licenses/>.
VERSION='2013-03-14 11:07:40-04:00'
if [ -z "${1}" ]
then
echo
echo "mps2eps version ${VERSION}"
echo
echo "A wrapper that uses tex and dvips to convert mps file to eps."
echo "The generated eps file will be in the same directory as the mps file."
echo
echo "Usage: mps2eps <mps file>"
echo
exit
fi
if [ ! -f $1 ]
then
echo "File $1 does not exist."
exit 1
fi
dir=`dirname $1`
mps=`basename $1`
eps=${mps%.*}.eps
tmpname=${mps%.*}_mps2eps
tmptex=${tmpname}.tex
tmpdvi=${tmpname}.dvi
tmplog=${tmpname}.log
cd $dir
echo '\nopagenumbers
\input epsf
\centerline{\epsfbox{'$mps'}}
\end' > $tmptex
tex $tmptex > /dev/null
dvips -E -j -o $eps $tmpdvi 2> /dev/null
rm -f $tmptex $tmpdvi $tmplog