org2hpda 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. DIARY = ~/TODO/diary
  28. hipsterFiles = weekCalendar.pdf yearCalendar.pdf monthCalendar3.pdf monthCalendar2.pdf monthCalendar1.pdf
  29. pocketModFiles = weekCalendar.pdf yearCalendar-rotated.pdf \
  30. monthCalendar3-rotated.pdf monthCalendar2-rotated.pdf monthCalendar1-rotated.pdf
  31. all: pocketMod.pdf hipsterPDA.pdf
  32. %.dvi: %.tex
  33. # Quick hack to massage the LaTeX produced by cal-tex
  34. # quote '@', then increase font size of week calendars and
  35. # finaly increase font of diary entries in moth calendar
  36. sed -e 's/\\verb|@|/\@/g' \
  37. -e 's/documentclass\[11pt\]/documentclass[12pt]/g' \
  38. -e 's/{\\tiny \\raggedright #3}/{\\small \\raggedright #3}/g' \
  39. < $< > /tmp/temp-org-file.$$$$; mv /tmp/temp-org-file.$$$$ $<
  40. $(LATEX) $^
  41. %.pdf: %.dvi
  42. dvipdf $^
  43. %-rotated.pdf: %.pdf
  44. cp $^ $@
  45. for n in 1 2 3; do \
  46. pdf90 --outfile tmp.pdf $@; mv tmp.pdf $@; \
  47. done
  48. weekCalendar.tex: $(DIARY)
  49. $(EMACS) -eval "(progn (calendar) (cal-tex-cursor-week-iso 4) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  50. monthCalendar1.tex: $(DIARY)
  51. $(EMACS) -eval "(progn (calendar) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  52. monthCalendar2.tex: $(DIARY)
  53. $(EMACS) -eval "(progn (calendar) (calendar-forward-month 1) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  54. monthCalendar3.tex: $(DIARY)
  55. $(EMACS) -eval "(progn (calendar) (calendar-forward-month 2) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  56. yearCalendar.tex: $(DIARY)
  57. $(EMACS) -eval "(progn (calendar) (calendar-forward-month 2) (cal-tex-cursor-year-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
  58. pocketMod.pdf: $(pocketModFiles)
  59. pdfjoin --outfile tmp.pdf $^
  60. pdfnup tmp.pdf --outfile $@ --nup 4x2 --frame true
  61. hipsterPDA.pdf: $(hipsterFiles)
  62. pdfnup weekCalendar.pdf --outfile page1.pdf --nup 2x2 --frame true
  63. pdfjoin --outfile tmp.pdf monthCalendar[1-3]-rotated.pdf yearCalendar-rotated.pdf
  64. pdfnup tmp.pdf --outfile page2.pdf --nup 2x2 --frame true
  65. pdfjoin --outfile $@ page1.pdf page2.pdf
  66. clean:
  67. rm -rf *.aux *.dvi *.tex *.log *.pdf