summaryrefslogtreecommitdiffstats
path: root/presentations/common-goods/Makefile
blob: 68df7fe35f148d35f9f226e4071c009ba58ad198 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
notes = \
  eek-2017-09-common-goods-notes-sv.pdf

other = \
  proposal-en.pdf \
  proposal-sv.pdf \
  script.pdf

all: $(notes) $(other)


%-notes-sv.pdf: script-sv_.pdf
	echo '$(tex-includepdf-nup)' | pdflatex -jobname $(basename $@)

define tex-includepdf-nup
\documentclass[a4paper, 11pt]{article}\
\usepackage[a4paper, margin = 0pt]{geometry}\
\usepackage{pdfpages}\
\pagestyle{empty}\
\begin{document}\
\includepdf[pages = -, nup = 2x1]{$(basename $<).pdf}\
\end{document}
endef

script-sv_.pdf: script-sv_.tex
	jobname=$(basename $@) ;\
	echo "Rerun right" >> $(basename $@).log ;\
	for i in {0..4}; do \
          if grep -q 'Rerun.*right' $(basename $@).log; then \
	    pdflatex -jobname $(basename $@) $<;\
          fi ;\
        done

script-sv_.tex: script-sv.mdwn latex.sed
	pandoc -s -S -f markdown -t latex \
          -V "classoption=a4paper,12pt" \
          -V "geometry=paperwidth=.5\paperwidth,hmargin=10mm,top=15mm,bottom=15mm,includefoot" \
          < $< \
          | sed -f latex.sed > $@



$(other): %.pdf: %.mdwn
	pandoc -s -S -f markdown -t latex \
          -V "classoption=a4paper,12pt" \
          -V "geometry=hmargin=35mm,top=20mm,bottom=15mm,includefoot" \
          -o $(basename $<).pdf $<

clean:
	rm -f $(notes)
	rm -f *.aux *.log
	rm -f *.tex
	rm -f *.pdf
	rm -f *~ *_.* *_


SHELL = /bin/bash