Difference between revisions of "Text Command"

From GeoGebra Manual
Jump to: navigation, search
(command syntax: changed [ ] into ( ))
(new syntax added)
Line 1: Line 1:
 
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|text}}
 
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|text}}
 
; Text( <Object> )
 
; Text( <Object> )
: Returns the formula for the object as a [[texts|text object]].
+
: Returns the formula of the object as a [[texts|text object]].
: {{Note| By default, values are substituted for variables.}}
+
: {{Note| By default, values are substituted to variables.}}
 
: {{Example|1=If ''a = 2'' and ''c = a<sup>2</sup>'', then <code>Text(c)</code> returns the text ''"4"''.}}
 
: {{Example|1=If ''a = 2'' and ''c = a<sup>2</sup>'', then <code>Text(c)</code> returns the text ''"4"''.}}
 
; Text( <Object>, <Boolean for Substitution of Variables> )
 
; Text( <Object>, <Boolean for Substitution of Variables> )
: Returns the formula for the object as a text object. The Boolean variable determines if values are substituted for variables (''true'') or if variable names are shown in the text (''false'').
+
: Returns the formula of the object as a text object. The Boolean variable determines whether values are substituted to variables (''true'') or variable names are shown in the text (''false'').
 
:{{Example|1=<div>If ''a = 2'' and ''c =  a<sup>2</sup>'', then  
 
:{{Example|1=<div>If ''a = 2'' and ''c =  a<sup>2</sup>'', then  
 
:* <code>Text(c, true)</code> returns the text ''"4"'' and  
 
:* <code>Text(c, true)</code> returns the text ''"4"'' and  
 
:* <code>Text(c, false)</code> returns the text ''"a<sup>2</sup>"''.</div>}}
 
:* <code>Text(c, false)</code> returns the text ''"a<sup>2</sup>"''.</div>}}
 
; Text( <Object>, <Point> )
 
; Text( <Object>, <Point> )
: Returns the formula for the object as a text object at the position of the given point.
+
: Returns the formula of the object as a text object at the position of the given point.
 
: {{Example|1=<code>Text("hello", (2, 3))</code> returns the text ''"hello"'' at the position ''(2, 3)''.}}
 
: {{Example|1=<code>Text("hello", (2, 3))</code> returns the text ''"hello"'' at the position ''(2, 3)''.}}
 
; Text( <Object>, <Point>, <Boolean for Substitution of Variables> )
 
; Text( <Object>, <Point>, <Boolean for Substitution of Variables> )
: Returns the formula for the object as a text object at the position of the given point. The Boolean variable determines if values are substituted for variables (''true'') or if variable names are shown in the text (''false'').
+
: Returns the formula of the object as a text object, at the position of the given point. The Boolean variable determines whether values are substituted to variables (''true'') or variable names are shown in the text (''false'').
 
: {{Example|1=If ''a = 2'' and ''c = a<sup>2</sup>'', then <code>Text(c, (2, 1), true)</code> returns the text ''"4"'' at the position ''(2, 1)''.}}
 
: {{Example|1=If ''a = 2'' and ''c = a<sup>2</sup>'', then <code>Text(c, (2, 1), true)</code> returns the text ''"4"'' at the position ''(2, 1)''.}}
 
; Text( <Object>, <Point>, <Boolean for Substitution of Variables>, <Boolean for LaTeX formula> )
 
; Text( <Object>, <Point>, <Boolean for Substitution of Variables>, <Boolean for LaTeX formula> )
: Returns the formula for the object as a text object at the position of the given point. First Boolean variable determines if values are substituted for variables (''true'') or if variable names are shown in the text (''false'').  If the second Boolean variable is ''true'', the result is rendered using [[LaTeX]].
+
: Returns the formula of the object as a text object at the position of the given point. First Boolean variable determines whether values are substituted to variables (''true'') or variable names are shown in the text (''false'').  If the second Boolean variable is ''true'', the text is rendered using [[LaTeX]].
: {{Example|1=If ''a = 2'' and ''c = a<sup>2</sup>'', then <code>Text(c, (2, 1), true, true)</code> returns the text ''"4"'' at the position ''(2, 1)'' using LaTeX.}}
+
: {{Example|1=If ''a = 2'' and ''c = a<sup>2</sup>'', then <code>Text(c, (2, 1), true, true)</code> returns the LaTeX text ''"4"'' at the position ''(2, 1)''.}}
 +
:Text( <Object>, <Point>, <Boolean for Substitution of Variables>, <Boolean for LaTeX formula>, <Horizontal alignment [-1|0|1]>, <Vertical alignment [-1|0|1]> )
 +
: Returns the formula of the object as a text object at the position of the given point. The first Boolean variable determines whether values are substituted to variables (''true'') or variable names are shown in the text (''false'').  If the second Boolean variable is ''true'', the text is rendered using [[LaTeX]]. The values -1, 0, 1 for horizontal and vertical alignment shift the text from the default position respectively as follows:
 +
:* -1: horizontal shift leftwards / vertical shift downwards
 +
:* 0: centers the text horizontally / vertically on the given point
 +
:1: horizontal shift rightwards, vertical shift upwards
 +
: {{Example|1=If ''a = 2'' and ''c = a<sup>2</sup>'', then <code>Text(c, (2, 1), true, true, -1, 0)</code> returns the LaTeX text ''"4"'' to the left of ''(2, 1)'', and aligned vertically with the point.}}
 
{{Note|1=See also [[File:Mode text.svg|link=|22px]] [[Insert Text Tool|Insert Text]] tool.}}
 
{{Note|1=See also [[File:Mode text.svg|link=|22px]] [[Insert Text Tool|Insert Text]] tool.}}

Revision as of 18:04, 27 December 2020


Text( <Object> )
Returns the formula of the object as a text object.
Note: By default, values are substituted to variables.
Example: If a = 2 and c = a2, then Text(c) returns the text "4".
Text( <Object>, <Boolean for Substitution of Variables> )
Returns the formula of the object as a text object. The Boolean variable determines whether values are substituted to variables (true) or variable names are shown in the text (false).
Example:
If a = 2 and c = a2, then
  • Text(c, true) returns the text "4" and
  • Text(c, false) returns the text "a2".
Text( <Object>, <Point> )
Returns the formula of the object as a text object at the position of the given point.
Example: Text("hello", (2, 3)) returns the text "hello" at the position (2, 3).
Text( <Object>, <Point>, <Boolean for Substitution of Variables> )
Returns the formula of the object as a text object, at the position of the given point. The Boolean variable determines whether values are substituted to variables (true) or variable names are shown in the text (false).
Example: If a = 2 and c = a2, then Text(c, (2, 1), true) returns the text "4" at the position (2, 1).
Text( <Object>, <Point>, <Boolean for Substitution of Variables>, <Boolean for LaTeX formula> )
Returns the formula of the object as a text object at the position of the given point. First Boolean variable determines whether values are substituted to variables (true) or variable names are shown in the text (false). If the second Boolean variable is true, the text is rendered using LaTeX.
Example: If a = 2 and c = a2, then Text(c, (2, 1), true, true) returns the LaTeX text "4" at the position (2, 1).
Text( <Object>, <Point>, <Boolean for Substitution of Variables>, <Boolean for LaTeX formula>, <Horizontal alignment [-1|0|1]>, <Vertical alignment [-1|0|1]> )
Returns the formula of the object as a text object at the position of the given point. The first Boolean variable determines whether values are substituted to variables (true) or variable names are shown in the text (false). If the second Boolean variable is true, the text is rendered using LaTeX. The values -1, 0, 1 for horizontal and vertical alignment shift the text from the default position respectively as follows:
  • -1: horizontal shift leftwards / vertical shift downwards
  • 0: centers the text horizontally / vertically on the given point
1: horizontal shift rightwards, vertical shift upwards
Example: If a = 2 and c = a2, then Text(c, (2, 1), true, true, -1, 0) returns the LaTeX text "4" to the left of (2, 1), and aligned vertically with the point.
Note: See also Mode text.svg Insert Text tool.
© 2024 International GeoGebra Institute