File:  [Research Unix] / researchv10dc / vol2 / index / tools / tdist
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 3 months ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

awk '
/{\\(em|sl)[ a-zA-Z]*/	{
	save=$0
	sub(/{\\(em|sl)/,"XX",$0)
	i=index($0,"XX")
	string = substr(save,i)
	save=string
	left=gsub(/{\\(em|sl)/,"{",save)
	right=gsub(/}/,"}",save)
	if(right == 0){
		getline
		string = string " " $0
		right=gsub(/}/,"}",string)
		save=string
		left = gsub(/{\\(em|sl)/,"{", save)
	}
	if(left == 1){
		findterm(string)
		next
	}
	else {
		for(j=1;j<=left;j++){
			findterm(string)
			sub(/{\\(em|sl)/,"YY",string)
			save=string
			sub(/{\\(em|sl)/,"XX",save)
			i=index(save,"XX")
			string = substr(string,i)
		}
	}
	}
function findterm(string){
	num = split(string,a," ")
	term = a[1]
	for(i=2;i<=num;i++){
		term = term " " a[i]
		if(term ~ /}/){
			if(i > 2 || term ~ /[,\.]/)break
			if(length(a[i+1]) > 3 && a[i+1] !~ /\(/){
				term = term " " a[i+1]
				break
			}
			else break
		}
	}
	sub(/[\.,:;]/, "", term)
	print term
}' $1.tex


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.