Difference between revisions of "LaTeX/C2/Numbering-Equations/English"
Nancyvarkey (Talk | contribs) |
PoojaMoolya (Talk | contribs) |
||
(One intermediate revision by one other user not shown) | |||
Line 96: | Line 96: | ||
|| | || | ||
||I will keep the '''numbers.tex''' file intact, and not change it. | ||I will keep the '''numbers.tex''' file intact, and not change it. | ||
− | |||
− | |||
− | |||
|- | |- | ||
||Narration only | ||Narration only | ||
Line 106: | Line 103: | ||
I recommend this method whenever a code file is given with ANY '''spoken tutorial'''. | I recommend this method whenever a code file is given with ANY '''spoken tutorial'''. | ||
+ | |- | ||
+ | ||Open '''align.tex''' | ||
+ | ||Let me open '''align.tex''' | ||
|- | |- | ||
|| Press the '''Typeset''' key | || Press the '''Typeset''' key | ||
− | || Let us compile this file by pressing the '''Typeset''' arrow at the top left hand corner. | + | || 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. | You can see the '''pdf''' file on the right. | ||
Line 172: | Line 172: | ||
||One consequence is that the second equation is now numbered as one. | ||One consequence is that the second equation is now numbered as one. | ||
|- | |- | ||
− | || | + | || Highlight equation 2 in the running text |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|| Unfortunately, the reference to the second equation has become wrong in the text. | || 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? | + | |Narration only |
+ | ||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. | Such a requirement occurs frequently while writing reports, theses, papers, etc. | ||
Line 190: | Line 186: | ||
We have seen this in a previous tutorial also. | We have seen this in a previous tutorial also. | ||
− | Let me put ''' | + | Let me put '''slash label PID''' at the end of the second equation, but before '''end align'''. |
|- | |- | ||
|| Put \ref{PID} | || Put \ref{PID} | ||
− | || Replace '''2''' in the running text with ''' | + | || Replace '''2''' in the running text with '''slash ref PID''' as I do now. |
|- | |- | ||
||Compile | ||Compile | ||
− | ||After '''compiling''' once, two | + | ||After '''compiling''' once, two question marks appear against the equation number. |
|- | |- | ||
||Compile again | ||Compile again | ||
− | ||On compiling twice, the question marks get replaced by the correct number. | + | ||On '''compiling''' twice, the question marks get replaced by the correct number. |
|- | |- | ||
|| Remove \nonumber | || Remove \nonumber | ||
− | || Let us change the equation number once again by removing ''' | + | || Let us change the equation number once again by removing '''nonumber'''. |
|- | |- | ||
||Compile twice. | ||Compile twice. | ||
Line 217: | Line 213: | ||
|| The '''variable''' in the '''ref''' and '''label commands''' have to be identical. | || The '''variable''' in the '''ref''' and '''label commands''' have to be identical. | ||
− | Check what happens if you change '''PID''' in the '''ref command''' to | + | Check what happens if you change '''PID''' in the '''ref command''' to lowercase. |
Leave the '''PID''' in uppercase in the '''label command''' and '''compile'''. | Leave the '''PID''' in uppercase in the '''label command''' and '''compile'''. | ||
|- | |- | ||
||Point to question mark | ||Point to question mark | ||
− | ||We get question mark here because this | + | ||We get question mark here because this lowercase '''pid''' is not defined. |
− | I will put pid back in uppercase and compile | + | I will put pid back in uppercase and '''compile'''. |
|- | |- | ||
|| Narration | || Narration | ||
Line 244: | Line 240: | ||
||Let me go to a '''web browser'''. | ||Let me go to a '''web browser'''. | ||
− | Let me do a web search on the topic of LaTeX multiline | + | Let me do a web search on the topic of '''LaTeX multiline'''. |
|- | |- | ||
||Hover on stackexchange | ||Hover on stackexchange | ||
||The very first hit is on '''stackexchange'''. | ||The very first hit is on '''stackexchange'''. | ||
− | Let me click this ''' | + | Let me click this '''“How to align...”'''. |
|- | |- | ||
||Scroll down the page | ||Scroll down the page | ||
||If you scroll down this page, you will see a question and several answers. | ||If you scroll down this page, you will see a question and several answers. | ||
− | Most answers present a complete code. | + | Most answers present a complete '''code'''. |
|- | |- | ||
|| Copy from top to bottom, not from bottom | || Copy from top to bottom, not from bottom | ||
Line 261: | Line 257: | ||
This number may be different when you access this page. | This number may be different when you access this page. | ||
− | Below | + | Below this, the '''pdf''' file created by this '''code''' is shown. |
Let me paste it on the '''tex''' file. | Let me paste it on the '''tex''' file. | ||
|- | |- | ||
− | || | + | || Compile |
|| Let us '''compile''' the '''tex''' file. | || Let us '''compile''' the '''tex''' file. | ||
Line 271: | Line 267: | ||
|- | |- | ||
|| | || | ||
− | || Please try all '''commands''' explained in this web page and understand them. | + | || Please try all '''commands''' explained in this '''web page''' and understand them. |
|- | |- | ||
|| Remove the text between the begin and end document | || Remove the text between the begin and end document | ||
Line 280: | Line 276: | ||
You can practise this part even if you don’t have '''web access'''. | You can practise this part even if you don’t have '''web access'''. | ||
|- | |- | ||
− | || | + | || Scroll down the page >> Contents |
− | || Let us scroll and go to | + | || Let us scroll and go to '''Contents'''. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | || | + | ||Click on Typesetting Mathematics |
+ | ||Let us click '''“Typesetting Mathematics”'''. | ||
+ | |- | ||
+ | ||Point to the examples. | ||
+ | ||You can see many examples. | ||
+ | |- | ||
+ | ||Go to page 87 | ||
+ | ||Let us go to page 87. | ||
+ | |- | ||
+ | ||Copy and paste the code | ||
+ | ||Let us copy '''“cases code”''' and paste it within the '''document environment'''. | ||
+ | |- | ||
+ | ||Compile | ||
+ | |On '''compiling''' it, we get the output given in '''ltxprimer'''. | ||
+ | |- | ||
+ | || Change equation* to align* >> Compile | ||
|| You may change '''equation*''' to '''align*''', and '''compile'''. | || You may change '''equation*''' to '''align*''', and '''compile'''. | ||
Line 331: | Line 332: | ||
Hint: we saw this in an earlier tutorial. | Hint: we saw this in an earlier tutorial. | ||
− | You can also locate an answer for this in '''ltxprimer.pdf''' | + | You can also locate an answer for this in '''ltxprimer.pdf''' file. |
+ | |||
+ | Search for '''Cross References'''. | ||
|- | |- | ||
|| Assignment 3 | || Assignment 3 | ||
− | || Try examples from '''Chapter | + | || Try examples from '''Chapter 8''' of '''ltxprimer pdf''' file we saw earlier. |
Try to understand them. | Try to understand them. | ||
Line 370: | Line 373: | ||
− | You will have to register on this website to ask questions | + | You will have to register on this '''website''' to ask questions. |
|- | |- | ||
|| Where to post slide | || Where to post slide | ||
− | || For topics not covered in spoken tutorials, visit ''' | + | || For topics not covered in spoken tutorials, visit '''stackexchange''' at this address. |
This is a great place to get answers on '''LaTeX'''. | This is a great place to get answers on '''LaTeX'''. | ||
Line 383: | Line 386: | ||
|- | |- | ||
|| | || | ||
− | || '''Spoken Tutorial''' project is funded by MHRD, Government of India | + | || '''Spoken Tutorial''' project is funded by MHRD, Government of India. |
|- | |- | ||
|| | || | ||
− | || Thanks for joining | + | || Thanks for joining. |
− | Goodbye | + | Goodbye. |
|- | |- | ||
|} | |} |
Latest revision as of 11:51, 30 October 2019
Initialisation: |
|
Visual Cue | Narration |
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-
|
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
|
What are the prerequisites?
|
Additional material slide
Show equation.tex Show ltxprimer pdf file
|
I shall use the following files:
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. | |
Point to the title align.tex | I have saved it as align.tex to use in this tutorial. |
I will keep the numbers.tex file intact, and not change it. | |
Narration only | 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. |
Open align.tex | Let me open align.tex |
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. |
Point to the equations | These equations do not have numbers. |
Remove the * from align | We can put equation numbers by removing the star from the align star. |
Remove the * from begin align and end align
|
Remove the star from both begin and end statements.
Forgetting it in the end statement is a common mistake. |
Put * in end align statement | Let’s see what happens if I forget to remove it from the end align statement. |
Compile | Let us compile. |
Error message | It gives an error message- begin align ended with align star. |
Remove the * from end align | 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 | Compile.
We see number 2 in the running text. |
Narration | I will now show you how to remove the equation number of one equation. |
Point to first equation | Suppose that we don’t want a number for the first equation. |
Put \nonumber at the end of first equation and compile | Go to the end of the first equation, but before intertext, and put back slash nonumber. |
Highlight \nonumber | Please note that nonumber is one word.
Do not forget the back slash at the beginning. |
Compile >>Point to 1st equation | On compiling, the number disappears from the first equation. |
Highlight the 2nd equation | One consequence is that the second equation is now numbered as one. |
Highlight equation 2 in the running text | Unfortunately, the reference to the second equation has become wrong in the text. |
Narration only | 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. |
Put \label{PID} | It is possible to do this through the label statement.
We have seen this in a previous tutorial also. Let me put slash label PID at the end of the second equation, but before end align. |
Put \ref{PID} | Replace 2 in the running text with slash ref PID as I do now. |
Compile | After compiling once, two question marks appear against the equation number. |
Compile again | 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. | Compile twice to get correct answers. |
Change PID to pid in ref command, but don’t compile
Compile |
The variable in the ref and label commands have to be identical.
Check what happens if you change PID in the ref command to lowercase. Leave the PID in uppercase in the label command and compile. |
Point to question mark | We get question mark here because this lowercase pid is not defined.
I will put pid back in uppercase and compile. |
Narration | I will now show you how to take help from the Internet. |
Delete all the text in the tex file | Before that, I am going to delete everything in the tex file.
If you don’t like it, you can open a new file. |
Narration only | To do this part, you need access to Internet.
If you don’t have this access now, you may try this part later. |
Go to Google page >> type LaTeX multiline in the search bar | Let me go to a web browser.
Let me do a web search on the topic of LaTeX multiline. |
Hover on stackexchange | The very first hit is on stackexchange.
Let me click this “How to align...”. |
Scroll down the page | 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 this, the pdf file created by this code is shown. Let me paste it on the tex file. |
Compile | 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. |
Scroll down the page >> Contents | Let us scroll and go to Contents. |
Click on Typesetting Mathematics | Let us click “Typesetting Mathematics”. |
Point to the examples. | You can see many examples. |
Go to page 87 | Let us go to page 87. |
Copy and paste the code | Let us copy “cases code” and paste it within the document environment. |
Compile | On compiling it, we get the output given in ltxprimer. |
Change equation* to align* >> Compile | 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 file. Search for Cross References. |
Assignment 3 | Try examples from Chapter 8 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.
|
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?
|
Where to post slide | For topics not covered in spoken tutorials, visit stackexchange 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. |