Variables

Basics

Typing a letter inserts that letter as a variable unless the insertion point is inside of certain special objects, such as a text annotation or unit.

To write:

2 x

Type:

2 X

Greek variables

Greek variable names are common in math, but most keyboards don’t include Greek letters! You can insert Greek variables using abbreviations. Type gr, then the name of the Greek letter, then press Space.

You can also use the buttons in the Greek variables palette.

To write alpha:

α

Type:

G R A L P H A Space

That may seem like a lot of typing, but you don’t have to type the entire name. You only have to type enough to identify the letter. In this case, just gra is enough.

To get a capital, use a capital letter somewhere while typing.

To write capital phi:

Φ

Type:

Shift + G R P Space

Constants

The editor treats variables and constants differently. If you insert the greek letter pi using the abbreviation grpi, the result is a variable, π . This is not the special number π , the ratio of a circle’s circumference to its diameter. Notice that the letters use different styles to help you tell the difference. Well-known constants have their own abbreviations. For example, to insert the constant pi you just type pi without the gr.

To write:

e i π + 1 = 0

Type:

E X P Space ^ C I Space P I Space Enter + 1 = 0

If you are only using the editor to write math for another person to read, the difference may not seem important. But if you use features such as calculation, you may not get the result you expect if you mix up a constant and a variable. To avoid surprises, make a habit of using the correct object.

Data types

A variable’s type describes the kind of value it represents, such as scalar or vector. Variables of different types use different styles to help communicate this to the reader. For example, vector variables are often drawn with an arrow over them, like this: x . This makes your math easier to read and can reduce mistakes. It may also affect how the editor treats the variable or what commands are offered for it.

You can change a variable’s type by right clicking on it, choosing Change data type, and choosing the new type.

You can also use abbreviations to quickly create a variable of a certain type. To create a regular scalar variable, just type the name as always. For other data types, type v, the variable name, and a letter describing the desired type:

Data type Code Example
Scalar (the default) N vxN (or just X) x
Vector V vxV or vx x
Matrix M vAM A
Tensor T vTT T
Set S vCS C
Point P vBP B
Boolean B vaB a
String U vpU p

Note: Some of these types are not fully supported by the editor yet (for example, they may be missing appropriate operators). Other types may be added in future versions.

Accents

Since variable names are traditionally a single letter, accent characters are often used to indicate that two variables are related in some way. Like data types, you can produce accented variables using a v… abbreviation. In this case, the variable name is followed by a (usually) lower case character that indicates the type of accent. Accented variables are scalar unless you also indicate a type.

Accent Code Example
Bar (macron) b vxb x ¯
Hat (circumflex) h vph p ^
Tilde (twiddle) t vst s ~
Acute a vma m ´
Grave g vng n `
Breve (smile) u vxu x ˘
Check c vic ı ˇ
Dot d vxd x ˙
Two dots D vyD y ¨

You can combine types and accents in an abbreviation, and the order does not matter. For example, vaUd and vadU will both create a string variable a with a dot accent.

To add an accent or type to a Greek letter, you can add the same letters to the end of a gr abbreviation. You may need to type a little more of the Greek letter name than usual if there is a conflict with another abbreviation.

To write:

π ~

Type:

G R P I T Space

In mathematical writing, the same accent is often used for many different purposes depending on the kind of math. For this reason, the editor doesn’t assign them special meaning. To the editor, two variables with the same name but different accents are simply different variables.

Identifiers

In most mathematical writing, variables are only one letter long. This can make it harder for someone unfamiliar with your subject to follow you. To help, the editor offers identifiers. Identifiers act like variables, but they can have longer names.

To write the identifier:

area

Type:

Alt + I A R E A Enter

In the editor, identifiers are a different colour so you can easily tell them apart from a list of variable names to be multiplied.

Identifiers don’t have accents, but you can set their data type.


Contents