From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:01 Welcome to this tutorial on numbering equations using LaTeX.

My name is Kannan Moudgalya.

00:09 In this tutorial, we will learn-
00:12 How to put equation numbers
00:15 How to remove them
00:17 How to correctly reference equations
00:21 How to use the information on the web
00:25 One may use any of Linux, Windows or a Mac operating system.
00:31 One needs LaTeX.
00:34 I shall use TeXworks.
00:37 What are the prerequisites?
00:39 One needs to be familiar with spoken tutorials that introduce LaTeX.
00:45 We recommend the use of the Side-by-Side method.
00:49 This information is available at the Spoken Tutorial webpage.
00:55 I shall use the following files:
00:58 numbers.tex, which you can see here.
01:03 ltxprimer pdf file from TUG India. It is here.
01:09 These are available as Code files along with this tutorial.
01:14 With these files, you will be able to practise along with me.
01:19 If you don't have these files, please download them from the Spoken Tutorial website.
01:26 Let us begin the tutorial.
01:28 Let us learn how to create numbers for equations in LaTeX.
01:33 I have already opened the file numbers.tex in TeXworks.
01:39 I have saved it as align.tex to use in this tutorial.
01:44 I will keep the numbers.tex file intact, and not change it.
01:49 Please pause the tutorial, make a copy of numbers.tex and open it.
01:55 Whenever you want to start afresh, you can make a new copy of numbers.tex
02:01 I recommend this method whenever a code file is given with ANY spoken tutorial.
02:08 Let me open align.tex
02:11 Let us compile this file by pressing the Typeset arrow at the top left hand corner.
02:18 You can see the pdf file on the right.
02:22 These equations do not have numbers.
02:26 We can put equation numbers by removing the star from the align star.
02:32 Let us remove the star from both begin and end statements.
02:39 Forgetting it in the end statement is a common mistake.
02:43 Let’s see what happens if I forget to remove it from the end align statement.
02:49 Let us compile.
02:51 It gives an error message begin align ended with align star.
02:57 Let us remove the star from end align also.
03:02 Let us abort typesetting and compile.
03:07 We now have equation numbers.
03:11 Let us now refer to the second equation in the running text.
03:16 Put the number 2 after the word equation.
03:21 Compile.

We see number 2 in the running text.

03:27 I will now show you how to remove the equation number of one equation.
03:32 Suppose that we don’t want a number for the first equation.
03:37 Go to the end of the first equation, but before intertext, and put back slash nonumber.
03:46 Please note that nonumber is one word.
03:50 Do not forget the back slash at the beginning.
03:54 On compiling, the number disappears from the first equation.
04:00 One consequence is that the second equation is now numbered as one.
04:07 Unfortunately, the reference to the second equation has become wrong in the text.
04:13 Can we prevent such mistakes even if we have to add or remove equations?
04:19 Such a requirement occurs frequently while writing reports, theses, papers, etc.
04:27 It is possible to do this through the label statement.
04:32 We have seen this in a previous tutorial also.
04:36 Let me put slash label PID at the end of the second equation, but before end align.
04:47 Replace 2 in the running text with slash ref PID as I do now.
04:56 After compiling once, two question marks appear against the equation number.
05:02 On compiling twice, the question marks get replaced by the correct number.
05:09 Let us change the equation number once again by removing nonumber.
05:15 Compile twice to get correct answers.
05:20 The variable in the ref and label commands have to be identical.
05:26 Check what happens if you change PID in the ref command to lowercase.
05:34 Leave the PID in uppercase in the label command and compile.
05:40 We get question mark here because this lowercase pid is not defined.
05:48 I will put pid back in uppercase and compile.
05:55 I will now show you how to take help from the Internet.
06:00 Before that, I am going to delete everything in the tex file.
06:05 If you don’t like it, you can open a new file.
06:09 To do this part, you need access to Internet.

If you don’t have this access now, you may try this part later.

06:17 Let me go to a web browser.
06:20 Let me do a web search on the topic of LaTeX multiline.
06:27 The very first hit is on stackexchange.
06:32 Let me click this “How to align...”.
06:36 If you scroll down this page, you will see a question and several answers.
06:43 Most answers present a complete code.
06:48 Let us copy the code that says 58.
06:53 This number may be different when you access this page.
06:58 Below this, the pdf file created by this code is shown.
07:04 Let me paste it on the tex file.
07:08 Let us compile the tex file.
07:11 You can check the output in this pdf file to be identical to what we saw in stackexchange.
07:19 Please try all commands explained in this web page and understand them.
07:24 Next let me delete everything inside the document environment.
07:31 Let us now open the ltxprimer pdf file that we have provided with this tutorial.
07:38 You can practise this part even if you don’t have web access.
07:43 Let us scroll and go to Contents.
07:48 Let us click “Typesetting Mathematics”.
07:52 You can see many examples.
07:55 Let us go to page 87.
07:59 Let us copy “cases code” and paste it within the document environment.
08:08 On compiling it, we get the output given in ltxprimer.
08:14 You may change equation* to align*, and compile.
08:20 We get identical results.
08:23 I suggest that you spend a minute in understanding this example.
08:28 I also suggest that you try more examples from ltxprimer.
08:33 This brings us to the end of this tutorial.
08:37 This page summarises what we learnt in this tutorial.
08:42 Please recall each of these commands.

This is your first assignment.

08:48 Please do a search on these commands over the web, in ltxprimer, etc.

Locate these examples and try them out.

08:59 I will give some more assignments.
09:03 We compiled twice to get correct numbers.

Why should we compile twice?

09:09 Hint: we saw this in an earlier tutorial.
09:13 You can also locate an answer for this in ltxprimer.pdf file.
09:19 Search for Cross References.
09:22 Try examples from Chapter 8 of ltxprimer pdf file we saw earlier.

Try to understand them.

09:30 Try multiline examples from the Stackexchange web page we saw earlier.
09:36 I will now give some general information.
09:40 This video summarises the Spoken Tutorial project.
09:45 We conduct workshops using Spoken Tutorials.
09:50 Do you have questions in THIS Spoken Tutorial?
09:54 Please visit this site
09:56 Choose the minute and second where you have the question
10:00 Explain your question briefly
10:03 Someone from our team will answer them
10:06 You will have to register on this website to ask questions.
10:11 For topics not covered in spoken tutorials, visit stackexchange at this address.
10:17 This is a great place to get answers on LaTeX.
10:22 You may also have questions on our workshops, certificates, etc.

For this, get in touch with us at this email address.

10:32 Spoken Tutorial project is funded by MHRD, Government of India.
10:37 Thanks for joining.


Contributors and Content Editors