#!/usr/local/bin/perl # # David MacKay 4 June 94 # # delatex.p - crude program to strip out texy stuff # while( <>){ if ( /\\end\{document\}/ ) { last ; } # if there is a % character (not \% ) then delete what follows. s/\\\%/ /g; s/\%.*$//; if ( s/\\renewcommand.*$// || s/\\newcommand.*$// || s/\\newth.*$// || s/\\newlength// || s/\\setlength// || s/\\psfig.*$// ) { next ; } # s/\\ref\{\w{0,20}\}/ /g; # s/\\ref\{\w{0,20}\.\w{0,20}\}/ /g; # s/\\cite\{\w{0,20}\}/ /g; # s/\\cite\{\w{0,20}\.\w{0,20}\}/ /g; # s/\\cite\{\w{0,20}\,\w{0,20}\}/ /g; # s/\\label\{\w{0,20}\}/ /g; # s/\\label\{\w{0,20}\.\w{0,20}\}/ /g; s/\[.*\]//g; # s/\\\w{0,20}\*/ /g; s/\\section/* /g; s/\\begin\{.*\}//g; s/\\end\{.*\}//g; s/\\em//g; s/\\left//g; s/\\right//g; s/\\rm//g; s/\\em//g; s/\\bf//g; s/\\sc//g; s/\\frac//g; s/\\subsubsection/-/g; s/\\subsection/--/g; s/\\caption/**/g; s/\\small//g; s/\\large//g; s/\\textstyle//g; # s/\\\w{0,20}\{[0-9a-z_A-Z\.\,\:]{0,40}\}/ /g; # s/\\\w{0,20}\b/ /g; # s/\\|\{|\}|\_|\$|\^|\*|\&|\=|\,|\||\+|\-|[0-9]|\!|\// /g; s/\\|\{|\}|\$|\&/ /g; s/\\\!/ /g; s/\\\:/ /g; print ; }