summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/pdflatex-preserve-pdf
blob: f9d70b1e5717bdf7feb9d14a5683a26fa70efa1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh -ex
# $Id$
# Public domain.  Originally written by Karl Berry, 2015.
# This tiny script is used from ctan2tds as a specialinsrunner.
# 
# The problem is that a number of packages make it impossible to
# generate derived files (.sty) from their .dtx without also
# regenerating the documentation (.pdf).  Which we do not want to do,
# because remaking the doc generally involves many steps, external
# programs, and who knows what else.
# 
# Thus this script saves foo.pdf, runs pdflatex foo.tex, then restores
# foo.pdf.  That way we get the derived files but the author's .pdf.
# 
# Authors are sometimes responsive to supporting an alternate method for
# running the dtx that does not remake the doc (e.g., \ifpdf), but not
# always.  So we need this workaround.

basefile=`echo "$1" | sed 's/\.[^.]*$//'`
mv "$basefile.pdf" save.pdf
pdflatex "$@"
mv save.pdf "$basefile.pdf"