New default for the gnus frame setup
[org-mode/org-tableheadings.git] / contrib / scripts / org2hpda
blob1957aa92b72e723f176b08d7da2efe223707819d
1 # org2hpda - a small utility to generate hipster pda style printouts from org mode 
2 # Copyright (C) 2007  Christian Egli
3
4 # Version: 0.6
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/>.
19 # Commentary:
20 # ===========
22 # set cal-tex-diary to true so that diary entries show up in the calendar 
24 # Usage:
25 # ======
27 # run this makefile with 
29 #  make -f org2hpda
31 # The makfile will take the entries from your diary file and generate
32 # two PDFs containing nicely printed weekly and monthly calendars. One
33 # is done in the style of a pocketMod (http://www.pocketmod.com/) and
34 # the other is done in the style of the Hipster PDA
35 # (http://en.wikipedia.org/wiki/Hipster_PDA). 
37 # Requirements:
38 # =============
40 # the pdf* commands are part of the pdfjam package which can be found
41 # at http://www.warwick.ac.uk/go/pdfjam
43 EMACS = emacs -batch -l ~/.emacs
44 LATEX = latex
45 DIARY = $($(EMACS) -eval "diary-file")
47 hipsterFiles =  weekCalendar.pdf yearCalendar.pdf monthCalendar3.pdf monthCalendar2.pdf monthCalendar1.pdf
48 pocketModFiles =  weekCalendar.pdf yearCalendar-rotated.pdf \
49         monthCalendar3-rotated.pdf monthCalendar2-rotated.pdf monthCalendar1-rotated.pdf
51 all: pocketMod.pdf hipsterPDA.pdf
53 %.dvi: %.tex
54         # Quick hack to massage the LaTeX produced by cal-tex
55         # quote '@', then increase font size of week calendars,
56         # increase font of diary entries in moth calendar and 
57         # finally reduce links to their destination, i.e. 
58         # change '[[http://foo][bar]]' to 'bar'
59         sed     -e 's/\\verb|@|/\@/g' \
60                 -e 's/documentclass\[11pt\]/documentclass[12pt]/g' \
61                 -e 's/{\\tiny \\raggedright #3}/{\\small \\raggedright #3}/g' \
62                 -e 's/\[\[[^]]\+\]\[\([^]]\+\)\]\]/\1/g' \
63                 < $< > /tmp/temp-org-file.$$$$; mv /tmp/temp-org-file.$$$$ $<
64         $(LATEX) $^
66 %.pdf: %.dvi
67         dvipdf $^
69 %-rotated.pdf: %.pdf
70         cp $^ $@
71         for n in 1 2 3; do \
72                 pdf90 --outfile tmp.pdf $@; mv tmp.pdf $@; \
73         done
75 weekCalendar.tex: $(DIARY)
76         $(EMACS) -eval "(progn (calendar) (cal-tex-cursor-week-iso 4) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
78 monthCalendar1.tex: $(DIARY)
79          $(EMACS) -eval "(progn (calendar) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
81 monthCalendar2.tex: $(DIARY)
82          $(EMACS) -eval "(progn (calendar) (calendar-forward-month 1) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
84 monthCalendar3.tex: $(DIARY)
85          $(EMACS) -eval "(progn (calendar) (calendar-forward-month 2) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
87 yearCalendar.tex: $(DIARY)
88          $(EMACS) -eval "(progn (calendar) (calendar-forward-month 2) (cal-tex-cursor-year-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
90 pocketMod.pdf: $(pocketModFiles)
91         pdfjoin --outfile tmp.pdf $^
92         pdfnup tmp.pdf --outfile $@ --nup 4x2 --frame true
94 hipsterPDA.pdf: $(hipsterFiles)
95         pdfnup weekCalendar.pdf --outfile page1.pdf --nup 2x2 --frame true
96         pdfjoin --outfile tmp.pdf monthCalendar[1-3]-rotated.pdf yearCalendar-rotated.pdf
97         pdfnup tmp.pdf --outfile page2.pdf --nup 2x2 --frame true
98         pdfjoin --outfile $@ page1.pdf page2.pdf
100 clean:
101         rm -rf *.aux *.dvi *.tex *.log *.pdf