 Hello and welcome to the eighth video in a series on latex, the mathematical typesetting system. In the previous video, we learned about the concept of an environment, which is a way of setting off chunks of a latex document to behave according to some specific rules. The next three videos are going to look at specific environments that do some common and useful things. In this video in particular, we're going to learn about an environment for typesetting displayed equations. So first we're going to recap what we already know about displayed equations using the double dollar sign notation and introduce an alternative way to do this. Then we're going to show how to use both the equation environment and the equation star environment to create displayed equations in a slightly different way. So actually we already know how to create displayed equations in latex and that's using the double dollar sign notation. For example, let's typeset this equation offset using the displayed mode double dollar sign x squared plus y squared equals one and then close the double dollar signs and typeset and that creates the equation in a nice displayed mode. Something I didn't mention earlier is that there's another equivalent notation for this and that's using the following notation. We're going to type slash open square bracket and then we'll type the same equation again, x squared plus y squared equals one and then slash close the square brackets and then we compile. We see that both of these notations do exactly the same thing. They create a displayed mode equation. Some people prefer the square bracket notation over the double dollar sign notation so we need to be equally proficient with each. Now there's an environment that does this as well and it's called the equation environment. It's very simple to use. Let's do an example. We're just going to open the environment by typing slash begin curly brace equation and close the curly braces. And then we're just going to type in the equation we want. Let's go with x to the fourth plus y to the fourth equals one and then we close the environment as usual by typing slash end curly brace equation close curly brace. When we compile, we see we get a nice displayed mode equation just like the previous equations were. So you're probably asking what's the point of having the equation environment when you already have the double dollar sign and slash square bracket notation. Well, the main reason is over here on the right edge of the page. Notice that when you use the equation environment, the equation is automatically numbered by latech and this becomes a very useful feature. For example, let's suppose this last equation with the fourth powers is one that I'm going to be referring back to several times in my document. I can use latech to give that equation an alias or a label and refer back to it using the label. To see how this works, let's go up to here just after the environment is opened and type slash label and then curly braces. And then I'm going to choose a name for this. I'm just going to call it fourth power. And close the curly braces. And now let's add a sentence to see how this works following the equation. So I'm going to type equation and then I'm going to use a new command called ref slash ref curly braces. And then the thing I'm going to plug into the curly braces is the label that I typed above, fourth power, close curly braces. And then I'll finish off the sentence as follows. Notice in the argument of the ref command is the same label that I defined above. When I compile, latech is going to automatically insert the appropriate equation number where the ref command was placed in the sentence. Now why this is good is that since equations are automatically numbered by latech, if you use the equation environment, if I happen to add a new equation up above this one, I don't want the equation with the fourth powers to be equation one anymore, that really ought to be equation two. Let's go ahead and do this. I'll go up above the previous equation and type in a new equation, begin equation x cubed plus y cubed equals one, let's say, and then end the equation. Now like I said, this equation ought to be equation one now, and the one with the fourth powers ought to be equation two. When I compile, what you see is that since the equations are automatically numbered, latech alters all the references to it correctly. So it is now correctly listed as equation two. So you can see that if you happen to have a document that has several or dozens or hundreds of equations, and this auto numbering feature becomes a real lifesaver. Now there's a variation on this environment called equation star. There are a couple of nice features of this environment that I want to show you, but in order to use them, we first need to add one line to our preamble. That goes, let's go up here to the preamble area, that's any place following the document class line and before the begin document line. And we're going to add the line slash use package, curly brace, AMS math, close curly brace. Now what's happening in this line is that it causes latech to load what's known as a package, that the set of features that extends the usual features of latech beyond what's normally loaded. We'll talk about packages in a lot more detail in a later video. For now, just type that line in verbatim in the preamble and let's go with it. So the purpose of equation star is to give you some more control over how your equations are numbered. For example, maybe you just don't want your equation to be numbered at all. And here's how that might look. We'll type slash begin equation star, close the curly braces, and let's add say x to the fifth plus y to the fifth equals one, and then end the equation star and compile. And as advertised, what you see is that the new equation is not numbered at all, and sometimes that's what you want. Or with equation star, you can also specify your own label. Let's suppose I want to label this fifth power equation with eq five, for example. So to get that numbering, I would add the following slash tag curly brace eq five right after the environment is open like so. And when you compile, notice over here in the right, the new tag is generated. If I happen to add a sentence with a label, like so, following the equation, once I compile, notice that the reference is done displaying the tag that I specified. So that's a brief look at the equation and equation star environments, and maybe why you might want to use those instead of the normal double dollar sign notation for displayed mode equations. Thanks for watching.