[OS X TeX] Loop in tabular environment

Ross Moore ross at ics.mq.edu.au
Fri Apr 16 20:37:53 EDT 2004


On 17/04/2004, at 1:39 AM, Œistein Andersen wrote:

> I have a problem with the following loop, which reads lines from a 
> file:
>
> \loop
>     \ifeof1 \encorefalse \fi
> \ifencore
>     \read1 to \ligne
>     % TREATMENT OF \ligne
>     % OUTPUT
> \repeat
>
> This loop works correctly. However, if I put it into a "tabular" 
> environment and use "&" or "\cr", the loop will end. Apparently, the 
> loop cannot exceed one "cell" of the table. Is this correct? Is there 
> a simple solution, or should I rather write this using another 
> language than TeX?

If you want the high-quality typesetting, then of course you should use 
TeX.

Presumably you have tried to read the lines from within a tabular
environment, which is then just taking place within the 1st cell.

An easier way to read data from a file, into a table,
is to preprocess (a copy of) the data-file to contain all
of the markup for the table. In practice this can be done
quite easily using a spreadsheet, allowing you to insert
columns of & and \cr characters.

Then use \input to read the preprocessed data as normal TeX source
containing the whole table, rather than \read it line-by-line
and trying to program how each piece should be handled.



>
> Thank you for any help.

Hope this helps,

	Ross


>
> -- 
> Øistein Andersen
> -----------------------------------------------------
> Please see <http://www.esm.psu.edu/mac-tex/> for list
> guidelines, information, and LaTeX/TeX resources.
>
>
>
>
------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114
------------------------------------------------------------------------

-----------------------------------------------------
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.





More information about the MacOSX-TeX mailing list