🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #1148

testing and parsing input

#1148
From: Darrell McCauley
Date: Mon, 10 Aug 1992 10:08
50 lines
2129 bytes
I am modifying a LaTeX style (endfloat.sty) which reads
input within an environment and writes it to a file. Testing
to see when I reach the \end of the environment is easy, but
suppose I want to trap any use of \somemacro within this
environment and use it's argument for something else.

Assuming that the input would look something like this:

\begin{envname}
something that will be written to a file
\somemacro{arg}
\end{envname}

I do something like this to find the end of the environment:

{\escapechar=-1
 \xdef\endenvtest{\string\\end\string\{envname\string\}}%
}
...
\ifx\test\endenvtest
      % finish up
\else
    \immediate\write\@anotherfile{#1}
...

as I read the input.  Unfortunately this method of testing
will not work for trapping \somemacro{arg} since I do not
know what the argument will look like (or will it? I couldn't
get it to work).

Can anyone recommend a way to test for usage of \somemacro
in this context?

================= Related Question======================= 
If an example usage looks like \somemacro{one two three
four} and I want to extract "one two three" for use by
\anothermacro, how would I do this? 

References to The Fine Manual are okay, as long as they are
constructive. The text after Exercise 20.4 looks helpful,
but I haven't figured anything out after an hour or two of
hacking.

Thank you,

--Darrell McCauley, Purdue University (mccauley@ecn.purdue.edu)
-- 
James Darrell McCauley          Department of Ag Engr, Purdue Univ
mccauley@ecn.purdue.edu         West Lafayette, Indiana 47907-1146
** "Do what is important first, then what is urgent." (unknown) **
Technical Details
Message-ID: <1992Aug10.100826.21945@noose.ecn.purdue.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sdd.hp.com!news.cs.indiana.edu!noose.ecn.purdue.edu!ecn.purdue.edu!mccauley

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sdd.hp.com!news.cs.indiana.edu!noose.ecn.purdue.edu!ecn.purdue.edu!mccauley
From: mccauley@ecn.purdue.edu (Darrell McCauley)
Subject: testing and parsing input
Message-ID: <1992Aug10.100826.21945@noose.ecn.purdue.edu>
Followup-To: comp.text.tex
Sender: news@noose.ecn.purdue.edu (USENET news)
Organization: Ag Engineering Dept, Purdue University 
Date: Mon, 10 Aug 1992 10:08:26 GMT
Lines: 50