I would like to write something like:
\foreach \myline in {\input{filehandle}}
{\dosomethingwith\myline}
If I have an outside_file.tex:
this,
is,
the content, of, a
file
and then try to pass it to a \foreach loop as follows
\documentclass{article}
\usepackage{pgffor}
\newcommand\dosomethingwith[1]{\textbf{#1}\par}
\begin{document}
Output as expected:\par
\foreach \myitem in {this,is,the content, of, a file}
{\dosomethingwith\myitem}
Output not as expected:\par
\foreach \myitem in {\input{outside_file}}
{\dosomethingwith\myitem}
\end{document}
I do not get the result I expect.
Here's an image of the result:

I once saw some package for loading and storing the content of a file in a macro. But I can no longer find that package. If you know the package I am referring to, I would accept since that will solve the problem I'm having here.


catchfile. But, I would nevertheless be interested in someone explaining why I can't just directly use\input{...}as I have above. – A.Ellett Sep 20 '14 at 01:37textmerg. Is that new? I haven't updated my LaTeX installation since about July. – A.Ellett Sep 20 '14 at 02:05