makehandouts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. # In the folder containing a LaTeX source beamer file named 'foo.tex'
  3. # one types 'makehandouts foo' to create 'foo-handout.pdf' for viewing
  4. # slides without pauses, and create also 'foo-handoutnup.pdf' where n
  5. # = 1,2,4 for easy formatted slides printing with acroread.
  6. #
  7. # Notes: Run this command in the same folder containing 'foo.tex'
  8. # Type 'makehandouts' to get a hint on usage
  9. if [ -n "$1" ]; then
  10. echo "# makefile for $1.tex (created by makehandouts command)" > /tmp/makefile
  11. echo "# creates $1-handout.pdf (for viewing slides without" >> /tmp/makefile
  12. echo "# pauses), $1-handout1up.pdf, $1-handout2up.pdf," >> /tmp/makefile
  13. echo "# and $1-handout4up.pdf (formatted for printing)" >> /tmp/makefile
  14. echo "default: $1-handout4up.pdf $1-handout2up.pdf $1-handout1up.pdf" >> /tmp/makefile
  15. echo " " >> /tmp/makefile
  16. echo "1up: $1-handout1up.pdf" >> /tmp/makefile
  17. echo " " >> /tmp/makefile
  18. echo "2up: $1-handout2up.pdf" >> /tmp/makefile
  19. echo " " >> /tmp/makefile
  20. echo "4up: $1-handout4up.pdf" >> /tmp/makefile
  21. echo " " >> /tmp/makefile
  22. echo "$1-handout4up.pdf: $1-handout.pdf" >> /tmp/makefile
  23. echo " pdfnup $1-handout.pdf --nup 2x2 --outfile /tmp/junk.pdf" >> /tmp/makefile
  24. echo " pdf90 /tmp/junk.pdf --outfile $1-handout4up.pdf" >> /tmp/makefile
  25. echo " " >> /tmp/makefile
  26. echo "$1-handout2up.pdf: $1-handout.pdf" >> /tmp/makefile
  27. echo " pdfnup $1-handout.pdf --nup 1x2 --outfile $1-handout2up.pdf" >> /tmp/makefile
  28. echo " " >> /tmp/makefile
  29. echo "$1-handout1up.pdf: $1-handout.pdf" >> /tmp/makefile
  30. echo " pdf90 $1-handout.pdf --outfile $1-handout1up.pdf" >> /tmp/makefile
  31. echo " " >> /tmp/makefile
  32. echo "$1-handout.pdf: $1-handout.tex" >> /tmp/makefile
  33. echo " pdflatex $1-handout" >> /tmp/makefile
  34. echo " pdflatex $1-handout" >> /tmp/makefile
  35. echo " " >> /tmp/makefile
  36. echo "$1-handout.tex: $1.tex" >> /tmp/makefile
  37. echo " sed -e 's/\\documentclass\[/\documentclass[handout,notes,/g' -e 's/\\documentclass{/\documentclass[handout,notes]{/g' $1.tex > $1-handout.tex" >> /tmp/makefile
  38. echo "created makefile for $1.tex"
  39. else
  40. echo "usage: 'makehandouts <LaTeX root filename>'"
  41. echo "e.g.: 'makehandouts foo' to create handouts for foo.tex"
  42. exit 1
  43. fi
  44. if [ -e $1.tex ]; then
  45. echo "checking that $1.tex exists...yes"
  46. make -f /tmp/makefile
  47. else
  48. echo "Aborting: File $1.tex does not exist! Typo?"
  49. exit 1
  50. fi