[texhax] conversion of .tex to .txt

Alan Litchfield alan at alphabyte.co.nz
Sat Feb 9 21:40:59 CET 2008


> Grover Hughes wrote:
>> 2008 February 8
>> Hello-- I am writing you at the suggestion of Karl Berry, who has  
>> been
>> trying to help me with my problem, which is as follows:
>> I work in DOS 6.22 and I have several files written in TeX which I
>> want to convert to straight ASCII. (These files do not contain math
>> symbols, just text stuff; they pertain to Pari/GP, and are tutorials
>> and explanations.) I can read these files, but they contain a lot of
>> symbols and characters which obviously don't belong in a purely ASCII
>> text, and while I can edit them out, it's a chore, as there are a lot
>> of 'em, and I'd rather have some software program to do the  
>> conversion
>> (i.e., editing) for me.
>> I have a file called "tex2mail", which is stated to be such a
>> conversion program, but that introduces its own problems.
>> In a file called README, I am told that I must convert the first line
>> in "tex2mail" so it will show "the correct full path name of your  
>> perl
>> executable".
>> I have no idea what the "correct path name" should be, nor do I
>> have anything pertaining to "perl" (which I am told is some sort of
>> programming language itself).

Perl is a scripting language which would need to be installed on your  
system before you can run the program. The path name would point to  
where on your computer the program that runs the perl language is  
installed. That is what they mean about the "perl executable". Perl  
quite large and there are a number of settings that need to be set  
properly before it will work so you may not want to be bothered unless  
there is no other way, otherwise it looks like this may do what you  

>> Also, the README file says that the invocation to cause the  
>> conversion
>> to take place is:
>>  tex2mail [-linelength <bytesperline> ] [-debug <level> ] [-by_par]
>> [-TeX] [-ragged] [-noindent] < foo.tex > foo.txt
>> in which I assume that "foo" would be replaced by the actual name of
>> the TeX file which I want to have converted. Is that correct? I tried
>> that, but (probably because I hadn't changed that pesky first line in
>> any way) all I got was an error message from DOS, about a bad  
>> command.

I would think that first you need to cd to the directory where your  
tex file is and then run:
C:/../tex2mail -TeX foo.tex

where the .. indicates the path to where the tex2mail file is stored,  
or you could copy it into the same folder as the tex files.

You are correct in your assumption about the "foo.tex" file name and  
your own. In theory it should also accept *.tex if all your tex files  
are in the same directory and if you wanted to process them all at the  
same time.

>> Karl steered me to a program called "detex", which I downloaded, but
>> when I tried it, all I got was a message stating that it won't run
>> under DOS (which Karl warned me up front might well be the case). He
>> suggested that I explain my problem to you and to ask if you might
>> know of a binary (in detex, or whatever) which WOULD run in DOS and  
>> do
>> what I want. So, I'm asking!!

detex is good but there a few issues with some LaTeX environments from  
what I recall.

Had a quick look at the detex folder and you need to compile the  
source code. This may be a good thing if you have a compiler on your  
system. This page:
http://www.eskimo.com/~scs/cclass/handouts/cstepbystep/sx3c.html : has  
a nice simple explanation of the steps.

Here is a list of places that seem to have free compilers if you need  
http://gcc.gnu.org/ (preferred)

I hope this is what you were looking for.


Alan Litchfield GradDipBus, MBus(Hons), CTT, MNZCS
PO Box 1941, Auckland, NZ. 1140

Alan Litchfield GradDipBus, MBus(Hons), CTT, MNZCS
PO Box 1941, Auckland, NZ. 1140

More information about the texhax mailing list