Jesteś w: Start / Przedsięwzięcia/Projects / TeX Pearls / 2006 Pearls / taco-hoekwater / bachotex2006-taco-hoekwater-pearl1.tex

bachotex2006-taco-hoekwater-pearl1.tex

TeX document icon bachotex2006-taco-hoekwater-pearl1.tex — TeX document, 1 KB (1254 bytes)

Zawartość pliku

%%% Taco Hoekwater: 4 endless lines
% The end of a line in an \input-ed file normally creates a space in the output,
% TeX appends a character with the current value of \endlinechar to each that
% character is later converted to a space.

\immediate\write18
  {echo -n Y >bla.tex}
X\input bla Z
% gives XY Z

% If you do not want that space, for instance because you want to typeset the
% of the file in-line, then there are a number of options. Two are usable
% writing, and two others during type reading.

% 1. Writing a percent sign to the end of the line works

\immediate\write18
  {echo -n Y\letterpercent >bla.tex}
X\input bla Z
% gives XYZ

% 2. Another option is ending the written line with \relax or a similar
% space-gobbling command.

\immediate\write18
  {echo -n Y\letterbackslash\letterbackslash relax >bla.tex}
X\input bla Z
% gives XY\relax Z

% 3. Temporarily setting \endlinechar to an impossible value like -1 is a possibility

\immediate\write18
  {echo -n Y >bla.tex}
X{\endlinechar=-1 \input bla }Z
% gives XYZ

% 4. Changing the catcode of the current \endlinechar to 9 (ignored) also works

\immediate\write18
  {echo -n Y >bla.tex}
X{\catcode'\^^M=9 \input bla }Z
% gives XYZ

\end