This repository has been archived by the owner on Jul 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
makewin.sh
98 lines (88 loc) · 2.17 KB
/
makewin.sh
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/sh
wd=${PWD}
echo ${PWD}
#Keep it clean
mkdir tmp
mkdir tmp/sjungbok
mkdir tmp/sjungbok/bilder
mkdir tmp/sjungbok/texter
cp *.tex tmp/sjungbok/.
cp formatmall.sty tmp/sjungbok/.
cp bilder/* tmp/sjungbok/bilder/.
cp texter/* tmp/sjungbok/texter/.
cd tmp/sjungbok
echo ${PWD}
touch index.tex
pdflatex.exe -halt-on-error sjungboken.tex
#Sortera låtar med 1 före 10 o.s.v.
#Funkar bara om de heter "...Nr XX...", typ "Fredmans epistel Nr 23: En liten visa"
echo Sorterar index..
sed -e 's/\\indexentry{Nr \([1-9]:.*\)/\\indexentry{Nr 0\1/' < sjungboken.idx > sjungboken2.idx
#Sortera åäö och ÅÄÖ rätt
sed -e '
:again
s/^\([^@]*\)\\IeC {\\r a}/\1zaz/g
t again
' -e '
:again2
s/^\([^@]*\)\\IeC {\\r A}/\1ZAZ/g
t again2
' -e '
:again3
s/^\([^@]*\)\\IeC {\\"a}/\1zbz/g
t again3
' -e '
:again4
s/^\([^@]*\)\\IeC {\\"A}/\1ZBZ/g
t again4
' -e '
:again5
s/^\([^@]*\)\\IeC {\\"o}/\1zcz/g
t again5
' -e '
:again6
s/^\([^@]*\)\\IeC {\\"O}/\1ZCZ/g
t again6
' < sjungboken2.idx > sjungboken3.idx
mv sjungboken3.idx sjungboken.idx
makeindex.exe sjungboken.idx
cat sjungboken.ind | grep \item | sed -r s/'\\item '\([^,].+\),\ \(.*\),\ \(.*\),.*/'\\hyperref\[\3]{\1}\\dotfill\\hyperref\[\3]{\2}\\\\'/>indexsort.tex
cat indexhead.tex indexsort.tex indexfoot.tex > index.tex
#sed -e '
#:again6
# s/^\([^@]*\)ZZZZ/\1\\IeC {\\"O}/g
# t again6
#' -e '
#:again5
# s/^\([^@]*\)zzzz/\1\\IeC {\\"o}/g
# t again5
#' -e '
#:again4
# s/^\([^@]*\)ZZZ/\1\\IeC {\\"A}/g
# t again4
#' -e '
#:again3
# s/^\([^@]*\)zzz/\1\\IeC {\\"a}/g
# t again3
#' -e '
#:again
# s/^\([^@]*\)zz/\1\\IeC {\\r a}/g
# t again
#' -e '
#:again2
# s/^\([^@]*\)ZZ/\1\\IeC {\\r A}/g
# t again2
#' < sjungboken.ind > sjungboken2.ind
#mv sjungboken2.ind sjungboken.ind
#Compile with indexes
pdflatex.exe -halt-on-error framsida.tex
pdflatex.exe -halt-on-error sjungboken.tex
pdflatex.exe -halt-on-error sjungboken.tex
pdflatex.exe -halt-on-error sjungboken-print.tex
cp sjungboken.pdf ../../sjungboken.pdf
cp framsida.pdf ../../framsida.pdf
cp sjungboken-print.pdf ../../sjungboken-print.pdf
cd ../.
rm -rf sjungbok
cd ../.
rm -rf tmp