# /u/sy/beebe/tex/bib/amermathmonthly/find-braceable-initial-title-words.awk, Fri Jul 2 12:29:18 1999 # Edit by Nelson H. F. Beebe # ======================================================================== # Scan one or more BibTeX files, using the check-bbl.wds file to # identify initial title words that should be braced for consistency, # and write a report on stdout in a format parsable by Emacs' compile # command. The report is sorted by the compound words, since that makes # it easier to ignore large groups of compounds that do not require # protecting braces. # # Usage: # awk -f find-braceable-initial-title-words.awk BibTeX-file(s) # # [02-Jul-1999] # ======================================================================== BEGIN { initialize() } /^ *title *= *"[A-Za-z]/ { report(substr($3,2)) } END { close(sortpipe) } # ======================================================================== function report(word) { ### print "DEBUG 1: [" word "]" if (word in Braceable_Word) print FILENAME ":" FNR ":\t" word | sortpipe } function initialize( line,words,wdsfile) { sortpipe = "sort -k 2 -t'\t'" wdsfile = "/u/sy/beebe/tex/bib/check-bbl.wds" while ((getline line < wdsfile) > 0) { split(line,words," ") words[1] = substr(words[1],2,length(words[1])-2) ### print "DEBUG 2 : [" words[1] "]" Braceable_Word[words[1]]++ } close (wdsfile) }