 Alright everybody, welcome back. So this is the second video on LaTeX. In the last video we talked about basic syntax, how to have a document class, how to begin an end-year document, titling, how to do bold and sections and stuff like that. In this video we're going to talk about lists, and then we're going to talk about labels and references. So let's get it started with lists. In fact, I'm going to make a section heading, I'm going to call it lists, great. And of course you probably remember how to compile, PDF LaTeX, and then the name of your document minus LaTeX2 right now. Okay, so let's get this underway. So lists are pretty easy to do, in fact there's an environment for it. What you do is you say begin enumerate, end enumerate, and enumerate is an environment for numbered lists. And in order to make elements in that list, you do slash item. So let's say, I don't know, it's a shopping list or something. So we have bread, maybe we have butter, I don't know, what else do you need, toilet paper, stuff like that, what else, cream, really weird stuff coming to my head right now. So let's say, you know, we got a list, and if we compile this, you will notice, oops I spilt that wrong, enumerate. So once you compile it, you will have a nice list, all of the different items being numbered. So that's nice. So let's say you want a non-ordered list, so an unordered list. To do that, of course here, for the numbered one we used enumerate, for an unordered list you use itemize. So itemize, now I'm really careful with my spelling, itemize. And you also use the item function to actually add items to it. So let's say corn, maize, I guess corn and maize are the same thing, but whatever. Lamp, okay, and if you compile that, you will see you have an unordered list, look at this inconsistency in capitalization, this is triggering the autistic people watching this. But yeah, so we have our lists nice and simple. And of course, as you would expect, if we go back here to our numbered list and add something in, let's say, I don't know, mugs, then everything will be automatically reordered for us, so that's very nice. So that's how to do lists, and you can make sub-lists in some situations. So let's say, under corn, we want to have another itemize and end itemize. And then we can have sub-items here, so here's, I don't know, red corn, black corn. I don't know if corn comes in these colors, but whatever and compile that. And you will have sub-entries here. So you can do that as well to sort of, you can do this in the numbered list as well. I think you'll get like A or B or something like that. But that's the logic of lists, so it's very simple syntax. Okay, so those are lists. Let's go on to labels and references. Now labels and references are sort of the magical part of LaTeX. And here's the sort of, go ahead and, I can't really talk while I'm writing. This makes it very hard for me to do screencasts, but psychologically trying, but I can do it. Okay, so what are labels and references? So here's the thing, let me tell you about an editing problem you're going to have to deal with a lot. Let's say you write, I don't know, a master's thesis. And some of the stuff you write in your thesis, you might write for a term paper later on. You might elaborate on it. You might try and publish parts of it. You might turn it into a dissertation. So you're going to be taking parts of documents and putting it in new documents. You're going to be, you know, this is the kind of thing that you have to do in editing a whole lot. So you're going to be taking parts of documents and putting them elsewhere. And normally numbering is a huge problem. But of course, as you've sort of already learned, LaTeX automatically renumbers everything if you move them around. But what about when you refer to specific items in the text? So here's an example. Let's say, let's add another section up here. We'll say intro, introduction, and I'll go ahead and compile that. So introduction is section one. Lists is section two. So let's say in our introduction we're going to talk about the other sections. So in section two, I will talk about lists. Nice and simple. We'll compile that. Great. That looks fine. But let's say you have to do some editing. Let's say you have to reorder some stuff. So let's say you now want to put the label section up here right after the introduction. So now it's reordered. Well, if you compile that, now labels is number two and lists is three. But this, when you're referring to the list section, that's two. That's annoying. How do we fix this? Well, LaTeX has a very nice way with labels and references. And how you do that is, let's go to your list section, because we want to refer to the list section. What we do is we call the label command. And it's best to do it in some, sometimes in the actual section heading, or some place where it's not going to be ambiguous of what you're talking about. And what you do is you can label list. Let's say we will just name it list. Now this is just an abstract label, it's never going to show up in your document. But when we use the reference command, now we can go back to two and we'll replace that with this function ref. And ref takes an argument and we'll put list in this as its argument. Now ref is going to be looking for what is defined as list. And ref is going to return the number of that whatever it is. So if we recompile it, you'll see first off this is turned into question marks. What is that about? Well, you have to recompile it twice. There are different reasons for that. If you have an automatically compiling setup, it might do this for you. But once you compile it again, you'll notice, look, now lists is section three and this is referring to section three. Now of course three is not written here, but it already has the right order. Now let's say we want to move the label section again. So we delete that and we put it down here and we'll recompile twice to get all the references right. And you'll notice that this has now changed back to section two because now it's referring to the list, this thing that's labeled lists and it is the second portion. So that's exactly what we want to have. Now why this is so good is when you write a document and you use label and reference to refer to the different sections or examples or stuff like that, that makes it so your document is extremely robust. You can do enormous amount of editing. In fact, you can even copy and paste the whole thing and put it in someone else's, let's say you're compiling articles or something and you put them all together. And all of the numbering, even if the numbering all changes, everything will be fine. They'll all refer to exactly what you want them to refer to. You can also, the reason I brought up lists here is that in the enumerate environment we have numbers here as well. And we can actually label these things as well. So let's label toilet paper, we'll label it toil or something like that. And then in the text somewhere, note we talk about toilet paper, which is number, number, and then we'll say ref and toil. And then that will automatically refer to the label down here. So we'll recompile it, recompile it twice. And you'll see that toilet paper is four and this number is four. And if we move toilet paper, let's say we make toilet paper one and recompile it twice, you will see that now this is number one. So anyway, what have we gotten here? Now we've learned two basic things, the enumerate, well, I mean, two general concepts. One is lists, and you use either the enumerate environment if you want counted lists or the itemize environment if you want uncounted unordered lists. And the other thing is the labeling and reference command, which you should use as much as possible because you never know what kind of changes you're going to put your document through. So these label and references commands will keep your numbers in sync even when they have to change. So that's a great tool. Okay, so in the next video, I think we're going to talk about bibliography management, which is another thing which is a huge advantage of LaTeX over Word or whatever you're using. So anyway, hope you learned something and I'll see you in the next video.