LaTeX-Old-Version/C2/Report-Writing/English

From Script | Spoken-Tutorial
Jump to: navigation, search

Welcome to this spoken tutorial on Report Writing using Latex. Notice three windows in the screen: source file is in the editor. I am using Emacs editor. In the terminal I compile the source file and create a pdf file. I view this pdf file in the pdf reader. I am using a pdf reader called “skim” on MACOXS. This reader loads the latest version of the pdf file. When you create your documents using Latex, you need not arrange these windows in such a non-overlapping fashion. You may also use a different editor and a different pdf reader. The procedure to use latex is identical in all unix system including Linux. It could be a little bit different on Windows. Nevertheless, the source file is identical in all operating systems. As a result, your working latex source file on windows, for example, will work without any change on unix systems as well. The first spoken tutorial in this series is on compiling. Which gives a brief introduction to Latex. You may want to go through it in case you have not done that already.

I am using 12pt as the text size and article class. I have defined titles of section, sub-section and sub-sub -section. The arguments of each of these appears in the output at appropriate places. Observe the distinctive features of these section titles. Irrespective of blank lines in the source file, the output remains the same. Let me add some blank lines here. Save. Compile. No difference. Put the source file back to the original state. Compile.

The sizes of the titles are created proportionately and automatically. For example, the section title is the largest and the sub-sub-section title is the smallest. These features remain the same even if I change the font size. Let’s change it to 11pt. Save. Compile. Although the overall size decreases, the above mentioned qualities of the titles do not change. Let me change the font back to 12pt.

A more important feature of the titles is the automatic generation of section numbers. For example, if I insert another section here. Save. Compile. I will create a new section in the output called ‘inserted section’, it appears here with appropriate numbers. In summary, the spacing, size, and distinctiveness, that is the titles appear in bold etc, are automatically taken care of by Latex.

I will now explain how to create table of contents. First of all, note that there is no file called Report.toc. Here it says that there is ‘no such file or directory’. Observe that report.tec is the source file. Let me add this command, table of contents, one word, here. Save. Compile. As I compile it, the word ‘contents’ appears in the output but nothing else. We now have a file called Report.toc.

The section titles are written into this toc file. Let’s see this. Okay, let me recompile it. This information will be used when we compile the next time. Let me recompile and see what happens to the contents. Observe here. All the titles are now present in the table of contents along with page numbers. Page number here is 1; it appears in the table of contents. This document has only one page. This two compilation procedure is applicable also to changes in titles.

Let us insert a new title here. Let me call it ‘modified section’. Let me compile it. You can see that it has changed here but it has yet to change in contents. Let me re-compile it a second time and solve this problem. We can also change the location of the table of contents. Let me shift it to the end of the document. Compile it. Now we can see that it has come to the end of the document. Let us bring the document back by shifting this to the top.

We will now create a title for the document. Let me do it here, right after the document class. Author. I can include new lines here. Date, today’s date. And then, ‘First created on 13th July 2007’. Let me compile it. There are no changes. The reason is that I have not told latex what to do with this information. So I add ‘make title’ command here, just after the document. One word at the place where I want the title to appear. Which is at the beginning of the document. On compiling, the title appears in the output.

We will now change the class of this document from article to report. So lets do that here. Let me compile it. On compiling the title appears on a whole page. The contents starts on a new page, with page 1. This is numbered as page 1. In other words, the title page has no number. We also see the section title has a zero in its number. The report class requires chapters as we have not defined any chapters the default value of zero is used. The sub-sub section, no longer has a number associated with it. The contents information is not correct, they still carry the old numbers. We solve this problem by recompilation. Now we have the new numbers. Let us start a chapter now.

‘First chapter’ we call it. Let us compile it twice. The contents did not change but the other things are missing. The reason is that the chapter command starts a new page. Let us go to the next page and confirm it. See also the explicit appearance of the word ‘chapter’ on the new page. See it here. Let me come back here. Let me compile it. Once more you can see that the new chapter information comes in the contents.

If you want to add appendixes, insert the command ‘appendix’. Appendix, and let me start a chapter in the appendix. ‘First chapter in the appendix’. Let me compile it twice. You can see that the first chapter has come here. Let’s go and see what it looks like. Appendix A has moved to a new page. And you can see the number of pages as gone to 4. And you also have this word ‘appendix’ appearing here. Let us add one more chapter. Let me compile it. You can see the page number has become 5. It is on a new page. Let us go the beginning of this. IF I compile it second time, the contents become correct.

What happens if we want to change the report class back to article. We go here. Lets compile it. On compiling, the latex complains that there is something wrong. Okay, there are two ways to handle when latex stops like this. The first way to exit by typing ‘X’. The pdf file will normally have all the previous pages, but in this particular case it says that there are no pages of output. One can immediately go to the source file, modify the problems and proceed. It is easy to locate the errors if the beginner compiles frequently. Any mistake will be caught immediately. Sometimes when latex pauses because of mistakes, I end the document then and there. Of course also close all the open environments and try to locate and fix the mistake. As latex does not worry about the material that comes after the end document command, no need to change that part. Once the error is corrected, the intermediate ‘end document’ command under close environment commands can be removed. When latex pauses sighting an error, we can also ask it to ignore and to proceed. This is done by pressing the return or enter key. As I did just now. Now what happens is, we have two pages. Go to the first page, we have all messed up information. What we can do to correct this mistake is – the mistake is that it is having the chapter here. Let us remove this. Let’s compile it. Okay, let’s do it again. Let’s compile it a second time. It complains, but it keeps complaining but there is something called chapter and it is in the table of contents and in the appendix. So let us get rid of this also. Lets compile it. Okay. Now it goes thru without any problems and the entire document has come in one page. And the content information is also correct.

Feel free to change the source file, for example, you may want to add new sections, new sub-sections in the main text, and also in the appendix, also in the report style. Try out the commands explained in this tutorial until you become confident keep trying. Ensure that your recent changes are acceptable by immediate compilation after every change. Most beginners, who forget this rule, get into a lot of difficulties. Please note that the way the source file appears in Emacs – color, size of titles etc are immaterial as far as the latex engine is concerned. What Latex wants is that the source file be correct and not how it is created. This brings us to the end of this tutorial. Thanks for joining. This is Kannan Moudgalya from CDEEP, IIT Bombay signing off. Good bye.

Contributors and Content Editors

Chandrika, Nancyvarkey, Pravin1389