Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!harvard!cmcl2!acf4!mamon From: mamon@acf4.UUCP (Gary Mamon) Newsgroups: net.text Subject: Re: Deroff equivalent for TeX/LaTeX? Message-ID: <8900004@acf4.UUCP> Date: Wed, 13-Aug-86 20:12:00 EDT Article-I.D.: acf4.8900004 Posted: Wed Aug 13 20:12:00 1986 Date-Received: Thu, 14-Aug-86 08:27:17 EDT References: <383@lll-lcc.UUCP> Organization: New York University Lines: 39 Hi there, A while back I wrote a detex program which seems to work. It is not very polished however, as you will find out. I use it mainly to count words in files. So here is the source, written in C (at which I am a novice). /* This program reads a file from the standard input, and send a detexed version to the standard output. In this version equations are left out. */ #include main() { int c; while((c=getchar()) != EOF) { if(c == '\\') /* Ignore TeX commands */ while(((c=getchar()) != ' ') && (c != '\n')) ; if(c == '%') { /* Ignore TeX comments */ while(((c=getchar()) != '\n')) ; } if(c == '$') { /* Ignore TeX equations */ if((c=getchar()) == '$') ; while((c=getchar()) != '$') ; if((c=getchar()) == '$') c = getchar(); } if(c == '{' || c == '}') continue; /* Ignore curly brackets */ putchar(c); } } Gary A. Mamon -------- New York University, Physics Department (212) 598-3627 ****** {allegra|ihnp4|seismo|princeton|topaz}!cmcl2!acf4!mamon Arpanet too!