[texhax] [solved] Re: Issue about `~' character

Rodolfo Medina rodolfo.medina at gmail.com
Fri Sep 30 22:12:00 CEST 2016


David Carlisle <d.p.carlisle at gmail.com> writes:

> On 30 September 2016 at 20:32, Rodolfo Medina <rodolfo.medina at gmail.com> wrote:
>> David Carlisle <d.p.carlisle at gmail.com> writes:
>>
>>> On 30 September 2016 at 19:31, Rodolfo Medina <rodolfo.medina at gmail.com>
>>> wrote:
>>>> David Carlisle <d.p.carlisle at gmail.com> writes:
>>>>
>>>> Fantastic, that works in my case.  In this case you need three \string s.
>>>> I couldn't imagine.  I had tried with two.
>>>
>>> don't think of it as three \string, its, just two tokens each preceded
>>> by \string so it gets written verbatim.
>>> You want your input file to have
>>>
>>> \string
>>> ~
>>> so to write that you can put \string before each token
>>>
>>> \sting\string
>>> \string~
>>>
>>>
>>> so it just more or less coincidentally ends up with three adjacent \string
>>
>>
>> I seem to understand...  Then when I put two \string 's before `~' what
>> happened?  How did TeX read and expand that?
>
> \string\string
>
> writes \string to the file and then ~ just writes what it would have
> written anyway as it isn't prefixed by anything so you get
>
> \string\penalty \@M \
>
> so when you read that back  the \string applies to \penalty so it
> typesets \penalty then quibbles about \@M unless you are in math mode.


Clear now.  This explains a lot about the use of \string.  Thanks for this very
instructive lesson of `TeX'.

Rodolfo



More information about the texhax mailing list