LaTeX/C2/Tables-and-Figures/English-timed
From Script | Spoken-Tutorial
| Time | Narration |
|---|---|
| 0:00 | Welcome to this tutorial on tables and figures. |
| 0:05 | We have two objectives in this tutorial. |
| 0:08 | The first is to explain how to create tables using the tabular environment; the second objective is to explain how to include tables in latex documents using the table environment. |
| 0:22 | A similar technique can be used to include figures also. |
| 0:27 | We have seen how to create the title page, |
| 0:32 | this one has title, author information, and creative commons, copyright information as explained in the tutorial on equations. |
| 0:45 | Today’s date appears in the last column created by this command. |
| 0:51 | Let us go to the second page. |
| 0:58 | I will now explain to you how to create this table in a step-by-step fashion. |
| 1:05 | Let us start with a clean slate. |
| 1:08 | Let me delete these commands. |
| 1:19 | Ill compile this and start with a clean slate. |
| 1:29 | The tabular environment is created using begin tabular and end tabular commands. |
| 1:38 | Let me do that here. |
| 2:03 | The ‘r r’ characters within the braces next to the begin tabular say that there are two columns and that they are right aligned. |
| 2:14 | In the first line, the entries are mango and mixed. |
| 2:20 | Two reverse slashes indicate next line. |
| 2:24 | Let me enter the next line. |
| 2:28 | Jackfruit. |
| 2:32 | Kolli hills. |
| 2:37 | Banana. |
| 2:40 | Green. |
| 2:42 | Let me end this tabular environment. |
| 2:47 | Let me compile this. |
| 2:51 | And this has appeared here. |
| 2:56 | We get the 3 by 2 table, there are three rows and 2 columns. |
| 3:02 | The two columns are right aligned as indicated by the r r character. |
| 3:09 | To separate the two columns, we introduce a vertical line between the column alignment characters. |
| 3:20 | So let me put that vertical line. |
| 3:23 | Save it. |
| 3:24 | Compile it. |
| 3:28 | You see that a vertical line has come. |
| 3:31 | If you want vertical lines at the end also, put them at appropriate places. |
| 3:42 | Let me put them, save them, compile them. |
| 3:48 | So these have come. |
| 3:50 | As a matter of fact, we can put more vertical lines. |
| 3:54 | Let me put one more vertical line at the beginning. |
| 4:02 | There you are! A second line has come. |
| 4:07 | See there are two vertical lines. |
| 4:11 | We will now try different alignments. |
| 4:15 | Lets put a ‘c’ here, to say that the second column should be center aligned. |
| 4:27 | This is center aligned now. |
| 4:30 | Let us make the first column left aligned. |
| 4:34 | Right now it is right aligned let me make them left aligned. |
| 4:40 | L, |
| 4:41 | Save, |
| 4:43 | Compile. |
| 4:46 | Now it is left aligned. |
| 4:50 | We will now separate the rows with horizontal lines as follows. |
| 4:56 | Lets put a h-line here. |
| 5:00 | Let us see what happens when we do that. |
| 5:04 | It puts a top line. |
| 5:07 | If I put another h-line here, |
| 5:16 | see a line has come. |
| 5:17 | So let me complete this. |
| 5:19 | Let me put h-line. |
| 5:22 | Here I have to put a break line with two reverse slashes and then h-line. |
| 5:30 | H-line begins from the beginning of the sentence. |
| 5:36 | So now I have completed the horizontal lines. |
| 5:42 | Now let us add three more columns and one more row. |
| 5:49 | So what I do is, I come here, and C , C, R. |
| 6:01 | So I have added three more columns, first two of them are center aligned the third one is right aligned. |
| 6:08 | And then here I want to say: |
| 6:15 | fruit |
| 6:19 | type |
| 6:22 | number of units |
| 6:26 | cost per unit |
| 6:30 | cost rupees |
| 6:38 | h-line. |
| 6:41 | So mixed |
| 6:43 | 20 |
| 6:45 | 75 rupees |
| 6:47 | 1500 rupees. |
| 6:51 | Jackfruit |
| 6:54 | 10 of them |
| 6:57 | 50 rupees |
| 6:59 | 500 rupees. |
| 7:01 | Banana green |
| 7:05 | 10 dozens |
| 7:07 | 20 rupees a dozen and 200 rupees total. |
| 7:12 | So let’s see whether we can compile this. |
| 7:20 | So it has created the table. |
| 7:25 | See the need for right alignment, this is so that we can add these numbers. |
| 7:34 | Suppose that we want to split the columns in two. |
| 7:39 | For example, here these two columns have fruit details and these three have cost calculations. |
| 7:48 | So this is done with the help of, what is known as multi-column command. |
| 7:55 | Let me do it as follows. |
| 7:59 | Multi-column |
| 8:04 | take 2 |
| 8:06 | center-aligned |
| 8:10 | Fruit Details. |
| 8:12 | First two are over then I put a tab to indicate the next column. |
| 8:19 | Go to the next line. |
| 8:24 | Multi-column, three, also to be center-aligned. |
| 8:29 | Cost within braces – cost calculations |
| 8:37 | slash h-line. |
| 8:44 | So there you are. |
| 8:46 | The first two have the title fruit details, the next three have the title cost calculations. |
| 8:52 | I don’t have the vertical lines that’s because I didn’t tell latex to do that. So let’s do that. |
| 8:59 | Here I want two vertical lines, here I want 1 vertical line. |
| 9:05 | Before this I already have the line here so let me just put this here. |
| 9:11 | See what happens. |
| 9:16 | So now the vertical lines have also come. |
| 9:24 | Because these 2 and 3 are single character arguments its possible to write them without braces. |
| 9:40 | Okay, Same thing works. |
| 9:42 | Sometimes it is necessary to draw horizontal lines between only a few columns. |
| 9:52 | So we explain this as follows. |
| 9:54 | Let me split this mango, instead of mixed let me call this Malgoa, |
| 10:05 | and then 18 kilograms |
| 10:13 | 50 kilograms |
| 10:17 | let me delete this |
| 10:23 | okay. |
| 10:24 | And here let me say that it is Alfanso |
| 10:33 | 2 dozens |
| 10:35 | 300 rupees a dozen, and a total of 1500. |
| 10:44 | Let’s see what happens when I save this. Compile this. |
| 10:50 | So I’ve got this, what happens is this line comes here and as well as here and I don’t want this and this. So this is taken care of by saying instead of this horizontal line, I want a C line and between the columns 2 and 4. |
| 11:19 | So I should have done this here. |
| 11:22 | So let me put this back here. |
| 11:27 | H-line here. |
| 11:30 | C-line 2 to 4. |
| 11:40 | Okay, so now I have the line between columns two and four only. |
| 11:52 | So this central line has split the mangoes into two of the most popular mangoes in India. |
| 11:58 | We will conclude this example, conclude this table with a last row. |
| 12:04 | Let me total up as follows. |
| 12:11 | Multi-column four |
| 12:14 | 2 vertical lines, right-aligned |
| 12:20 | vertical separator |
| 12:24 | Total cost |
| 12:27 | Rupees. |
| 12:32 | Close this. |
| 12:35 | Next tab |
| 12:38 | 2200 |
| 12:42 | h-line. |
| 12:48 | So there you are. |
| 12:50 | So this was the table that we started with at the beginning of this tutorial. |
| 12:59 | How do we work with the tables created using the tabular environment? |
| 13:04 | Latex treats the entire table created using the tabular environment as a single object. |
| 13:10 | For example, if you write, |
| 13:17 | this is |
| 13:24 | an |
| 13:27 | example |
| 13:39 | This is an example table |
| 13:47 | What happens is this table gets sandwiched between these two. This is an example to, example table. |
| 13:56 | This table appears in a running sentence. |
| 14:01 | It is possible to include tables using a centre environment. |
| 14:05 | A more common approach is to include it in the table environment. As we show now. |
| 14:18 | Begin. |
| 14:21 | Table. |
| 14:25 | Close this. |
| 14:33 | So what happens is now ‘this is an example table’. |
| 14:36 | This statement comes separately and whatever that appeared between this ‘begin’ and ‘end’ table have been placed separately as a table. |
| 14:50 | In other words, even though the table appear in between some text, it has been put separately. |
| 14:57 | This is not centered. |
| 14:59 | What I can do is give a command here called ‘centering’. |
| 15:08 | To place this at the center of the document. |
| 15:17 | Let us now create a caption. |
| 15:20 | Table caption is put before the table. |
| 15:23 | Let me put a caption here |
| 15:31 | Caption – cost of fruits in India. |
| 15:42 | So the caption has come. |
| 15:44 | This is too close; I want to leave a small space. |
| 15:47 | Let me do that by giving through this v-space command 1 ex. |
| 15:57 | That is the space equivalent of the ‘x’ character. |
| 16:01 | So I have left this vertical space. |
| 16:04 | So now it looks okay. |
| 16:06 | By default, Latex places tables at the top of the page. |
| 16:11 | This placement is done automatically. |
| 16:14 | The table is ‘floated’ to the next available slot. |
| 16:18 | To explain this, let me cut and paste some text from the bottom of this document. |
| 16:25 | Let me delete this. |
| 16:28 | Let me delete this, |
| 16:38 | Alright. |
| 16:43 | Now there is some write up about these fruits. |
| 16:49 | Go to the top of this. |
| 16:55 | Paste it here. |
| 16:58 | Compile it. |
| 17:01 | So as before the table got placed at the top of this page. |
| 17:06 | Let me put some more text here. |
| 17:12 | Four copies. |
| 17:16 | So now what has happened is |
| 17:26 | this table has been floated to the second page and |
| 17:31 | there is nothing else here so it has been placed at the middle of this page. |
| 17:35 | Let me put one more copy of this, some more text. |
| 17:43 | So now what has happened is |
| 17:49 | this is the title page, this is the text page, the table has been floated, it has gone to the top of this page. |
| 18:01 | As in equations, we can also create labels and use them for referencing. |
| 18:06 | For example |
| 18:12 | you give this command below the caption command. |
| 18:15 | You have to give it below the caption command because it is the caption command that creates the table number. |
| 18:21 | For example, here table 1 has been created automatically by this caption command. |
| 18:26 | If you put the label after this, this label will refer to the number created using the caption command. |
| 18:33 | So label |
| 18:40 | fruits. |
| 18:43 | So let me just go back and say |
| 18:48 | let me add this line here. |
| 18:53 | The cost of these fruits is shown in Table reference, you have to give the label, it should be the same as this |
| 19:08 | tab fruits |
| 19:12 | Let me compile it. |
| 19:16 | So there it is. |
| 19:17 | On first compilation, this variable is not assigned. |
| 19:22 | So let me re-compile it, so now I have got this. |
| 19:28 | We can create a list of tables automatically. |
| 19:33 | As we explain now. |
| 19:37 | After the ‘make title’, suppose we want this ‘list of tables’ - one word, is the command. |
| 19:50 | So what has happened is |
| 19:53 | it has created a list of tables. |
| 19:57 | Typically one would have to compile twice to make sure the table number comes correct. |
| 20:03 | Here it comes, the table according to this list is in page two but we know that it is in page 3. |
| 20:13 | So this is in page 3. |
| 20:15 | So lets go back and compile it once more |
| 20:20 | so there you are, it is in page 3. |
| 20:26 | So this has been explained before. |
| 20:29 | Alright, this comes to the end of this part in which we explained tables. |
| 20:36 | We will now explain how to create figures using the command called ‘include graphics’. |
| 20:48 | So for this we need to include this package called ‘graphicx’. |
| 21:00 | Okay! Suppose I go to the bottom of this, |
| 21:08 | and say, the command is as follows. Begin, figure, |
| 21:14 | include graphics, |
| 21:19 | width equals. |
| 21:29 | I have a file called iitb.pdf. |
| 21:36 | There you are. |
| 21:38 | I include it here with the width of this figure coming out to be equal to that of the line width. |
| 21:51 | Let me end this figure. |
| 21:55 | Compile this. |
| 22:01 | There you are. |
| 22:04 | So it has also been put at the top of this page. |
| 22:09 | Alright! What I will do is, so let me just, this is for if I want to use the entire line width . |
| 22:17 | Suppose I want to use point 5, that is half a line width, |
| 22:26 | then it has been made small. |
| 22:29 | And note that it has been left aligned. |
| 22:32 | as in the table I can say ‘centering’, |
| 22:38 | which will center this at the middle. |
| 22:49 | I can also create a caption, figure captions are created after the figure is included. |
| 23:00 | ‘Golden Jubilee logo of IIT Bombay. |
| 23:13 | Okay, as before I can create a label and refer to it using the ‘ref’ command. |
| 23:28 | I can also make this list of figures appear along with the list of tables. |
| 23:36 | So suppose I want list of figures also. |
| 23:45 | Ill compile it. |
| 23:48 | I will compile it twice |
| 23:51 | and there it is. List of figures also comes automatically. |
| 23:56 | All the figure captions will appear here. |
| 24:08 | There is one last thing that I want to show you here. |
| 24:11 | That is how to rotate these figures. |
| 24:15 | This is done by the angle option. |
| 24:21 | Suppose angle, I want to rotate by 90 degrees. |
| 24:25 | So lets go to this figure. |
| 24:29 | Let’s compile this. |
| 24:32 | So this has been rotated by 90 degrees. |
| 24:37 | Rotate it by minus 90,. |
| 24:42 | alright So this is the way to include figures. |
| 24:48 | Here I am assuming that iitb.pdf is available. |
| 24:53 | This brings us to the end of this tutorial. |
| 24:55 | The beginners of latex should compile after every few changes to the source document and make sure that what they have entered is correct. |
| 25:05 | Thank you for listening to this tutorial. |
| 25:07 | This is Kannan Moudgalya signing off. Good-bye. |