 Good morning. My name is Kannan Mughalya. I'm a professor in chemical engineering. I have been asked by Professor Fartek to come and deliver this lecture on latex. How many of you already use latex? Everybody uses latex. Who doesn't use latex? Is there anyone who doesn't use latex? So why are we doing this lecture? Only people who know latex have come. How many students are in the class? 19. Those of you who have been using latex for more than one year, can you raise your hand? More than one year. More than five years. People who just started using latex, raise your hand. Are there some people? So I'm happy that I didn't come prepared because it would have been a waste of time. Had I come prepared, what I will do is I will share some experience that I have had in using latex. So I have been using latex at least for 15 years. It's something that I don't claim to be an expert. In the sense I don't write style files and things like that. But I'm very comfortable in using it and in fact it is very difficult for me to start using word for example. LibreOffice Writer. How many of you use LibreOffice Writer? So I find it difficult to do and sometimes things don't work. I have a tough time trying to figure out why things don't work. And of course I always go to Google to find out the solution. Google works for latex also. You know the basics. Then as you experience it, as you use it, you see that your skills become better and better. More importantly, you find that there are a lot of things that the community has developed and left on the net. You can just download and use them. So I'm going to circulate two books that we wrote on latex. I haven't got the other two. So this is a book that I wrote in 2007 and I took 10 years to write this book. Based on the experience in teaching this course at IIT Bombay to our MTech students who come from various engineering colleges who have various backgrounds. So I wanted to teach a course that will be good for all of them. Then I wanted to write this book. Of course I delivered that course many times through C-Deep. It was transmitted. So for that I created many slides. I created examples. I created pictures, drawings and things like that. So in 2007, John Wiley and Sons, this was published at the UK office and they got it reviewed at four different places. One reviewer in North America. One reviewer in Europe. Third reviewer in continental. Second was in continental Europe. Third was UK. Fourth was Australia and Japan. So because this is for the international market. They thought it was okay. While writing, they also asked me will you be able to give camera ready copies for this book? I wasn't sure. In fact, one of my friends, one of my colleagues in electrical engineering said don't agree to that because they will want you to do a lot of precise adjustments because it's John Wiley. And you may not be able to do it will take a lot of your time. So I said I cannot do the final correction, but I will do the, you know, more or less final. So then he said the person whom I was negotiating with in John Wiley and Sons, he said in that case I won't give you all the money I have kept for writing this book. They do have some money. I'll give you only 1000 pounds. Other money I'm going to keep for final correction. But it turned out that they didn't have to make any changes. Okay. And I lost that other money because I did the whole thing. Okay. You will see I'm going to circulate this book. You will see in every figure also it has lots of figures, more than 100 figures. Probably it has 1000 equations. Right. You can see in figures also the symbols, mathematical symbols are the same symbols as in the text. Obviously you, how do you create a figure? What software do you use to create a figure? Do you create a latex output in that? Because I have not used it. You'll have to find out because one of the things that you would like to do is sometimes you have mathematical symbols. You have mathematical symbols in running text. Right. And you say, see that figure and you want to see that symbol there. The output variable, you know, some C or zeta does that symbol zeta in the figure same as the one in the text. Okay. If you do that, if you make them identical, it's something that somebody like John Wiley would want. Okay. Those are the things that made very easy. And so this is one book which I'm going to pass around. And I can tell you that if I didn't use latex, it would have taken many more years to write it. In fact, I can't imagine doing this in Word or LibreOffice Writer and still making sure that it will be correct. It'll be correct. All cross references will be correct. Right. So that that I would not have been and of course the get up the second book that I wrote. Actually, I made a promise to my wife after writing this book that I won't write another book. Okay, because I took 10 years and I was there all the time. And in fact, my I feared that if I wrote another book, there will be a divorce at home. So I didn't dare write a book. Okay. But she was surprised that I wrote this book. She asked me, when did you write this book? She didn't even know this. I wrote this book along with my staff members. I think there are 10 to 12 people, 10 people here. They're all my staff members. We wrote this book in one week. Of course, it just explains an EDA tool called Askad. We wrote a similar book on Arduino, Arduino microcontroller. We wrote another book that was that took a little longer, but maybe 10, 12 days because that required quite a bit of validation of the hardware connection. But this one didn't have any of them. We had a software. We wanted to explain it and we had 10 people. Then I said, look, we have to plan it out one week. We will produce this book. So we formed a management team and the work was allocated to various people. They will do this. This person will do this. This person will generate pictures and so on and so forth. But if I didn't tell you all the story, if you read this book, you will not know that it was written by 10 people. The consistency that you have in this book is amazing. I can tell you that there are no mistakes in cross-referencing. All figure numbers, table numbers, chapter numbers are exact. There are no mistakes. How does it work? He is writing. He is giving a chapter number. I'm using it. He has got a figure number. Somebody else is using it. But still it is correct. No mistakes. So it is possible with latex. I can assure you that it is not possible with any other software. It may be possible, but it may require a lot of work. I want to ask you, now that more people have come, is there anyone who doesn't use latex here? So I think you should learn. What I'm going to do is I'm just going to circulate these two books. You can just have a look at it, pass it around. So this is one week book. This is 10 year book. I don't want you to understand anything. We are not going to ask any questions on this. I just want you to see the type setting. While we are going through this, because all of you already know latex, I'll tell one more story. In our MTech program, I had an MTech student from Mumbai, I think Bharti with the Apeed or some college like this. And he wrote the seminar report. Seminar report is compulsory in the first semester. And he produced a terrible report at a tough time. And I asked him, why is it so bad? So he said, he said, oh, it kept formatting it by itself. What he meant was in word, you connect it to a printer, prints differently. Okay. You open it and then open it. You make some change. It has changed everything subsequently. And it has made a lot of changes. That's what he meant. And he got a C, CC, I think. That means he just barely passed. Then I told him after the seminar, so he came and talked to me. I said that his performance wasn't so bad. He did actually well. His English was weak. But nevertheless, he did a good amount of work. I thought he deserved something better than a CC. So I told him, one of the problems is that you are unable to, you know, write it, produce a good report because of the method that you have used. Please use latex. So I taught him to use latex. And next presentation, I think it was the first stage, he got an A. And they said, fantastic work. How come you improved so much? Okay. I know he improved. Okay. And then so I always tell my students after that experience, if you write your report in latex, you get one grade higher, minimum, okay, because of the get up and so on, you can produce it in any other software also, perhaps, but that will require a lot of work. That will require a lot of work you can do without that. You can do it fairly comfortably. Okay. So I want now from the audience, I'm going to ask you some questions now that you have used latex. Can somebody tell me what in your opinion is one powerful feature of latex? Any one of you can tell or a feature that you like. Formulas can be written easily. Right. So you don't need another software for that. All mathematical symbols can be written. And for people who know programming, it is very logical. Begin this and this and then open braces, close braces for fractions, hours, all kinds of things. Okay. Very nice. Okay. Anything else? Cross referencing is very good. What all who said that? Yeah. What other what what all cross referencing have you done? Table number. Okay. External reference. Meaning like internet. Citations. Citations. Okay. For the references at the end of the book. Okay. What else? Now customization will take up. I want to finish this numbering. So the book that I'm passing around, I told you that I have about 1000 equations. Okay. I always ask people, you have written a report with let's say hundreds of equations and your guy asks you to remove the first equation. Okay. Now the numbering will start from 234. Okay. Of course, the number latex will automatically change it to 123. But what was to has become one now. What was 99 has become 98 now and so on. Right. But what about referring to those equations in the text? Okay. So you put a label and in the second pass to pass compilation, compiles it first time, assigns values to all symbols in the second pass, it picks up those values from the table and puts it. Right. How many of you have used automatic referencing? Or how many of you have not used automatic referencing? Is there anybody? Some of you, you may want to use that. Okay. So for example, so if you say, let's say you say something like g of s equals frag numerator over. The moment you write an equation like this, then you say slash label. Now you put something. So that's where the variable that you create and then you can refer to this. So for example, if I say equation one, so my symbol is called equation one, then I want to refer to it. So what do you say in equation reference? Yeah, transfer function g of s is defined. So this is how I would write the text. So what I have done is instead of calling it because I can compile it and see that the equation number is one. I can refer to it. I can just say in equation one, that will be the easiest thing to do. But if I do this at the time of compilation, actually I don't know what number this equation is going to take. I'm saying whatever number is assigned to it should be used here. Whatever number I define here should be used here. If it is chapter one dash 52, this will be chapter one dash 52. Whatever is defined here, whatever is assigned here will be used here. So this equation numbering is extremely good. So you can do this for, you can also say this was defined in slash page ref slash ref. So I think page ref, I think this should not be there. In the place of ref you say page ref, slash page ref bracket equation one. When I have a doubt, I always go and check whether it is page ref. Page ref. So that is correct. Then it will say in page. So in fact I would say in page, is this coming? In page page ref. That's how it will come. So I can actually demonstrate this. Begin document. Begin equation. Let's say g of s equals rack n of s p of s. End equation. Just compile it first. pdf let's take test. Test.pdf. When we later, I'll hold it here and I can make it bigger. So a very simple equation that I generated. And it has an equation number one. So let me write one more thing. Equation array. Equation array. I have to put this, put this. I could have used a line also. This is what I normally do. N of s equals, let me just try if it works. Let me take errors. It's not happy with this. I'm going to switch over to something that I like. Let me use a line. For this, I need a package called ms math. The same thing. Anything is I should not use. So here is a simple thing. I'm just using an environment called a line. In order to define this environment, I have to use a ms math. That is a package I have used. Anyway, we are discussing the numbers. Numbering, automatic numbering. Let's say n of s is n0 plus n1 s plus n2 s2. s to the power 2 plus c dots. This is how it is coming. I'll keep it here. So now I can write it, modify it, compile it. It will come here. So supposing I want to put something like n underscore capital N, s to the power capital N. Save it, compile it, and you see that you've got the new nn s to the power n. It comes. So it's a very effective kind of a thing. You have to use a pdf viewer that remains the keeps the focus on the same page because some will refresh or may not refresh. So you'll have to reload once again. And you'll have to go to that particular page, which is a pain. You'll have to close a pdf viewer, which will keep the focus in the same place and will also refresh automatically. If you do that, then it is very effective. You make a change, see it immediately. Make a change, see it immediately. You can do that. Now if I say in equation 2, the numerator transfer function is defined. In equation 2, the numerator transfer function is defined. Actually I can stretch it a little bit. I have more space here. So we can see that. What happens if I get rid of this first equation? So your guide says get rid of the first equation. And now it has become 1 here. It has become 2 here. So what do we do? This when we put the label. So we say slash label equation. Then I say in equation reference, equation 2. So I see that I put a label there. So the label is assigned a value in the first compilation. pdf latex is the compilation process. And in the second time it is assigned. So let me compile it. Now it says that it is not defined yet. Now it is 1. In equation 1, the numerator transfer function is defined. What I will do is now I will get rid of this. I will compile it. It says 1 now because this is the value in the symbol table previously. I compile it once more and it picks it. It picks it. So this is a very powerful feature. Of course the page ref is another one that I told you. I have said that this equation is defined in page ref equation 2. This is no big deal because the whole thing is quarter page. I need not give a page. I know page number. It is in 1. But imagine you are writing your thesis. Sometimes it is useful. One of the things that in my book I said, who has that book? Digital control. I said anything I referred to, within last 2-3 pages, I will just say go and see it. But anything above 10 pages, I will always say defined in page number this. To make it easy for the reader. It is a 500 page book, 600 page book. And you refer to something defined 200 pages ago, we will have a tough time turning over. And late take use is free of cost. It does not cost anything. So automatic numbering is extremely useful. Page numbers, equation numbers, table number, chapter number, section number. Anything, even if you have an enumerated list, 1, 2, 3, 4, 5, you want to refer to the fifth point in that list somewhere. So you can refer to that. In the list, point number 5 is this. Then it does not matter who comes and changes, whether your friend, partner, whoever, your enemy adds one line, removes one line. It is still the same. So it is very good for group effort. The next was about citation. Somebody said citation, right? Citation. Citation is very useful because sometimes you write a paper, you send it. And the paper says that the journal author says, editor says, this is not good enough, you know, send it somewhere else. Or even in the same journal, he says, this is fine. We are happy with your work, but we need to have the referencing in a different style. What style do you all use? Have you used bibliography? Have you used BipTec? In case you haven't used, I wanted to show you. So that's why I picked. So you see in our web page, spoken-tutorial.org. By the way, we have got many awards for this effort. If you go there, you can see the links for this. In fact, Google thought that it was a very good idea what we were doing and they gave a research award. So what you have to do is from this pull-down menu, you choose Laetic. We dub the spoken part into many Indian languages. So you can choose English here. The search. And then it gives you 12 videos here. It gives a playlist. It gives you the order in which you have to listen to. So we have one of them called. So by the way, how many of you use Windows? Other people use the Linux? Very good. Happy with that. So for Windows people also, it is useful. You can run the same thing. You can take the source code. Just put it into, you know, suppose you decide to switch over to Linux and no problem, whatever you generated, take all the source file, copy it. It'll work without any problem. Several years ago, I switched over from a Linux machine to Mac. And then I had by the time already written a book on optimization, which I am not circulating. I just took the same thing. I just have to define the default directory in Linux. It is slash home, something, something, username. Whereas in Mac, it is default directories slash users, something. So I just had to create a symbolic link that whenever it looks for slash home, it should go to slash users. That's the only change I had to make. Then later compile without any other change. The whole thing worked without any problem. So that kind of thing is not possible in any other machine. So anyway, coming back later on Windows, what is compiling is a, by the way, these are all about 10-minute tutorials. So I would want you to read in case anybody is interested in learning latex. You learn using this how to establish using tech works. We recommend tech works. How many of you use tech works? Is there anybody? Okay. Of course, I always use Emacs and PDF latex. You're welcome to use in case you want to use an editor for this purpose. I recommend latex works because it works. Because it works on Mac. It works on Windows. It works on Linux, all three. Okay. So that you don't even have to learn the editor that integrated development environment if you change your system. What is compiling? Letter writing, report writing, mathematical type setting, equations. So let me just show you what mathematical type setting looks like. Welcome to this tutorial on basic mathematics type setting using latex. Notice three windows, match dot. Let me advance it a little bit. I'm not sure whether you can see. Similarly, we write beta, gamma, delta and so on. Let's see what happens when we compile this. Let me use it and open it in Chrome because I'm unable to something. One can get a complete list of such symbols from standard textbooks on latex or from the Internet. We will next take up the concept of spaces in mathematical expressions. Before we do this, let's delete these. Welcome to this tutorial on basic mathematics type setting using latex. So let me advance it a little bit. Gamma, delta and so on. Let's see what happens when we compile this. So you can see that the way I have created this tutorial. In fact, I created them myself. You can also see that I generated them in 2007. Because some students of mine wanted, you know, said, can you please create some tutorials? We have difficulty in using latex. We know it is very good, but we have a tough time using it. Can you please create it? So that's when I created most of them. TechWorks was created by my staff member. I'll use this. Then I say equations, tables and figures. How many of you have used Beamer? Some of you have used Beamer. Beamer is very nice because it is useful to make presentations. The same equations can be used. Same thing, cut and paste from your latex document into this with some minor adjustment. You will see that it applies. Bibliography is something that I would recommend. It will increase your productivity immensely. Once again, you might have, in your thesis, you might have 50 references. And then you suddenly found some other author you wanted to insert. At the time of examination, somebody says you missed out this important reference. You should include all your numbering changes, alphabetical order changes, whatever it is, then you can accommodate directly. So this is two whatever equations and numbering and so on. Now let's go to the next point that somebody said. You can define your own commands. That's what you mentioned. Who said that? Because we are just still going through advantages of latex. I think we will probably finish this lecture just by discussing that. It is, latex is a, you know, it is programmable. You can define your own commands. Very powerful. I am going to illustrate this with a command that I, as a teacher, as a faculty member, use extensively, day in and day out. Suppose I give a question paper, let's say a quiz, conduct a quiz, or a mid-sum exam. So I have questions, 1, 2, 3, 4, 5 and so on. And then I have answers for them also. I want to keep the question and answer together. By the way, how many of you are teachers who taught in some class or other, some college or other? Is there anybody? There is nobody? You will find, once you become a faculty member, you will find immense use for this. Because over a period of time, you set a lot of papers and you have a lot of answers also for that. For every question, you have an answer. But at the time of exam, you don't want to release the answer to them. So you want to suppress all the answers and give it. But when the exam is over, you want to unsuppress. You want to give all the answers. So for that, there is a very nice command, very simple command. I will also explain that command. But I will first demonstrate it. So this is mid-semester exam. We just concluded last week. So I will show with that 016 exams. Don't worry about all the equations and so on. Let me just show you this. So this is my mid-semester exam. You can see question. I have answer also. Similarly, second problem, there is a question here on the answer terms. Now this I wrote so that we can start the grading. I gave it to my TAS. Start the grading. Here is the solution for the question. Now what I can do is if I go and change this, I have a command called eat answer. I have removed that. That means it's going to eat the answer. So what I will do is I don't want to correct it in front of you. Let me do this for big quiz. 02 big quiz.tech. Let me close this. Close this. Can be corrected just that it will take couple of minutes. 02. F. Actually I should do, because I like this because it comes in two columns. So once again you can see that problem, question, answer. Similarly question 2, answer and so on. Now what I will do is I will eat the answer. Compile it and you see the whole thing has come in one page. It's very useful to teachers. All the exams that I have conducted, since the time I found this command, I have got solutions. Otherwise I'll have to search. I generated 100 equations in the last five years, but I don't know which answer is for which question. Because you will have two versions, one for keeping question and answer, another one to give it to the students. The moment you have two versions, there are management problems. You make a correction in one, you forget to correct the other one. Here it is the same version used. So let me just show you what I do. By the way this was actually suggested to me by Professor Sudarshan. Your head, right? So we have a small group of people, we discuss with each other and then we get better, learning from each other's experience. So here is a new command called quest. What does it say? It has, what is in square brackets says it has one command. It has one argument. It has one argument. And then that argument is referred to as hash one. How is the hash one to be used? We just put it. It puts in braces. So you see here, this one says there is one argument. This one says, this one refers to that hash one. But what does it say? It says nothing, just use it. So I have something like, here is the question. Question this, up to this. For example, if I close this, it shows that. You see that? See the cursor? So that is the question. So that is quest. The whole thing, so if I say slash quest, it will, it just, this whole thing is argument one. Entire thing within the braces is argument one. It says just put it there. Okay? All right. Now I have a, also a command called eat quest. Okay? What does eat quest do? Eat quest says, inside the braces nothing. See this? I am renewing command quest. But now it has nothing in it. Okay? You understand? So let me show that. What happens if I eat the question also? Whatever else I had done manually has come, but all questions also disappeared because I have eaten them. The same thing you have to do for answer also. So it allows me to show only questions or only answer or both. Why would I show none of course? Okay? So I won't do that. So it is very useful to me and I, so if I want to put only answer, I have only answer. So it's a very powerful thing. This is just an example of what you can do in. Now I'll undo both of them. So now I have question and answer. Oops. Okay? Here is a question. Here is a question and here is the answer. Right? Do you follow? So it's a very powerful thing. Okay? Any other advantages of latex? Any other advantage you can think of? You want to point out? Okay? So I changed my presentation because you already know latex. I don't want to go through this. I want you to just see the beauty of latex. It's a very beautiful thing. It allows you to do all kinds of fantastic things. Right? So I have 5 minutes. So what I want to do is, I know that many of you are from various colleges. In your college, does anybody use latex? If anybody says that in your college they use latex, I would like to know. Which college? IIT Jodhpur. Okay? AMU. Okay? Kannur. Okay? Kannur, of course. Kerala is Linux, I mean, open source people. Yeah. C-O-E-P. Okay? IIT Kanchipuram. Okay? Very good. ISI Kolkata. Okay? NIT Calicut. Okay? Sangli. Okay? Very good. So what I would like to do is, I would, now that you all, you're all using latex, I would, where are you from? Yeah? BJTI. Okay? Now that you are using latex, I would want you to share this with your colleges. Okay? You share this information with your colleges, using your UG colleges, using Spokane tutorial they can all learn. Okay? Let me show you some statistics in latex use. See these statistics? Training. So we have trained 11 lakh students using Spokane tutorials on various IT topics. Here the topic is of course only latex. Let me just filter. We have trained 62,000 people around the country on the use of latex, and it turns out that most of them are college teachers. Most of them are pursuing their higher studies. They write, they do MTAG, they do PhD, they have to write a report, they have to send paper, they have to make presentation, they have to write their thesis. They find this very useful, and you can see that various places across the country, people are using. So here is somebody, Kerala Kottayam. Kottayam. So view participants, you can actually see who did this, Anuj Mohammad did this, and these are the people who underwent this workshop. So we have lot of information, you can see this. So what I want you to do is to see, I want you to show where the help is available so that you can ask your college teacher to contact them and our people will be happy to conduct this workshop in latex for your college students, your colleagues, your undergraduate friends. So you see this software training. Here there is something called about the training. Go there. It actually tells about how this training is, what are the different topics available, what is the procedure and so on. But finally, at the end, it gives a list of people who take care of various states. In our team, we have people for every state their email address and phone number. We just share this information with your friends and so are your teacher. They can organize this for all your colleges. There is one other thing, there is one other question I want you to ask. Quick question. How many of you in your college has internet connectivity in every computer so that you can simultaneously watch videos in your lab? I see few hands going up, but not many, thank you. So for that, there is something called create your own disk image. You can say advanced C, all levels. Advanced C is not there. It's a bash, all levels. How many of you know bash? No, it is still downloading. So using this, it normally works. Using this, you can add selected files, you can create zip file, and that zip file can be copied into every machine, unzip, and then open the index.html. It will open from the file system, but you don't need internet. It gives the entire playlist, the whole environment is set up. So you may want to point to these two features to your colleges so that they can start using latex. So I want to thank you. Thanks for listening to me. Sorry for exceeding time limit. Okay, goodbye.