Difference between revisions of "LaTeX-Old-Version/C2/Equations/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 2: Line 2:
 
|'''Time'''
 
|'''Time'''
 
|'''Narration'''
 
|'''Narration'''
 +
 
|-
 
|-
 
|00:00
 
|00:00
 
|Welcome to this tutorial on creating '''equations''' through '''Latex'''.  
 
|Welcome to this tutorial on creating '''equations''' through '''Latex'''.  
 +
 
|-
 
|-
 
|00:06
 
|00:06
 
|You see three windows as usual.  
 
|You see three windows as usual.  
 +
 
|-
 
|-
 
|00:10
 
|00:10
 
|I have created a '''12pt''' size, '''article class''' document. And using '''AMSmath package''' and also using the 'ccliscences' package for creative commons copyright statement as here.  
 
|I have created a '''12pt''' size, '''article class''' document. And using '''AMSmath package''' and also using the 'ccliscences' package for creative commons copyright statement as here.  
 +
 
|-
 
|-
 
|00:30
 
|00:30
 
|'''make title''' creates the title page. '''new page''' command takes the rest of the document to a new page.  
 
|'''make title''' creates the title page. '''new page''' command takes the rest of the document to a new page.  
 +
 
|-
 
|-
 
|00:43
 
|00:43
 
|There are many ways to create equations, I will use the command '''align star''' to create equations.
 
|There are many ways to create equations, I will use the command '''align star''' to create equations.
 +
 
|-
 
|-
 
|00:51
 
|00:51
 
| Let us begin with a matrix differential equation consisting of four components.  
 
| Let us begin with a matrix differential equation consisting of four components.  
 +
 
|-
 
|-
 
|01:03
 
|01:03
 
|Align star, Frac d by dt of begin b-matrix, x_1, next line x_2, end b-matrix.
 
|Align star, Frac d by dt of begin b-matrix, x_1, next line x_2, end b-matrix.
 +
 
|-
 
|-
 
|01:27
 
|01:27
 
| Let me close this. Let us compile it.  
 
| Let me close this. Let us compile it.  
 +
 
|-
 
|-
 
|01:37
 
|01:37
 
|So we have created ‘d by dt of x1 x2’.  
 
|So we have created ‘d by dt of x1 x2’.  
 +
 
|-
 
|-
 
|01:42
 
|01:42
 
|Let us now '''augment''' the '''vector''' with two more components.  
 
|Let us now '''augment''' the '''vector''' with two more components.  
 +
 
|-
 
|-
 
|01:48
 
|01:48
 
|You do it as follows. Next line x3, next line x4. '''Save''' it. Compile it. So I have four components.  
 
|You do it as follows. Next line x3, next line x4. '''Save''' it. Compile it. So I have four components.  
 +
 
|-
 
|-
 
|02:03
 
|02:03
 
|Let me now say that this is equal to the right hand side matrix  begin b-matrix.
 
|Let me now say that this is equal to the right hand side matrix  begin b-matrix.
 +
 
|-
 
|-
 
|02:20
 
|02:20
 
| Zero, zero, one, zero.  
 
| Zero, zero, one, zero.  
 +
 
|-
 
|-
 
|02:29
 
|02:29
 
|Next line: zero, zero, zero, one.  
 
|Next line: zero, zero, zero, one.  
 +
 
|-
 
|-
 
|02:37
 
|02:37
 
|And then, lets close this matrix. '''Save'''.  
 
|And then, lets close this matrix. '''Save'''.  
 +
 
|-
 
|-
 
|02:47
 
|02:47
 
|So I have this. So I have written the first two rows.
 
|So I have this. So I have written the first two rows.
 +
 
|-
 
|-
 
|02:53
 
|02:53
 
| It is always a good idea to compile after every few small additions so that we have not made a mistake.  
 
| It is always a good idea to compile after every few small additions so that we have not made a mistake.  
 +
 
|-
 
|-
 
|03:00
 
|03:00
 
|Note that the align star environment takes the role of the dollar signs.  
 
|Note that the align star environment takes the role of the dollar signs.  
 +
 
|-
 
|-
 
|03:06
 
|03:06
 
|For example, we did not enter the dollar sign at all. As a matter of fact, we should not enter the dollar sign within the aligned star environment.  
 
|For example, we did not enter the dollar sign at all. As a matter of fact, we should not enter the dollar sign within the aligned star environment.  
 +
 
|-
 
|-
 
|03:14
 
|03:14
 
|Let us add a third line to the matrix on the right hand side and illustrate this idea.  
 
|Let us add a third line to the matrix on the right hand side and illustrate this idea.  
 +
 
|-
 
|-
 
|03:25
 
|03:25
 
|Zero, dollar minus gamma, zero, zero. So there are four entries. Compile it. It comes and says, missing dollar inserted.  
 
|Zero, dollar minus gamma, zero, zero. So there are four entries. Compile it. It comes and says, missing dollar inserted.  
 +
 
|-
 
|-
 
|03:50
 
|03:50
 
