#!/usr/local/bin/perl # # David MacKay 4 June 94 # # delatex1.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/\%.*$//; s/\%.*\n//; if ( /\\bibliography/ || # if there is a match with any of /\\oddsidemargin/ || # these strings then the whole line is skipped /\\textwidth/ || /\\pagestyle/ || /\\markboth/ || /\\markright/ || /\\hyphenation/ || s/\\topmargin// || # I use s here but match / / would do fine s/\\textheight// || s/\\documentstyle// || /\\maketitle/ || /\\renewcommand/ || /\\newcommand/ || /\\def/ || /width=/ || # these lines are to remove psfig material /height=/ || # /bbllx=/ || /bburx=/ || /bblly=/ || /bbury=/ || s/\\newth.*$// || s/\\newlength// || s/\\setlength// || /psfig/ ) { next ; } if ( /\input\{(.*)\}/ ) { print STDERR "Warning not following direction to input file $1 \n" ; } s/\[[^\]]*\]//g; s/\\section/\n* /g; s/\\title/\n** /g; s/\\author/\n-- /g; s/\\date//g; s/\\today//g; s/\\hfill//g; # for ken s/\\ignore\{[^\}]*\}//g; s/\\bd\{([^\}]*)\}/$1/g; print ; }