* Bug #13432 fixed - xstringl help page was not clear about fonts and Latex-rendered...
[scilab.git] / scilab / modules / graphics / help / en_US / text / xstringl.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) ENPC - Jean-Philippe Chancelier
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
11  *
12  -->
13 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" xml:id="xstringl">
14     <refnamediv>
15         <refname>xstringl</refname>
16         <refpurpose>compute a box which surrounds
17             strings
18         </refpurpose>
19     </refnamediv>
20     <refsynopsisdiv>
21         <title>Calling Sequence</title>
22         <synopsis>rect=xstringl(x,y,str,[fontId,fontSize])</synopsis>
23     </refsynopsisdiv>
24     <refsection>
25         <title>Arguments</title>
26         <variablelist>
27             <varlistentry>
28                 <term>rect</term>
29                 <listitem>
30                     <para>vector of 4 real scalars defining the box.</para>
31                 </listitem>
32             </varlistentry>
33             <varlistentry>
34                 <term>x,y</term>
35                 <listitem>
36                     <para>real scalars, coordinates of the lower-left point of the
37                         strings.
38                     </para>
39                 </listitem>
40             </varlistentry>
41             <varlistentry>
42                 <term>str</term>
43                 <listitem>
44                     <para>matrix of strings.</para>
45                     <para>
46                         Starting from Scilab 5.2, it is possible to write <link linkend="math_rendering_features_in_graphic">LaTeX or MathML expression</link>.
47                     </para>
48                 </listitem>
49             </varlistentry>
50             <varlistentry>
51                 <term>fontId</term>
52                 <listitem>
53                     <para>an integer specifying the font type. For more information, see <link linkend="graphics_fonts">graphics_fonts</link></para>
54                 </listitem>
55             </varlistentry>
56             <varlistentry>
57                 <term>fontSize</term>
58                 <listitem>
59                     <para>an integer specifying the font size. For more information, see <link linkend="graphics_fonts">graphics_fonts</link></para>
60                 </listitem>
61             </varlistentry>
62         </variablelist>
63     </refsection>
64     <refsection>
65         <title>Description</title>
66         <para>
67             <literal>xstringl</literal> returns in <literal>rect=[x,y,w,h]</literal>
68             (upper-left point, width, height) the size of a rectangle in the current
69             graphic scale which would surround the strings <literal>str</literal> drawn at
70             location <literal>x,y</literal> (lower-left point).
71         </para>
72         <para>The result can be approximative when using the Postscript driver.</para>
73     </refsection>
74     <refsection>
75         <title>Examples</title>
76         <programlisting role="example">
77 <![CDATA[ 
78 plot2d([0, 1], [0, 1], 0);
79 str = ["$\underleftrightarrow{Scilab}$" "is"; "not" "elisaB"]; // Only valid from Scilab 5.2
80 r = xstringl(0.5, 0.7, str);
81 xrects([r(1) r(2)+r(4) r(3) r(4)]');
82 xstring(r(1), r(2), str);
83
84 str = ["Scilab" "is"; "not" "Matlab"];
85 r2 = xstringl(0.2, 0.2, str, 5, 7);
86 xrects([r2(1) r2(2)+r2(4) r2(3) r2(4)]');
87 xstring(r2(1), r2(2), str)
88 txt = gce();
89 txt.font_size = 7;
90 txt.font_style = 5;
91  ]]>
92         </programlisting>
93             <scilab:image>
94 <![CDATA[ 
95 plot2d([0, 1], [0, 1], 0);
96 str = ["$\underleftrightarrow{Scilab}$" "is"; "not" "elisaB"]; // Only valid from Scilab 5.2
97 r = xstringl(0.5, 0.7, str);
98 xrects([r(1) r(2)+r(4) r(3) r(4)]');
99 xstring(r(1), r(2), str);
100
101 str = ["Scilab" "is"; "not" "Matlab"];
102 r2 = xstringl(0.2, 0.2, str, 5, 8);
103 xrects([r2(1) r2(2)+r2(4) r2(3) r2(4)]');
104 xstring(r2(1), r2(2), str)
105 txt = gce();
106 txt.font_size = 8;
107 txt.font_style = 5;
108  ]]>
109             </scilab:image>
110         <programlisting role="example">
111 <![CDATA[
112 plot2d([0, 1], [0, 1], 0);
113 // Only valid from Scilab 5.2
114 mathml = "<mrow>" +.. 
115             "<mfrac>" +..
116                 "<mrow>" +.. 
117                     "<mi> d </mi>" +.. 
118                     "<mi> y </mi>" +..  
119                 "</mrow>" +..
120                 "<mrow>" +..
121                     "<mi>d</mi>" +..
122                     "<mi>x</mi>" +..
123                 "</mrow>" +..
124             "</mfrac>" +..
125                 "<mo> = </mo>" +..
126             "<mfrac>" +..
127                 "<mn> 1 </mn>" +..
128                 "<msup>" +..
129                     "<mi> y </mi>" +..
130                     "<mn> 2 </mn>" +..
131                 "</msup>" +..
132             "</mfrac>" +..
133          "</mrow>";
134 str=["SCILAB", "can write LaTeX :", "$\frac{abc}{xyz}$"; "or", "MathML :", mathml]; 
135 r2 = xstringl(0.2, 0.4, str, 10, 4);
136 xrects([r2(1) r2(2)+r2(4) r2(3) r2(4)]');
137 xstring(r2(1), r2(2), str);
138 txt = gce();
139 txt.font_size = 4;
140 txt.font_style = 10;
141  ]]>
142         </programlisting>
143             <scilab:image>
144                 <![CDATA[
145 plot2d([0, 1], [0, 1], 0);
146 // Only valid from Scilab 5.2
147 mathml = "<mrow>" +.. 
148             "<mfrac>" +..
149                 "<mrow>" +.. 
150                     "<mi> d </mi>" +.. 
151                     "<mi> y </mi>" +..  
152                 "</mrow>" +..
153                 "<mrow>" +..
154                     "<mi>d</mi>" +..
155                     "<mi>x</mi>" +..
156                 "</mrow>" +..
157             "</mfrac>" +..
158                 "<mo> = </mo>" +..
159             "<mfrac>" +..
160                 "<mn> 1 </mn>" +..
161                 "<msup>" +..
162                     "<mi> y </mi>" +..
163                     "<mn> 2 </mn>" +..
164                 "</msup>" +..
165             "</mfrac>" +..
166          "</mrow>";
167 str=["SCILAB", "can write LaTeX :", "$\frac{abc}{xyz}$"; "or", "MathML :", mathml]; 
168 r2 = xstringl(0.2, 0.4, str, 10, 4);
169 xrects([r2(1) r2(2)+r2(4) r2(3) r2(4)]');
170 xstring(r2(1), r2(2), str);
171 txt = gce();
172 txt.font_size = 4;
173 txt.font_style = 10;
174  ]]>
175             </scilab:image>
176     <programlisting>
177 <![CDATA[
178 plot2d([0, 6],[0, 6], 0);
179 str=["$\underleftrightarrow{\tiny{Scilab}}$"; "$\underleftrightarrow{\scriptsize{Scilab}}$";   
180      "$\underleftrightarrow{\footnotesize{Scilab}}$"; "$\underleftrightarrow{\small{Scilab}}$"; 
181      "$\underleftrightarrow{\normalsize{Scilab}}$"; "$\underleftrightarrow{\large{Scilab}}$";
182      "$\underleftrightarrow{\Large{Scilab}}$"; "$\underleftrightarrow{\LARGE{Scilab}}$";
183      "$\underleftrightarrow{\huge{Scilab}}$"; "$\underleftrightarrow{\Huge{Scilab}}$"];
184 r = xstringl(0.5, 0.5, str, 5, 3);
185 xrects([r(1); r(2)+r(4); r(3); r(4)]);
186 xstring(r(1), r(2), str);
187 txt = gce();
188 txt.font_size = 3;
189 txt.font_style = 5;
190 txt.font_color = 2;
191
192 str = ["${\tiny{\frac{x}{y}}$", "${\scriptsize{\frac{x}{y}}$", ..
193        "${\footnotesize{\frac{x}{y}}$", "${\small{\frac{x}{y}}$", ..
194        "${\normalsize{\frac{x}{y}}$", "${\large{\frac{x}{y}}$", ..
195        "${\Large{\frac{x}{y}}$", "${\LARGE{\frac{x}{y}}$", ..
196        "${\huge{\frac{x}{y}}$", "$\Huge{\frac{x}{y}}$"];
197 r = xstringl(2, 0.5, str, 0, 3);
198 xrects([r(1); r(2)+r(4); r(3); r(4)]);
199 xstring(r(1), r(2), str);
200 txt = gce();
201 txt.font_size = 3;
202 txt.font_style = 0;
203 txt.font_color = 2;
204 ]]>    
205         </programlisting>
206             <scilab:image>
207 <![CDATA[
208 plot2d([0, 6],[0, 6], 0);
209 str=["$\underleftrightarrow{\tiny{Scilab}}$"; "$\underleftrightarrow{\scriptsize{Scilab}}$";   
210      "$\underleftrightarrow{\footnotesize{Scilab}}$"; "$\underleftrightarrow{\small{Scilab}}$"; 
211      "$\underleftrightarrow{\normalsize{Scilab}}$"; "$\underleftrightarrow{\large{Scilab}}$";
212      "$\underleftrightarrow{\Large{Scilab}}$"; "$\underleftrightarrow{\LARGE{Scilab}}$";
213      "$\underleftrightarrow{\huge{Scilab}}$"; "$\underleftrightarrow{\Huge{Scilab}}$"];
214 r = xstringl(0.5, 0.5, str, 5, 3);
215 xrects([r(1); r(2)+r(4); r(3); r(4)]);
216 xstring(r(1), r(2), str);
217 txt = gce();
218 txt.font_size = 3;
219 txt.font_style = 5;
220 txt.font_color = 2;
221
222 str = ["${\tiny{\frac{x}{y}}$", "${\scriptsize{\frac{x}{y}}$", ..
223        "${\footnotesize{\frac{x}{y}}$", "${\small{\frac{x}{y}}$", ..
224        "${\normalsize{\frac{x}{y}}$", "${\large{\frac{x}{y}}$", ..
225        "${\Large{\frac{x}{y}}$", "${\LARGE{\frac{x}{y}}$", ..
226        "${\huge{\frac{x}{y}}$", "$\Huge{\frac{x}{y}}$"];
227 r = xstringl(2, 0.5, str, 0, 3);
228 xrects([r(1); r(2)+r(4); r(3); r(4)]);
229 xstring(r(1), r(2), str);
230 txt = gce();
231 txt.font_size = 3;
232 txt.font_style = 0;
233 txt.font_color = 2;
234 ]]>    
235         </scilab:image>
236     </refsection>
237     <refsection role="see also">
238         <title>See Also</title>
239         <simplelist type="inline">
240             <member>
241                 <link linkend="titlepage">titlepage</link>
242             </member>
243             <member>
244                 <link linkend="xstring">xstring</link>
245             </member>
246             <member>
247                 <link linkend="xstringl">xstringl</link>
248             </member>
249             <member>
250                 <link linkend="xtitle">xtitle</link>
251             </member>
252             <member>
253                 <link linkend="stringbox">stringbox</link>
254             </member>
255         </simplelist>
256     </refsection>
257 </refentry>