|What we will do is, let's come here, get rid of these dollar signs. '''Save''' it.  
 
|What we will do is, let's come here, get rid of these dollar signs. '''Save''' it.  
 +
 
|-
 
|-
|03;59
+
|03:59
 
|Exit compilation by this x. recompile it and note that '''minus gamma''' has come. So we need one more line here, we put that. Zero, alpha without dollar sign, zero, zero. Alright, now this is the way to do that.
 
|Exit compilation by this x. recompile it and note that '''minus gamma''' has come. So we need one more line here, we put that. Zero, alpha without dollar sign, zero, zero. Alright, now this is the way to do that.
 +
 
|-
 
|-
 
|04:28
 
|04:28
| Let's complete this equation. I have a few more terms here.  
+
|Let's complete this equation. I have a few more terms here.  
 +
 
 
|-
 
|-
 
|04:34
 
|04:34
 
|Let me just see if it is here, yes, it is here.  
 
|Let me just see if it is here, yes, it is here.  
 +
 
|-
 
|-
 
|04:39
 
|04:39
 
|Let’s cut this. Put this here.  
 
|Let’s cut this. Put this here.  
 +
 
|-
 
|-
 
|04:46
 
|04:46
 
|Let’s see what happens when I compile this.  
 
|Let’s see what happens when I compile this.  
 +
 
|-
 
|-
 
|04:52
 
|04:52
 
|This is a model of an inverted pendulum.  
 
|This is a model of an inverted pendulum.  
 +
 
|-
 
|-
 
|04:59
 
|04:59
 
|What do you do when you have more than one equation?
 
|What do you do when you have more than one equation?
 +
 
|-
 
|-
 
|05:04
 
|05:04
| Let us add one more '''align''' statement. And I have written this equation here.  
+
|Let us add one more '''align''' statement. And I have written this equation here.  
 +
 
 
|-
 
|-
 
|05:13
 
|05:13
 
|Let me bring it from there.  
 
|Let me bring it from there.  
 +
 
|-
 
|-
 
|05:17
 
|05:17
 
|Here is the equation, so let me say '''begin align star'''.  
 
|Here is the equation, so let me say '''begin align star'''.  
 +
 
|-
 
|-
 
|05:26
 
|05:26
 
|Let’s cut this. Copy this. Close this '''align'''. We compile it.  
 
|Let’s cut this. Copy this. Close this '''align'''. We compile it.  
 +
 
|-
 
|-
 
|05:39
 
|05:39
 
|When I compile it, I get the second equation appearing.  
 
|When I compile it, I get the second equation appearing.  
 +
 
|-
 
|-
 
|05:44
 
|05:44
 
|There are two problems with this. There is a large gap between the two equations, also we may want to align the equations.  
 
|There are two problems with this. There is a large gap between the two equations, also we may want to align the equations.  
 +
 
|-
 
|-
 
|05:52
 
|05:52
 
|In view of these observations, we put both of these equations into a single '''align star''' environment.  
 
|In view of these observations, we put both of these equations into a single '''align star''' environment.  
 +
 
|-
 
|-
 
|06:01
 
|06:01
 
|So we will do this as follows. Delete this.  
 
|So we will do this as follows. Delete this.  
 +
 
|-
 
|-
 
|06:08
 
|06:08
 
|Save this. Compile it.
 
|Save this. Compile it.
 +
 
|-
 
|-
 
|06:14
 
|06:14
| Now what has happened is that both the equations have come on the same line.  
+
|Now what has happened is that both the equations have come on the same line.  
 +
 
 
|-
 
|-
 
|06:20
 
|06:20
 
|We will take care of that by telling latex to split this by the '''reverse slash'''. Two of them.  
 
|We will take care of that by telling latex to split this by the '''reverse slash'''. Two of them.  
 +
 
|-
 
|-
 
|06:33
 
|06:33
 
|When I compile it, now these have gone to second equation.  
 
|When I compile it, now these have gone to second equation.  
 +
 
|-
 
|-
 
|06:40
 
|06:40
 
|But the equations are not aligned. Suppose that we want to align the 'equal to' sign, suppose we want to align these two signs, we put an ampersand symbol in front of the 'equal to' signs here. Let's put it.  
 
|But the equations are not aligned. Suppose that we want to align the 'equal to' sign, suppose we want to align these two signs, we put an ampersand symbol in front of the 'equal to' signs here. Let's put it.  
 +
 
|-
 
|-
 
|07:00
 
|07:00
 
|And then we will put it here also. Ampersand. Let’s compile this. Now notice that both of them are aligned.  
 
|And then we will put it here also. Ampersand. Let’s compile this. Now notice that both of them are aligned.  
 +
 
|-
 
|-
 
|07:18
 
|07:18
 
|Suppose that we want to introduce some text in between the equations without upsetting the alignment.
 
|Suppose that we want to introduce some text in between the equations without upsetting the alignment.
 +
 
|-
 
|-
 
|07:24
 
|07:24
| This can be achieved using the '''inter-text''' command.
+
|This can be achieved using the '''inter-text''' command.
 +
 
 
|-
 
|-
 
|07:29
 
|07:29
| So we remove... we made a mistake here, the 'delta mu' has come here. So, what we should do is, let us first put this properly, compile this.  
+
|So we remove... we made a mistake here, the 'delta mu' has come here. So, what we should do is, let us first put this properly, compile this.  
 +
 
 
|-
 
|-
 
|07:48
 
|07:48
 
|Now 'delta mu' has come there. 'U of t' is here.  
 
|Now 'delta mu' has come there. 'U of t' is here.  
 +
 
|-
 
|-
 
|07::51
 
|07::51
 
|Now we want to introduce some text between these two. So the line separator slash slash  is removed and in that place we introduce this text that we want to include.  
 
|Now we want to introduce some text between these two. So the line separator slash slash  is removed and in that place we introduce this text that we want to include.  
 +
 
|-
 
|-
 
|08:07
 
|08:07
 
|Let’s take this text and put it there. Whatever text we want to put, appears in braces with an '''inter-text''' command.  
 
|Let’s take this text and put it there. Whatever text we want to put, appears in braces with an '''inter-text''' command.  
 +
 
|-
 
|-
 
|08:24
 
|08:24
 
|Note that the opening brace has to be closed, not closing the brace is a common mistake made by the beginners.  
 
|Note that the opening brace has to be closed, not closing the brace is a common mistake made by the beginners.  
 +
 
|-
 
|-
 
|08:37
 
|08:37
 
|Let's compile this. So here is the text and you also have the equations aligned.  
 
|Let's compile this. So here is the text and you also have the equations aligned.  
 +
 
|-
 
|-
 
|08:50
 
|08:50
 
|Note also the use of the dollar sign within the '''inter-text''' command.  
 
|Note also the use of the dollar sign within the '''inter-text''' command.  
 +
 
|-
 
|-
 
|08:54
 
|08:54
 
|'''Inter-text''' is like running text, so this is not really a part of the '''align''' environment. You need to include dollars here.  
 
|'''Inter-text''' is like running text, so this is not really a part of the '''align''' environment. You need to include dollars here.  
 +
 
|-
 
|-
 
|09:03
 
|09:03
 
|These equations don’t have numbers. In fact, the star in the '''align star''' command has told latex not to put the equation numbers.  
 
|These equations don’t have numbers. In fact, the star in the '''align star''' command has told latex not to put the equation numbers.  
 +
 
|-
 
|-
 
|9:14
 
|9:14
 
|Let us remove the star and see what the '''align environment''' does. Let’s remove the star here. Also remove the star here. Let’s see what happens.  
 
|Let us remove the star and see what the '''align environment''' does. Let’s remove the star here. Also remove the star here. Let’s see what happens.  
 +
 
|-
 
|-
 
|09:30
 
|09:30
 
|So equation numbers have appeared automatically.  
 
|So equation numbers have appeared automatically.  
 +
 
|-
 
|-
 
|09:36
 
|09:36
 
|We want to refer to them, so for example, let’s say we want to refer to them, so I have this here.  
 
|We want to refer to them, so for example, let’s say we want to refer to them, so I have this here.  
 +
 
|-
 
|-
 
|09:49
 
|09:49
 
|Suppose, this is the second equation I want to discretize, so I write this statement.  
 
|Suppose, this is the second equation I want to discretize, so I write this statement.  
 +
 
|-
 
|-
 
|09:55
 
|09:55
 
|Let me take this here, below this, put it.  
 
|Let me take this here, below this, put it.  
 +
 
|-
 
|-
 
|10:04
 
|10:04
 
|Let me compile it. So it says "we will now discretize the PID controller given in equation 2".  
 
|Let me compile it. So it says "we will now discretize the PID controller given in equation 2".  
 +
 
|-
 
|-
 
|10:13
 
|10:13
 
|The equation numbers unfortunately may change while insertion or deletion of equations.  
 
|The equation numbers unfortunately may change while insertion or deletion of equations.  
 +
 
|-
 
|-
 
|10:20
 
|10:20
 
|To demonstrate this, let us suppose, we include an equation here.  
 
|To demonstrate this, let us suppose, we include an equation here.  
 +
 
|-
 
|-
 
|10:32
 
|10:32
 
|Slash, slash, a equals b.  
 
|Slash, slash, a equals b.  
 +
 
|-
 
|-
 
|10:40
 
|10:40
 
|And then we will delete these lines. Let’s compile this.  
 
|And then we will delete these lines. Let’s compile this.  
 +
 
|-
 
|-
 
|10:47
 
|10:47
 
|Now I have 'a equals b' as the second equation. Now this has become the third equation.
 
|Now I have 'a equals b' as the second equation. Now this has become the third equation.
 +
 
|-
 
|-
 
|10:53
 
|10:53
| Here we have hard-coded that equation 2 has to be discretized but this is no longer the second equation.
+
|Here we have hard-coded that equation 2 has to be discretized but this is no longer the second equation.
 +
 
 
|-
 
|-
 
|11:04
 
|11:04
| Hard-coding of equation numbers in referencing always has this problem. This is solved by the '''label''' command.
+
|Hard-coding of equation numbers in referencing always has this problem. This is solved by the '''label''' command.
 +
 
 
|-
 
|-
 
|11:12
 
|11:12
| So, let us come here and here at the end of the equation we introduce ‘label equation PID’ and then here I write in equation ‘ref’, '''ref''' is the command and whatever that comes here label, should appear here also, again within the braces, 'equation PID’.  
+
|So, let us come here and here at the end of the equation we introduce ‘label equation PID’ and then here I write in equation ‘ref’, '''ref''' is the command and whatever that comes here label, should appear here also, again within the braces, 'equation PID’.  
 +
 
 
|-
 
|-
 
|11:39
 
|11:39
 
|Let's see what happens when I compile it.  
 
|Let's see what happens when I compile it.  
 +
 
|-
 
|-
 
|11:47
 
|11:47
 
|On compiling it, we see question marks here.  
 
|On compiling it, we see question marks here.  
 +
 
|-
 
|-
 
|11:52
 
|11:52
 
|On second compilation, see what has happened here – now it has become three. On second compilation the numbers become correct.  
 
|On second compilation, see what has happened here – now it has become three. On second compilation the numbers become correct.  
 +
 
|-
 
|-
 
|12:03
 
|12:03
 
|This is similar to what we saw in table of contents.  
 
|This is similar to what we saw in table of contents.  
 +
 
|-
 
|-
 
|12:08
 
|12:08
 
|Let us now delete the 'a equals b' equation.
 
|Let us now delete the 'a equals b' equation.
 +
 
|-
 
|-
 
|12:15
 
|12:15
| Let us get rid of this also.  
+
|Let us get rid of this also.  
 +
 
 
|-
 
|-
 
|12:22
 
|12:22
 
|Let’s compile it. This equation 2 is gone but you still have this three.  
 
|Let’s compile it. This equation 2 is gone but you still have this three.  
 +
 
|-
 
|-
 
|12:30
 
|12:30
 
|On first compilation the reference gives the previous number, on second compilation the numbers become correct.  
 
|On first compilation the reference gives the previous number, on second compilation the numbers become correct.  
 +
 
|-
 
|-
 
|12:40
 
|12:40
 
|The '''labels''' are '''case sensitive'''. For example, here I have called it equation PID, PID is in capitals. Let’s change this to small pid.  
 
|The '''labels''' are '''case sensitive'''. For example, here I have called it equation PID, PID is in capitals. Let’s change this to small pid.  
 +
 
|-
 
|-
 
|12:54
 
|12:54
 
|What happens now, here it says that it doesn’t know that.  
 
|What happens now, here it says that it doesn’t know that.  
 +
 
|-
 
|-
 
|13:02
 
|13:02
 
|It's only that these have to be identical, these need not be characters. For example, suppose I want to give numbers here, let me just put hundred, let me put 100. '''Save''' it. Compile it.  
 
|It's only that these have to be identical, these need not be characters. For example, suppose I want to give numbers here, let me just put hundred, let me put 100. '''Save''' it. Compile it.  
 +
 
|-
 
|-
 
|13:21
 
|13:21
 
|Okay, it doesn’t know it yet in the first compilation but if I compile it  second time it will know. Numbers are the same.  
 
|Okay, it doesn’t know it yet in the first compilation but if I compile it  second time it will know. Numbers are the same.  
 +
 
|-
 
|-
 
|13:30
 
|13:30
 
|In a similar way we can create labels for sections, sub-sections and so on.  
 
|In a similar way we can create labels for sections, sub-sections and so on.  
 +
 
|-
 
|-
 
|13:35
 
|13:35
 
|So let us do that, let us demonstrate this with section. Let us do it here.  
 
|So let us do that, let us demonstrate this with section. Let us do it here.  
 +
 
|-
 
|-
 
|13:45
 
|13:45
 
|Section, this is first section. Label, sec 100.  
 
|Section, this is first section. Label, sec 100.  
 +
 
|-
 
|-
 
|13:56
 
|13:56
 
|Then we go to the end of the document here.  
 
|Then we go to the end of the document here.  
 +
 
|-
 
|-
 
|14:00
 
|14:00
 
|And say: section ref sec-100, shows how to write equations. '''Save''' it here.  
 
|And say: section ref sec-100, shows how to write equations. '''Save''' it here.  
 +
 
|-
 
|-
 
|14:23
 
|14:23
| ‘Section, question marks shows how to write equations’.  
+
|‘Section, question marks shows how to write equations’.  
 +
 
 
|-
 
|-
 
|14:26
 
|14:26
 
|On next compilation, this is taken care of.  
 
|On next compilation, this is taken care of.  
 +
 
|-
 
|-
 
|14:30
 
|14:30
 
|So section 1, this number is the same as this number.  
 
|So section 1, this number is the same as this number.  
 +
 
|-
 
|-
 
|14:34
 
|14:34
 
|So this works for sections, sub-sections and so on. In fact, with any environment that has a number associated with it.  
 
|So this works for sections, sub-sections and so on. In fact, with any environment that has a number associated with it.  
 +
 
|-
 
|-
 
|14:42
 
|14:42
 
|Alright, let’s delete these.  
 
|Alright, let’s delete these.  
 +
 
|-
 
|-
 
|14:56
 
|14:56
 
|Let's compile these once again. Alright.  
 
|Let's compile these once again. Alright.  
 +
 
|-
 
|-
 
|15:04
 
|15:04
 
|We will now see how to accommodate long equations.  
 
|We will now see how to accommodate long equations.  
 +
 
|-
 
|-
 
|15:09
 
|15:09
 
|So, I have already written it here. Let me just go there at the end of the document, okay here it is.  
 
|So, I have already written it here. Let me just go there at the end of the document, okay here it is.  
 +
 
|-
 
|-
 
|15:23
 
|15:23
 
|Okay. So let me add this.  
 
|Okay. So let me add this.  
 +
 
|-
 
|-
 
|15:29
 
|15:29
 
|Put it here. Let's see what happens when I compile it.  
 
|Put it here. Let's see what happens when I compile it.  
 +
 
|-
 
|-
 
|15:40
 
|15:40
 
|So I have a third equation that I have added here, it’s a long equation. It’s a long equation so it doesn’t fit into one line.
 
|So I have a third equation that I have added here, it’s a long equation. It’s a long equation so it doesn’t fit into one line.
 +
 
|-
 
|-
 
|15:49
 
|15:49
 
| So let us break it into two. The way to do that is, let us break it here, slash slash and come here and I’m putting an align with this ampersand.  
 
| So let us break it into two. The way to do that is, let us break it here, slash slash and come here and I’m putting an align with this ampersand.  
 +
 
|-
 
|-
 
|16:11
 
|16:11
 
|Let me '''save''' it, compile it. See that this equation has been broken into two parts and I am aligning it with the plus sign.  
 
|Let me '''save''' it, compile it. See that this equation has been broken into two parts and I am aligning it with the plus sign.  
 +
 
|-
 
|-
 
|16:26
 
|16:26
 
|All these equal signs and plus signs are aligned now.  
 
|All these equal signs and plus signs are aligned now.  
 +
 
|-
 
|-
 
|16:30
 
|16:30
 
|Unfortunately we have equation numbers in both parts.  
 
|Unfortunately we have equation numbers in both parts.  
 +
 
|-
 
|-
 
|16:35
 
|16:35
 
|Supposing we don’t want the number in the first line, suppose we don’t want this number. Include the command ‘no number’ before this slash, slash symbol. Do this as follows.  
 
|Supposing we don’t want the number in the first line, suppose we don’t want this number. Include the command ‘no number’ before this slash, slash symbol. Do this as follows.  
 +
 
|-
 
|-
 
|16:51
 
|16:51
 
|'''Save''' this. Compile this. See that this equation number is gone and this has become three automatically.  
 
|'''Save''' this. Compile this. See that this equation number is gone and this has become three automatically.  
 +
 
|-
 
|-
 
|17:02
 
|17:02
 
|We see that the braces we wanted in some terms are missing. For example, here I have said e n, e n minus 1. Here it appears without these braces. This is because, braces are delimiters in latex.  
 
|We see that the braces we wanted in some terms are missing. For example, here I have said e n, e n minus 1. Here it appears without these braces. This is because, braces are delimiters in latex.  
 +
 
|-
 
|-
|17;16
+
|17:16
 
|We now want to tell latex to not interpret these braces. This is done by putting a reverse slash before the braces.
 
|We now want to tell latex to not interpret these braces. This is done by putting a reverse slash before the braces.
 +
 
|-
 
|-
 
|17:24
 
|17:24
 
| Let me put a reverse slash here. Let me also put a reverse slash here.  
 
| Let me put a reverse slash here. Let me also put a reverse slash here.  
 +
 
|-
 
|-
 
|17:36
 
|17:36
 
|See that now we have the braces here; similarly let's put it here also.  
 
|See that now we have the braces here; similarly let's put it here also.  
 +
 
|-
 
|-
 
|17:46
 
|17:46
 
|Here and here. Let's'''Save''' this, now we have got that.  
 
|Here and here. Let's'''Save''' this, now we have got that.  
 +
 
|-
 
|-
 
|17:58
 
|17:58
 
|We will now show how to create large brackets in equations. For example, here, these brackets are very small.  
 
|We will now show how to create large brackets in equations. For example, here, these brackets are very small.  
 +
 
|-
 
|-
 
|18:08
 
|18:08
 
|The way to do that is using – what are known as '''left''' and '''right''' commands.  
 
|The way to do that is using – what are known as '''left''' and '''right''' commands.  
 +
 
|-
 
|-
 
|18:15
 
|18:15
 
|So let's come here – so the equation is here.  
 
|So let's come here – so the equation is here.  
 +
 
|-
 
|-
 
|18:21
 
|18:21
 
|The way to do this is – '''K slash left''' and on this side I have this, so here I put slash '''right'''.  
 
|The way to do this is – '''K slash left''' and on this side I have this, so here I put slash '''right'''.  
 +
 
|-
 
|-
 
|18:38
 
|18:38
 
|Let’s compile this. See this, it has become bigger.  
 
|Let’s compile this. See this, it has become bigger.  
 +
 
|-
 
|-
 
|18:45
 
|18:45
 
|We can do this also with square brackets.
 
|We can do this also with square brackets.
 +
 
|-
 
|-
 
|18:58
 
|18:58
| I got square brackets. I can also put braces, only thing is that I have to tell latex not to interpret. So I put a slash brace.  
+
|I got square brackets. I can also put braces, only thing is that I have to tell latex not to interpret. So I put a slash brace.  
 +
 
 
|-
 
|-
 
|19:12
 
|19:12
 
|Let’s compile this.  
 
|Let’s compile this.  
 +
 
|-
 
|-
 
|19:17
 
|19:17
 
|See this braces.  
 
|See this braces.  
 +
 
|-
 
|-
 
|19:22
 
|19:22
 
|When we have one equation split into multiple lines, we will have to put only the left on the first. For example, here, we have a bracket here, we have a bracket here, I want to make this slightly bigger. So let me do that here.  
 
|When we have one equation split into multiple lines, we will have to put only the left on the first. For example, here, we have a bracket here, we have a bracket here, I want to make this slightly bigger. So let me do that here.  
 +
 
|-
 
|-
 
|19:35
 
|19:35
 
|Suppose for example, I want to put a '''left''' bracket here and here I want to put a '''right''' bracket. Compile it.
 
|Suppose for example, I want to put a '''left''' bracket here and here I want to put a '''right''' bracket. Compile it.
 +
 
|-
 
|-
 
|19:57
 
|19:57
| It comes and complains ‘forgotten right’, because I opened it here but I didn’t close it in the same equation.  
+
|It comes and complains ‘forgotten right’, because I opened it here but I didn’t close it in the same equation.  
 +
 
 
|-
 
|-
 
|20:04
 
|20:04
 
|The way to do that is to use what is known as '''slash right dot''', that means don’t worry about the right hand side.  
 
|The way to do that is to use what is known as '''slash right dot''', that means don’t worry about the right hand side.  
 +
 
|-
 
|-
 
|20:15
 
|20:15
 
|Similarly , here we have to say '''slash left dot''', don’t worry about the left here. Let me exit here. Let me re-compile it. So this is taken care of.  
 
|Similarly , here we have to say '''slash left dot''', don’t worry about the left here. Let me exit here. Let me re-compile it. So this is taken care of.  
 +
 
|-
 
|-
 
|20:30
 
|20:30
 
|Now suppose I want to push this a little inside. I can always say '''slash h-space 1cm'''.
 
|Now suppose I want to push this a little inside. I can always say '''slash h-space 1cm'''.
 +
 
|-
 
|-
 
|20:45
 
|20:45
 
| Let me just do that shift.  
 
| Let me just do that shift.  
 +
 
|-
 
|-
 
|20:51
 
|20:51
 
|So, this has been shifted, this has been aligned.  
 
|So, this has been shifted, this has been aligned.  
 +
 
|-
 
|-
 
|20:54
 
|20:54
 
|If you don’t want this, you want the plus sign to come inside,
 
|If you don’t want this, you want the plus sign to come inside,
 +
 
|-
 
|-
 
|20:59
 
|20:59
| let’s do this here, put the plus sign here.
+
|let’s do this here, put the plus sign here.
 +
 
 
|-
 
|-
 
|21:08
 
|21:08
 
| Okay, this plus is inside. Now this is nicely done.  
 
| Okay, this plus is inside. Now this is nicely done.  
 +
 
|-
 
|-
 
|21:17
 
|21:17
 
|All '''commands''' that work in between the dollar signs also work between the aligned environment but for the ampersand symbol that is used for the aligning of multiple equations.  
 
|All '''commands''' that work in between the dollar signs also work between the aligned environment but for the ampersand symbol that is used for the aligning of multiple equations.  
 +
 
|-
 
|-
 
|21:27
 
|21:27
 
|All commands that work in the aligned environment also work within the dollar symbols.
 
|All commands that work in the aligned environment also work within the dollar symbols.
|-
+
 
 +
|-
 
|21:32
 
|21:32
 
|Nevertheless, there is a small difference in the way some outputs appear in the aligned environment and in the running mode obtained with the dollar.  
 
|Nevertheless, there is a small difference in the way some outputs appear in the aligned environment and in the running mode obtained with the dollar.  
 +
 
|-
 
|-
 
|21:41
 
|21:41
 
|This can be illustrated with the integral mode.  
 
|This can be illustrated with the integral mode.  
 +
 
|-
 
|-
 
|21:46
 
|21:46
 
|So let's come here.  
 
|So let's come here.  
 +
 
|-
 
|-
 
|21:50
 
|21:50
 
|Let me delete these.
 
|Let me delete these.
 +
 
|-
 
|-
 
|21:53
 
|21:53
 
| So I have this statement here. Let me take this,  
 
| So I have this statement here. Let me take this,  
 +
 
|-
 
|-
 
|22:10
 
|22:10
 
|let me put it here.  
 
|let me put it here.  
 +
 
|-
 
|-
 
|22:15
 
|22:15
 
|"The integral mode includes the term" this integral.  
 
|"The integral mode includes the term" this integral.  
 +
 
|-
 
|-
 
|22:21
 
|22:21
 
|Let me close this, otherwise alignment will complain.  
 
|Let me close this, otherwise alignment will complain.  
 +
 
|-
 
|-
 
|22:28
 
|22:28
 
|So what I have done is: The integral mode includes the term" this integral.
 
|So what I have done is: The integral mode includes the term" this integral.
 +
 
|-
 
|-
 
|22:33
 
|22:33
 
| Note the size of this integral and size of this integral. This is a lot bigger and this is smaller.  
 
| Note the size of this integral and size of this integral. This is a lot bigger and this is smaller.  
 +
 
|-
 
|-
 
|22:47
 
|22:47
 
|Such changes also occur in the case of fractions, sum and product to cite a few.  
 
|Such changes also occur in the case of fractions, sum and product to cite a few.  
 +
 
|-
 
|-
 
|22:52
 
|22:52
 
|There is one other thing that I want to tell before completing this tutorial.
 
|There is one other thing that I want to tell before completing this tutorial.
 +
 
|-
 
|-
 
|22:58
 
|22:58
| Aligned environment does not like blank lines in between. Suppose for example, I create a blank line here.  
+
|Aligned environment does not like blank lines in between. Suppose for example, I create a blank line here.  
 +
 
 
|-
 
|-
 
|23:11
 
|23:11
 
|It comes and says that paragraph ended before alignment was complete. If you really want a space, leave a percentage which tells latex that it is a comment.  
 
|It comes and says that paragraph ended before alignment was complete. If you really want a space, leave a percentage which tells latex that it is a comment.  
 +
 
|-
 
|-
 
|23:24
 
|23:24
 
|Re-compiling. It goes through and you get all the text as before.  
 
|Re-compiling. It goes through and you get all the text as before.  
 +
 
|-
 
|-
 
|23:32
 
|23:32
 
|This brings us to the end of this tutorial. Thanks for listening.  
 
|This brings us to the end of this tutorial. Thanks for listening.  
 +
 
|-
 
|-
 
|23:37
 
|23:37
 
|This is Kannan Moudgalya, signing off. Good-bye.
 
|This is Kannan Moudgalya, signing off. Good-bye.

Revision as of 11:47, 24 March 2017

Time Narration
00:00 Welcome to this tutorial on creating equations through Latex.
00:06 You see three windows as usual.
00:10 I have created a 12pt size, article class document. And using AMSmath package and also using the 'ccliscences' package for creative commons copyright statement as here.
00:30 make title creates the title page. new page command takes the rest of the document to a new page.
00:43 There are many ways to create equations, I will use the command align star to create equations.
00:51 Let us begin with a matrix differential equation consisting of four components.
01:03 Align star, Frac d by dt of begin b-matrix, x_1, next line x_2, end b-matrix.
01:27 Let me close this. Let us compile it.
01:37 So we have created ‘d by dt of x1 x2’.
01:42 Let us now augment the vector with two more components.
01:48 You do it as follows. Next line x3, next line x4. Save it. Compile it. So I have four components.
02:03 Let me now say that this is equal to the right hand side matrix begin b-matrix.
02:20 Zero, zero, one, zero.
02:29 Next line: zero, zero, zero, one.
02:37 And then, lets close this matrix. Save.
02:47 So I have this. So I have written the first two rows.
02:53 It is always a good idea to compile after every few small additions so that we have not made a mistake.
03:00 Note that the align star environment takes the role of the dollar signs.
03:06 For example, we did not enter the dollar sign at all. As a matter of fact, we should not enter the dollar sign within the aligned star environment.
03:14 Let us add a third line to the matrix on the right hand side and illustrate this idea.
03:25 Zero, dollar minus gamma, zero, zero. So there are four entries. Compile it. It comes and says, missing dollar inserted.
03:50 What we will do is, let's come here, get rid of these dollar signs. Save it.
03:59 Exit compilation by this x. recompile it and note that minus gamma has come. So we need one more line here, we put that. Zero, alpha without dollar sign, zero, zero. Alright, now this is the way to do that.
04:28 Let's complete this equation. I have a few more terms here.
04:34 Let me just see if it is here, yes, it is here.
04:39 Let’s cut this. Put this here.
04:46 Let’s see what happens when I compile this.
04:52 This is a model of an inverted pendulum.
04:59 What do you do when you have more than one equation?
05:04 Let us add one more align statement. And I have written this equation here.
05:13 Let me bring it from there.
05:17 Here is the equation, so let me say begin align star.
05:26 Let’s cut this. Copy this. Close this align. We compile it.
05:39 When I compile it, I get the second equation appearing.
05:44 There are two problems with this. There is a large gap between the two equations, also we may want to align the equations.
05:52 In view of these observations, we put both of these equations into a single align star environment.
06:01 So we will do this as follows. Delete this.
06:08 Save this. Compile it.
06:14 Now what has happened is that both the equations have come on the same line.
06:20 We will take care of that by telling latex to split this by the reverse slash. Two of them.
06:33 When I compile it, now these have gone to second equation.
06:40 But the equations are not aligned. Suppose that we want to align the 'equal to' sign, suppose we want to align these two signs, we put an ampersand symbol in front of the 'equal to' signs here. Let's put it.
07:00 And then we will put it here also. Ampersand. Let’s compile this. Now notice that both of them are aligned.
07:18 Suppose that we want to introduce some text in between the equations without upsetting the alignment.
07:24 This can be achieved using the inter-text command.
07:29 So we remove... we made a mistake here, the 'delta mu' has come here. So, what we should do is, let us first put this properly, compile this.
07:48 Now 'delta mu' has come there. 'U of t' is here.
07::51 Now we want to introduce some text between these two. So the line separator slash slash is removed and in that place we introduce this text that we want to include.
08:07 Let’s take this text and put it there. Whatever text we want to put, appears in braces with an inter-text command.
08:24 Note that the opening brace has to be closed, not closing the brace is a common mistake made by the beginners.
08:37 Let's compile this. So here is the text and you also have the equations aligned.
08:50 Note also the use of the dollar sign within the inter-text command.
08:54 Inter-text is like running text, so this is not really a part of the align environment. You need to include dollars here.
09:03 These equations don’t have numbers. In fact, the star in the align star command has told latex not to put the equation numbers.
9:14 Let us remove the star and see what the align environment does. Let’s remove the star here. Also remove the star here. Let’s see what happens.
09:30 So equation numbers have appeared automatically.
09:36 We want to refer to them, so for example, let’s say we want to refer to them, so I have this here.
09:49 Suppose, this is the second equation I want to discretize, so I write this statement.
09:55 Let me take this here, below this, put it.
10:04 Let me compile it. So it says "we will now discretize the PID controller given in equation 2".
10:13 The equation numbers unfortunately may change while insertion or deletion of equations.
10:20 To demonstrate this, let us suppose, we include an equation here.
10:32 Slash, slash, a equals b.
10:40 And then we will delete these lines. Let’s compile this.
10:47 Now I have 'a equals b' as the second equation. Now this has become the third equation.
10:53 Here we have hard-coded that equation 2 has to be discretized but this is no longer the second equation.
11:04 Hard-coding of equation numbers in referencing always has this problem. This is solved by the label command.
11:12 So, let us come here and here at the end of the equation we introduce ‘label equation PID’ and then here I write in equation ‘ref’, ref is the command and whatever that comes here label, should appear here also, again within the braces, 'equation PID’.
11:39 Let's see what happens when I compile it.
11:47 On compiling it, we see question marks here.
11:52 On second compilation, see what has happened here – now it has become three. On second compilation the numbers become correct.
12:03 This is similar to what we saw in table of contents.
12:08 Let us now delete the 'a equals b' equation.
12:15 Let us get rid of this also.
12:22 Let’s compile it. This equation 2 is gone but you still have this three.
12:30 On first compilation the reference gives the previous number, on second compilation the numbers become correct.
12:40 The labels are case sensitive. For example, here I have called it equation PID, PID is in capitals. Let’s change this to small pid.
12:54 What happens now, here it says that it doesn’t know that.
13:02 It's only that these have to be identical, these need not be characters. For example, suppose I want to give numbers here, let me just put hundred, let me put 100. Save it. Compile it.
13:21 Okay, it doesn’t know it yet in the first compilation but if I compile it second time it will know. Numbers are the same.
13:30 In a similar way we can create labels for sections, sub-sections and so on.
13:35 So let us do that, let us demonstrate this with section. Let us do it here.
13:45 Section, this is first section. Label, sec 100.
13:56 Then we go to the end of the document here.
14:00 And say: section ref sec-100, shows how to write equations. Save it here.
14:23 ‘Section, question marks shows how to write equations’.
14:26 On next compilation, this is taken care of.
14:30 So section 1, this number is the same as this number.
14:34 So this works for sections, sub-sections and so on. In fact, with any environment that has a number associated with it.
14:42 Alright, let’s delete these.
14:56 Let's compile these once again. Alright.
15:04 We will now see how to accommodate long equations.
15:09 So, I have already written it here. Let me just go there at the end of the document, okay here it is.
15:23 Okay. So let me add this.
15:29 Put it here. Let's see what happens when I compile it.
15:40 So I have a third equation that I have added here, it’s a long equation. It’s a long equation so it doesn’t fit into one line.
15:49 So let us break it into two. The way to do that is, let us break it here, slash slash and come here and I’m putting an align with this ampersand.
16:11 Let me save it, compile it. See that this equation has been broken into two parts and I am aligning it with the plus sign.
16:26 All these equal signs and plus signs are aligned now.
16:30 Unfortunately we have equation numbers in both parts.
16:35 Supposing we don’t want the number in the first line, suppose we don’t want this number. Include the command ‘no number’ before this slash, slash symbol. Do this as follows.
16:51 Save this. Compile this. See that this equation number is gone and this has become three automatically.
17:02 We see that the braces we wanted in some terms are missing. For example, here I have said e n, e n minus 1. Here it appears without these braces. This is because, braces are delimiters in latex.
17:16 We now want to tell latex to not interpret these braces. This is done by putting a reverse slash before the braces.
17:24 Let me put a reverse slash here. Let me also put a reverse slash here.
17:36 See that now we have the braces here; similarly let's put it here also.
17:46 Here and here. Let'sSave this, now we have got that.
17:58 We will now show how to create large brackets in equations. For example, here, these brackets are very small.
18:08 The way to do that is using – what are known as left and right commands.
18:15 So let's come here – so the equation is here.
18:21 The way to do this is – K slash left and on this side I have this, so here I put slash right.
18:38 Let’s compile this. See this, it has become bigger.
18:45 We can do this also with square brackets.
18:58 I got square brackets. I can also put braces, only thing is that I have to tell latex not to interpret. So I put a slash brace.
19:12 Let’s compile this.
19:17 See this braces.
19:22 When we have one equation split into multiple lines, we will have to put only the left on the first. For example, here, we have a bracket here, we have a bracket here, I want to make this slightly bigger. So let me do that here.
19:35 Suppose for example, I want to put a left bracket here and here I want to put a right bracket. Compile it.
19:57 It comes and complains ‘forgotten right’, because I opened it here but I didn’t close it in the same equation.
20:04 The way to do that is to use what is known as slash right dot, that means don’t worry about the right hand side.
20:15 Similarly , here we have to say slash left dot, don’t worry about the left here. Let me exit here. Let me re-compile it. So this is taken care of.
20:30 Now suppose I want to push this a little inside. I can always say slash h-space 1cm.
20:45 Let me just do that shift.
20:51 So, this has been shifted, this has been aligned.
20:54 If you don’t want this, you want the plus sign to come inside,
20:59 let’s do this here, put the plus sign here.
21:08 Okay, this plus is inside. Now this is nicely done.
21:17 All commands that work in between the dollar signs also work between the aligned environment but for the ampersand symbol that is used for the aligning of multiple equations.
21:27 All commands that work in the aligned environment also work within the dollar symbols.
21:32 Nevertheless, there is a small difference in the way some outputs appear in the aligned environment and in the running mode obtained with the dollar.
21:41 This can be illustrated with the integral mode.
21:46 So let's come here.
21:50 Let me delete these.
21:53 So I have this statement here. Let me take this,
22:10 let me put it here.
22:15 "The integral mode includes the term" this integral.
22:21 Let me close this, otherwise alignment will complain.
22:28 So what I have done is: The integral mode includes the term" this integral.
22:33 Note the size of this integral and size of this integral. This is a lot bigger and this is smaller.
22:47 Such changes also occur in the case of fractions, sum and product to cite a few.
22:52 There is one other thing that I want to tell before completing this tutorial.
22:58 Aligned environment does not like blank lines in between. Suppose for example, I create a blank line here.
23:11 It comes and says that paragraph ended before alignment was complete. If you really want a space, leave a percentage which tells latex that it is a comment.
23:24 Re-compiling. It goes through and you get all the text as before.
23:32 This brings us to the end of this tutorial. Thanks for listening.
23:37 This is Kannan Moudgalya, signing off. Good-bye.

Contributors and Content Editors

Minal, Nancyvarkey, PoojaMoolya, Pratik kamble, Sandhya.np14