Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!ptimtc!nntp-server.caltech.edu!marcel From: marcel@cs.caltech.edu (Marcel van der Goot) Newsgroups: comp.text.tex Subject: Re: TeX guru help needed Keywords: \loop, \par, \long, Midnight Message-ID: <1991Jun26.215459.28084@nntp-server.caltech.edu> Date: 26 Jun 91 21:54:59 GMT References: <1991Jun25.203859.6701@rusmv1.rus.uni-stuttgart.de> Sender: news@nntp-server.caltech.edu Distribution: comp Organization: California Institute of Technology (CS dept) Lines: 33 Daniel Pfeiffer (pfeiffer@cix.cict.fr) wrote: > I want to read and parse every line in a file that contains no > empty lines: > [...] > I read from a file whose lines are all uniform, and recognized by \@parse. > When I get to the end of the file the value of \@theline is \par. So I > figured I'd test for the end with \ifx\@theline\par. Problem is that > \loop tries to read everything upto \repeat but falls flat on it's face > when it sees the \par. The reason for this is that \loop is not defined as a \long macro. You could redefine \loop so that it is. However, as Rainer Sch\"opf pointed out, the preferred way of testing for the end of file is with \ifeof. > Alternate solutions to parsing every line in a file are also welcome! I think you might find Midnight/dolines.tex [.doc] useful. Also, since I'm advertising anyway, I think that Midnight/loop.tex is more convenient to use than plain TeX's \loop macro. (It doesn't have \long definitions either; I'll correct that in future releases.) dolines.tex, dolines.doc, loop.tex, and loop.doc are available from ymir.claremont.edu [134.173.4.23], directory [tex.inputs.midnight]. (You need loop.tex to use dolines.tex.) Marcel van der Goot .---------------------------------------------------------------- | Blauw de viooltjes, marcel@vlsi.cs.caltech.edu | Rood zijn de rozen; | Een rijm kan gezet | Met plaksel en dozen. |