Create a newspaper in TeX

Posted by ads on Tuesday, 2007-07-31
Posted in [Software][Tex]

My problem: for our wedding I need a small magazine with a foto on the front, the agenda, some notes for the music and some more additional information. The decision was to create A5 sheets and print them doublesided on an A4 paper, so you need at least 4 A5 sheets to fill one paper.

The first attempt was OpenOffice, but if you have more than one A4 paper, it’s really hard to have the sheets in the correct order. For one paper you need sheet 1 and 4 and sheet 2 and 3 adjoin each other. If you have 8 sheets, you need 1 and 8 together, 2 and 7 and so on …

Thats complicated to do in OpenOffice (maybe there’s a way to do this, but I don’t know it).

So after some minutes I changed over to Tex, took one of my existing makefiles and modified it a bit. With the following makefile you can just create sheet after sheet in your TeX-file, type make and you get 2 PDFs, one with the odd pages and one with the even pages. Thats all, what you have to do.

Oh, make sure, you have an exact number of pages (4, 8, 12, …) ;-)

 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
name=document

# print the odd pages first (1, 3, 5, ...)

all:	$(name)-o.pdf $(name)-e.pdf $(name).pdf clean
	acroread $(name)-o.pdf $(name)-e.pdf

allone:	$(name)-o.pdf $(name)-e.pdf $(name).pdf clean
	acroread $(name).pdf

$(name)-o.pdf:	$(name)-o.ps
	ps2pdf14 $(name)-o.ps $(name)-o.pdf

$(name)-e.pdf:	$(name)-e.ps
	ps2pdf14 $(name)-e.ps $(name)-e.pdf

$(name).pdf:	$(name).ps
	ps2pdf14 $(name).ps $(name).pdf

$(name).ps:	$(name).dvi
	dvips $(name).dvi
	psbook $(name).ps $(name)-tmp.ps
	mv $(name)-tmp.ps $(name).ps
	psnup -Pa5 -2 $(name).ps $(name)-tmp.ps
	mv $(name)-tmp.ps $(name).ps
	cat $(name).ps | sed -e 's/DocumentPaperSizes: a5/DocumentPaperSizes: a4/' > $(name)-tmp.ps
	mv $(name)-tmp.ps $(name).ps

$(name)-o.ps:	$(name).ps
	psselect -o $(name).ps $(name)-o.ps

$(name)-e.ps:	$(name).ps
	psselect -r -e $(name).ps $(name)-e.ps

$(name).dvi:	$(name).tex
	latex $(name).tex
	latex $(name).tex > /dev/null 2>&1

clean:
	rm -rf $(name).aux $(name).dvi $(name).log $(name).nav $(name).out $(name).ps $(name).snm $(name).toc $(name).vrb $(name)-o.ps $(name)-e.ps

cleanall:	clean
	rm -rf $(name).pdf $(name)-o.pdf $(name)-e.pdf

.PHONY:	all $(name).pdf $(name)-o.pdf $(name)-e.pdf clean cleanall

Categories: [Software] [Tex]

Share: