#!/bin/bash # # Syntax: dvi2ps [-s] [-l] [-h] [-d dir1:dir2:...] filename [...] # # Purpose: Transforms .dvi files into .ps files using dvips. # Use the -s flag to reduce the intermediate output. # Use the -l flag to select letter paper. # Use the -d flag to specify extra directories to be added to # TEXINPUTS. # The -h flag shows the help info for this command. # # See also: dvips # Created: Feb 17, 1993 by Bart De Schutter # Last revised: Mar 22, 2012 by Bart De Schutter # # See http://www.deschutter.info/util/scripts.html for the latest version of # this script. # Status: public # Category: postscript, latex extra_option="" extra_dirs="" while getopts :lshd: option do case "$option" in l) extra_option="$extra_option -t letter";; s) extra_option="$extra_option -q";; h) sed '/^$/q;/^#!/d;s/^# //;s/^#//' $0 >&2 exit 1;; d) extra_dirs=${OPTARG};; \?) echo >&2 echo >&2 "Unknown option: $OPTARG" echo >&2 sed '/^$/q;/^#!/d;s/^# //;s/^#//' $0 >&2 exit 1;; esac done shift $(($OPTIND-1)) if [ -n "${extra_dirs}" ] then TEXINPUTS="$TEXINPUTS${extra_dirs}:" fi if [ $# -eq 0 ]; then echo >&2 echo >&2 "ERROR: ${0##*/} requires at least 1 input argument." echo >&2 sed '/^$/q;/^#!/d;s/^# //;s/^#//' $0 >&2 exit 1 fi for fname in "$@" do \dvips $extra_option -o "${fname%.dvi}.ps" "${fname%.dvi}.dvi" done