summaryrefslogtreecommitdiff
path: root/indexing/texindex/ix.format
blob: eb2b389ad5f37acc86116c36f8af7c6e65d89de5 (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
# ix.format : awk - script
# entfernt Sortierschluessel, fuegt \item etc. ein
BEGIN	{
		FS = OFS = "\t"
		printf "\\begin{theindex}"
	}
	{
		n = split($2,feld,", ")
		if (n > 3)
		{
			for (i=4; i <=n; i++)
				feld[3] = feld[3] ", " feld[i]
			n = 3 
		}
		for (i = 1; feld[i]==altfeld[i] && i<=n ; i++)
			;
		for (k=i; k <=n; k++)
		{
			printf "\n\\"
			for (j=1; j<k; j++)
				printf "sub"
			printf "item %s ",feld[k]
		}
		nzahl = split($3,zahlfeld," ")
		for (j=1; j<nzahl; j++)
			printf"%s, ",zahlfeld[j]
		printf "%s",zahlfeld[nzahl]
		for (j=1; j<=i; j++)
			altfeld[i] = feld[i]
	}
END	{
		printf "\n\\end{theindex}\n"
	}