| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Browse and search Google Drive and Gmail attachments (plus Dropbox and Slack files) with a unified tool for working with your cloud files. Try Dokkio (from the makers of PBworks) for free. Now available on the web, Mac, Windows, and as a Chrome extension!

View
 

Adding text to an activity with release 40

Page history last edited by Russell Blyth 10 years, 1 month ago

Adding Text in GeoGebra 4.0

 

Verified with 3.9.162

 

We will work through some examples of adding text to the geometry window of GeoGebra. We will start with simple cases and then add complexity.  To give a context, consider a GeoGebra file for demonstrating quadratic equations where we have three sliders, named a, b, and c, and a function f(x)=a*x^2+b*x+c.

 

 

I) Adding text with the text tool.

 

A) Inserting basic text with the text tool.

The first method is to use the text tool.  Select the third tool menu from the right by holding the triangle on its lower right corner.  The second item in that menu is for inserting text.  Select that item.

 

 

Once the Insert Text Tool is selected, the icon is highlighted and the tool tip gives instructions to click in the graphics window where you want to insert text.

 

 

Clicking in the window brings up a dialog box where we insert the text.  We will start with a simple text that will become our header for the application.  We want to inset the text "Considering Quadratic Equations".  We simply type the text in and click the OK button.

 

 

Since this will be our header, we would like to increase the size of the text and change its color. We get to the properties either by right clicking (ctrl-click on Macs) on the object or choosing "Object Properties" from Edit menu

 

 

We change the size with the text tab and change the color with the color tab.

 

 

 

B) Adding dynamic values with the text tool.

Besides text, we would also like to be able to add values that will change with dynamic demonstration.  For a single value we select the object from the drop down list of objects.

For our example we will add words that let us know the ordered pair is the vertex.

It should be noted that the boxes with object names produced this way allow for expressions

C) Adding formatted formulas, the LaTeX option:

One of the options we want is for the text to be formatted mathematics.  GeoGebra gives you the option of interpreting the text as a LaTeX formula.  For our purposes, LaTeX is a mathematical markup language whose syntax is beyond the scope of this article.  However for simple constructions GeoGebra lets us work with syntax provided by drop down menus and a preview screen.  In the image below we see how GeoGebra adds the text for a fraction, as well as a preview of the typeset formula.

We would like to give a formula for the vertex in terms of a, b, and f.  Besides the fraction construction we would also like to use the bracket construction so our parentheses are made big enough.  We need to substitute the correct numerator and denominator for a and b in the formula.

D) Adding values into the Formulas:

We would next like to have the mathematically formatted expressions, but use the live values rather then the variable names.  It is easiest to do this by converting the values one at a time.  We start by selecting the b in the first numerator and then selecting b from the object list.  Note, that the live value is represented by a box containing the variable name in the edit window and as a value in the preview window.

It is worth noting that GeoGebra does not simplify a live algebraic value that is part of an expression.  Thus if b is -1.4, then –b is -–1.4.  We can however make –b the live value.  That will be simplified.  Similarly we want 2a as the live value for the numerator.

We continue the same way, replacing all of the parameters with values.

 

E) Combining text, mathematical typesetting, and values in a single text.

Finally, we would like to combine standard text, mathematical formulae, and values in a single text.  We want to construct a text along the lines of

 

The vertex is (an expression using names of variables) or (an expression with values).

 

We then use

"$\text{The Vertex is }\left( \frac{ -b }{2 a},f \left( \frac{ -b}{2a} \right)   \right)

\text{ or }\left( \frac{|-b| }{( |2 a| ) },f \left( \frac{ (|-b|}{ |2 a| } \right)   \right)  $"

 

 

 

While that looks quite daunting, you should remember that it was constructed by the process described above, using the palettes in the drop down LaTeX formula menu without needing to know LaTex.  It is worth noting that GeoGebra has a \text{} command in its version of LaTex for adding text into a LaTeX formulation.  The \text{} command is treated as mathematics and needs to go between the dollar signs.

 

The pieces of code between dollar signs are LaTex formulas.  Carriage returns in the formulas are ignored.  Carriage returns in the text are considered hard returns and will show up on screen.  The returns from the wrapping in the text box will be ignored in the displayed text.

 

A note on line breaks –

For static text (not LaTeX formulas) the "hard returns" you get from typing in a return show up in how the text is displayed.  The "soft returns" that are created by text wrapping when you type do not show up in the displayed text.

 

For formulas, using multiple line displays is a bit complicated because LaTeX ignores carriage returns while in math mode (inside a pair of dollar signs) but pays attention to them in text mode (between pairs of dollar signs).  The straightforward way, if you are comfortable with LaTeX, is to use one pair of dollar signs for each line and then to have hard carriage returns (places where you hit the return key) in between the dollar signs to create line breaks.  A second method is to is to create an array and to put the pieces in each line. 

 

II) Advanced features – Some of the advanced features of text require that we change the object properties. 

 

A) Location – By default the location of a string is tied to the coordinates where it was created.  A text string can be moved by dragging it to a desired location. The starting point of a text is the lower left corner of a text.  We can specify the coordinates of a point. Using the position tab, we can also set the location to a named point.

Sometimes we would like to specify a point relative to the screen rather than to the coordinate system, for example, putting the title in the middle top of the screen.  To do this we use the Corner[] command.  The Corner command returns the coordinates of the lower left, lower right, upper right, and upper left corners respectively for values 1, 2, 3, and 4.  We can designate a point in the middle from left to right and 20% from top to bottom with a point:

Base=(.5*x(Corner[1])+.5*x(Corner[2]), .8*y(Corner[4])+.2*y(Corner[1]))

 

B) Visibility – Another advanced feature is visibility.  Using the advanced tab of object properties, we can give a condition for a text to be visible.  In the example below we add a condition so text8 is only visible when yVert is negative.

 

 

III) Labels and Captions.

Another way to add text to a GeoGebra construction is with the labels option.  We find this option in the Basic tab of the Object Properties dialog.  There is a check box to show the label.  The options for the label are the name of the object, it value, its name and value, and a caption.  In GeoGebra 4.0 the caption can be static text or a LaTeX formula.

 

 

IV) Formula Text – A final command to consider is FormulaText, which displays formulas with proper typesetting.  In the example we have been working on, FormulaText[f] gives the properly typeset formula for f(), with values plugged in for a, b, and c.

 

© 2011, Mike May, S.J., maymk@slu.edu

  Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 license, Mike May, S.J. maymk@slu.edu

Comments (0)

You don't have permission to comment on this page.