How to align a sequence of texts to the right?

Cecilia Lucía Gigena shared this question 2 years ago
Answered

I have this sequence of texts:


I3=Sequence(Text("\begin{array}{r}" + (5i) + "\end{array}", l4(i + 1), true, true), i, 0, 25)


which refers to this sequence of points:


I4=Sequence((-2.1, k / 25 * 15 + 0.5), k, 0, 25, 5)


but it's actually intended to be the labels of these points:

I1=Sequence((0, k / 25 * 15), k, 0, 25, 5)


You can see that first 2 values have only one digit, and the others have 2 digits. This is a problem concerning text position. I have selected the I4 positions considering the 2 digit numbers, and so the others are not properly written.

I want the 1 digit numbers to be closer to points, so that they look like labels for this points (I am actually builiding an y-axis drawing, to be exported and put into a video - regular GeoGebra y axis is too small to be legible in the video).


What I need is to align the sequence to the right, not each point separatedly. Maybe a TableText can do that - I'm not familiar with its Syntax yet. I have read this article:

https://wiki.geogebra.org/e...

but I get confused about how to keep the relationship text-points AND add the TableText syntax at the same time.

Best Answer
photo

OK

Use this version (for explor to understand) with Sequence() instead of Zip()

Comments (12)

photo
1

this?

sequence02=one line text per point

sequence03=multiline text per point

--------------------------------------

the text is horizontal shift leftwards from the anchor point

the multiline-text is right-justified in itself ( independently of the location of the anchor point)

It makes no sense to adjust single-line text in itself.

------------------------------------------------------

used commands:

Text()

TableText()

Zip()

Corner()

photo
1

Thanks! That looks great. But I'm not getting to do that in my file.


I'm having some problem with file attaching, so I am providing my files with this link:

https://www.dropbox.com/sh/...


I copied your code and replaced the name of your list with mine, but it declares "Illegal argument"...

photo
1

you should not copy the solution but you should understand the solution.

photo
1

I'm trying to understand but it's hard.

I have checked the link you provided and it ONLY says this:


Zip( <Expression>, <Var1>, <List1>, <Var2>, <List2>, ...)


No explanation for what an expression is, what a variable is, what a list is. Only a few examples, very different from mine.

I have written this formula:


5i, i, 0, 25


So I don't know if I have to use it as EXPRESSION, or just put a sequence:

I2 = Secuencia(5i, i, 0, 25)


...and then call it from the Zip as if it was a list.


So:

Maybe <Expression> = 5i

or maybe <List1> = I2


Why would I need to write both?


An then... in <List2>, I'm trying to put I1 or I4 (which are lists of points), and it says Illegal argument.


So, let's start all over again:


Zip( <Expression>, <Var1>, <List1>, <Var2>, <List2>, ...)


What should I put in <Expression>?

What should I put in <List1>?

What should I put in <Var1>?

Data are: this formula 5i, i, 0, 25, and a list of points.

photo
2

OK

Use this version (for explor to understand) with Sequence() instead of Zip()

photo
2

OK.

I have copied your sequence and replaced your list names for mine:

Secuencia(Texto("" + (l2(n)),I1(n) + (X pixX, Y pixX), true, true, -1, 0), n, 1, Longitud(l2))


I2 is my list of numbers 0,5,10,15,20,25

and I1 is my list of points.


It automatically creates sliders for n, X, Y


And it says: Illegal argument Texto"" + (I2(n))


I don't get why it does not accept my list.


See my attachments in this link: https://www.dropbox.com/sh/...

photo
3

change I1 (upercase i) to l1 (lowercase L)

photo
1

Thanks! That worked. I'm gonna avoid i/I and l/L letters from now on. Case gets easily confused. I will use B or other letter instead.

photo
2

also remember that B1 or L1 are also addresses in the spreadsheet.

maybe L_1 or s1 or Li1 are better

photo
1

Hi rami,

I'm trying to do something similar in another file, but I am not getting the same result. I don't understand the difference between your sequence and mine. Why is mine not alligned to the right?


I've tried both with Sequence and with Zip. Both do the same - correct text, correct point, alligned to the left.


Zip(Texto(n, (0 + X, y(i) + Y), true), n, T1, i, A8)


Secuencia(Texto(20 - 5i, (0 + X, y(A8(i)) + Y), true), i, 1, 3)


This was the sequence you did. I don't get which part of the sequence specifies that text should be on the right.

Secuencia(Texto("" + (L2(n)), L1(n) + (X pixX, Y pixX), true, true, -1, 0), n, 1, Longitud(L2))

photo
1

Please give short answers to all the following questions.

Please do not give explanations or questions. Don't give anything but short answers.

----------------------------------------------------------------------------------------------------


bbd73f370c090ece84e7d908f97c32e6

question 1: how many parameters does the above command Text() have

---------------------------------------------------------------------------------------

Texto("" + (L2(n)), L1(n) + (X pixX, Y pixX), true, true, -1, 0)

question 2: how many parameters does the above command have

question 3: what is the value of parameter number 6

Question 4: what is the meaning of parameter number 6

------------------------------------------------------------------------------------------

Texto(20 - 5i, (0 + X, y(A8(i)) + Y), true)

question 5: how many parameters does the above command have

question 6: which value (-1 or 0 or 1) is taken into account for the horizontal alignment. (note: also consider that a default value could be taken into account)

question 7: What needs to be changed to get the desired result.

======================================================

Note1 : I can't evaluate it, because I don"t have the GGB file, but maybe it has some other errors.

Note2 : I will be back in the forum tomorrow.

photo
photo
1

para alinear un texto debe referirse a varias lineas una bajo otra pues en GG no tiene sentido alinear una sola linea de texto

esto se hace igual que haciamos con una matriz array en Latex o un tabletext() pero usando la letra r en lugar de la letra c segun hablamos en el post de centrar

otro asunto es el posicionar el texto respecto a un punto, esto se hace con los dos ultimos parametros del comando texto() que debe valer -1,0,1 segun se refiera a que el texto se posiciona a izq centro o der del punto, tal como estuvimos usandolo en dicho post

© 2023 International GeoGebra Institute