Difference between revisions of "LaTeX/C2/Numbering-Equations/English"
Pravin1389 (Talk | contribs) (Created page with " {| border = 1 |- || Initialisation: | style="border:0.05pt solid #000000;padding:0.097cm;" | # Copy numbers.tex into align.tex # Both numbers.tex and align.tex should be size...") |
Nancyvarkey (Talk | contribs) |
||
Line 3: | Line 3: | ||
|- | |- | ||
|| Initialisation: | || Initialisation: | ||
− | | style="border:0.05pt solid #000000;padding:0.097cm;" | # Copy numbers.tex into align.tex | + | | style="border:0.05pt solid #000000;padding:0.097cm;" | |
+ | # Copy numbers.tex into align.tex | ||
# Both numbers.tex and align.tex should be sized | # Both numbers.tex and align.tex should be sized | ||
# Both should be opened in Texworks | # Both should be opened in Texworks | ||
Line 21: | Line 22: | ||
# Check that you have Internet access | # Check that you have Internet access | ||
|- | |- | ||
− | || | + | |} |
− | || | + | |
+ | <br> | ||
+ | <br> | ||
+ | |||
+ | {| border = 1 | ||
+ | |- | ||
+ | || '''Visual Cue''' | ||
+ | || '''Narration''' | ||
|- | |- | ||
|| Opening slide | || Opening slide | ||
− | || Welcome to this tutorial on numbering equations using LaTeX | + | || Welcome to this tutorial on numbering equations using '''LaTeX'''. |
− | My name is Kannan Moudgalya | + | My name is Kannan Moudgalya. |
|- | |- | ||
|| Learning objectives slide | || Learning objectives slide | ||
− | || In this tutorial, we will learn | + | || In this tutorial, we will learn- |
− | How to put equation numbers | + | #How to put equation numbers |
− | + | #How to remove them | |
− | How to remove | + | #How to correctly reference equations |
− | + | #How to use the information on the '''web''' | |
− | How to correctly reference equations | + | |
− | + | ||
− | How to use the information on the web | + | |
|- | |- | ||
|| System requirements slide | || System requirements slide | ||
− | || One may use any of Linux, Windows or a Mac operating system | + | || One may use any of '''Linux, Windows''' or a '''Mac''' operating system. |
− | One needs LaTeX | + | One needs '''LaTeX'''. |
− | I shall use | + | I shall use '''TeXworks'''. |
|- | |- | ||
|| Prerequisites slide | || Prerequisites slide | ||
Line 55: | Line 60: | ||
|| What are the prerequisites? | || What are the prerequisites? | ||
− | One needs to be familiar with spoken tutorials that introduce LaTeX | + | #One needs to be familiar with spoken tutorials that introduce '''LaTeX'''. |
− | + | #We recommend the use of the '''Side-by-Side method'''. | |
− | We recommend the use of the Side-by-Side method | + | #This information is available at the '''Spoken Tutorial webpage'''. |
− | + | ||
− | This information is available at the Spoken Tutorial webpage | + | |
|- | |- | ||
|| Additional material slide | || Additional material slide | ||
Line 68: | Line 71: | ||
− | Back to slides file, press down arrow | + | Back to slides file, press down arrow. |
− | || I shall use the following files:numbers.tex, which you can see | + | || I shall use the following files: |
+ | *'''numbers.tex''', which you can see here. | ||
+ | *'''ltxprimer pdf''' file from '''TUG India'''. It is here. | ||
− | These are available as | + | These are available as Code files along with this tutorial. |
− | With these files, you will be able to practise along with me | + | 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 | + | If you don't have these files, please download them from the '''Spoken Tutorial website'''. |
|- | |- | ||
|| Open numbers.tex | || Open numbers.tex | ||
− | || Let us begin the tutorial | + | || Let us begin the tutorial. |
|- | |- | ||
|| | || | ||
− | || Let us learn how to create numbers for equations in LaTeX | + | || Let us learn how to create numbers for equations in '''LaTeX'''. |
− | I have already opened the file numbers.tex in TeXworks. | + | 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. | ||
+ | |- | ||
+ | ||Open '''align.tex''' | ||
+ | ||Let me open '''align.tex''' | ||
+ | |- | ||
+ | ||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'''. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | I recommend this method whenever a code file is given with ANY spoken tutorial | + | |
|- | |- | ||
− | || Press the | + | || Press the '''Typeset''' key |
− | || Let us compile this file by pressing the | + | || 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. |
+ | |- | ||
+ | || 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 | + | ||Remove the '''star''' from both '''begin''' and '''end statements'''. |
− | Compile | + | 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. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | We now have equation numbers | + | |
|- | |- | ||
− | || Write a statement that makes use of the number of the second equation | + | || 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 | + | || Let us now refer to the second equation in the running text. |
Put the number 2 after the word equation. | 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. | ||
|- | |- | ||
− | || | + | || Narration only |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | || 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? | 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. | ||
+ | |- | ||
+ | ||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 '''\label{PID}''' at the end of the second equation, but before '''end align'''. | |
− | + | ||
− | Let me put \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 \ref{PID} as I do now | + | || Replace '''2''' in the running text with '''\ref{PID}''' as I do now. |
− | + | |- | |
− | After compiling once, two Question marks appear against the equation number | + | ||Compile |
− | + | ||After '''compiling''' once, two Question marks appear against the equation number. | |
− | On compiling twice, the question marks get replaced by the correct number | + | |- |
+ | ||Compile again | ||
+ | ||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 \nonumber | + | || Let us change the equation number once again by removing '''\nonumber'''. |
− | + | |- | |
− | Compile twice to get correct answers | + | ||Compile twice. |
+ | ||'''Compile''' twice to get correct answers. | ||
|- | |- | ||
|| | || | ||
− | Change PID to pid, but don’t compile | + | Change PID to pid in ref command, but don’t compile |
− | Put it back as PID | + | Put it back as PID in label command |
− | + | ||
− | + | Compile | |
+ | || The '''variable''' in the '''ref''' and '''label commands''' have to be identical. | ||
− | We get question mark here because this lower case pid is not defined | + | 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'''. | ||
+ | |- | ||
+ | ||Point to question mark | ||
+ | ||We get question mark here because this lower case '''pid''' is not defined. | ||
I will put pid back in uppercase and compile | I will put pid back in uppercase and compile | ||
|- | |- | ||
− | || | + | || Narration |
− | || I will now show you how to take help from the Internet | + | || I will now show you how to take help from the '''Internet'''. |
− | + | |- | |
− | Before that, I am going to delete everything in the tex file | + | ||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 | + | 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 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 | ||
+ | ||The very first hit is on '''stackexchange'''. | ||
− | + | Let me click this '''“how to align”'''. | |
− | + | |- | |
− | 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. | |
− | 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 | ||
− | || Let us copy the code that says 58 | + | || Let us copy the '''code''' that says '''58'''. |
− | This number may be different when | + | This number may be different when you access this page. |
− | Below that, the pdf output created by this code is shown | + | Below that, the '''pdf''' output created by this code is shown. |
− | Let me paste it on the tex file | + | Let me paste it on the '''tex''' file. |
|- | |- | ||
|| | || | ||
− | || Let us compile 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 | + | 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 | + | || 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 | ||
− | || Next let me delete everything inside the document environment | + | || Next let me delete everything inside the '''document environment'''. |
− | Let us now open the ltxprimer pdf file that we have provided with this tutorial | + | 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 | + | You can practise this part even if you don’t have '''web access'''. |
|- | |- | ||
|| | || | ||
− | || Let us scroll and go to contents | + | || Let us scroll and go to contents. |
− | Let us click “typesetting mathematics” | + | Let us click '''“typesetting mathematics”'''. |
− | You can see many examples | + | You can see many examples. |
− | Let us go to page 87 | + | Let us go to page 87. |
− | Let us copy “cases code” and paste it within the document environment | + | Let us copy '''“cases code”''' and paste it within the '''document environment'''. |
− | On compiling it, we get the output given in ltxprimer | + | On '''compiling''' it, we get the output given in '''ltxprimer'''. |
|- | |- | ||
|| | || | ||
− | || You may change equation* to align*, and compile | + | || You may change '''equation*''' to '''align*''', and '''compile'''. |
− | We get identical results | + | We get identical results. |
− | I suggest that you spend a minute in understanding this example | + | I suggest that you spend a minute in understanding this example. |
− | I also suggest that you try more examples from ltxprimer | + | I also suggest that you try more examples from '''ltxprimer'''. |
|- | |- | ||
|| | || | ||
− | || This brings us to the end of this tutorial | + | || This brings us to the end of this tutorial. |
|- | |- | ||
|| What did we learn slide | || What did we learn slide | ||
Press space | Press space | ||
− | || This page summarises what we learnt in this tutorial | + | || This page summarises what we learnt in this tutorial. |
− | Please recall each of these commands | + | Please recall each of these '''commands'''. |
− | This is your first assignment | + | This is your first assignment. |
− | Please do a search on these commands over the web, in ltxprimer, etc. | + | Please do a search on these commands over the '''web''', in '''ltxprimer''', etc. |
− | Locate these examples and try them out | + | Locate these examples and try them out. |
|- | |- | ||
|| More assignments slide | || More assignments slide | ||
− | || I will give some more assignments | + | || I will give some more assignments. |
|- | |- | ||
|| Assignment 2 | || Assignment 2 | ||
Line 304: | Line 325: | ||
− | || We compiled twice to get correct numbers | + | || We '''compiled''' twice to get correct numbers. |
− | Why should we compile twice? | + | Why should we '''compile''' twice? |
− | 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 - search for Cross References | + | You can also locate an answer for this in '''ltxprimer.pdf''' - search for '''Cross References'''. |
|- | |- | ||
|| Assignment 3 | || Assignment 3 | ||
− | || Try examples from Chapter VIII of ltxprimer pdf file we saw earlier | + | || Try examples from '''Chapter VIII''' of '''ltxprimer pdf''' file we saw earlier. |
− | Try to understand them | + | Try to understand them. |
|- | |- | ||
|| Assignment 4 | || Assignment 4 | ||
− | || Try multiline examples from the Stackexchange web page we saw earlier | + | || Try '''multiline''' examples from the '''Stackexchange web page''' we saw earlier. |
|- | |- | ||
|| About the ST slide | || About the ST slide | ||
Press the Enter key | Press the Enter key | ||
− | || I will now give some general information | + | || I will now give some general information. |
− | This video summarises the '''Spoken Tutorial''' project | + | This video summarises the '''Spoken Tutorial''' project. |
|- | |- | ||
|| Workshops slide | || Workshops slide | ||
− | || We conduct workshops using '''Spoken Tutorials''' | + | || We conduct workshops using '''Spoken Tutorials'''. |
|- | |- | ||
|| Answers slide | || Answers slide | ||
Line 342: | Line 363: | ||
Space twice | Space twice | ||
− | || Do you have questions in THIS '''Spoken Tutorial?''' * Please visit this site | + | || Do you have questions in THIS '''Spoken Tutorial?''' |
+ | * Please visit this site | ||
* Choose the minute and second where you have the question | * Choose the minute and second where you have the question | ||
* Explain your question briefly | * Explain your question briefly | ||
* Someone from our team will answer them | * Someone from our team will answer them | ||
− | |||
Revision as of 11:17, 28 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. | |
Open align.tex | Let me open align.tex |
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. |
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. |
Narration only
|
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. |
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 \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. |
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 lower case. Leave the PID in uppercase in the label command and compile. |
Point to question mark | We get question mark here because this lower case 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 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.
|
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 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 |