Logiciel libre de géométrie, d'analyse et de simulation multiplateforme par Yves Biton

# LaTeX code example 2 : Using LaTeX code in a text display with several lines.

publication jeudi 22 décembre 2016.

MathGraph32 allows he user to create LaTeX display via icon or .

It is also possible to insert LaTeX code in a text display (with one or several lines) via icons or but if you want to export your figure in html (JavaScript) it is better to use a LaTeX display and a matrix as explained below.

Create a new figure with menu item File - new Figure with - Frame without vectors and ask for an orthonormal frame, dotted and woith no scaling.

Via icon create a free point with integer coordinates and name this point M.

Use icon to measure the abscissa of M in the frame and icon to measure it’s ordinate. Give these measures the name x and y.

Now create a point of coordinates (x ;0) with .

Let’s now create a value display linked to the last point created via icon . Click first on the point. A dialog box pops up.

In the text field Value to be displayed, enter x. In the text field Starting string, enter a character $and, in the field Following string , also enter a character$.

These two characters $are optional . Using them will make the display use LaTeX style. Fill in the dialog box as below : You can move the value display relatively to the point x with icon In the same way, create a point of coordinates (0 ; y) and a display of the value of y linked to this last point with a character$ in the fields Starting string and Following string .

In the line style palette, set the dotted line style, thickness 2 activated and use icon to join point M with the two points of coordinates (x ;0) et (0 ; y).

We will now create a LaTeX displayshowing how to calculate the distance between O and M.

First create with icon a calculus named dis with formula sqrt(x^2+y^2).

Click on icon the click on the top left corner of the figure. A dialog box pops’up for entering the text.

First use icon to get the code of a matrix of two lines and one column.

In the first line enter code  \text{La distance entre O et M est :} (you can use button ), and, in the second line of the matrix, enter code  \text{OM =} then click on icon . MathGraph32 inserts LaTeX code for a square root. Inside the braces, write code \left(  \right)^2 + \left(  \right)^2 (use icon for the brackets).

Set the cursor position inside the first bracket and click on button Dynamic value insertion. In the dialog box, click on x then click on button Insert code. In the same way, set the cursor position inside the first bracket and click on button Dynamic value insertion to inset a dynamic display of y. Now enter a character ≃ (use teh special character floating box) the click on btton Dynamic value insertion too get a dynamic display of dis with three digits.

The full code of the LaTeX display is :

\begin{array}{l} \text{La distance entre O et M est :} \\ OM = \sqrt{\left( \Val{x} \right)^2 +\left(  \Val{y} \right)^2} \approx \Val{dis,3} \end{array}

Validate the dialoge box.

You will see during the typing of the text that the result is visible on the figure (and blinking).

Now capture point M with tool

Here is underneath the figure animated via Mathgraph32 javascript library.

Capture point M.