#!/usr/bin/env bash
##
################################################################################
##
##  pdfjam-slides3up: A shell program to make a 3-up "handout"
##  of presentation slides, with space for side-notes
##
##  (c) 2019: David Firth (http://go.warwick.ac.uk/dfirth, original author)
##  License: GPL (https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
##
##  This is a simple wrapper for pdfjam, version N.NN
##
################################################################################
##
footskip=3.1cm                           ## default setting
pagecommand='{\thispagestyle{empty}}'    ## default setting
case ${1} in
    --pagenumbering)
	case ${2} in
	    false)
		continue ;;
	    true)
		pagecommand='{\thispagestyle{plain}}' ;;
	    *)       ## a footskip dimension was supplied
		pagecommand='{\thispagestyle{plain}}' ;
		footskip="$2" ;;
	esac ;
	shift; shift ;;
    *)
	continue ;;
esac
exec pdfjam --suffix 3up --nup 1x3 --frame true --noautoscale false \
  --delta "0cm 0.2cm" --scale 0.87 --offset "-3.8cm 0cm" \
  --preamble "\footskip $footskip" --pagecommand "$pagecommand" "$@"
##
################################################################################
##
