forked from MEGA65/mega65-user-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_letters.sh
More file actions
executable file
·28 lines (22 loc) · 847 Bytes
/
generate_letters.sh
File metadata and controls
executable file
·28 lines (22 loc) · 847 Bytes
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
#!/bin/bash
grep -B 999 "%% MAILMERGE_BEGIN_REPEATED" registration_code_template.tex > mm_top.tex
grep -A 999 "%% MAILMERGE_END_REPEATED" registration_code_template.tex > mm_bottom.tex
grep -B 999 "%% MAILMERGE_END_REPEATED" registration_code_template.tex | grep -A 999 "%% MAILMERGE_BEGIN_REPEATED" > mm_repeated.tex
cat mm_top.tex > mm.tex
while read p; do
echo "$p"
cat mm_repeated.tex | sed "s/CODEGOESHERE/${p}/g" >> mm.tex
done <codes.txt
cat mm_bottom.tex >> mm.tex
latexmk -pdf -pdflatex="xelatex -interaction=nonstopmode" -use-make mm.tex
echo "Output will be written to mm.pdf"
gs \
-sOutputFile=mm-greyscale.pdf \
-sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray \
-dProcessColorModel=/DeviceGray \
-dCompatibilityLevel=1.4 \
-dNOPAUSE \
-dBATCH \
mm.pdf
echo "Greyscale version written to mm-greyscale.pdf"