#!/usr/bin/perl -w # Last modified: Thu Apr 25 22:12:47 2002 # $Id: prosper,v 1.8 2002/06/17 14:52:55 nevin Exp $ ## prosper: a script that converts LaTeX src to PDF ## Nevin Kapur ## Usage: prosper use strict; use File::Basename; use constant REVISION => '$Revision: 1.8 $'; my $file = $ARGV[-1] or die "Usage: $0 [-ps] \n"; # ## Strip off some common extensions # $file = basename($file, qw[.tex .dvi .ps .pdf]); $ENV{GS_OPTIONS} = '-sPAPERSIZE=a4'; # ### Use latex by default. If the environment variable LATEX is set ### then use it instead. Useful for people who have latexn or other ### script that runs latex multiple times. # my $latex = 'latex'; # ## Produce PDF by default ## # my $pdf = 1; $latex = $ENV{LATEX} if defined $ENV{LATEX}; my @latex_cmd = ('latexn', $file); my @dvips_cmd = ('dvips', '-R', '-Ppdf', '-G0', '-o', "$file.ps", "$file.dvi" ); if ($ARGV[0] eq '-ps') { @dvips_cmd = ('dvips', '-o', "$file.ps", "$file.dvi"); $pdf = 0; } my @ps2pdf_cmd = ( 'ps2pdf', "$file.ps", "$file.pdf" ); print "prosper version: @{[ REVISION ]}.\n"; print "@latex_cmd\n"; system(@latex_cmd) == 0 or die "system @latex_cmd failed: $?"; print "@dvips_cmd\n"; system (@dvips_cmd) == 0 or die "system @dvips_cmd failed: $?"; if ($pdf) { print "@ps2pdf_cmd\n"; system (@ps2pdf_cmd) == 0 or die "system @ps2pdf_cmd failed: $?"; } __END__ =head1 NAME prosper - convert a LaTeX file to PDF =head1 SYNOPSIS prosper file.tex prosper -ps file.tex =head1 DESCRIPTION prosper processes a LaTeX files created using the prosper documentclass to PDF. It sets up the environment so that A4 paper is used (as expected by prosper). It uses the command-line arguments C<-Ppdf -G0> to dvips to produce better PDF. With the optional command line argument -ps, only a postscript file is produced. =head1 ENVIRONMENT VARIABLES =over =item LATEX If this environment variable is set then use it instead of C. This is useful if you use some batch processing script like latexn. =back =head1 AUTHOR Nevin Kapur =head1 VERSION $Id: prosper,v 1.8 2002/06/17 14:52:55 nevin Exp $ =cut ### Local variables: ### compile-command: "perl -wc prosper" ### End: