* \input introduces space
@ 2006-02-28 15:55 Peter Münster
2006-02-28 16:12 ` Taco Hoekwater
0 siblings, 1 reply; 6+ messages in thread
From: Peter Münster @ 2006-02-28 15:55 UTC (permalink / raw)
Hello,
\input seems to introduce a space. Example:
\starttext
\immediate\write18{echo -n X >bla.tex}
X\input bla\relax X
\stoptext
How could I get rid of this space?
Cheers, Peter
--
http://pmrb.free.fr/contact/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: \input introduces space
2006-02-28 15:55 \input introduces space Peter Münster
@ 2006-02-28 16:12 ` Taco Hoekwater
2006-02-28 16:22 ` Taco Hoekwater
2006-02-28 18:04 ` Hans Hagen
0 siblings, 2 replies; 6+ messages in thread
From: Taco Hoekwater @ 2006-02-28 16:12 UTC (permalink / raw)
Hi Peter,
Not the \input command, but the end-of-line in the inputted file
is creating the space, indirectly. TeX normally appends a character
with the current value of \endlinechar to each line of an input-ed
file, and that character is later converted to a space.
Setting \endlinechar to -1 temporarily is a possibility, another
is writing a percent sign to the end of the line, yet another is
ending the written line with \relax (or a similar space-gobbling
command), and finally changing the catcode of the current
\endlinechar to 9 (ignored) also works.
Cheers, Taco
Peter Münster wrote:
> Hello,
> \input seems to introduce a space. Example:
>
> \starttext
> \immediate\write18{echo -n X >bla.tex}
> X\input bla\relax X
> \stoptext
>
> How could I get rid of this space?
>
> Cheers, Peter
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: \input introduces space
2006-02-28 16:12 ` Taco Hoekwater
@ 2006-02-28 16:22 ` Taco Hoekwater
2006-02-28 17:24 ` Peter Münster
2006-02-28 18:04 ` Hans Hagen
1 sibling, 1 reply; 6+ messages in thread
From: Taco Hoekwater @ 2006-02-28 16:22 UTC (permalink / raw)
Taco Hoekwater wrote:
> Setting \endlinechar to -1 temporarily is a possibility, another
> is writing a percent sign to the end of the line, yet another is
> ending the written line with \relax (or a similar space-gobbling
> command), and finally changing the catcode of the current
> \endlinechar to 9 (ignored) also works.
Here is a file demonstrating all four:
\starttext
% 1
\immediate\write18{echo -n X >bla1.tex}
X{\endlinechar=-1 \input bla1 }X
% 2
\immediate\write18{echo -n X\letterpercent >bla2.tex}
X\input bla2 X
% 3
\immediate
\write18
{echo -n X\letterbackslash\letterbackslash relax >bla3.tex}
X\input bla3 X
% 4
\immediate\write18{echo -n X >bla4.tex}
X{\catcode`\^^M=9 \input bla4 }X
\stoptext
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: \input introduces space
2006-02-28 16:22 ` Taco Hoekwater
@ 2006-02-28 17:24 ` Peter Münster
0 siblings, 0 replies; 6+ messages in thread
From: Peter Münster @ 2006-02-28 17:24 UTC (permalink / raw)
On Tue, 28 Feb 2006, Taco Hoekwater wrote:
> Taco Hoekwater wrote:
> > Setting \endlinechar to -1 temporarily is a possibility, another
> > is writing a percent sign to the end of the line, yet another is
> > ending the written line with \relax (or a similar space-gobbling
> > command), and finally changing the catcode of the current
> > \endlinechar to 9 (ignored) also works.
>
> Here is a file demonstrating all four:
Hello Taco,
thanks a lot for your solutions, one can even omit the "-n" now!
Cheers, Peter
--
http://pmrb.free.fr/contact/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: \input introduces space
2006-02-28 16:12 ` Taco Hoekwater
2006-02-28 16:22 ` Taco Hoekwater
@ 2006-02-28 18:04 ` Hans Hagen
2006-02-28 19:33 ` Peter Münster
1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2006-02-28 18:04 UTC (permalink / raw)
Taco Hoekwater wrote:
> Hi Peter,
>
> Not the \input command, but the end-of-line in the inputted file
> is creating the space, indirectly. TeX normally appends a character
> with the current value of \endlinechar to each line of an input-ed
> file, and that character is later converted to a space.
>
> Setting \endlinechar to -1 temporarily is a possibility, another
> is writing a percent sign to the end of the line, yet another is
> ending the written line with \relax (or a similar space-gobbling
> command), and finally changing the catcode of the current
> \endlinechar to 9 (ignored) also works.
>
> Cheers, Taco
>
> Peter M�nster wrote:
>
>> Hello,
>> \input seems to introduce a space. Example:
>>
>> \starttext
>> \immediate\write18{echo -n X >bla.tex}
>> X\input bla\relax X
>> \stoptext
>>
>> How could I get rid of this space?
>>
>> Cheers, Peter
>>
>>
in addition to taco's answers:
X\ignorespaces \input bla\relax \removeunwantedspaces X
can help you out;
btw, can you wikify taco's response? somewhere under 'how tex reads input'; in due time we can then add some additional info about how scantokens etc behave (everyeof stuff and such)
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.com
| www.pragma-pod.nl
-----------------------------------------------------------------
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-02-28 19:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-28 15:55 \input introduces space Peter Münster
2006-02-28 16:12 ` Taco Hoekwater
2006-02-28 16:22 ` Taco Hoekwater
2006-02-28 17:24 ` Peter Münster
2006-02-28 18:04 ` Hans Hagen
2006-02-28 19:33 ` Peter Münster
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).