On Jan 26, 2007, at 15:39, Mojca Miklavec wrote:

> On 1/26/07, Hans van der Meer wrote:
>>
>> On Jan 25, 2007, at 13:48, Mojca Miklavec wrote:
>>>
>>> I don't know how to solve the problem you describe, but you can
>>> circumvent it by replacing
>>>     textext("\tts 66\%~")
>>> by
>>>     \sometxt{\tts 66\%~}
>>> It will also run much faster and more efficient.
>>>
>>> Mojca
>>
>>
>> Thanks. This helps, allthough I need to use \textext instead of
>> \sometxt.
>> The reason being that the picture returned in \textext is processed
>> further by the homemade Labelmacro for placement which I use for
>> global color settings of various elements of the drawing.
>> My confusion was with MetaFun's textext macro and TeX's \textext (and
>> \sometext) macro.
>
> But then I have a question for you: can you please explain in more
> details what \textext can do that \sometxt can't? (I didn't really
> understand your description.)
>
> I didn't understand your problem, but does it make any difference  
> if you set
> \chardef\TeXtextcolormode\zerocount
> at the top of your document? (In the case that you have problems  
> with colors.)

Let me explain why I have still need for \textext and textext.
I think there is room for all of these: textext, \textext, \sometxt.
For the use of \textext see my Label-macro in MetaPost below:

> %     =========================== Labels ===========================
> % Produce labels, shifted to their intended places.
> % Text at specific point possibly rotated, shifted, scaled, colored.
> % In contrast to plain.mf we do not solely use fixed (3bp)  
> labeloffset,
> % but add half the width and/or height of the current pen.
> % labeltext = Lab.xx(string) [scaled,shifted] or picture
> % pos       = point where to place text
>
> % Label(string/textext(string))
> vardef [EMAIL PROTECTED](expr labeltext) = [EMAIL PROTECTED](labeltext, 
> origin) enddef;
>
> % Label(string/textext(string), center) (label = synonym)
> def Label = draw theLabel enddef;
>
> % Label with text and centerposition
> vardef [EMAIL PROTECTED](expr labeltext, pos) =
>       save pic; picture pic;
>       if picture labeltext:
>               pic := labeltext;
>       else:
>               if labeltext = "":
>                       pic := nullpicture;
>               else:
>                       % prevent wobbling of text boxes with uneven depth
>                       pic := 
> textext("\setbox0=\hbox{"&labeltext&"}\dp0=0pt\box0");
>               fi
>       fi
>       
>       % calculate labelshift from suffix
>       save shift; pair shift;
>       shift = ((penX/2 + labeloffset) * xpart [EMAIL PROTECTED],
>                               (penY/2 + labeloffset) * ypart [EMAIL 
> PROTECTED])
>                               - ([EMAIL PROTECTED] * lrcorner pic + [EMAIL 
> PROTECTED] * ulcorner pic
>                               + (1 - [EMAIL PROTECTED] - [EMAIL PROTECTED]) * 
> llcorner pic);
>
>       % deliver picture shifted in position
>       pic shifted (pos + shift)
> enddef;
> %     =========================== end of Labels  
> ===========================

Using Label("a string", position) is mostly used. It allows one for  
example to concatenate strings in the MetaPost code, insert the value  
of numeric MetaPost variables within the string, etc.
However when textext fails (notably the use of \%, but I have seen  
others) I use \textext. The crux here is the fact that it returns a  
MetaPost picture; the code tests for this type on the labeltext  
parameter. At first I tried \sometxt but that didn't work. I didn't  
pursue the causes much further, but I suspect that it does not return  
a picture.

I will look into your new MyWay on \sometxt over the weekend.

Hans van der Meer


_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to