Narzędzia osobiste

Jesteś w: bachotex2006-bernd-raichle-pearl3.tex

# bachotex2006-bernd-raichle-pearl3.tex

bachotex2006-bernd-raichle-pearl3.tex — TeX document, 1 KB (1022 bytes)

## Zawartość pliku

%%% Bernd Raichle: \input file inside a macro definition.
% If you have a file and want to read its contents in a macro definition, TeX
% does not allow to simply use
%
% \edef\foo{\input file }
%
% because at the end of a file TeX checks if you are inside an incomplete \if
% statement or \def macro definition and outputs the error message
%
% ! File ended while scanning text/definition of ...
%
% Nonetheless there is a non-trivial way to avoid this error message:

\immediate\openout15=bt-pp-r4.tex
\immediate\write15{Another TeX}
\immediate\write15{Pearl\string\noexpand}
\immediate\closeout15

\edef\foo{Yet \input bt-pp-r4.tex !}
\message{\meaning\foo}

% The primitive \noexpand does all the magic and you will get
%
% macro:->Yet Another TeX Pearl!
%
% without any error message.
%
% {\bf Question:} Why has \noexpand this effect?
%
% If you are using e-TeX, you can set its new special token list \everyeof to
% \noexpand to achieve this effect without changing the file.

\end


Akcje Dokumentu