summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/latexmk/extra-scripts/pst2pdf_for_latexmk
blob: 8e74f40c6e721ab2760137a9837e8f261ef17a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/bash
# pst2pdf_for_latexmk
# PSTricks 2 PDF converter :
# Usage: 
#      pst2pdf_for_latexmk
# produces PDF files for all files of the form *-fig*.tex
#      pst2pdf_for_latexmk <FILE> 
# only considers FILE-fig*.tex

# Modified from pst2pdf distributed with pdftricks.sty to use latexmk

# IT REQUIRES VERSION 3.21 OR HIGHER OF latexmk
# See http://www.phys.psu.edu/~collins/software/latexmk/versions.html
# The version on CTAN is not yet updated

# For each pdf file will only be made if the tex source is out-of-date
# This version of pst2pdf does not clean up generated files: they are
# needed by latexmk to determine whether or not the pdf file is
# out-of-date. 
#
#   To use this automatically with latexmk (linux/UNIX system assumed)
#      1. Install this script (pst2pdf_for_latexmk) somewhere in your PATH
#      2. Put a line like the following in an initialization file for latexmk:
#            $pdflatex = 'pdflatex %O %S; pst2pdf_for_latexmk %B';

#  1 Oct 2007 John Collins: Remove path from latexmk
# 28 Sep 2007 Herb Schulz processing steprs of figure files changed for no rotation and better BoundingBox
# 27 Sep 2007 John Collins
# 26 Sep 2007 John Collins

Myname='Pst2pdf_for_latexmk'
myname='pst2pdf_for_latexmk'

echo "This is $myname modified to use latexmk, by John Collins"

FILE=$1
if test -z $FILE; then
		FIGURES=`ls *-fig*.tex`;
else
		FIGURES=`ls -- $FILE-fig*.tex`;
fi


if test -z "$FIGURES"; then
   echo $Myname: No files to process
else
  echo $Myname: Using latexmk to process: $FIGURES 
#  latexmk -pdfdvi -ps- -dvi- -e '$dvipdf = q{dvips -E -o %B.eps %S && epstopdf %B.eps --outfile=%D}'  $FIGURES
  latexmk -pdfdvi -ps- -dvi- -e '$dvipdf = q{dvips -o %B.ps %S ; ps2pdf13 -dAutoRotatePages=/None %B.ps ; pdfcrop %B.pdf ; /bin/mv %B-crop.pdf %D}'  $FIGURES
fi