mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
b9aa557b35
* src/converter.C (Converters::convert): Convert command to be executed to the proper encoding. Use from_utf8 instead of from_ascii in order to avoid assertions when displaying an alert. * src/support/docstring.[Ch] (to_filesystem8bit): new conversion function. * lib/scripts/fig2pstex.py * lib/scripts/fig2pdftex.py: Modified to reflect the changes above. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16803 a592a061-630c-0410-9148-cb99ea01b6c8
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# file fig2pstex.py
|
|
# This file is part of LyX, the document processor.
|
|
# Licence details can be found in the file COPYING.
|
|
#
|
|
# \author Angus Leeming
|
|
# \author Bo Peng
|
|
#
|
|
# Full author contact details are available in file CREDITS
|
|
|
|
|
|
# This script converts an XFIG image to something that latex can process
|
|
# into high quality PostScript.
|
|
|
|
# Usage:
|
|
# python fig2pstex.py ${base}.fig ${base}.pstex
|
|
# This command generates
|
|
# ${base}.eps the converted eps file
|
|
# ${base}.pstex a tex file that can be included in your latex document
|
|
# using '\input{${output}}'.
|
|
#
|
|
# Note:
|
|
# Do not use this command as
|
|
# python fig2pstex.py file.fig file.eps
|
|
# the real eps file will be overwritten by a tex file named file.eps.
|
|
#
|
|
|
|
import os, sys
|
|
|
|
# We expect two args, the names of the input and output files.
|
|
if len(sys.argv) != 3:
|
|
sys.exit(1)
|
|
|
|
input, output = sys.argv[1:]
|
|
|
|
# Fail silently if the file doesn't exist
|
|
if not os.path.isfile(input):
|
|
sys.exit(0)
|
|
|
|
# Strip the extension from ${output}
|
|
outbase = os.path.splitext(output)[0]
|
|
|
|
# Generate the EPS file
|
|
# Generate the PSTEX_T file
|
|
if os.system('fig2dev -Lpstex %s %s.eps' % (input, outbase)) != 0 or \
|
|
os.system('fig2dev -Lpstex_t -p%s %s %s' % (outbase, input, output)) != 0:
|
|
print 'fig2dev fails'
|
|
sys.exit(1)
|