LaTeX/C2/Numbering-Equations/English

From Script | Spoken-Tutorial
Revision as of 15:28, 16 October 2019 by Pravin1389 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Initialisation: # Copy numbers.tex into align.tex
  1. Both numbers.tex and align.tex should be sized
  2. Both should be opened in Texworks
  3. Both should be at the first line
  4. align.tex should be below numbers.tex
  5. Compile align.tex and get align.pdf
  6. align.pdf should be sized
  7. align.pdf should be scrolled all the way to the top
  8. num-slides.pdf should be at the first slide
  9. All should be arranged, as recorded in the tutorial
  10. numbers.tex should be directly below the slides file
  11. Blank web browser with search “latex multi”
  12. The resulting google page should be in right zoom
  13. ltxprimer pdf file should be open in the first page
  14. The name of the ltxprimer.pdf should be seen
  15. ltxprimer pdf file should be zoomed appropriately
  16. Check that you have Internet access
Opening slide Welcome to this tutorial on numbering equations using LaTeX

My name is Kannan Moudgalya

Learning objectives slide In this tutorial, we will learn

How to put equation numbers

How to remove equation numbers

How to correctly reference equations

How to use the information on the web

System requirements slide One may use any of Linux, Windows or a Mac operating system

One needs LaTeX

I shall use Texworks

Prerequisites slide

Press Down arrow


Down arrow

What are the prerequisites?

One needs to be familiar with spoken tutorials that introduce LaTeX

We recommend the use of the Side-by-Side method

This information is available at the Spoken Tutorial webpage

Additional material slide

Show equation.tex

Show ltxprimer pdf file


Back to slides file, press down arrow

I shall use the following files:numbers.tex, which you can see hereltxprimer pdf file from TUG India, it is here


These are available as code files along with this tutorial

With these files, you will be able to practise along with me

If you don't have these files, please download them from the Spoken Tutorial website

Open numbers.tex Let us begin the tutorial
Let us learn how to create numbers for equations in LaTeX

I have already opened the file numbers.tex in TeXworks.

I have saved it as align.tex to use in this tutorial

I will keep the numbers.tex file intact, and not change it

Let me open align.tex

Please pause the tutorial, make a copy of numbers.tex and open it

Whenever you want to start afresh, you can make a new copy of numbers.tex

I recommend this method whenever a code file is given with ANY spoken tutorial

Press the typeset key Let us compile this file by pressing the typeset arrow at the top left hand corner

You can see the pdf file on the right


Remove the * from align

Compile

These equations do not have numbers

We can put equation numbers by removing the star from the align star

Remove the star from both begin and end statements

Forgetting it in the end statement is a common mistake

Let’s see what happens if I forget to remove it from the end align statement

Let us compile

It gives an error message begin align ended with align star

Let us remove the star from end align also

Let us abort typesetting and compile

We now have equation numbers

Write a statement that makes use of the number of the second equation Let us now refer to the second equation in the running text

Put the number 2 after the word equation.

Compile

We see number 2 in the running text

Put \nonumber at the end of first equation and compile


Compile

I will now show you how to remove the equation number of one equation

Suppose that we don’t want a number for the first equation

Go to the end of the first equation, but before intertext, and put back slash nonumber

Please note that nonumber is one word

Do not forget the back slash at the beginning

On compiling, the number disappears from the first equation

One consequence is that the second equation is now numbered as one



Put \label{PID}

Unfortunately, the reference to the second equation has become wrong in the text

Can we prevent such mistakes even if we have to add or remove equations?

Such a requirement occurs frequently while writing reports, theses, papers, etc.

It is possible to do this through the label statement

We have seen this in a previous tutorial also

Let me put \label{PID} at the end of the second equation, but before end align

Put \ref{PID} Replace 2 in the running text with \ref{PID} as I do now

After compiling once, two Question marks appear against the equation number

On compiling twice, the question marks get replaced by the correct number

Remove \nonumber Let us change the equation number once again by removing \nonumber

Compile twice to get correct answers

Change PID to pid, but don’t compile


Put it back as PID

The variable in the ref and label commands have to be identical Check what happens if you change PID in the ref command to lower case

Leave the PID in uppercase in the label command and compile

We get question mark here because this lower case pid is not defined

I will put pid back in uppercase and compile

I will now show you how to take help from the Internet

Before that, I am going to delete everything in the tex file

If you don’t like it, you can open a new file


Go to Google page


hover on stackexchange

To do this part, you need access to Internet

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

Let me go to a web browser

Let me do a web search on the topic of LaTeX multiline

The very first hit is on stackexchange

Let me click this “how to align”

If you scroll down this page, you will see a question and several answers

Most answers present a complete code

Copy from top to bottom, not from bottom Let us copy the code that says 58

This number may be different when you access this page

Below that, the pdf output created by this code is shown

Let me paste it on the tex file

Let us compile the tex file

You can check the output in this pdf file to be identical to what we saw in stackexchange

Please try all commands explained in this web page and understand them
Remove the text between the begin and end document Next let me delete everything inside the document environment

Let us now open the ltxprimer pdf file that we have provided with this tutorial

You can practise this part even if you don’t have web access

Let us scroll and go to contents

Let us click “typesetting mathematics”

You can see many examples

Let us go to page 87

Let us copy “cases code” and paste it within the document environment

On compiling it, we get the output given in ltxprimer

You may change equation* to align*, and compile

We get identical results

I suggest that you spend a minute in understanding this example

I also suggest that you try more examples from ltxprimer

This brings us to the end of this tutorial
What did we learn slide

Press space

This page summarises what we learnt in this tutorial

Please recall each of these commands

This is your first assignment

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

Locate these examples and try them out

More assignments slide I will give some more assignments
Assignment 2


We compiled twice to get correct numbers

Why should we compile twice?

Hint: we saw this in an earlier tutorial

You can also locate an answer for this in ltxprimer.pdf - search for Cross References

Assignment 3 Try examples from Chapter VIII of ltxprimer pdf file we saw earlier

Try to understand them

Assignment 4 Try multiline examples from the Stackexchange web page we saw earlier
About the ST slide

Press the Enter key

I will now give some general information


This video summarises the Spoken Tutorial project

Workshops slide We conduct workshops using Spoken Tutorials
Answers slide

Press Space key

Space

Space

Space

Space twice

Do you have questions in THIS Spoken Tutorial? * Please visit this site
  • Choose the minute and second where you have the question
  • Explain your question briefly
  • Someone from our team will answer them


You will have to register on this website to ask questions

Where to post slide For topics not covered in spoken tutorials, visit stack exchange at this address.

This is a great place to get answers on LaTeX.

General questions slide You may also have questions on our workshops, certificates, etc.

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

Spoken Tutorial project is funded by MHRD, Government of India
Thanks for joining

Goodbye

Contributors and Content Editors

Nancyvarkey, PoojaMoolya, Pravin1389