summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/pdflatex-preserve-pdf
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/bin/pdflatex-preserve-pdf')
-rwxr-xr-xMaster/tlpkg/bin/pdflatex-preserve-pdf22
1 files changed, 22 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/pdflatex-preserve-pdf b/Master/tlpkg/bin/pdflatex-preserve-pdf
new file mode 100755
index 00000000000..f9d70b1e571
--- /dev/null
+++ b/Master/tlpkg/bin/pdflatex-preserve-pdf
@@ -0,0 +1,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"