summaryrefslogtreecommitdiff
path: root/Master/bin/i386-linux/simpdftex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-06-01 21:45:40 +0000
committerKarl Berry <karl@freefriends.org>2008-06-01 21:45:40 +0000
commite9dd0f31205776af90862b4d7c8408cb89bea8f4 (patch)
treee2d7c297787c9278cc047d6af5bef42ded5fcb85 /Master/bin/i386-linux/simpdftex
parentcf4e0a0a5c6c0b5fe935b2460a14ab7f6577cc19 (diff)
at long last, install 2008-vintage i386-linux binaries
git-svn-id: svn://tug.org/texlive/trunk@8457 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/bin/i386-linux/simpdftex')
-rwxr-xr-xMaster/bin/i386-linux/simpdftex222
1 files changed, 153 insertions, 69 deletions
diff --git a/Master/bin/i386-linux/simpdftex b/Master/bin/i386-linux/simpdftex
index 86f8ec0e623..e5d5d4218b3 100755
--- a/Master/bin/i386-linux/simpdftex
+++ b/Master/bin/i386-linux/simpdftex
@@ -2,8 +2,8 @@
# Created by Gerben Wierda, May 2001
# Rewritten by Gerben Wierda, January 2002
-
-# Modified by Joachim Kock, May 2003
+# Modified by Joachim Kock, May 2003
+# Modified by Gerben Wierda, April 2007
# COPYRIGHT Gerben Wierda 2001--2004
# This file is free software. You are free to use this file in any way you like
@@ -111,19 +111,26 @@
# In the future, the old modes (altpdflatex and friends) through
# symlinks will disappear from my distribution, though they will
# still work.
+# 2007/05/07 Added dvipdfm support with compatibility with the patched version
+# that is available on the net (simpdftex_dpmx)
+# Changed version string to date-based string
+# 2007/08/09 Protected echo command against broken builtin versions by running
+# /bin/echo explicitly. There may exist /bin/echo implementations
+# that do not support -n and this script will have to be changed
+# before it works on such a system
# FEATURE: it seems -u +foo.map -u -foo.map does not work. So --extradvipsopts
# cannot be used to remove a map from the standard list
# BUG: Handling of file name extensions is not completely equialent to TeX
# i.e. foo.bar.bla gets you foo.bar.pdf not foo.bar.bla.pdf
-# Give all extensions
+# Hint: Give all extensions explicitely on the command line
-version='$Revision: 2.18 $'
+version='20070809'
calledas=`basename "$0"`
if [ "${calledas}" = "simpdftex" ]
then
- argwithoutlead=`echo -n "$1"|sed 's/^--//'`
+ argwithoutlead=`/bin/echo -n "$1"|sed 's/^--//'`
if [ "$1" != "" -a "$1" = "${argwithoutlead}" ]
then
formatname="$1"
@@ -133,6 +140,8 @@ then
fi
argvbackup="$*"
+dviprogram="dvips" # Might be dvips, dvipdfm or dvipdfmx
+
# maxpkdvipsopts: use only pfb's for real PS fonts, bitmaps are default for the others
maxpkdvipsopts="-Ppk"
# maxpfbdvipsopts: use as many pfb's as possible
@@ -159,33 +168,39 @@ distillerprog="ps2pdf13"
distillerfilter="no"
unset outdir
debug="no"
+dvipdfmoptions=""
usage()
{
cat <<_eof_help
This is simpdftex, $version
-Usage: simpdftex formatname
+Usage: simpdftex formatname [--mode modestring]
[--dvipsopts dvipsoptstring] [--extradvipsopts dvipsoptstring] [--pdf]
[--default] [--maxpk] [--maxpfb] [--extendedname] [--no-echo-version]
[--tex-path dir] [--keep-psfile] [--distiller-path dir] [--debug]
[--distiller prog] [--distiller-filter prog] [--help]
- [--outdir dir] [--extratexopts texoptsstring] tex-or-dvi-file
+ [--outdir dir] [--extratexopts texoptsstring]
+ [--dvipdfmopts dvipdfmoptstring] tex-or-dvi-file
simpdftex is a way to do pdf{e}{la}tex without having pdf{e}{la}tex. It needs a
-working TeX environment and ghostscript. Since pdf{e}{la}tex cannot handle
-insertion of .eps graphics, simpdftex gives an alternative. The output for both
-systems is comparable.
+working TeX environment and one of three ways to turn DVI file into PDF:
+ - dvips + a distiller like ghostscript
+ - dvipdfm
+ - dvipdfmx
+Since pdf{e}{la}tex cannot handle insertion of .eps graphics, simpdftex gives an
+alternative when using dvips mode. The output for both systems is comparable.
simpdftex compiles the file with {LA}TeX, processes the DVI file with dvips into
-PostScript and uses gs to produce pdf (with ps2pdf). There is finegrained
-control over the resulting filename and the options with which dvips produces
-the PostScript intermediary file.
+PostScript and uses gs to produce pdf (with ps2pdf). Or it uses dvipdfm or
+dvipdfmx to turn the DVI file into PDF. There is finegrained control over the
+resulting filename and the options with which dvips produces the PostScript
+intermediary file.
Dvips will call Metafont to produce bitmaps or include PostScript .pfb files
depending on the flags. See below.
-Default settings is normal name, maximal use of pfb's, just like pdf{la}tex,
+The default setting is normal name, maximal use of pfb's, just like pdf{la}tex,
in other words, "pdftex file.tex" and "altpdftex file.tex" both produce an
output file file.pdf. For pdftex, output options are controlled by pdftex.cfg,
for altpdftext by config.ps (unless --pdf is given).
@@ -195,6 +210,15 @@ Arguments:
If a .dvi file is given, skip the TeX process. Otherwise, TeX
the input file, dvips the resulting dvi file and ps2pdf the
resulting ps file
+ --mode
+ Tell simpdftex how to go from DVI to PDF. There are three modes:
+ - dvips
+ - dvipdfm
+ - dvipdfmx
+ --dpx
+ Compatibility flag with simpdftex_dpmx. Equal to --mode dvipdfmx
+ --dpm
+ Compatibility flag with simpdftex_dpmx. Equal to --mode dvipdfm
--help
Display this message and exit
--no-echo-version
@@ -216,6 +240,7 @@ Arguments:
optimal results for the chosen printer.
For file contents (not name) equivalent to:
--dvipsopts "-Ppk"
+ Not yet functional for the other modes.
--maxpfb
Use PostScript pfb files whenever possible. This produces
optimal results for the screen.
@@ -223,6 +248,7 @@ Arguments:
--dvipsopts "-Poutline"
If any font is included as TeX pk bitmap, it is rendered
at the default resolution.
+ Not yet functional for the other modes.
--pdf
Select .pdfmode extension for the output file name if
--extendedname has been set. Use printer definition
@@ -268,11 +294,13 @@ Arguments:
--distiller=/usr/local/alternate/bin/ps2pdf
--distiller=pstill
Using this flag sets the distiller filter mode to off
+ This flag only makes sense in dvips mode
--distiller-filter prog
Use a distiller executable or executable script which is
called with the PS input as standard input and which writes
the PDF output to standard output. E.g.:
--distiller-filter=u-psbuild
+ This flag only makes sense in dvips mode
--distiller-path
Give path needed by the distiller binary. This path is added
to the begin of you PATH environment before the distiller is
@@ -282,6 +310,12 @@ Arguments:
/usr/local/bin/ps2pdf find another gs than intended. By giving
an empty path, the path is not changed before the distiller
program is run. The default is empty.
+ This flag only makes sense in dvips mode
+ --dvipdfmopts
+ Give arbitrary arguments to dvipdfm or dvipdfmx, e.g.
+ --dvipdfmopts "-c"
+ Sets extension for --extendedfilename to .custom. --dvipdfmopts
+ overrides other flags that set dvipdfmopts.
--outdir dir
Write files here *if* our current directory is unwritable. This
mimicks the TEXMFOUTPUT environment variable of TeX, but
@@ -313,6 +347,15 @@ do
outputpostfix=".custom"
dvipsoptions="$1"
;;
+ --dvipdfmopts)
+ outputpostfix=".custom"
+ shift
+ dvipdfmoptions="$1"
+ ;;
+ --dvipdfopts) # Compatibility with simpdftex_dpmx
+ shift
+ dvipdfmoptions="$1"
+ ;;
--extradvipsopts)
shift
extradvipsoptions="$1"
@@ -360,6 +403,16 @@ do
distillerprog="$1"
distillerfilter="no"
;;
+ --mode)
+ shift
+ if [ "$1" = "dvips" -o "$1" = "dvipdfm" -o "$1" = "dvipdfmx" ]
+ then
+ dviprogram="$1"
+ else
+ /bin/echo "Unknown mode $1"
+ exit 1
+ fi
+ ;;
--outdir)
shift
export TEXINPUTS=`pwd`:`kpsewhich --expand-var '$TEXINPUTS'`
@@ -376,8 +429,14 @@ do
--no-echo-version)
echoversion="no"
;;
+ --dpx) # Compatibility with simpdftex_dpmx
+ dviprogram="dvipdfmx"
+ ;;
+ --dpm) # Compatibility with simpdftex_dpmx
+ dviprogram="dvipdfm"
+ ;;
--*)
- echo "Unknown option $1"
+ /bin/echo "Unknown option $1"
exit 1;;
"")
;;
@@ -389,15 +448,56 @@ done
if [ "${echoversion}" = "yes" -a "${debug}" = "no" ]
then
- echo "### This is $0, Version ${version}"
+ /bin/echo "### This is $0, Version ${version}"
fi
if [ "${debug}" = "yes" ]
then
- echo "##### This is $0, Version ${version}"
- echo "##### Arguments: ${argvbackup}"
+ /bin/echo "##### This is $0, Version ${version}"
+ /bin/echo "##### Arguments: ${argvbackup}"
fi
+run_dvipdfm()
+{
+ /bin/echo "### ${texpath}/${dviprogram} ${dvipdfmoptions} -o ${pdffile} ${dvifile}"
+ "${texpath}/${dviprogram}" ${dvipdfmoptions} -o "${pdffile}" "${dvifile}" || \
+ { /bin/echo "### FAILED to generate ${pdffile} (${status})"; \
+ exit 1; }
+}
+
+run_dvips()
+{
+ /bin/echo "### ${texpath}/${dviprogram} -R ${dvipsoptions} ${extradvipsoptions} -o ${psfile} ${dvifile}"
+ "${texpath}/${dviprogram}" -R ${dvipsoptions} ${extradvipsoptions} -o "${psfile}" "${dvifile}" || \
+ { /bin/echo "### FAILED to generate ${psfile} (${status})"; \
+ exit 1; }
+
+ if [ "${keeppsfile}" = "yes" ]; then
+ /bin/echo "### Saving intermediary ps file ${psfile} as ${savedpsfile}"
+ /bin/cp "${psfile}" "${savedpsfile}" || \
+ /bin/echo "### FAILED to save ${psfile} (${status})"
+ fi
+
+ if [ "${distillerpath}" != "" ]; then
+ PATH="${distillerpath}:${PATH}";export PATH
+ if [ "${debug}" = "yes" ]; then
+ /bin/echo "##### PATH set to ${PATH}"
+ fi
+ fi
+
+ if [ "${distillerfilter}" = "yes" ]; then
+ /bin/echo "### ${distillerprog} <${psfile} >${pdffile}"
+ "${distillerprog}" <"${psfile}" >"${pdffile}" || \
+ { /bin/echo "### FAILED to generate ${pdffile} (${status})"
+ exit 1; }
+ else
+ /bin/echo "### ${distillerprog} ${psfile} ${pdffile}"
+ "${distillerprog}" "${psfile}" "${pdffile}" || \
+ { /bin/echo "### FAILED to generate ${pdffile} (${status})"
+ exit 1; }
+ fi
+}
+
cleanup()
{
if [ "${tmpdir}" != "" -a "${debug}" = "no" ]
@@ -418,7 +518,7 @@ main()
{
if [ "${file}" = "" ]
then
- echo "simpdftex Empty argument: tex-or-dvi-file-name"
+ /bin/echo "simpdftex Empty argument: tex-or-dvi-file-name"
exit 1
fi
@@ -431,8 +531,8 @@ main()
startwithdvi="no"
basename=`basename "${file}"`
- nosuffixbasename=`echo -n ${basename}|sed 's/\.[^.]*$//'`
- nodvisuffixbasename=`echo -n ${basename}|sed 's/\.[dD][vV][iI]$//'`
+ nosuffixbasename=`/bin/echo -n ${basename}|sed 's/\.[^.]*$//'`
+ nodvisuffixbasename=`/bin/echo -n ${basename}|sed 's/\.[dD][vV][iI]$//'`
if [ "${nodvisuffixbasename}" = "${nosuffixbasename}" -a \
"${basename}" != "${nosuffixbasename}" ]
then
@@ -454,14 +554,14 @@ main()
fi
else
- echo "### Cannot write in current directory and no redirect found. Bailing out..."
+ /bin/echo "### Cannot write in current directory and no redirect found. Bailing out..."
exit 1
fi
fi
# Assume the command is called altpdf* where the rest is the actual tex
# program to be run
- texprogram=`echo ${calledas}|sed 's/altpdf//'`
+ texprogram=`/bin/echo ${calledas}|sed 's/altpdf//'`
if [ "${texprogram}" = "omega" -o "${texprogram}" = "lambda" ]
then
dvips="odvips"
@@ -492,72 +592,56 @@ main()
if [ "${debug}" = "yes" ]
then
- echo "##### TeX file: $texfile"
- echo "##### DVI file: $dvifile"
- echo "##### PS file: $psfile"
- echo "##### Saved PS file: $savedpsfile"
- echo "##### Created PDF file: $pdffile"
- echo "##### Final PDF file: $savedpdffile"
- echo "##### Environment:"
+ /bin/echo "##### TeX file: $texfile"
+ /bin/echo "##### DVI file: $dvifile"
+ if [ "${dviprogram}" = "dvips" ]
+ then
+ /bin/echo "##### PS file: $psfile"
+ /bin/echo "##### Saved PS file: $savedpsfile"
+ fi
+ /bin/echo "##### Created PDF file: $pdffile"
+ /bin/echo "##### Final PDF file: $savedpdffile"
+ /bin/echo "##### Environment:"
env | sed 's/^/##### /g'
fi
if [ "${startwithdvi}" = "yes" ]; then
- echo "### Skipping ${texprogram} ${texfile} [dvi->pdf only]"
+ /bin/echo "### Skipping ${texprogram} ${texfile} [dvi->pdf only]"
else
- echo "### ${texpath}/${texprogram} ${texfile}"
+ /bin/echo "### ${texpath}/${texprogram} ${texfile}"
"${texpath}/${texprogram}" ${extratexoptions} "${texfile}" || \
- echo "### WARNING: TeX returned non zero exit status ${status}"
- fi
-
- echo "### ${texpath}/${dvips} -R ${dvipsoptions} ${extradvipsoptions} -o ${psfile} ${dvifile}"
- "${texpath}/${dvips}" -R ${dvipsoptions} ${extradvipsoptions} -o "${psfile}" "${dvifile}" || \
- { echo "### FAILED to generate ${psfile} (${status})"; \
- exit 1; }
-
- if [ "${keeppsfile}" = "yes" ]; then
- echo "### Saving intermediary ps file ${psfile} as ${savedpsfile}"
- /bin/cp "${psfile}" "${savedpsfile}" || \
- echo "### FAILED to save ${psfile} (${status})"
+ /bin/echo "### WARNING: TeX returned non zero exit status ${status}"
fi
- if [ "${distillerpath}" != "" ]; then
- PATH="${distillerpath}:${PATH}";export PATH
- if [ "${debug}" = "yes" ]; then
- echo "##### PATH set to ${PATH}"
- fi
- fi
-
- if [ "${distillerfilter}" = "yes" ]; then
- echo "### ${distillerprog} <${psfile} >${pdffile}"
- "${distillerprog}" <"${psfile}" >"${pdffile}" || \
- { echo "### FAILED to generate ${pdffile} (${status})"
- exit 1; }
- else
- echo "### ${distillerprog} ${psfile} ${pdffile}"
- "${distillerprog}" "${psfile}" "${pdffile}" || \
- { echo "### FAILED to generate ${pdffile} (${status})"
- exit 1; }
- fi
+ case "${dviprogram}" in
+ "dvips")
+ run_dvips;;
+ "dvipdfm")
+ run_dvipdfm;;
+ "dvipdfmx")
+ run_dvipdfm;;
+ *)
+ /bin/echo "### ERROR: wrong dvipdf mode ${dviprogram}"
+ esac
- echo "### Copying/moving pdf file ${pdffile} to ${savedpdffile}"
+ /bin/echo "### Copying/moving pdf file ${pdffile} to ${savedpdffile}"
/bin/cp "${pdffile}" "${savedpdffile}.${tmpext}" || \
- echo "### FAILED to copy ${pdffile} (${status})"
+ /bin/echo "### FAILED to copy ${pdffile} (${status})"
/bin/rm -f "${savedpdffile}"
/bin/mv "${savedpdffile}.${tmpext}" "${savedpdffile}" || \
- echo "### FAILED to rename ${savedpdffile}.${tmpext} (${status})"
+ /bin/echo "### FAILED to rename ${savedpdffile}.${tmpext} (${status})"
if [ "${startwithdvi}" = "yes" ]; then
if [ "${keeppsfile}" = "yes" ]; then
- echo "### Succesfully generated ${savedpdffile} and ${savedpsfile}"
+ /bin/echo "### Succesfully generated ${savedpdffile} and ${savedpsfile}"
else
- echo "### Succesfully generated ${savedpdffile}"
+ /bin/echo "### Succesfully generated ${savedpdffile}"
fi
else
if [ "${keeppsfile}" = "yes" ]; then
- echo "### Succesfully generated ${dvifile}, ${savedpdffile} and ${savedpsfile}"
+ /bin/echo "### Succesfully generated ${dvifile}, ${savedpdffile} and ${savedpsfile}"
else
- echo "### Succesfully generated ${dvifile} and ${savedpdffile}"
+ /bin/echo "### Succesfully generated ${dvifile} and ${savedpdffile}"
fi
fi