LaTeX-Old-Version/C2/Tables-and-Figures/English-timed

From Script | Spoken-Tutorial
Revision as of 17:43, 16 October 2019 by Nancyvarkey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Time Narration
00:00 Welcome to this tutorial on Tables and Figures.
00:05 We have two objectives in this tutorial.
00:08 The first one 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.
00:22 A similar technique can be used to include figures also.
00:27 We have seen how to create the title page,
00:32 this one has title, author information, and Creative Commons, copyright information as explained in the tutorial on equations.
00:45 Today’s date appears in the last column created by this command.
00:51 Let us go to the second page.
00:58 I will now explain to you, how to create this table in a step-by-step fashion.
01:05 Let us start with a clean slate.
01:08 Let me delete these commands.
01:19 I will compile this and start with a clean slate.
01:29 The tabular environment is created using begin tabular and end tabular commands.
01:38 Let me do that here.
02: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.
02:14 In the first line, the entries are "mango" and "mixed".
02:20 Two reverse-slashes indicate next line.
02:24 Let me enter the next line.
02:28 "Jackfruit".
02:32 "Kolli hills".
02:37 "Banana".
02:40 "Green".
02:42 Let me end this tabular environment.
02:47 Let me compile this.
02:51 And, this has appeared here.
02:56 We get the 3 by 2 table. There are three rows and 2 columns.
03:02 The two columns are right aligned as indicated by the 'r r' character.
03:09 To separate the two columns, we introduce a vertical line between the column alignment characters.
03:20 So, let me put that vertical line.
03:23 Save it,Compile it.
03:28 You see that a vertical line has come.
03:31 If you want vertical lines at the end also, put them at appropriate places.
03:42 Let me put them, save them, compile them.
03:48 So, these have come.
03:50 As a matter of fact, we can put more vertical lines.
03:54 Let me put one more vertical line at the beginning.
04:02 There you are! A second line has come.
04:07 See there are two vertical lines.
04:11 We will now try different alignments.
04:15 Let's put a ‘c’ here to say that the second column should be center aligned.
04:27 This is center aligned now.
04:30 Let us make the first column left aligned.
04:34 Right now, it is right aligned; let me make them left aligned.
04:40 'l',Save
04:43 Compile.
04:46 Now it is left aligned.
04:50 We will now separate the rows with horizontal lines as follows.
04:56 Let's put a h-line here.
05:00 Let us see what happens when we do that.
05:04 It puts a top line.
05:07 If I put another h-line here,
05:16 see a line has come,So, let me complete this.
05:19 Let me put h-line.
05:22 Here I have to put a break line with two reverse slashes and then h-line.
05:30 H-line begins from the beginning of the sentence.
05:36 So, now I have completed the horizontal lines.
05:42 Now, let us add three more columns and one more row.
05:49 So, what I do is- I come here, and 'c' , 'c', 'r'.
06:01 So, I have added three more columns, first two of them are center aligned the third one is right aligned.
06:08 And then here I want to say:
06:15 "fruit"
06:19 "type"
06:22 "number of units"
06:26 "cost per unit"
06:30 "cost rupees"
06:38 h-line.
06:41 So, "mixed"
06:43 "20"
06:45 "75" rupees
06:47 "1500" rupees.
06:51 "Jackfruit"
06:54 "10" of them
06:57 "50" rupees
06:59 "500" rupees.
07:01 "Banana green"
07:05 "10" dozens
07:07 "20" rupees a dozen and "200" rupees total.
07:12 So, let’s see whether we can compile this.
07:20 So, it has created the table.
07:25 See the need for right alignment, this is.. so that we can add these numbers.
07:34 Suppose, that we want to split the columns in two.
07:39 For example, here these two columns have fruit details and these three have cost calculations.
07:48 So, this is done with the help of what is known as multi-column command.
07:55 Let me do it as follows.
07:59 multi-column
08:04 take 2
08:06 center-aligned
08:10 Fruit Details.
08:12 First two are over then I put a tab to indicate the next column.
08:19 Go to the next line.
08:24 multi-column, three, also to be center-aligned.
08:29 Cost within braces – cost calculations
08:37 slash h-line.
08:44 So, there you are.
08:46 The first two have the title "Fruit details", the next three have the title "Cost calculations".
08:52 I don’t have the vertical lines that’s because I didn’t tell latex to do that. So let’s do that.
08:59 Here, I want two vertical lines, here I want one vertical line.
09:05 Before this, I already have the line here, so let me just put this here.
09:11 See what happens.
09:16 So, now the vertical lines have also come.
09:24 Because these 2 and 3 are single character arguments its possible to write them without braces.
09:40 Okay, same thing works.
09:42 Sometimes it is necessary to draw horizontal lines between only a few columns.
09:52 So, we explain this as follows.
09: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,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 appears 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,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, let's 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 the 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, let me just, so 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 I will 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, let's 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 the 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.

Contributors and Content Editors

Nancyvarkey