org2hpda 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # org2hpda - a small utility to generate hipster pda style printouts from org mode
  2. # Copyright (C) 2007 Christian Egli
  3. #
  4. # Version: 0.4
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. # Commentary:
  20. #
  21. # set cal-tex-diary to true so that diary entries show up in the calendar
  22. #
  23. # the pdf* commands are part of the pdfjam package which can be found
  24. # at http://www.warwick.ac.uk/go/pdfjam
  25. EMACS = emacs -batch -l ~/.emacs
  26. LATEX = latex
  27. hipsterFiles = weekCalendar.pdf yearCalendar.pdf monthCalendar3.pdf monthCalendar2.pdf monthCalendar1.pdf
  28. pocketModFiles = weekCalendar.pdf yearCalendar-rotated.pdf \
  29. monthCalendar3-rotated.pdf monthCalendar2-rotated.pdf monthCalendar1-rotated.pdf
  30. all: pocketMod.pdf hipsterPDA.pdf
  31. %.dvi: %.tex
  32. # Quick hack to massage the LaTeX produced by cal-tex
  33. # quote '@', then increase font size of week calendars and
  34. # finaly increase font of diary entries in moth calendar
  35. sed -e 's/\\verb|@|/\@/g' \
  36. -e 's/documentclass\[11pt\]/documentclass[12pt]/g' \
  37. -e 's/{\\tiny \\raggedright #3}/{\\small \\raggedright #3}/g' \
  38. < $< > /tmp/temp-org-file.$$$$; mv /tmp/temp-org-file.$$$$ $<
  39. $(LATEX) $^
  40. %.pdf: %.dvi
  41. dvipdf $^
  42. %-rotated.pdf: %.pdf
  43. cp $^ $@
  44. for n in 1 2 3; do \
  45. pdf90 --outfile tmp.pdf $@; mv tmp.pdf $@; \
  46. done
  47. weekCalendar.tex: ~/diary
  48. $(EMACS) -eval "(progn (calendar) (cal-tex-cursor-week-iso 4) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  49. monthCalendar1.tex: ~/diary
  50. $(EMACS) -eval "(progn (calendar) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  51. monthCalendar2.tex: ~/diary
  52. $(EMACS) -eval "(progn (calendar) (calendar-forward-month 1) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  53. monthCalendar3.tex: ~/diary
  54. $(EMACS) -eval "(progn (calendar) (calendar-forward-month 2) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  55. yearCalendar.tex: ~/diary
  56. $(EMACS) -eval "(progn (calendar) (calendar-forward-month 2) (cal-tex-cursor-year-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  57. pocketMod.pdf: $(pocketModFiles)
  58. pdfjoin --outfile tmp.pdf $^
  59. pdfnup tmp.pdf --outfile $@ --nup 4x2 --frame true
  60. hipsterPDA.pdf: $(hipsterFiles)
  61. pdfnup weekCalendar.pdf --outfile page1.pdf --nup 2x2 --frame true
  62. pdfjoin --outfile tmp.pdf monthCalendar[1-3]-rotated.pdf yearCalendar-rotated.pdf
  63. pdfnup tmp.pdf --outfile page2.pdf --nup 2x2 --frame true
  64. pdfjoin --outfile $@ page1.pdf page2.pdf
  65. clean:
  66. rm -rf *.aux *.dvi *.tex *.log *.pdf