aboutsummaryrefslogtreecommitdiffstats
path: root/buch/splitpapers
diff options
context:
space:
mode:
authorAndreas Müller <andreas.mueller@ost.ch>2021-06-06 21:08:29 +0200
committerAndreas Müller <andreas.mueller@ost.ch>2021-06-06 21:08:29 +0200
commitb73b611b12f5de2c342b04a22cac7f21f3786bad (patch)
tree3afb19ea39d765ceb9c4c1eb979c20e19e598813 /buch/splitpapers
parentadd intro (diff)
downloadSeminarSpezielleFunktionen-b73b611b12f5de2c342b04a22cac7f21f3786bad.tar.gz
SeminarSpezielleFunktionen-b73b611b12f5de2c342b04a22cac7f21f3786bad.zip
add lambert w section
Diffstat (limited to '')
-rwxr-xr-xbuch/splitpapers45
1 files changed, 45 insertions, 0 deletions
diff --git a/buch/splitpapers b/buch/splitpapers
new file mode 100755
index 0000000..9ae5aae
--- /dev/null
+++ b/buch/splitpapers
@@ -0,0 +1,45 @@
+#! /bin/bash
+#
+# splitpapers -- split PDF into one file per chapter
+#
+# (c) 2020 Prof Dr Andreas Müller, Hochschule Rapperswil
+#
+if [ ! -f buch.aux ]
+then
+ echo "file buch.aux missing"
+ exit 1
+fi
+
+if [ ! -d separata ]
+then
+ mkdir separata
+fi
+
+awk 'BEGIN {
+ offsetpage = 10
+ startpage = 0
+ identifier = ""
+ chapterno = 0
+}
+/newlabel{chapter:/ {
+ s = substr($0, 19, length($0) - 19)
+ i = match(s, "}{{")
+ newidentifier = substr(s, 1, i-1)
+ s = substr(s, i+3, length(s)-i-3)
+ i = match(s, "}{")
+ newchapterno = int(substr(s, 1, i))
+ s = substr(s, i+2, length(s)-i-2)
+ i = match(s, "}{")
+ newpage = int(substr(s, 1, i))
+ if (chapterno > 7) {
+ printf("pdfjam --outfile separata/%s.pdf buch.pdf %d-%d\n", identifier, startpage + offsetpage, newpage + offsetpage - 1)
+ }
+ startpage = newpage
+ chapterno = newchapterno
+ identifier = newidentifier
+}
+END {
+ printf("pdfjam --outfile separata/%s.pdf buch.pdf %d-\n", identifier, startpage + offsetpage)
+}' buch.aux | bash
+
+