2 # -*- coding: utf-8 -*-
5 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING.
8 # \author Angus Leeming
11 # Full author contact details are available in file CREDITS
14 # This script converts an XFIG image to something that latex can process
15 # into high quality PostScript.
18 # python fig2pstex.py ${base}.fig ${base}.pstex
19 # This command generates
20 # ${base}.eps the converted eps file
21 # ${base}.pstex a tex file that can be included in your latex document
22 # using '\input{${output}}'.
25 # Do not use this command as
26 # python fig2pstex.py file.fig file.eps
27 # the real eps file will be overwritten by a tex file named file.eps.
32 # We expect two args, the names of the input and output files.
33 if len(sys.argv) != 3:
36 input, output = sys.argv[1:]
38 # Fail silently if the file doesn't exist
39 if not os.path.isfile(input):
42 # Strip the extension from ${output}
43 outbase = os.path.splitext(output)[0]
45 # Generate the EPS file
46 # Generate the PSTEX_T file
47 if os.system('fig2dev -Lpstex %s %s.eps' % (input, outbase)) != 0 or \
48 os.system('fig2dev -Lpstex_t -p%s %s %s' % (outbase, input, output)) != 0: