ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* use supp-fil in plain tex
@ 2000-03-10 16:51 Ed L. Cashin
  2000-03-12 10:43 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Ed L. Cashin @ 2000-03-10 16:51 UTC (permalink / raw)


Hello.  I have a situation where I'd like to process an undetermined
number of figures in a TeX document.  The way I'm currently handling
it is by generating the TeX code with perl, with TeX code to include
each figure.

However, a much simpler and more general strategy, that might not be
much slower, would be to use a loop in the TeX code that included the
files if they were there.  

The task is made easier by the fact that the included files are
MetaPost figures with consecutive suffixes.  The loop, then has to do
this: 

      counter variable i = 1
      while exists file myfile.i
            include figure from myfile.i
            increment i
      done

I know that loops can be done in plain TeX with the \loop macro, and I
saw the "\doiffileelse" macro in supp-fil.tex.  I'm trying to use it
like this:

    \input supp-mis
    \input supp-fil

    \newcount\iterator\iterator=1
    \newif\ifNotDone\NotDonetrue

    \loop\ifNotDone
      \doiffileelse{sumvouch\iterator}
    	    {\placeFgBg{sumvouch.\iterator}\advance\iterator by 1}
    	    {\NotDonefalse}
    \fi\repeat

... which may or may not be the right way to write the loop, but I get
errors like this while supp-fil is loading:

   This is pdfTeX, Version 3.14159-13d (Web2C 7.3.1)
   (sumvouch.tex[/usr/local/teTeX/share/texmf/pdftex/config/pdftex.cfg]
   Babel <v3.6x> and hyphenation patterns for american, french, german, ngerman, n
   ohyphenation, loaded.
   (/usr/local/teTeX/share/texmf/tex/context/base/supp-mis.tex
   loading : Context Support Macros / Missing
   ) (/usr/local/teTeX/share/texmf/tex/context/base/supp-fil.tex
   loading : Context Support Macros / Files
   ! Incomplete \ifx; all text was ignored after line 77.
   <inserted text> 
   		   \fi 
   <to be read again> 
   		      \newread 
   l.77 \ifx\undefined\scratchread  \newread
   					     \scratchread  \fi

Is it possible to use supp-fil this way in order to make use of the
\doiffileelse macro in a plain tex source?

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: use supp-fil in plain tex
  2000-03-10 16:51 use supp-fil in plain tex Ed L. Cashin
@ 2000-03-12 10:43 ` Hans Hagen
  2000-03-13 20:49   ` Ed L. Cashin
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2000-03-12 10:43 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

At 11:51 AM 3/10/2000 -0500, Ed L. Cashin wrote:

> ...
>
>      counter variable i = 1
>      while exists file myfile.i
>            include figure from myfile.i
>            increment i
>      done
>
>I know that loops can be done in plain TeX with the \loop macro, and I
>saw the "\doiffileelse" macro in supp-fil.tex.  I'm trying to use it
>like this:
>
>    \input supp-mis
>    \input supp-fil
>    
>    \newcount\iterator\iterator=1
>    \newif\ifNotDone\NotDonetrue
>    
>    \loop\ifNotDone
>      \doiffileelse{sumvouch\iterator}
>    	    {\placeFgBg{sumvouch.\iterator}\advance\iterator by 1}
>    	    {\NotDonefalse}
>    \fi\repeat
>
>... which may or may not be the right way to write the loop, but I get
>errors like this while supp-fil is loading:

Plain's \loop is rather fragile. 

\input syst-gen.tex
\input syst-ext.tex 
\input supp-fil.tex

\doloop
  {\doiffileelse{sumvouch.\recurselevel}
     {\placeFgBg{sumvouch.\iterator}}
     {\exitloop}}

or 

\dorecurse{134}{\placeFgBg{sumvouch.\recurselevel}}

(or \dostepwiserecurse... etc)

There's a lot of low level stuff in those files. The recurse macros can be
nested. 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: use supp-fil in plain tex
  2000-03-12 10:43 ` Hans Hagen
@ 2000-03-13 20:49   ` Ed L. Cashin
  2000-03-13 21:54     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Ed L. Cashin @ 2000-03-13 20:49 UTC (permalink / raw)


First of all, I should say that my context is not the latest.  It's
not so old, though.  It was in teTeX 1.0.6 and has a couple of things
in cont-new that were added subsequently.

Hans Hagen <pragma@wxs.nl> writes:

> At 11:51 AM 3/10/2000 -0500, Ed L. Cashin wrote:
...
> >I know that loops can be done in plain TeX with the \loop macro, and I
> >saw the "\doiffileelse" macro in supp-fil.tex.  I'm trying to use it
> >like this:
...
> 
> Plain's \loop is rather fragile. 
> 
> \input syst-gen.tex
> \input syst-ext.tex 
> \input supp-fil.tex

I tried including those files, but \beginTEX was not defined, so I
looked for that macro and added "\input syst-tex".  But then
"\forgetall" was undefined, so I added "\input supp-mis".

Even then, \forgetall was undefined when supp-pdf was loading.

This is what I'm doing now:

    \input syst-tex			% for \beginTEX
    \input syst-gen
    \input supp-mis			% for \forgetall
    \input syst-ext
    \input supp-fil
    \input supp-pdf			% no \forgetall -- don't know why.

> \doloop
>   {\doiffileelse{sumvouch.\recurselevel}
>      {\placeFgBg{sumvouch.\iterator}}
>      {\exitloop}}

I like that.  I assume that I should replace "\iterator" with another
"\recurselevel". 

--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: use supp-fil in plain tex
  2000-03-13 20:49   ` Ed L. Cashin
@ 2000-03-13 21:54     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2000-03-13 21:54 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

Hi Ed, 

>This is what I'm doing now:
>
>    \input syst-tex			% for \beginTEX
>    \input syst-gen
>    \input supp-mis			% for \forgetall
>    \input syst-ext
>    \input supp-fil
>    \input supp-pdf			% no \forgetall -- don't know why.

supp-mis loads everything latex users need when using supp-pdf 

You can comfortably load most syst's and supp's (same order as in context.tex

>> \doloop
>>   {\doiffileelse{sumvouch.\recurselevel}
>>      {\placeFgBg{sumvouch.\iterator}}
>>      {\exitloop}}
>
>I like that.  I assume that I should replace "\iterator" with another
>"\recurselevel". 

Indeed. I suggest you take a look at syst-gen.tex, syst-ext.tex and
supp-box.tex. They have --if I may say so-- some nice auxiliary macros. 

Hans  

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-03-13 21:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-10 16:51 use supp-fil in plain tex Ed L. Cashin
2000-03-12 10:43 ` Hans Hagen
2000-03-13 20:49   ` Ed L. Cashin
2000-03-13 21:54     ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).