[Scilab-users] example for xstringl fontId argument with latex-rendered strings

Philipp Mühlmann p.muehlmann at gmail.com
Fri May 23 10:23:05 CEST 2014


the "2" stands for the font ID...hence you should be able to change
font style by entering a different number there..see the help page

The $-sign in the str = (...) defines that the string is drawn in LaTeX mode.

note that there are at least two modes to write LaTeX

- a text mode
- a math mode

using just  the $-sign will enable LaTeX format but in math mode.
hence white space won't be drawn


using "$\mbox{}$" enables LaTeX mode (the $-sign), but now everything
that is written in between the brackets of \mbox{} is written in text
mode...hence white space is also drawn.


You may try following example code:
As you may recognize I used the gce() command to change the font style.
I do this because changing the font style within xstringl() somehow
doesn't work for me.




plot2d([0;1],[0;1],0);
// Only valid from Scilab 5.2

str1=["simple text"] ;

str2=["$\mbox{LaTeX format in text mode}$" ; "" ; "" ; "$LaTeX format
in mathmode$"] ;


r1 = xstringl(0.1,0.1,str1,2,4);
r2 = xstringl(0.1,0.4,str2);

xrects([r1(1) r1(2)+r1(4) r1(3) r1(4)]');       // computes rectangle
around string
xstring(r1(1),r1(2),str1);

xrects([r2(1) r2(2)+r2(4) r2(3) r2(4)]');       // computes rectangle
around string
xstring(r2(1),r2(2),str2);

// use just xstring

xstring(0.5,0.2,str2,0,1);       // computes as well rectangle around
string, since angle = 0 deg
xstring(0.5,0.5,str2,0,0);      // no rectangle asince bounding box value = 0

xstring(0.5,0.7,str2,-10,1);    // no rectangle around string since
angle = -45deg
e = gce();
e.font_style = 2;
e.font_size = 4;
e.box = 'on' ;

xstring(0.5,0.1,str1);
e = gce();
e.font_style = 2;
e.font_size = 4;
e.box = 'on' ;

2014-05-23 2:23 GMT+02:00, Adrien Vogt-Schilb <vogt at centre-cired.fr>:
> Thanks
>
> Actually i'd like to know if in the following the  "2" stands for "I am
> using Latex/MathML" .
> Calixte?
>
> str=["SCILAB","can write LaTeX :","$\frac{abc}{xyz}$";"or","MathML
> :",mathml]  ;
> r2  =  xstringl(0.5,0.5,str,2,5)
>
>
> Adrien
>
>
>
> On 22/05/2014 17:33, Philipp Mühlmann wrote:
>> I just checked the help page
>>
>> http://help.scilab.org/docs/5.3.3/en_US/xstringl.html
>>
>> The last example deals with strings in LaTeX format.
>>
>> Does this help?
>>
>> Cheers,
>> Phil
>>
>> 2014-05-22 17:54 GMT+02:00 Adrien Vogt-Schilb
>> <adrien.vogt.schilb at gmail.com>:
>>> Hi
>>>
>>> Does anyone have an example fo using xstringl with Latex-rendered
>>> strings?
>>>
>>> Thanks
>>>
>>> Adrien
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>>
>>
>
>
> --
> Adrien Vogt-Schilb
> Consultant (World Bank) and PhD Candidate (Cired)
> 1 202 473 7980
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>


-- 
There we have the salad.



More information about the users mailing list