🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.text
Article #1010

Re: Deroff equivalent for TeX/LaTeX?

#1010
From: Gary Mamon
Date: Thu, 14 Aug 1986 00:12
39 lines
1552 bytes
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!
Technical Details
Message-ID: <8900004@acf4.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!husc6!harvard!cmcl2!acf4!mamon
References: <383@lll-lcc.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!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