Re: spurious space in \sometxt

0 views
Skip to first unread message

Mojca Miklavec

unread,
Aug 11, 2006, 4:03:14 AM8/11/06
to gnuplot...@googlegroups.com
On 8/11/06, Taco Hoekwater wrote:
> Mojca Miklavec wrote:
> > Hello Hans and Taco,
> >
> > any idea where the additional space at the end comes from?
>
> It is caused by the line ending change. Something I'd forgotten
> about \scantokens is that it is *exactly* like a file, including
> the end of line processing. :-/
>
> Nasty problem, because that makes our handing \endlinechar a
> bit unwieldy. Maybe there is a way out, though:
>
> \let\normalscantokens\scantokens
> \def\scantokens#1{{\endlinechar-1 \normalscantokens{#1}}}

Wow! I checked for missing '%' or some spaces ... I couldn't imagine
that the problem was lying so deep that it needed redefinition of a
primitive.

It works on this simple test case, but I have no idea about the impact
of this to the rest of functionality in TeX. Where should this
definition go? To meta-tex.tex?

> > \starttext
> > \startMPcode
> > picture a; a := \sometxt{\framed{x}};
> > draw a;
> > draw bbox a;
> > \stopMPcode
> > \stoptext

Two additional questions:

- Which parameter is responsible for those additional 3(?) points
around \sometxt{...}? (but it's not so important at the moment)

- I somehow managed to find out how most of things can be implemented
in the way I wanted them to be, but I'm still a bit lost about how to
do some additional high-level definitions for \sometxt:

\startMPcode
\GPsetfont[iwona,ss,7pt]
\GPtext{whatever}
\GPsetfont[] % or \GPresetfont
\GPtext{some_dirty$characters}
\stopMPcode

\GPtext#1 should be able to:
- switch to the last font defined in \GPsetfont and then use
\sometxt{\fontswitching\strut #1}
- many demos have '_', '%' and '$' present in lables. I woud like to
provide a switch (labels=tex|literal or something similar) to make
everything inside \GPtext{...} to behave literally (as if it was
\type-d).

I might figure out how to do the first one after a lot of time and
after extensive playing with meta-tex, but I have no idea where to
start to solve the last problem.

Thanks a lot,
Mojca

Taco Hoekwater

unread,
Aug 11, 2006, 4:21:25 AM8/11/06
to gnuplot...@googlegroups.com

Mojca Miklavec wrote:
> It works on this simple test case, but I have no idea about the impact
> of this to the rest of functionality in TeX. Where should this
> definition go? To meta-tex.tex?

Dont use it, we will try to fix this another way, because this
redefinition would potentially break other stuff.

Taco

Hans Hagen

unread,
Aug 11, 2006, 4:31:07 AM8/11/06
to gnuplot...@googlegroups.com
Mojca Miklavec wrote:
> On 8/11/06, Taco Hoekwater wrote:
>
>> Mojca Miklavec wrote:
>>
>>> Hello Hans and Taco,
>>>
>>> any idea where the additional space at the end comes from?
>>>
>> It is caused by the line ending change. Something I'd forgotten
>> about \scantokens is that it is *exactly* like a file, including
>> the end of line processing. :-/
>>
>> Nasty problem, because that makes our handing \endlinechar a
>> bit unwieldy. Maybe there is a way out, though:
>>
>> \let\normalscantokens\scantokens
>> \def\scantokens#1{{\endlinechar-1 \normalscantokens{#1}}}
>>
>
> Wow! I checked for missing '%' or some spaces ... I couldn't imagine
> that the problem was lying so deep that it needed redefinition of a
> primitive.
>
oh, if you want a nightmare, read the thread between taco, bernd and me,
and previously between taco, phil and me ... scantokens is not what you
think it is

> It works on this simple test case, but I have no idea about the impact
> of this to the rest of functionality in TeX. Where should this
> definition go? To meta-tex.tex?
>

no, use the patch i sent you, overloading scantokens is tricky; it needs
a real fix


>
>>> \starttext
>>> \startMPcode
>>> picture a; a := \sometxt{\framed{x}};
>>> draw a;
>>> draw bbox a;
>>> \stopMPcode
>>> \stoptext
>>>
>
> Two additional questions:
>
> - Which parameter is responsible for those additional 3(?) points
> around \sometxt{...}? (but it's not so important at the moment)
>
>

\framed[offset=overlay]{x}

> - I somehow managed to find out how most of things can be implemented
> in the way I wanted them to be, but I'm still a bit lost about how to
> do some additional high-level definitions for \sometxt:
>
> \startMPcode
> \GPsetfont[iwona,ss,7pt]
> \GPtext{whatever}
> \GPsetfont[] % or \GPresetfont
> \GPtext{some_dirty$characters}
> \stopMPcode
>
> \GPtext#1 should be able to:
> - switch to the last font defined in \GPsetfont and then use
> \sometxt{\fontswitching\strut #1}
> - many demos have '_', '%' and '$' present in lables. I woud like to
> provide a switch (labels=tex|literal or something similar) to make
> everything inside \GPtext{...} to behave literally (as if it was
> \type-d).
>
> I might figure out how to do the first one after a lot of time and
> after extensive playing with meta-tex, but I have no idea where to
> start to solve the last problem.
>

the savest route is to add some code to gnuplot that escapes those
chars, i.e. \$ \_ etc

moving around arguments and rescanning is tricky

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
-----------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages