“Text 指令”的版本间的差异

来自GeoGebra Manual
跳转至: 导航搜索
 
(未显示同一用户的3个中间版本)
第1行: 第1行:
 
<noinclude>{{Manual Page|version=4.0}}</noinclude>{{command|text|Text}}
 
<noinclude>{{Manual Page|version=4.0}}</noinclude>{{command|text|Text}}
{{translate}}
+
 
; Text[Object]: Returns the formula for the object as a [[文字]].
+
; Text[ 〈物件〉]
: {{Note| By default, values are substituted for variables.}}
+
: 此指令會產生一個「[[文字]] 」物件。
: {{Example|1=If ''a = 2'' and ''c = a<sup>2</sup>'', then <code>Text[c]</code> returns the text "4".}}
+
: {{Note| 1=此指令相當於 <code>Text[〈物件〉, true]</code>,請參考下一個指令格式。}}
; Text[Object, Boolean]: 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'').
+
 
:{{Example|1=<div>If ''a = 2'' and ''c = a<sup>2</sup>'', then
+
; Text[〈物件〉,〈代入變數值〉]
:* <code>Text[c, true]</code> returns the text "4" and
+
:*〈代入變數值〉的預設值為「true」,因此 <code>Text[〈物件〉, true]</code> 的效果與 <code>Text[ 〈物件〉]</code> 一模一樣。
:* <code>Text[c, false]</code> returns the text "''a<sup>2</sup>''"</div>}}
+
:*〈代入變數值〉如果設為「true」,則會將文字內容所含的變數先轉換為數值後再顯示,如果設為「false」,則只顯示變數名稱。
; Text[Object, Point]: Returns the formula for 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)''.}}
+
 
; Text[Object, Point, Boolean]: 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'').
+
:{{example}}
; Text[Object, Point, Boolean substitute,Boolean LaTeX]:
+
:{| class="wikitable"
: 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]].
+
! 物件設定
{{example|1=假設 <code>n = 3</code>,則 <code>Text["\frac{1}{" + (2^n) + "}", A, true, true]</code> 會得到「<math>\frac{1}{8}</math>」的文字方塊,它的左上角會對齊 A 點。
+
! Text[obj]
 +
! Text[obj, false
 +
|-
 +
| obj = 3
 +
| 3
 +
| obj
 +
|-
 +
| obj: y = x<sup>2</sup>
 +
| y = x<sup>2</sup>
 +
| y = x<sup>2</sup>
 +
|-
 +
| A=(0,0)<br/>B=(1,0)<br/>obj=Circle[A,B]
 +
| x<sup>2</sup> + y<sup>2</sup> = 1
 +
| Circle[A,B]
 +
|-
 +
| a=2<br/>b=3<br/>c=6<br/>obj: a x + b y = c
 +
| 2 x + 3 y = 6
 +
| a x + b y = c
 +
|-
 +
| a = 2 <br/>obj = a<sup>2</sup> - 3a + 2
 +
| 0
 +
| a<sup>2</sup> - 3a + 2
 +
|}
 +
 
 +
; Text[ 〈物件〉, 〈文字位置〉, 〈代入變數值〉, 〈含 LaTeX 數學式〉]:
 +
:*〈文字位置〉是文字方塊的「左上角」,必須是一個點座標。
 +
:* 如果文字內容中含有 [[LaTeX]] 數學式,則〈含 LaTeX 數學式〉必須設為「true」。
 +
:{{example|1=假設 <code>n = 3</code>,則 <code>Text["\frac{1}{" + (2^n) + "}", A, true, true]</code> 會得到「<math>\frac{1}{8}</math>」的文字方塊,它的左上角會對齊 A 點。
 
}}
 
}}

2012年10月2日 (二) 15:41的最新版本

Accessories dictionary.png
本頁為官方文件,一般使用者無法修改,若有任何誤謬,請與官方聯絡。如欲編輯,請至本頁的開放版



Text[〈物件〉]
此指令會產生一個「文字」物件。
備註: 此指令相當於 Text[〈物件〉, true],請參考下一個指令格式。
Text[〈物件〉,〈代入變數值〉]
  • 〈代入變數值〉的預設值為「true」,因此 Text[〈物件〉, true] 的效果與 Text[〈物件〉] 一模一樣。
  • 〈代入變數值〉如果設為「true」,則會將文字內容所含的變數先轉換為數值後再顯示,如果設為「false」,則只顯示變數名稱。


範例:
物件設定 Text[obj] Text[obj, false]
obj = 3 3 obj
obj: y = x2 y = x2 y = x2
A=(0,0)
B=(1,0)
obj=Circle[A,B]
x2 + y2 = 1 Circle[A,B]
a=2
b=3
c=6
obj: a x + b y = c
2 x + 3 y = 6 a x + b y = c
a = 2
obj = a2 - 3a + 2
0 a2 - 3a + 2
Text[〈物件〉, 〈文字位置〉, 〈代入變數值〉, 〈含 LaTeX 數學式〉]
  • 〈文字位置〉是文字方塊的「左上角」,必須是一個點座標。
  • 如果文字內容中含有 LaTeX 數學式,則〈含 LaTeX 數學式〉必須設為「true」。
範例: 假設 n = 3,則 Text["\frac{1}{" + (2^n) + "}", A, true, true] 會得到「\frac{1}{8}」的文字方塊,它的左上角會對齊 A 點。
© 2024 International GeoGebra Institute