🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #10504

Re: TeX guru help needed

#10504
From: C.E. Thompson
Date: Wed, 26 Jun 1991 11:55
34 lines
1682 bytes
In article <PFEIFFER.91Jun25101651@cix.cict.fr> pfeiffer@cix.cict.fr (Daniel Pfeiffer) writes:
>I want to read and parse every line in a file that contains no
>empty lines:
>
>	\openin\@std \bookname.sind
>	\loop
>		\read\@std to\@theline
>		\ifx\@theline\par\encorefalse\fi
>	\ifencore
{rest of code omitted}
>	\repeat
>
>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.  ...

As Rainer Sch"opf has pointed out, using \ifeof\@std is much the easiest
and clearest way to make the test. However, it may be worth pointing out
that the \ifx test wouldn't work even if you had managed to get the \par
into the \loop. \@theline is a macro containing only \par at this time, not
\par itself. You could write

    \def\@lastline{\par}
    \loop
       ...
       \ifx\@theline\@lastline ...

and that solves both problems.

Chris Thompson
JANET:    cet1@uk.ac.cam.phx
Internet: cet1%phx.cam.ac.uk@nsfnet-relay.ac.uk
Technical Details
Message-ID: <1991Jun26.115538.1710@cl.cam.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!cam-cl!news
References: <PFEIFFER.91Jun25101651@cix.cict.fr>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!cam-cl!news
From: cet1@cl.cam.ac.uk (C.E. Thompson)
Newsgroups: comp.text.tex
Subject: Re: TeX guru help needed
Keywords: \loop \par
Message-ID: <1991Jun26.115538.1710@cl.cam.ac.uk>
Date: 26 Jun 91 11:55:38 GMT
References: <PFEIFFER.91Jun25101651@cix.cict.fr>
Reply-To: cet1@cl.cam.ac.uk (C.E. Thompson)
Distribution: comp
Organization: U of Cambridge Comp Lab, UK
Lines: 34