rro@lll-lcc.UUCP (Rodney Oldehoeft) (08/12/86)
[] I'm looking for an equivalent of deroff for filtering input to TeX and LaTex in order to remove "\" commands, etc. in preparation for processing by style and diction. These latter utilities have been useful to me with troff, and it would be nice to continue using them with TeX/LaTeX. Anyone have such a filter, or know where it can be found? Rod Oldehoeft lll-crg!rro
mamon@acf4.UUCP (Gary Mamon) (08/14/86)
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 <stdio.h> 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!
jeff@mcnc.UUCP (Jeffrey Copeland) (08/14/86)
The program you want is called detex and is on the Unix TeX tape.